48 #define PI 3.14159265358979323e0
49 #define PI_OVER_2 (PI/2.0e0)
50 #define MAX_DELTA_LONG ((PI * 70)/180.0)
51 #define MIN_SCALE_FACTOR 0.1
52 #define MAX_SCALE_FACTOR 10.0
55 TransverseMercator::TransverseMercator(
56 double ellipsoidSemiMajorAxis,
57 double ellipsoidFlattening,
58 double centralMeridian,
59 double latitudeOfTrueScale,
63 char *ellipsoidCode) :
65 TranMerc_Origin_Long( centralMeridian ),
66 TranMerc_Origin_Lat( latitudeOfTrueScale ),
67 TranMerc_False_Easting( falseEasting ),
68 TranMerc_False_Northing( falseNorthing ),
69 TranMerc_Scale_Factor( scaleFactor ),
70 TranMerc_Delta_Northing( 20000000.0 ),
71 TranMerc_Delta_Easting( 10000000.0 )
74 double invFlattening = 1.0 / ellipsoidFlattening;
76 strcpy( ellipsCode, ellipsoidCode );
78 if (ellipsCode[0] ==
'\0')
82 if (ellipsoidSemiMajorAxis <= 0.0)
86 if ( invFlattening < 150 )
94 if ((centralMeridian < -
PI) || (centralMeridian > (2*
PI)))
103 if (TranMerc_Origin_Long >
PI)
104 TranMerc_Origin_Long -= (2*
PI);
111 generateCoefficients(
112 invFlattening, n1, TranMerc_aCoeff, TranMerc_bCoeff, R4oa, ellipsCode );
114 TranMerc_K0R4 = R4oa * TranMerc_Scale_Factor * ellipsoidSemiMajorAxis;
115 TranMerc_K0R4inv = 1.0 / TranMerc_K0R4;
136 TranMerc_eps = tm.TranMerc_eps;
138 TranMerc_K0R4 = tm.TranMerc_K0R4;
139 TranMerc_K0R4inv = tm.TranMerc_K0R4inv;
143 TranMerc_aCoeff[i] = tm.TranMerc_aCoeff[i];
144 TranMerc_bCoeff[i] = tm.TranMerc_bCoeff[i];
147 TranMerc_Origin_Long = tm.TranMerc_Origin_Long;
148 TranMerc_Origin_Lat = tm.TranMerc_Origin_Lat;
149 TranMerc_False_Easting = tm.TranMerc_False_Easting;
150 TranMerc_False_Northing = tm.TranMerc_False_Northing;
151 TranMerc_Scale_Factor = tm.TranMerc_Scale_Factor;
153 TranMerc_Delta_Easting = tm.TranMerc_Delta_Easting;
154 TranMerc_Delta_Northing = tm.TranMerc_Delta_Northing;
165 TranMerc_Origin_Long, TranMerc_Origin_Lat, TranMerc_Scale_Factor,
166 TranMerc_False_Easting, TranMerc_False_Northing );
173 double longitude = geodeticCoordinates->
longitude();
174 double latitude = geodeticCoordinates->
latitude();
177 longitude -= (2 *
PI);
179 longitude += (2 *
PI);
184 double lambda = longitude - TranMerc_Origin_Long;
189 checkLatLon( latitude, lambda );
191 double easting, northing;
192 latLonToNorthingEasting( latitude, longitude, northing, easting );
196 double falseEasting, falseNorthing;
197 latLonToNorthingEasting(
198 TranMerc_Origin_Lat, TranMerc_Origin_Long, falseNorthing, falseEasting );
200 easting += TranMerc_False_Easting - falseEasting;
201 northing += TranMerc_False_Northing - falseNorthing;
203 char warning[256] =
"";
206 if( invFlattening < 290.0 || invFlattening > 301.0 )
208 "Eccentricity is outside range that algorithm accuracy has been tested." );
215 void TransverseMercator::latLonToNorthingEasting(
216 const double &latitude,
217 const double &longitude,
224 double lambda = longitude - TranMerc_Origin_Long;
229 checkLatLon( latitude, lambda );
231 double cosLam = cos(lambda);
232 double sinLam = sin(lambda);
233 double cosPhi = cos(latitude);
234 double sinPhi = sin(latitude);
236 double P, part1, part2, denom, cosChi, sinChi;
246 P = exp(TranMerc_eps * aTanH(TranMerc_eps * sinPhi));
247 part1 = (1 + sinPhi) / P;
248 part2 = (1 - sinPhi) * P;
249 denom = part1 + part2;
250 cosChi = 2 * cosPhi / denom;
251 sinChi = (part1 - part2) / denom;
257 U = aTanH(cosChi * sinLam);
258 V = atan2(sinChi, cosChi * cosLam);
261 computeHyperbolicSeries( 2.0 * U, c2ku, s2ku );
262 computeTrigSeries( 2.0 * V, c2kv, s2kv );
269 for (
int k =
N_TERMS - 1; k >= 0; k--)
271 xStar += TranMerc_aCoeff[k] * s2ku[k] * c2kv[k];
272 yStar += TranMerc_aCoeff[k] * c2ku[k] * s2kv[k];
279 easting = (TranMerc_K0R4 * xStar);
280 northing = (TranMerc_K0R4 * yStar);
287 double easting = mapProjectionCoordinates->
easting();
288 double northing = mapProjectionCoordinates->
northing();
290 if ( (easting < (TranMerc_False_Easting - TranMerc_Delta_Easting))
291 ||(easting > (TranMerc_False_Easting + TranMerc_Delta_Easting)))
296 if ( (northing < (TranMerc_False_Northing - TranMerc_Delta_Northing))
297 || (northing > (TranMerc_False_Northing + TranMerc_Delta_Northing)))
302 double longitude, latitude;
305 double falseEasting, falseNorthing;
306 latLonToNorthingEasting(
307 TranMerc_Origin_Lat, TranMerc_Origin_Long, falseNorthing, falseEasting );
309 easting -= (TranMerc_False_Easting - falseEasting);
310 northing -= (TranMerc_False_Northing - falseNorthing);
312 northingEastingToLatLon( northing, easting, latitude, longitude );
314 longitude = (longitude >
PI) ? longitude - (2 *
PI): longitude;
315 longitude = (longitude <= -
PI) ? longitude + (2 *
PI): longitude;
317 if(fabs(latitude) > (90.0 *
PI / 180.0))
321 if((longitude) > (
PI))
323 longitude -= (2 *
PI);
324 if(fabs(longitude) >
PI)
327 else if((longitude) < (-
PI))
329 longitude += (2 *
PI);
330 if(fabs(longitude) >
PI)
337 if( invFlattening < 290.0 || invFlattening > 301.0 )
339 "Eccentricity is outside range that algorithm accuracy has been tested." );
345 void TransverseMercator::northingEastingToLatLon(
346 const double &northing,
347 const double &easting,
358 double xStar = TranMerc_K0R4inv * (easting);
359 double yStar = TranMerc_K0R4inv * (northing);
362 computeHyperbolicSeries( 2.0 * xStar, c2kx, s2kx );
363 computeTrigSeries( 2.0 * yStar, c2ky, s2ky );
370 for (
int k =
N_TERMS - 1; k >= 0; k--)
372 U += TranMerc_bCoeff[k] * s2kx[k] * c2ky[k];
373 V += TranMerc_bCoeff[k] * c2kx[k] * s2ky[k];
381 double coshU = cosh(U);
382 double sinhU = sinh(U);
383 double cosV = cos(V);
384 double sinV = sin(V);
387 if ((fabs(cosV) < 10E-12) && (fabs(coshU) < 10E-12))
390 lambda = atan2(sinhU, cosV);
393 sinChi = sinV / coshU;
394 latitude = geodeticLat( sinChi, TranMerc_eps );
398 longitude = TranMerc_Origin_Long + lambda;
403 void TransverseMercator::generateCoefficients(
407 double bCoeff[MAX_TERMS],
445 double n2, n3, n4, n5, n6, n7, n8, n9, n10, coeff;
447 n1 = 1.0 / (2*invfla - 1.0);
463 if (( strcmp( ellipsoidCode,
"AA") == 0) || (strcmp(ellipsoidCode,
"AM") == 0))
465 aCoeff[0] = 8.3474517669594013740e-04;
466 aCoeff[1] = 7.554352936725572895e-07;
467 aCoeff[2] = 1.18487391005135489e-09;
468 aCoeff[3] = 2.3946872955703565e-12;
469 aCoeff[4] = 5.610633978440270e-15;
470 aCoeff[5] = 1.44858956458553e-17;
474 bCoeff[0] = -8.3474551646761162264e-04;
475 bCoeff[1] = -5.863630361809676570e-08;
476 bCoeff[2] = -1.65562038746920803e-10;
477 bCoeff[3] = -2.1340335537652749e-13;
478 bCoeff[4] = -3.720760760132477e-16;
479 bCoeff[5] = -7.08304328877781e-19;
483 else if (( strcmp( ellipsoidCode,
"EA") == 0) || ( strcmp( ellipsoidCode,
"EB") == 0) ||
484 ( strcmp( ellipsoidCode,
"EC") == 0) || ( strcmp( ellipsoidCode,
"ED") == 0) ||
485 ( strcmp( ellipsoidCode,
"EE") == 0))
487 aCoeff[0] = 8.3064943111192510534e-04;
488 aCoeff[1] = 7.480375027595025021e-07;
489 aCoeff[2] = 1.16750772278215999e-09;
490 aCoeff[3] = 2.3479972304395461e-12;
491 aCoeff[4] = 5.474212231879573e-15;
492 aCoeff[5] = 1.40642257446745e-17;
496 bCoeff[0] = -8.3064976590443772201e-04;
497 bCoeff[1] = -5.805953517555717859e-08;
498 bCoeff[2] = -1.63133251663416522e-10;
499 bCoeff[3] = -2.0923797199593389e-13;
500 bCoeff[4] = -3.630200927775259e-16;
501 bCoeff[5] = -6.87666654919219e-19;
505 else if (( strcmp( ellipsoidCode,
"BN") == 0) || ( strcmp( ellipsoidCode,
"BR") == 0))
507 aCoeff[0] = 8.3522527226849818552e-04;
508 aCoeff[1] = 7.563048340614894422e-07;
509 aCoeff[2] = 1.18692075307408346e-09;
510 aCoeff[3] = 2.4002054791393298e-12;
511 aCoeff[4] = 5.626801597980756e-15;
512 aCoeff[5] = 1.45360057224474e-17;
516 bCoeff[0] = -8.3522561262703079182e-04;
517 bCoeff[1] = -5.870409978661008580e-08;
518 bCoeff[2] = -1.65848307463131468e-10;
519 bCoeff[3] = -2.1389565927064571e-13;
520 bCoeff[4] = -3.731493368666479e-16;
521 bCoeff[5] = -7.10756898071999e-19;
525 else if (( strcmp( ellipsoidCode,
"KA") == 0) || ( strcmp( ellipsoidCode,
"HE") == 0) ||
526 ( strcmp( ellipsoidCode,
"FA") == 0))
528 aCoeff[0] = 8.3761175713442343106e-04;
529 aCoeff[1] = 7.606346200814720197e-07;
530 aCoeff[2] = 1.19713032035541037e-09;
531 aCoeff[3] = 2.4277772986483520e-12;
532 aCoeff[4] = 5.707722772225013e-15;
533 aCoeff[5] = 1.47872454335773e-17;
537 bCoeff[0] = -8.3761210042019176501e-04;
538 bCoeff[1] = -5.904169154078546237e-08;
539 bCoeff[2] = -1.67276212891429215e-10;
540 bCoeff[3] = -2.1635549847939549e-13;
541 bCoeff[4] = -3.785212121016612e-16;
542 bCoeff[5] = -7.23053625983667e-19;
546 else if ( strcmp( ellipsoidCode,
"WD") == 0)
548 aCoeff[0] = 8.3772481044362217923e-04;
549 aCoeff[1] = 7.608400388863560936e-07;
550 aCoeff[2] = 1.19761541904924067e-09;
551 aCoeff[3] = 2.4290893081322466e-12;
552 aCoeff[4] = 5.711579173743133e-15;
553 aCoeff[5] = 1.47992364667635e-17;
557 bCoeff[0] = -8.3772515386847544554e-04;
558 bCoeff[1] = -5.905770828762463028e-08;
559 bCoeff[2] = -1.67344058948464124e-10;
560 bCoeff[3] = -2.1647255130188214e-13;
561 bCoeff[4] = -3.787772179729998e-16;
562 bCoeff[5] = -7.23640523525528e-19;
566 else if ( strcmp( ellipsoidCode,
"WE") == 0)
568 aCoeff[0] = 8.3773182062446983032e-04;
569 aCoeff[1] = 7.608527773572489156e-07;
570 aCoeff[2] = 1.19764550324249210e-09;
571 aCoeff[3] = 2.4291706803973131e-12;
572 aCoeff[4] = 5.711818369154105e-15;
573 aCoeff[5] = 1.47999802705262e-17;
577 bCoeff[0] = -8.3773216405794867707e-04;
578 bCoeff[1] = -5.905870152220365181e-08;
579 bCoeff[2] = -1.67348266534382493e-10;
580 bCoeff[3] = -2.1647981104903862e-13;
581 bCoeff[4] = -3.787930968839601e-16;
582 bCoeff[5] = -7.23676928796690e-19;
586 else if ( strcmp( ellipsoidCode,
"RF") == 0)
588 aCoeff[0] = 8.3773182472855134012e-04;
589 aCoeff[1] = 7.608527848149655006e-07;
590 aCoeff[2] = 1.19764552085530681e-09;
591 aCoeff[3] = 2.4291707280369697e-12;
592 aCoeff[4] = 5.711818509192422e-15;
593 aCoeff[5] = 1.47999807059922e-17;
597 bCoeff[0] = -8.3773216816203523672e-04;
598 bCoeff[1] = -5.905870210369121594e-08;
599 bCoeff[2] = -1.67348268997717031e-10;
600 bCoeff[3] = -2.1647981529928124e-13;
601 bCoeff[4] = -3.787931061803592e-16;
602 bCoeff[5] = -7.23676950110361e-19;
606 else if (( strcmp( ellipsoidCode,
"SA") == 0) || ( strcmp( ellipsoidCode,
"AN") == 0))
608 aCoeff[0] = 8.3775209887947194075e-04;
609 aCoeff[1] = 7.608896263599627157e-07;
610 aCoeff[2] = 1.19773253021831769e-09;
611 aCoeff[3] = 2.4294060763606098e-12;
612 aCoeff[4] = 5.712510331613028e-15;
613 aCoeff[5] = 1.48021320370432e-17;
617 bCoeff[0] = -8.3775244233790270051e-04;
618 bCoeff[1] = -5.906157468586898015e-08;
619 bCoeff[2] = -1.67360438158764851e-10;
620 bCoeff[3] = -2.1650081225048788e-13;
621 bCoeff[4] = -3.788390325953455e-16;
622 bCoeff[5] = -7.23782246429908e-19;
626 else if ( strcmp( ellipsoidCode,
"ID") == 0)
628 aCoeff[0] = 8.3776052087969078729e-04;
629 aCoeff[1] = 7.609049308144604484e-07;
630 aCoeff[2] = 1.19776867565343872e-09;
631 aCoeff[3] = 2.4295038464530901e-12;
632 aCoeff[4] = 5.712797738386076e-15;
633 aCoeff[5] = 1.48030257891140e-17;
637 bCoeff[0] = -8.3776086434848497443e-04;
638 bCoeff[1] = -5.906276799395007586e-08;
639 bCoeff[2] = -1.67365493472742884e-10;
640 bCoeff[3] = -2.1650953495573773e-13;
641 bCoeff[4] = -3.788581120060625e-16;
642 bCoeff[5] = -7.23825990889693e-19;
646 else if (( strcmp( ellipsoidCode,
"IN") == 0) || ( strcmp( ellipsoidCode,
"HO") == 0))
648 aCoeff[0] = 8.4127599100356448089e-04;
649 aCoeff[1] = 7.673066923431950296e-07;
650 aCoeff[2] = 1.21291995794281190e-09;
651 aCoeff[3] = 2.4705731165688123e-12;
652 aCoeff[4] = 5.833780550286833e-15;
653 aCoeff[5] = 1.51800420867708e-17;
657 bCoeff[0] = -8.4127633881644851945e-04;
658 bCoeff[1] = -5.956193574768780571e-08;
659 bCoeff[2] = -1.69484573979154433e-10;
660 bCoeff[3] = -2.2017363465021880e-13;
661 bCoeff[4] = -3.868896221495780e-16;
662 bCoeff[5] = -7.42279219864412e-19;
666 else if ( strcmp( ellipsoidCode,
"WO") == 0)
668 aCoeff[0] = 8.4411652150600103279e-04;
669 aCoeff[1] = 7.724989750172583427e-07;
670 aCoeff[2] = 1.22525529789972041e-09;
671 aCoeff[3] = 2.5041361775549209e-12;
672 aCoeff[4] = 5.933026083631383e-15;
673 aCoeff[5] = 1.54904908794521e-17;
677 bCoeff[0] = -8.4411687285559594196e-04;
678 bCoeff[1] = -5.996681687064322548e-08;
679 bCoeff[2] = -1.71209836918814857e-10;
680 bCoeff[3] = -2.2316811233502163e-13;
681 bCoeff[4] = -3.934782433323038e-16;
682 bCoeff[5] = -7.57474665717687e-19;
686 else if ( strcmp( ellipsoidCode,
"CC") == 0)
688 aCoeff[0] = 8.4703742793654652315e-04;
689 aCoeff[1] = 7.778564517658115212e-07;
690 aCoeff[2] = 1.23802665917879731e-09;
691 aCoeff[3] = 2.5390045684252928e-12;
692 aCoeff[4] = 6.036484469753319e-15;
693 aCoeff[5] = 1.58152259295850e-17;
697 bCoeff[0] = -8.4703778294785813001e-04;
698 bCoeff[1] = -6.038459874600183555e-08;
699 bCoeff[2] = -1.72996106059227725e-10;
700 bCoeff[3] = -2.2627911073545072e-13;
701 bCoeff[4] = -4.003466873888566e-16;
702 bCoeff[5] = -7.73369749524777e-19;
706 else if ( strcmp( ellipsoidCode,
"CG") == 0)
708 aCoeff[0] = 8.5140099460764136776e-04;
709 aCoeff[1] = 7.858945456038187774e-07;
710 aCoeff[2] = 1.25727085106103462e-09;
711 aCoeff[3] = 2.5917718627340128e-12;
712 aCoeff[4] = 6.193726879043722e-15;
713 aCoeff[5] = 1.63109098395549e-17;
717 bCoeff[0] = -8.5140135513650084564e-04;
718 bCoeff[1] = -6.101145475063033499e-08;
719 bCoeff[2] = -1.75687742410879760e-10;
720 bCoeff[3] = -2.3098718484594067e-13;
721 bCoeff[4] = -4.107860472919190e-16;
722 bCoeff[5] = -7.97633133452512e-19;
726 else if ( strcmp( ellipsoidCode,
"CD") == 0)
728 aCoeff[0] = 8.5140395445291970541e-04;
729 aCoeff[1] = 7.859000119464140978e-07;
730 aCoeff[2] = 1.25728397182445579e-09;
731 aCoeff[3] = 2.5918079321459932e-12;
732 aCoeff[4] = 6.193834639108787e-15;
733 aCoeff[5] = 1.63112504092335e-17;
737 bCoeff[0] = -8.5140431498554106268e-04;
738 bCoeff[1] = -6.101188106187092184e-08;
739 bCoeff[2] = -1.75689577596504470e-10;
740 bCoeff[3] = -2.3099040312610703e-13;
741 bCoeff[4] = -4.107932016207395e-16;
742 bCoeff[5] = -7.97649804397335e-19;
752 coeff += (-18975107.0) * n8 / 50803200.0;
753 coeff += (72161.0) * n7 / 387072.0;
754 coeff += (7891.0) * n6 / 37800.0;
755 coeff += (-127.0) * n5 / 288.0;
756 coeff += (41.0) * n4 / 180.0;
757 coeff += (5.0) * n3 / 16.0;
758 coeff += (-2.0) * n2 / 3.0;
759 coeff += (1.0) * n1 / 2.0;
765 coeff += (148003883.0) * n8 / 174182400.0;
766 coeff += (13769.0) * n7 / 28800.0;
767 coeff += (-1983433.0) * n6 / 1935360.0;
768 coeff += (281.0) * n5 / 630.0;
769 coeff += (557.0) * n4 / 1440.0;
770 coeff += (-3.0) * n3 / 5.0;
771 coeff += (13.0) * n2 / 48.0;
777 coeff += (79682431.0) * n8 / 79833600.0;
778 coeff += (-67102379.0) * n7 / 29030400.0;
779 coeff += (167603.0) * n6 / 181440.0;
780 coeff += (15061.0) * n5 / 26880.0;
781 coeff += (-103.0) * n4 / 140.0;
782 coeff += (61.0) * n3 / 240.0;
788 coeff += (-40176129013.0) * n8 / 7664025600.0;
789 coeff += (97445.0) * n7 / 49896.0;
790 coeff += (6601661.0) * n6 / 7257600.0;
791 coeff += (-179.0) * n5 / 168.0;
792 coeff += (49561.0) * n4 / 161280.0;
798 coeff += (2605413599.0) * n8 / 622702080.0;
799 coeff += (14644087.0) * n7 / 9123840.0;
800 coeff += (-3418889.0) * n6 / 1995840.0;
801 coeff += (34729.0) * n5 / 80640.0;
807 coeff += (175214326799.0) * n8 / 58118860800.0;
808 coeff += (-30705481.0) * n7 / 10378368.0;
809 coeff += (212378941.0) * n6 / 319334400.0;
815 coeff += (-16759934899.0) * n8 / 3113510400.0;
816 coeff += (1522256789.0) * n7 / 1383782400.0;
822 coeff += (1424729850961.0) * n8 / 743921418240.0;
828 coeff += (-7944359.0) * n8 / 67737600.0;
829 coeff += (5406467.0) * n7 / 38707200.0;
830 coeff += (-96199.0) * n6 / 604800.0;
831 coeff += (81.0) * n5 / 512.0;
832 coeff += (1.0) * n4 / 360.0;
833 coeff += (-37.0) * n3 / 96.0;
834 coeff += (2.0) * n2 / 3.0;
835 coeff += (-1.0) * n1 / 2.0;
841 coeff += (-24749483.0) * n8 / 348364800.0;
842 coeff += (-51841.0) * n7 / 1209600.0;
843 coeff += (1118711.0) * n6 / 3870720.0;
844 coeff += (-46.0) * n5 / 105.0;
845 coeff += (437.0) * n4 / 1440.0;
846 coeff += (-1.0) * n3 / 15.0;
847 coeff += (-1.0) * n2 / 48.0;
853 coeff += (6457463.0) * n8 / 17740800.0;
854 coeff += (-9261899.0) * n7 / 58060800.0;
855 coeff += (-5569.0) * n6 / 90720.0;
856 coeff += (209.0) * n5 / 4480.0;
857 coeff += (37.0) * n4 / 840.0;
858 coeff += (-17.0) * n3 / 480.0;
864 coeff += (-324154477.0) * n8 / 7664025600.0;
865 coeff += (-466511.0) * n7 / 2494800.0;
866 coeff += (830251.0) * n6 / 7257600.0;
867 coeff += (11.0) * n5 / 504.0;
868 coeff += (-4397.0) * n4 / 161280.0;
874 coeff += (-22894433.0) * n8 / 124540416.0;
875 coeff += (8005831.0) * n7 / 63866880.0;
876 coeff += (108847.0) * n6 / 3991680.0;
877 coeff += (-4583.0) * n5 / 161280.0;
883 coeff += (2204645983.0) * n8 / 12915302400.0;
884 coeff += (16363163.0) * n7 / 518918400.0;
885 coeff += (-20648693.0) * n6 / 638668800.0;
891 coeff += (497323811.0) * n8 / 12454041600.0;
892 coeff += (-219941297.0) * n7 / 5535129600.0;
898 coeff += (-191773887257.0) * n8 / 3719607091200.0;
904 coeff += 49 * n10 / 65536.0;
905 coeff += 25 * n8 / 16384.0;
910 R4oa = coeff / (1 + n1);
914 void TransverseMercator::checkLatLon(
double latitude,
double deltaLon )
918 deltaLon -= (2 *
PI);
920 deltaLon += (2 *
PI);
922 double testAngle = fabs( deltaLon );
924 double delta = fabs( deltaLon -
PI );
925 if( delta < testAngle )
928 delta = fabs( deltaLon +
PI );
929 if( delta < testAngle )
934 if( delta < testAngle )
938 if( delta < testAngle )
948 double TransverseMercator::aTanH(
double x)
950 return(0.5 * log((1 + x) / (1 - x)));
954 double TransverseMercator::geodeticLat(
960 double s_old = 1.0e99;
962 double onePlusSinChi = 1.0+sinChi;
963 double oneMinusSinChi = 1.0-sinChi;
965 for(
int n = 0; n < 30; n++ )
967 p = exp( e * aTanH( e * s ) );
969 s = ( onePlusSinChi * pSq - oneMinusSinChi )
970 /( onePlusSinChi * pSq + oneMinusSinChi );
972 if( fabs( s - s_old ) < 1.0e-12 )
981 void TransverseMercator::computeHyperbolicSeries(
988 c2kx[0] = cosh(twoX);
989 s2kx[0] = sinh(twoX);
990 c2kx[1] = 2.0 * c2kx[0] * c2kx[0] - 1.0;
991 s2kx[1] = 2.0 * c2kx[0] * s2kx[0];
992 c2kx[2] = c2kx[0] * c2kx[1] + s2kx[0] * s2kx[1];
993 s2kx[2] = c2kx[1] * s2kx[0] + c2kx[0] * s2kx[1];
994 c2kx[3] = 2.0 * c2kx[1] * c2kx[1] - 1.0;
995 s2kx[3] = 2.0 * c2kx[1] * s2kx[1];
996 c2kx[4] = c2kx[0] * c2kx[3] + s2kx[0] * s2kx[3];
997 s2kx[4] = c2kx[3] * s2kx[0] + c2kx[0] * s2kx[3];
998 c2kx[5] = 2.0 * c2kx[2] * c2kx[2] - 1.0;
999 s2kx[5] = 2.0 * c2kx[2] * s2kx[2];
1000 c2kx[6] = c2kx[0] * c2kx[5] + s2kx[0] * s2kx[5];
1001 s2kx[6] = c2kx[5] * s2kx[0] + c2kx[0] * s2kx[5];
1002 c2kx[7] = 2.0 * c2kx[3] * c2kx[3] - 1.0;
1003 s2kx[7] = 2.0 * c2kx[3] * s2kx[3];
1006 void TransverseMercator::computeTrigSeries(
1013 c2ky[0] = cos(twoY);
1014 s2ky[0] = sin(twoY);
1015 c2ky[1] = 2.0 * c2ky[0] * c2ky[0] - 1.0;
1016 s2ky[1] = 2.0 * c2ky[0] * s2ky[0];
1017 c2ky[2] = c2ky[1] * c2ky[0] - s2ky[1] * s2ky[0];
1018 s2ky[2] = c2ky[1] * s2ky[0] + c2ky[0] * s2ky[1];
1019 c2ky[3] = 2.0 * c2ky[1] * c2ky[1] - 1.0;
1020 s2ky[3] = 2.0 * c2ky[1] * s2ky[1];
1021 c2ky[4] = c2ky[3] * c2ky[0] - s2ky[3] * s2ky[0];
1022 s2ky[4] = c2ky[3] * s2ky[0] + c2ky[0] * s2ky[3];
1023 c2ky[5] = 2.0 * c2ky[2] * c2ky[2] - 1.0;
1024 s2ky[5] = 2.0 * c2ky[2] * s2ky[2];
1025 c2ky[6] = c2ky[5] * c2ky[0] - s2ky[5] * s2ky[0];
1026 s2ky[6] = c2ky[5] * s2ky[0] + c2ky[0] * s2ky[5];
1027 c2ky[7] = 2.0 * c2ky[3] * c2ky[3] - 1.0;
1028 s2ky[7] = 2.0 * c2ky[3] * s2ky[3];
TransverseMercator(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double latitudeOfTrueScale, double falseEasting, double falseNorthing, double scaleFactor, char *ellipsoidCode)
static const char * ellipsoidFlattening
MapProjection5Parameters * getParameters() const
static const char * centralMeridian
MSP::CCS::MapProjectionCoordinates * convertFromGeodetic(MSP::CCS::GeodeticCoordinates *geodeticCoordinates)
static const char * longitude
static const char * semiMajorAxis
static const char * originLatitude
static const char * invalidEllipsoidCode
static const char * northing
TransverseMercator & operator=(const TransverseMercator &tm)
static const char * scaleFactor
~TransverseMercator(void)
static const char * easting
MSP::CCS::GeodeticCoordinates * convertToGeodetic(MSP::CCS::MapProjectionCoordinates *mapProjectionCoordinates)