NETGeographicLib  1.43
Geodesic.h
Go to the documentation of this file.
1 /**
2  * \file NETGeographicLib/Geodesic.h
3  * \brief Header for NETGeographicLib::Geodesic class
4  *
5  * NETGeographicLib is copyright (c) Scott Heiman (2013)
6  * GeographicLib is Copyright (c) Charles Karney (2010-2012)
7  * <charles@karney.com> and licensed under the MIT/X11 License.
8  * For more information, see
9  * http://geographiclib.sourceforge.net/
10  **********************************************************************/
11 #pragma once
12 #include "NETGeographicLib.h"
13 
14 namespace NETGeographicLib
15 {
16  ref class GeodesicLine;
17  /**
18  * \brief .NET wrapper for GeographicLib::Geodesic.
19  *
20  * This class allows .NET applications to access GeographicLib::Geodesic.
21  *
22  * The shortest path between two points on a ellipsoid at (\e lat1, \e lon1)
23  * and (\e lat2, \e lon2) is called the geodesic. Its length is \e s12 and
24  * the geodesic from point 1 to point 2 has azimuths \e azi1 and \e azi2 at
25  * the two end points. (The azimuth is the heading measured clockwise from
26  * north. \e azi2 is the "forward" azimuth, i.e., the heading that takes you
27  * beyond point 2 not back to point 1.) In the figure below, latitude if
28  * labeled &phi;, longitude &lambda; (with &lambda;<sub>12</sub> =
29  * &lambda;<sub>2</sub> &minus; &lambda;<sub>1</sub>), and azimuth &alpha;.
30  *
31  * <img src="http://upload.wikimedia.org/wikipedia/commons/c/cb/Geodesic_problem_on_an_ellipsoid.svg" width=250 alt="spheroidal triangle">
32  *
33  * Given \e lat1, \e lon1, \e azi1, and \e s12, we can determine \e lat2, \e
34  * lon2, and \e azi2. This is the \e direct geodesic problem and its
35  * solution is given by the function Geodesic::Direct. (If \e s12 is
36  * sufficiently large that the geodesic wraps more than halfway around the
37  * earth, there will be another geodesic between the points with a smaller \e
38  * s12.)
39  *
40  * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1, \e
41  * azi2, and \e s12. This is the \e inverse geodesic problem, whose solution
42  * is given by Geodesic::Inverse. Usually, the solution to the inverse
43  * problem is unique. In cases where there are multiple solutions (all with
44  * the same \e s12, of course), all the solutions can be easily generated
45  * once a particular solution is provided.
46  *
47  * The standard way of specifying the direct problem is the specify the
48  * distance \e s12 to the second point. However it is sometimes useful
49  * instead to specify the arc length \e a12 (in degrees) on the auxiliary
50  * sphere. This is a mathematical construct used in solving the geodesic
51  * problems. The solution of the direct problem in this form is provided by
52  * Geodesic::ArcDirect. An arc length in excess of 180&deg; indicates that
53  * the geodesic is not a shortest path. In addition, the arc length between
54  * an equatorial crossing and the next extremum of latitude for a geodesic is
55  * 90&deg;.
56  *
57  * This class can also calculate several other quantities related to
58  * geodesics. These are:
59  * - <i>reduced length</i>. If we fix the first point and increase \e azi1
60  * by \e dazi1 (radians), the second point is displaced \e m12 \e dazi1 in
61  * the direction \e azi2 + 90&deg;. The quantity \e m12 is called
62  * the "reduced length" and is symmetric under interchange of the two
63  * points. On a curved surface the reduced length obeys a symmetry
64  * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 = \e
65  * s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an
66  * azimuthal equidistant projection.
67  * - <i>geodesic scale</i>. Consider a reference geodesic and a second
68  * geodesic parallel to this one at point 1 and separated by a small
69  * distance \e dt. The separation of the two geodesics at point 2 is \e
70  * M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is
71  * defined similarly (with the geodesics being parallel at point 2). On a
72  * flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gives
73  * the scale of the Cassini-Soldner projection.
74  * - <i>area</i>. The area between the geodesic from point 1 to point 2 and
75  * the equation is represented by \e S12; it is the area, measured
76  * counter-clockwise, of the geodesic quadrilateral with corners
77  * (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and
78  * (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of any
79  * simple geodesic polygon.
80  *
81  * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and
82  * Geodesic::Inverse allow these quantities to be returned. In addition
83  * there are general functions Geodesic::GenDirect, and Geodesic::GenInverse
84  * which allow an arbitrary set of results to be computed. The quantities \e
85  * m12, \e M12, \e M21 which all specify the behavior of nearby geodesics
86  * obey addition rules. If points 1, 2, and 3 all lie on a single geodesic,
87  * then the following rules hold:
88  * - \e s13 = \e s12 + \e s23
89  * - \e a13 = \e a12 + \e a23
90  * - \e S13 = \e S12 + \e S23
91  * - \e m13 = \e m12 \e M23 + \e m23 \e M21
92  * - \e M13 = \e M12 \e M23 &minus; (1 &minus; \e M12 \e M21) \e m23 / \e m12
93  * - \e M31 = \e M32 \e M21 &minus; (1 &minus; \e M23 \e M32) \e m12 / \e m23
94  *
95  * Additional functionality is provided by the GeodesicLine class, which
96  * allows a sequence of points along a geodesic to be computed.
97  *
98  * The shortest distance returned by the solution of the inverse problem is
99  * (obviously) uniquely defined. However, in a few special cases there are
100  * multiple azimuths which yield the same shortest distance. Here is a
101  * catalog of those cases:
102  * - \e lat1 = &minus;\e lat2 (with neither point at a pole). If \e azi1 =
103  * \e azi2, the geodesic is unique. Otherwise there are two geodesics and
104  * the second one is obtained by setting [\e azi1, \e azi2] = [\e azi2, \e
105  * azi1], [\e M12, \e M21] = [\e M21, \e M12], \e S12 = &minus;\e S12.
106  * (This occurs when the longitude difference is near &plusmn;180&deg; for
107  * oblate ellipsoids.)
108  * - \e lon2 = \e lon1 &plusmn; 180&deg; (with neither point at a pole). If
109  * \e azi1 = 0&deg; or &plusmn;180&deg;, the geodesic is unique. Otherwise
110  * there are two geodesics and the second one is obtained by setting [\e
111  * azi1, \e azi2] = [&minus;\e azi1, &minus;\e azi2], \e S12 = &minus;\e
112  * S12. (This occurs when \e lat2 is near &minus;\e lat1 for prolate
113  * ellipsoids.)
114  * - Points 1 and 2 at opposite poles. There are infinitely many geodesics
115  * which can be generated by setting [\e azi1, \e azi2] = [\e azi1, \e
116  * azi2] + [\e d, &minus;\e d], for arbitrary \e d. (For spheres, this
117  * prescription applies when points 1 and 2 are antipodal.)
118  * - s12 = 0 (coincident points). There are infinitely many geodesics which
119  * can be generated by setting [\e azi1, \e azi2] = [\e azi1, \e azi2] +
120  * [\e d, \e d], for arbitrary \e d.
121  *
122  * The calculations are accurate to better than 15 nm (15 nanometers) for the
123  * WGS84 ellipsoid. See Sec. 9 of
124  * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
125  * details. The algorithms used by this class are based on series expansions
126  * using the flattening \e f as a small parameter. These are only accurate
127  * for |<i>f</i>| &lt; 0.02; however reasonably accurate results will be
128  * obtained for |<i>f</i>| &lt; 0.2. Here is a table of the approximate
129  * maximum error (expressed as a distance) for an ellipsoid with the same
130  * major radius as the WGS84 ellipsoid and different values of the
131  * flattening.<pre>
132  * |f| error
133  * 0.01 25 nm
134  * 0.02 30 nm
135  * 0.05 10 um
136  * 0.1 1.5 mm
137  * 0.2 300 mm
138  * </pre>
139  * For very eccentric ellipsoids, use GeodesicExact instead.
140  *
141  * The algorithms are described in
142  * - C. F. F. Karney,
143  * <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
144  * Algorithms for geodesics</a>,
145  * J. Geodesy <b>87</b>, 43--55 (2013);
146  * DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
147  * 10.1007/s00190-012-0578-z</a>;
148  * addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
149  * geod-addenda.html</a>.
150  * .
151  * For more information on geodesics see \ref geodesic.
152  *
153  * C# Example:
154  * \include example-Geodesic.cs
155  * Managed C++ Example:
156  * \include example-Geodesic.cpp
157  * Visual Basic Example:
158  * \include example-Geodesic.vb
159  *
160  * <B>INTERFACE DIFFERENCES:</B><BR>
161  * A default constructor has been provided that assumes WGS84 parameters.
162  *
163  * The MajorRadius, Flattening, and EllipsoidArea functions are
164  * implemented as properties.
165  *
166  * The GenDirect, GenInverse, and Line functions accept the
167  * "capabilities mask" as a NETGeographicLib::Mask rather than an
168  * unsigned.
169  **********************************************************************/
170  public ref class Geodesic
171  {
172  private:
173  // The pointer to the unmanaged GeographicLib::Geodesic.
174  const GeographicLib::Geodesic* m_pGeodesic;
175 
176  // Frees the unmanaged memory when this object is destroyed.
177  !Geodesic();
178  public:
179  /**
180  * Bit masks for what calculations to do. These masks do double duty.
181  * They signify to the GeodesicLine::GeodesicLine constructor and to
182  * Geodesic::Line what capabilities should be included in the GeodesicLine
183  * object. They also specify which results to return in the general
184  * routines Geodesic::GenDirect and Geodesic::GenInverse routines.
185  * GeodesicLine::mask is a duplication of this enum.
186  **********************************************************************/
187  enum class mask {
188  /**
189  * No capabilities, no output.
190  * @hideinitializer
191  **********************************************************************/
192  NONE = 0U,
193  /**
194  * Calculate latitude \e lat2. (It's not necessary to include this as a
195  * capability to GeodesicLine because this is included by default.)
196  * @hideinitializer
197  **********************************************************************/
198  LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE),
199  /**
200  * Calculate longitude \e lon2.
201  * @hideinitializer
202  **********************************************************************/
203  LONGITUDE = 1U<<8 | unsigned(captype::CAP_C3),
204  /**
205  * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
206  * include this as a capability to GeodesicLine because this is included
207  * by default.)
208  * @hideinitializer
209  **********************************************************************/
210  AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE),
211  /**
212  * Calculate distance \e s12.
213  * @hideinitializer
214  **********************************************************************/
215  DISTANCE = 1U<<10 | unsigned(captype::CAP_C1),
216  /**
217  * Allow distance \e s12 to be used as input in the direct geodesic
218  * problem.
219  * @hideinitializer
220  **********************************************************************/
221  DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C1p),
222  /**
223  * Calculate reduced length \e m12.
224  * @hideinitializer
225  **********************************************************************/
226  REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2),
227  /**
228  * Calculate geodesic scales \e M12 and \e M21.
229  * @hideinitializer
230  **********************************************************************/
231  GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2),
232  /**
233  * Calculate area \e S12.
234  * @hideinitializer
235  **********************************************************************/
236  AREA = 1U<<14 | unsigned(captype::CAP_C4),
237  /**
238  * Unroll \e lon2 in the direct calculation. (This flag used to be
239  * called LONG_NOWRAP.)
240  * @hideinitializer
241  **********************************************************************/
242  LONG_UNROLL = 1U<<15,
244  /**
245  * All capabilities, calculate everything. (LONG_UNROLL is not
246  * included in this mask.)
247  * @hideinitializer
248  **********************************************************************/
249  ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_ALL),
250  };
251  /** \name Constructor
252  **********************************************************************/
253  ///@{
254  /**
255  * Constructor for a ellipsoid with
256  *
257  * @param[in] a equatorial radius (meters).
258  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
259  * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
260  * to 1/\e f.
261  * @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
262  * positive.
263  **********************************************************************/
264  Geodesic(double a, double f);
265 
266  /**
267  * Constructor for the WGS84 ellipsoid.
268  **********************************************************************/
269  Geodesic();
270  ///@}
271 
272  /**
273  * \brief the destructor calls the finalizer.
274  **********************************************************************/
275  ~Geodesic() { this->!Geodesic(); }
276 
277  /** \name Direct geodesic problem specified in terms of distance.
278  **********************************************************************/
279  ///@{
280  /**
281  * Solve the direct geodesic problem where the length of the geodesic
282  * is specified in terms of distance.
283  *
284  * @param[in] lat1 latitude of point 1 (degrees).
285  * @param[in] lon1 longitude of point 1 (degrees).
286  * @param[in] azi1 azimuth at point 1 (degrees).
287  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
288  * negative.
289  * @param[out] lat2 latitude of point 2 (degrees).
290  * @param[out] lon2 longitude of point 2 (degrees).
291  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
292  * @param[out] m12 reduced length of geodesic (meters).
293  * @param[out] M12 geodesic scale of point 2 relative to point 1
294  * (dimensionless).
295  * @param[out] M21 geodesic scale of point 1 relative to point 2
296  * (dimensionless).
297  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
298  * @return \e a12 arc length of between point 1 and point 2 (degrees).
299  *
300  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
301  * azi1 should be in the range [&minus;540&deg;, 540&deg;). The values of
302  * \e lon2 and \e azi2 returned are in the range [&minus;180&deg;,
303  * 180&deg;).
304  *
305  * If either point is at a pole, the azimuth is defined by keeping the
306  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
307  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
308  * 180&deg; signifies a geodesic which is not a shortest path. (For a
309  * prolate ellipsoid, an additional condition is necessary for a shortest
310  * path: the longitudinal extent must not exceed of 180&deg;.)
311  *
312  * The following functions are overloaded versions of Geodesic::Direct
313  * which omit some of the output parameters. Note, however, that the arc
314  * length is always computed and returned as the function value.
315  **********************************************************************/
316  double Direct(double lat1, double lon1, double azi1, double s12,
317  [System::Runtime::InteropServices::Out] double% lat2,
318  [System::Runtime::InteropServices::Out] double% lon2,
319  [System::Runtime::InteropServices::Out] double% azi2,
320  [System::Runtime::InteropServices::Out] double% m12,
321  [System::Runtime::InteropServices::Out] double% M12,
322  [System::Runtime::InteropServices::Out] double% M21,
323  [System::Runtime::InteropServices::Out] double% S12);
324 
325  /**
326  * See the documentation for Geodesic::Direct.
327  **********************************************************************/
328  double Direct(double lat1, double lon1, double azi1, double s12,
329  [System::Runtime::InteropServices::Out] double% lat2,
330  [System::Runtime::InteropServices::Out] double% lon2);
331 
332  /**
333  * See the documentation for Geodesic::Direct.
334  **********************************************************************/
335  double Direct(double lat1, double lon1, double azi1, double s12,
336  [System::Runtime::InteropServices::Out] double% lat2,
337  [System::Runtime::InteropServices::Out] double% lon2,
338  [System::Runtime::InteropServices::Out] double% azi2);
339 
340  /**
341  * See the documentation for Geodesic::Direct.
342  **********************************************************************/
343  double Direct(double lat1, double lon1, double azi1, double s12,
344  [System::Runtime::InteropServices::Out] double% lat2,
345  [System::Runtime::InteropServices::Out] double% lon2,
346  [System::Runtime::InteropServices::Out] double% azi2,
347  [System::Runtime::InteropServices::Out] double% m12);
348 
349  /**
350  * See the documentation for Geodesic::Direct.
351  **********************************************************************/
352  double Direct(double lat1, double lon1, double azi1, double s12,
353  [System::Runtime::InteropServices::Out] double% lat2,
354  [System::Runtime::InteropServices::Out] double% lon2,
355  [System::Runtime::InteropServices::Out] double% azi2,
356  [System::Runtime::InteropServices::Out] double% M12,
357  [System::Runtime::InteropServices::Out] double% M21);
358 
359  /**
360  * See the documentation for Geodesic::Direct.
361  **********************************************************************/
362  double Direct(double lat1, double lon1, double azi1, double s12,
363  [System::Runtime::InteropServices::Out] double% lat2,
364  [System::Runtime::InteropServices::Out] double% lon2,
365  [System::Runtime::InteropServices::Out] double% azi2,
366  [System::Runtime::InteropServices::Out] double% m12,
367  [System::Runtime::InteropServices::Out] double% M12,
368  [System::Runtime::InteropServices::Out] double% M21);
369  ///@}
370 
371  /** \name Direct geodesic problem specified in terms of arc length.
372  **********************************************************************/
373  ///@{
374  /**
375  * Solve the direct geodesic problem where the length of the geodesic
376  * is specified in terms of arc length.
377  *
378  * @param[in] lat1 latitude of point 1 (degrees).
379  * @param[in] lon1 longitude of point 1 (degrees).
380  * @param[in] azi1 azimuth at point 1 (degrees).
381  * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
382  * be negative.
383  * @param[out] lat2 latitude of point 2 (degrees).
384  * @param[out] lon2 longitude of point 2 (degrees).
385  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
386  * @param[out] s12 distance between point 1 and point 2 (meters).
387  * @param[out] m12 reduced length of geodesic (meters).
388  * @param[out] M12 geodesic scale of point 2 relative to point 1
389  * (dimensionless).
390  * @param[out] M21 geodesic scale of point 1 relative to point 2
391  * (dimensionless).
392  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
393  *
394  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
395  * azi1 should be in the range [&minus;540&deg;, 540&deg;). The values of
396  * \e lon2 and \e azi2 returned are in the range [&minus;180&deg;,
397  * 180&deg;).
398  *
399  * If either point is at a pole, the azimuth is defined by keeping the
400  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
401  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
402  * 180&deg; signifies a geodesic which is not a shortest path. (For a
403  * prolate ellipsoid, an additional condition is necessary for a shortest
404  * path: the longitudinal extent must not exceed of 180&deg;.)
405  *
406  * The following functions are overloaded versions of Geodesic::Direct
407  * which omit some of the output parameters.
408  **********************************************************************/
409  void ArcDirect(double lat1, double lon1, double azi1, double a12,
410  [System::Runtime::InteropServices::Out] double% lat2,
411  [System::Runtime::InteropServices::Out] double% lon2,
412  [System::Runtime::InteropServices::Out] double% azi2,
413  [System::Runtime::InteropServices::Out] double% s12,
414  [System::Runtime::InteropServices::Out] double% m12,
415  [System::Runtime::InteropServices::Out] double% M12,
416  [System::Runtime::InteropServices::Out] double% M21,
417  [System::Runtime::InteropServices::Out] double% S12);
418 
419  /**
420  * See the documentation for Geodesic::ArcDirect.
421  **********************************************************************/
422  void ArcDirect(double lat1, double lon1, double azi1, double a12,
423  [System::Runtime::InteropServices::Out] double% lat2,
424  [System::Runtime::InteropServices::Out] double% lon2);
425 
426  /**
427  * See the documentation for Geodesic::ArcDirect.
428  **********************************************************************/
429  void ArcDirect(double lat1, double lon1, double azi1, double a12,
430  [System::Runtime::InteropServices::Out] double% lat2,
431  [System::Runtime::InteropServices::Out] double% lon2,
432  [System::Runtime::InteropServices::Out] double% azi2);
433 
434  /**
435  * See the documentation for Geodesic::ArcDirect.
436  **********************************************************************/
437  void ArcDirect(double lat1, double lon1, double azi1, double a12,
438  [System::Runtime::InteropServices::Out] double% lat2,
439  [System::Runtime::InteropServices::Out] double% lon2,
440  [System::Runtime::InteropServices::Out] double% azi2,
441  [System::Runtime::InteropServices::Out] double% s12);
442 
443  /**
444  * See the documentation for Geodesic::ArcDirect.
445  **********************************************************************/
446  void ArcDirect(double lat1, double lon1, double azi1, double a12,
447  [System::Runtime::InteropServices::Out] double% lat2,
448  [System::Runtime::InteropServices::Out] double% lon2,
449  [System::Runtime::InteropServices::Out] double% azi2,
450  [System::Runtime::InteropServices::Out] double% s12,
451  [System::Runtime::InteropServices::Out] double% m12);
452 
453  /**
454  * See the documentation for Geodesic::ArcDirect.
455  **********************************************************************/
456  void ArcDirect(double lat1, double lon1, double azi1, double a12,
457  [System::Runtime::InteropServices::Out] double% lat2,
458  [System::Runtime::InteropServices::Out] double% lon2,
459  [System::Runtime::InteropServices::Out] double% azi2,
460  [System::Runtime::InteropServices::Out] double% s12,
461  [System::Runtime::InteropServices::Out] double% M12,
462  [System::Runtime::InteropServices::Out] double% M21);
463 
464  /**
465  * See the documentation for Geodesic::ArcDirect.
466  **********************************************************************/
467  void ArcDirect(double lat1, double lon1, double azi1, double a12,
468  [System::Runtime::InteropServices::Out] double% lat2,
469  [System::Runtime::InteropServices::Out] double% lon2,
470  [System::Runtime::InteropServices::Out] double% azi2,
471  [System::Runtime::InteropServices::Out] double% s12,
472  [System::Runtime::InteropServices::Out] double% m12,
473  [System::Runtime::InteropServices::Out] double% M12,
474  [System::Runtime::InteropServices::Out] double% M21);
475  ///@}
476 
477  /** \name General version of the direct geodesic solution.
478  **********************************************************************/
479  ///@{
480 
481  /**
482  * The general direct geodesic problem. Geodesic::Direct and
483  * Geodesic::ArcDirect are defined in terms of this function.
484  *
485  * @param[in] lat1 latitude of point 1 (degrees).
486  * @param[in] lon1 longitude of point 1 (degrees).
487  * @param[in] azi1 azimuth at point 1 (degrees).
488  * @param[in] arcmode boolean flag determining the meaning of the \e
489  * s12_a12.
490  * @param[in] s12_a12 if \e arcmode is false, this is the distance between
491  * point 1 and point 2 (meters); otherwise it is the arc length between
492  * point 1 and point 2 (degrees); it can be negative.
493  * @param[in] outmask a bitor'ed combination of Geodesic::mask values
494  * specifying which of the following parameters should be set.
495  * @param[out] lat2 latitude of point 2 (degrees).
496  * @param[out] lon2 longitude of point 2 (degrees).
497  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
498  * @param[out] s12 distance between point 1 and point 2 (meters).
499  * @param[out] m12 reduced length of geodesic (meters).
500  * @param[out] M12 geodesic scale of point 2 relative to point 1
501  * (dimensionless).
502  * @param[out] M21 geodesic scale of point 1 relative to point 2
503  * (dimensionless).
504  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
505  * @return \e a12 arc length of between point 1 and point 2 (degrees).
506  *
507  * The Geodesic::mask values possible for \e outmask are
508  * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2;
509  * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2;
510  * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
511  * - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
512  * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
513  * m12;
514  * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
515  * M12 and \e M21;
516  * - \e outmask |= Geodesic::AREA for the area \e S12;
517  * - \e outmask |= Geodesic::ALL for all of the above;
518  * - \e outmask |= Geodesic::LONG_UNROLL to unroll \e lon2 instead of
519  * wrapping it into the range [&minus;180&deg;, 180&deg;).
520  * .
521  * The function value \e a12 is always computed and returned and this
522  * equals \e s12_a12 is \e arcmode is true. If \e outmask includes
523  * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12.
524  * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this
525  * is automatically included is \e arcmode is false.
526  *
527  * With the LONG_UNROLL bit set, the quantity \e lon2 &minus; \e lon1
528  * indicates how many times and in what sense the geodesic encircles
529  * the ellipsoid. Because \e lon2 might be outside the normal allowed
530  * range for longitudes, [&minus;540&deg;, 540&deg;), be sure to
531  * normalize it with Math::AngNormalize2 before using it in other
532  * GeographicLib calls.
533  **********************************************************************/
534  double GenDirect(double lat1, double lon1, double azi1,
535  bool arcmode, double s12_a12,
536  Geodesic::mask outmask,
537  [System::Runtime::InteropServices::Out] double% lat2,
538  [System::Runtime::InteropServices::Out] double% lon2,
539  [System::Runtime::InteropServices::Out] double% azi2,
540  [System::Runtime::InteropServices::Out] double% s12,
541  [System::Runtime::InteropServices::Out] double% m12,
542  [System::Runtime::InteropServices::Out] double% M12,
543  [System::Runtime::InteropServices::Out] double% M21,
544  [System::Runtime::InteropServices::Out] double% S12);
545  ///@}
546 
547  /** \name Inverse geodesic problem.
548  **********************************************************************/
549  ///@{
550  /**
551  * Solve the inverse geodesic problem.
552  *
553  * @param[in] lat1 latitude of point 1 (degrees).
554  * @param[in] lon1 longitude of point 1 (degrees).
555  * @param[in] lat2 latitude of point 2 (degrees).
556  * @param[in] lon2 longitude of point 2 (degrees).
557  * @param[out] s12 distance between point 1 and point 2 (meters).
558  * @param[out] azi1 azimuth at point 1 (degrees).
559  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
560  * @param[out] m12 reduced length of geodesic (meters).
561  * @param[out] M12 geodesic scale of point 2 relative to point 1
562  * (dimensionless).
563  * @param[out] M21 geodesic scale of point 1 relative to point 2
564  * (dimensionless).
565  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
566  * @return \e a12 arc length of between point 1 and point 2 (degrees).
567  *
568  * \e lat1 and \e lat2 should be in the range [&minus;90&deg;, 90&deg;]; \e
569  * lon1 and \e lon2 should be in the range [&minus;540&deg;, 540&deg;).
570  * The values of \e azi1 and \e azi2 returned are in the range
571  * [&minus;180&deg;, 180&deg;).
572  *
573  * If either point is at a pole, the azimuth is defined by keeping the
574  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
575  * and taking the limit &epsilon; &rarr; 0+.
576  *
577  * The solution to the inverse problem is found using Newton's method. If
578  * this fails to converge (this is very unlikely in geodetic applications
579  * but does occur for very eccentric ellipsoids), then the bisection method
580  * is used to refine the solution.
581  *
582  * The following functions are overloaded versions of Geodesic::Inverse
583  * which omit some of the output parameters. Note, however, that the arc
584  * length is always computed and returned as the function value.
585  **********************************************************************/
586  double Inverse(double lat1, double lon1, double lat2, double lon2,
587  [System::Runtime::InteropServices::Out] double% s12,
588  [System::Runtime::InteropServices::Out] double% azi1,
589  [System::Runtime::InteropServices::Out] double% azi2,
590  [System::Runtime::InteropServices::Out] double% m12,
591  [System::Runtime::InteropServices::Out] double% M12,
592  [System::Runtime::InteropServices::Out] double% M21,
593  [System::Runtime::InteropServices::Out] double% S12);
594 
595  /**
596  * See the documentation for Geodesic::Inverse.
597  **********************************************************************/
598  double Inverse(double lat1, double lon1, double lat2, double lon2,
599  [System::Runtime::InteropServices::Out] double% s12);
600 
601  /**
602  * See the documentation for Geodesic::Inverse.
603  **********************************************************************/
604  double Inverse(double lat1, double lon1, double lat2, double lon2,
605  [System::Runtime::InteropServices::Out] double% azi1,
606  [System::Runtime::InteropServices::Out] double% azi2);
607 
608  /**
609  * See the documentation for Geodesic::Inverse.
610  **********************************************************************/
611  double Inverse(double lat1, double lon1, double lat2, double lon2,
612  [System::Runtime::InteropServices::Out] double% s12,
613  [System::Runtime::InteropServices::Out] double% azi1,
614  [System::Runtime::InteropServices::Out] double% azi2);
615 
616  /**
617  * See the documentation for Geodesic::Inverse.
618  **********************************************************************/
619  double Inverse(double lat1, double lon1, double lat2, double lon2,
620  [System::Runtime::InteropServices::Out] double% s12,
621  [System::Runtime::InteropServices::Out] double% azi1,
622  [System::Runtime::InteropServices::Out] double% azi2,
623  [System::Runtime::InteropServices::Out] double% m12);
624 
625  /**
626  * See the documentation for Geodesic::Inverse.
627  **********************************************************************/
628  double Inverse(double lat1, double lon1, double lat2, double lon2,
629  [System::Runtime::InteropServices::Out] double% s12,
630  [System::Runtime::InteropServices::Out] double% azi1,
631  [System::Runtime::InteropServices::Out] double% azi2,
632  [System::Runtime::InteropServices::Out] double% M12,
633  [System::Runtime::InteropServices::Out] double% M21);
634 
635  /**
636  * See the documentation for Geodesic::Inverse.
637  **********************************************************************/
638  double Inverse(double lat1, double lon1, double lat2, double lon2,
639  [System::Runtime::InteropServices::Out] double% s12,
640  [System::Runtime::InteropServices::Out] double% azi1,
641  [System::Runtime::InteropServices::Out] double% azi2,
642  [System::Runtime::InteropServices::Out] double% m12,
643  [System::Runtime::InteropServices::Out] double% M12,
644  [System::Runtime::InteropServices::Out] double% M21);
645  ///@}
646 
647  /** \name General version of inverse geodesic solution.
648  **********************************************************************/
649  ///@{
650  /**
651  * The general inverse geodesic calculation. Geodesic::Inverse is defined
652  * in terms of this function.
653  *
654  * @param[in] lat1 latitude of point 1 (degrees).
655  * @param[in] lon1 longitude of point 1 (degrees).
656  * @param[in] lat2 latitude of point 2 (degrees).
657  * @param[in] lon2 longitude of point 2 (degrees).
658  * @param[in] outmask a bitor'ed combination of Geodesic::mask values
659  * specifying which of the following parameters should be set.
660  * @param[out] s12 distance between point 1 and point 2 (meters).
661  * @param[out] azi1 azimuth at point 1 (degrees).
662  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
663  * @param[out] m12 reduced length of geodesic (meters).
664  * @param[out] M12 geodesic scale of point 2 relative to point 1
665  * (dimensionless).
666  * @param[out] M21 geodesic scale of point 1 relative to point 2
667  * (dimensionless).
668  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
669  * @return \e a12 arc length of between point 1 and point 2 (degrees).
670  *
671  * The Geodesic::mask values possible for \e outmask are
672  * - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
673  * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
674  * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
675  * m12;
676  * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
677  * M12 and \e M21;
678  * - \e outmask |= Geodesic::AREA for the area \e S12;
679  * - \e outmask |= Geodesic::ALL for all of the above.
680  * .
681  * The arc length is always computed and returned as the function value.
682  **********************************************************************/
683  double GenInverse(double lat1, double lon1, double lat2, double lon2,
684  Geodesic::mask outmask,
685  [System::Runtime::InteropServices::Out] double% s12,
686  [System::Runtime::InteropServices::Out] double% azi1,
687  [System::Runtime::InteropServices::Out] double% azi2,
688  [System::Runtime::InteropServices::Out] double% m12,
689  [System::Runtime::InteropServices::Out] double% M12,
690  [System::Runtime::InteropServices::Out] double% M21,
691  [System::Runtime::InteropServices::Out] double% S12);
692  ///@}
693 
694  /** \name Interface to GeodesicLine.
695  **********************************************************************/
696  ///@{
697 
698  /**
699  * Set up to compute several points on a single geodesic.
700  *
701  * @param[in] lat1 latitude of point 1 (degrees).
702  * @param[in] lon1 longitude of point 1 (degrees).
703  * @param[in] azi1 azimuth at point 1 (degrees).
704  * @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
705  * specifying the capabilities the GeodesicLine object should possess,
706  * i.e., which quantities can be returned in calls to
707  * GeodesicLine::Position.
708  * @return a GeodesicLine object.
709  *
710  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
711  * azi1 should be in the range [&minus;540&deg;, 540&deg;).
712  *
713  * The NETGeographicLib::Mask values are
714  * - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is
715  * added automatically;
716  * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
717  * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is
718  * added automatically;
719  * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
720  * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12;
721  * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12
722  * and \e M21;
723  * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
724  * - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
725  * geodesic to be given in terms of \e s12; without this capability the
726  * length can only be specified in terms of arc length;
727  * - \e caps |= NETGeographicLib::Mask::ALL for all of the above.
728  * .
729  *
730  * If the point is at a pole, the azimuth is defined by keeping \e lon1
731  * fixed, writing \e lat1 = &plusmn;(90 &minus; &epsilon;), and taking the
732  * limit &epsilon; &rarr; 0+.
733  **********************************************************************/
734  GeodesicLine^ Line(double lat1, double lon1, double azi1,
735  NETGeographicLib::Mask caps );
736 
737  ///@}
738 
739  /** \name Inspector functions.
740  **********************************************************************/
741  ///@{
742 
743  /**
744  * @return \e a the equatorial radius of the ellipsoid (meters). This is
745  * the value used in the constructor.
746  **********************************************************************/
747  property double MajorRadius { double get(); }
748 
749  /**
750  * @return \e f the flattening of the ellipsoid. This is the
751  * value used in the constructor.
752  **********************************************************************/
753  property double Flattening { double get(); }
754 
755  /**
756  * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
757  * polygon encircling a pole can be found by adding
758  * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
759  * polygon.
760  **********************************************************************/
761  property double EllipsoidArea { double get(); }
762 
763  /**
764  * %return The unmanaged pointer to the GeographicLib::Geodesic.
765  *
766  * This function is for internal use only.
767  **********************************************************************/
768  System::IntPtr^ GetUnmanaged();
769  ///@}
770  };
771 } // namespace NETGeographicLib
System::IntPtr^ GetUnmanaged()
void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
double GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
Header for NETGeographicLib::NETGeographicLib objects.
double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
.NET wrapper for GeographicLib::GeodesicLine.
Definition: GeodesicLine.h:71
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
GeodesicLine^ Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps)
double GenInverse(double lat1, double lon1, double lat2, double lon2, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12)
~Geodesic()
the destructor calls the finalizer.
Definition: Geodesic.h:275