Good news for mapmakers

More
20 years 3 weeks ago #18281 by mdvalley
I finally cracked the vertical L-Point code! Enjoy.

For the geog program:
Code:
void PlaceLpoint(Lpoint_T * data, float percentage) { Entity_T * moon; Entity_T * planet; double vecx, vecy, vecz, dist, x, y, z, angle; moon = &geog_array[data->moon_index].entity; planet = &geog_array[data->center_index].entity; vecx = moon->x_pos - planet->x_pos; vecy = moon->y_pos - planet->y_pos; vecz = moon->z_pos - planet->z_pos; dist = sqrt(vecx*vecx+vecy*vecy+vecz*vecz); x = vecx/dist; y = vecy/dist; z = vecz/dist; vecx = x*dist*percentage + planet->x_pos; vecy = y*dist*percentage + planet->y_pos; vecz = z*dist*percentage + planet->z_pos; if ( z == -1 ) // To prevent divide by zero errors if a moon is straight north { data->orient1 = (float)0; // North data->orient2 = (float)sqrt(1/2); data->orient3 = (float)sqrt(1/2); } else { angle = acos(z)/2; data->orient1 = (float)cos(angle); data->orient2 = (float)(-y*cos(angle)/(z+1)); data->orient3 = (float)(x*cos(angle)/(z+1)); }; data->x_pos = vecx; data->y_pos = vecy; data->z_pos = vecz; }

Please Log in or Create an account to join the conversation.

More
20 years 3 weeks ago #11877 by Second Chance
Cool! Nice job.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 10 months ago #12155 by tech2kjason
Replied by tech2kjason on topic Good news for mapmakers
Excellent work!

Please Log in or Create an account to join the conversation.

More
19 years 10 months ago #12214 by GrandpaTrout
Great! I will add this to the GeogSdk.

-Gtrout

Please Log in or Create an account to join the conversation.