54 double delta_e, delta_f, delta_g, intermed_val;
58 delta_e = tgt_desc->
e - src_desc->
e;
59 delta_f = tgt_desc->
f - src_desc->
f;
60 delta_g = tgt_desc->
g - src_desc->
g;
62 intermed_val = (-src_desc->
clon * delta_e) -
63 ( src_desc->
slon * delta_f);
66 (-src_desc->
slon * delta_e) +
67 ( src_desc->
clon * delta_f);
69 (src_desc->
slat * intermed_val) +
70 (src_desc->
clat * delta_g);
72 (-src_desc->
clat * intermed_val) +
73 ( src_desc->
slat * delta_g);
98 double delta_e, delta_f, delta_g, intermed_val;
103 double* vend = efg_xyz + (3 * count);
106 for (vector = efg_xyz; vector < vend; vector += 3)
108 delta_e = vector[
GEO_E] - src_desc->
e;
109 delta_f = vector[
GEO_F] - src_desc->
f;
110 delta_g = vector[
GEO_G] - src_desc->
g;
112 intermed_val = (-src_desc->
clon * delta_e) -
113 ( src_desc->
slon * delta_f);
116 (-src_desc->
slon * delta_e) +
117 ( src_desc->
clon * delta_f);
119 (src_desc->
slat * intermed_val) +
120 (src_desc->
clat * delta_g);
122 (-src_desc->
clat * intermed_val) +
123 ( src_desc->
slat * delta_g);
130 double DLL_CALLCONV geoLlh2DiffX (
double lat1,
double lon1,
double hgt1,
int datum1,
double lat2,
double lon2,
double hgt2,
int datum2)
142 double DLL_CALLCONV geoLlh2DiffY (
double lat1,
double lon1,
double hgt1,
int datum1,
double lat2,
double lon2,
double hgt2,
int datum2)
153 double DLL_CALLCONV geoLlh2DiffZ (
double lat1,
double lon1,
double hgt1,
int datum1,
double lat2,
double lon2,
double hgt2,
int datum2)
182 double *e,
double *f,
double *g)
185 double N,a,e2,ee2, b, flat;
195 N = a / (sqrt(1.0 - e2 * pow(slat,2.0)));
198 *e = (N + height) * clat * cos(lon);
199 *f = (N + height) * clat * sin(lon);
200 *g = (N * (1.0 - e2) + height) * sin(lat);
216 double N, slat, clat, slon, clon;
221 double* vend = llh_efg + (3 * count);
224 for (vector = llh_efg; vector < vend; vector += 3)
227 sincos(vector[
GEO_LAT], &slat, &clat);
228 sincos(vector[
GEO_LON], &slon, &clon);
231 slat = sin(vector[GEO_LAT]);
232 clat = cos(vector[GEO_LAT]);
233 slon = sin(vector[GEO_LON]);
234 clon = cos(vector[GEO_LON]);
238 N = datum->
a / (sqrt(1.0 - datum->
e2 * slat * slat));
346 sqrt(pow(xyz_in[
GEO_X],2.0) + pow(xyz_in[
GEO_Y],2.0) + pow(xyz_in[
GEO_Z],2.0));
349 rae_out[
GEO_AZ] = atan2(xyz_in[GEO_X], xyz_in[GEO_Y]);
351 if((xyz_in[GEO_X] < 0.0) && (xyz_in[GEO_Y] < 0.0)) rae_out[
GEO_AZ] += (2.0 *
M_PI);
352 if((xyz_in[GEO_X] < 0.0) && (xyz_in[
GEO_Y] > 0.0)) rae_out[
GEO_AZ] += (2.0 *
M_PI);
355 horz_dist = sqrt(pow(xyz_in[GEO_X],2.0) + pow(xyz_in[GEO_Y],2.0));
356 rae_out[
GEO_EL] = atan2(xyz_in[GEO_Z], horz_dist);
386 double* vend = xyz_rae + (3 * count);
389 for (vector = xyz_rae; vector < vend; vector += 3)
400 if (az < -0.0f) az += (2.0 *
M_PI);
403 horz_dist = sqrt(vector[GEO_X]*vector[GEO_X] + vector[GEO_Y]*vector[GEO_Y]);
406 vector[
GEO_EL] = atan2(vector[GEO_Z], horz_dist);
430 double rae[3],xyz[3];
457 double rae[3],xyz[3];
484 double rae[3],xyz[3];
509 xyz_out[
GEO_Y] = cos(rae_in[GEO_AZ]) * r_cos_e;
534 double* vend = rae_xyz + (3 * count);
537 for (vector = rae_xyz; vector < vend; vector += 3)
540 sincos(vector[
GEO_EL], &r_sin_e, &r_cos_e);
541 sincos(vector[
GEO_AZ], &sin_a, &cos_a);
545 vector[
GEO_X] = sin_a * r_cos_e;
546 vector[
GEO_Y] = cos_a * r_cos_e;
547 vector[
GEO_Z] = r_sin_e;
549 r_cos_e = vector[
GEO_RNG] * cos(vector[GEO_EL]);
550 r_sin_e *= vector[
GEO_RNG] * sin(vector[GEO_EL]);
551 cos_a = cos(vector[GEO_AZ]);
553 vector[
GEO_X] = sin(vector[GEO_AZ]) * r_cos_e;
554 vector[
GEO_Y] = cos_a * r_cos_e;
590 efg_out[
GEO_E] = c1 + loc->
e;
591 efg_out[
GEO_F] = c2 + loc->
f;
592 efg_out[
GEO_G] = c3 + loc->
g;
611 double nclonslat = -loc->
clon * loc->
slat;
612 double clonclat = loc->
clon * loc->
clat;
613 double nslonslat = -loc->
slon * loc->
slat;
614 double slonclat = loc->
slon * loc->
clat;
618 double* vend = xyz_efg + (3 * count);
621 for (vector = xyz_efg; vector < vend; vector += 3)
625 nclonslat * vector[
GEO_Y] +
626 clonclat * vector[
GEO_Z];
629 nslonslat * vector[
GEO_Y] +
630 slonclat * vector[
GEO_Z];
636 vector[
GEO_E] = c1 + loc->
e;
637 vector[
GEO_F] = c2 + loc->
f;
638 vector[
GEO_G] = c3 + loc->
g;
678 efg_out[
GEO_E] = c1 + loc->
e;
679 efg_out[
GEO_F] = c2 + loc->
f;
680 efg_out[
GEO_G] = c3 + loc->
g;
696 switch (toupper(*sign))
727 switch (toupper(*sign))
758 double t1,m,d,s,sign;
765 s = modf(fabs(in)/100.0, &t1) * 100.0;
766 m = modf(t1/100.0, &d) * 100.0;
769 return( (d + (m/60.0) + (s/3600.0)) * sign *
DEG_TO_RAD);
783 double *deg,
double *min,
double *sec,
double *dir)
796 fraction = modf(temp,deg);
798 temp = fraction * 60.0;
799 fraction = modf(temp,min);
801 *sec = fraction * 60.0;
821 frac = modf(frac * 60.0,&m);
825 return(((d*10000.0)+(m*100)+s)*sign);
866 double *deg,
double *min,
double *sec,
double *dir)
879 fraction = modf(dd,deg);
881 temp = fraction * 60.0;
882 fraction = modf(temp,min);
884 *sec = fraction * 60.0;
890 double deg, min, sec,dir;
896 double deg, min, sec,dir;
902 double deg, min, sec,dir;