Geo-Coordinates-VandH-XS

 view release on metacpan or  search on metacpan

XS.c  view on Meta::CPAN

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
*
*      To go the other way, as this program does, undo the final translation,
*      rotation, and scaling.  The z-value Pz of the point on the x-y-z sphere
*      satisfies the quadratic Azz+Bz+c=0, where
*              A = (ExWz-EzWx)^2 + (EyWzx-EzWy)^2 + (ExWy-EyWx)^2;
*              B = -2[(Ex cos(arc to W) - Wx cos(arc to E))(ExWz-EzWx) -
*                      (Ey cos(arc to W) -Wy cos(arc to E))(EyWz-EzWy)];
*              C = (Ex cos(arc to W) - Wx cos(arc to E))^2 +
*                      (Ey cos(arc to W) - Wy cos(arc to E))^2 -
*                      (ExWy - EyWx)^2.
*      Solve with the quadratic formula.  The latitude is simply the
*      arc sine of Pz.  Px and Py satisfy
*              ExPx + EyPy + EzPz = cos(arc to E);
*              WxPx + WyPy + WzPz = cos(arc to W).
*      Substitute Pz's value, and solve linearly to get Px and Py.
*      The longitude is the arc tangent of Px/Py.
*      Finally, this latitude and longitude are spherical; use the
*      inverse polynomial approximation on the latitude to get the
*      ellipsoidal earth latitude, and add 52 degrees to the longitude.
*/

XS.xs  view on Meta::CPAN

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
*
*      To go the other way, as this program does, undo the final translation,
*      rotation, and scaling.  The z-value Pz of the point on the x-y-z sphere
*      satisfies the quadratic Azz+Bz+c=0, where
*              A = (ExWz-EzWx)^2 + (EyWzx-EzWy)^2 + (ExWy-EyWx)^2;
*              B = -2[(Ex cos(arc to W) - Wx cos(arc to E))(ExWz-EzWx) -
*                      (Ey cos(arc to W) -Wy cos(arc to E))(EyWz-EzWy)];
*              C = (Ex cos(arc to W) - Wx cos(arc to E))^2 +
*                      (Ey cos(arc to W) - Wy cos(arc to E))^2 -
*                      (ExWy - EyWx)^2.
*      Solve with the quadratic formula.  The latitude is simply the
*      arc sine of Pz.  Px and Py satisfy
*              ExPx + EyPy + EzPz = cos(arc to E);
*              WxPx + WyPy + WzPz = cos(arc to W).
*      Substitute Pz's value, and solve linearly to get Px and Py.
*      The longitude is the arc tangent of Px/Py.
*      Finally, this latitude and longitude are spherical; use the
*      inverse polynomial approximation on the latitude to get the
*      ellipsoidal earth latitude, and add 52 degrees to the longitude.
*/



( run in 0.572 second using v1.01-cache-2.11-cpan-8d75d55dd25 )