NETGeographicLib  1.40
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
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  * Do not wrap the \e lon2 in the direct calculation.
239  * @hideinitializer
240  **********************************************************************/
241  LONG_NOWRAP = 1U<<15,
242  /**
243  * All capabilities, calculate everything. (LONG_NOWRAP is not
244  * included in this mask.)
245  * @hideinitializer
246  **********************************************************************/
247  ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_ALL),
248  };
249  /** \name Constructor
250  **********************************************************************/
251  ///@{
252  /**
253  * Constructor for a ellipsoid with
254  *
255  * @param[in] a equatorial radius (meters).
256  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
257  * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
258  * to 1/\e f.
259  * @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
260  * positive.
261  **********************************************************************/
262  Geodesic(double a, double f);
263 
264  /**
265  * Constructor for the WGS84 ellipsoid.
266  **********************************************************************/
267  Geodesic();
268  ///@}
269 
270  /**
271  * \brief the destructor calls the finalizer.
272  **********************************************************************/
273  ~Geodesic() { this->!Geodesic(); }
274 
275  /** \name Direct geodesic problem specified in terms of distance.
276  **********************************************************************/
277  ///@{
278  /**
279  * Solve the direct geodesic problem where the length of the geodesic
280  * is specified in terms of distance.
281  *
282  * @param[in] lat1 latitude of point 1 (degrees).
283  * @param[in] lon1 longitude of point 1 (degrees).
284  * @param[in] azi1 azimuth at point 1 (degrees).
285  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
286  * negative.
287  * @param[out] lat2 latitude of point 2 (degrees).
288  * @param[out] lon2 longitude of point 2 (degrees).
289  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
290  * @param[out] m12 reduced length of geodesic (meters).
291  * @param[out] M12 geodesic scale of point 2 relative to point 1
292  * (dimensionless).
293  * @param[out] M21 geodesic scale of point 1 relative to point 2
294  * (dimensionless).
295  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
296  * @return \e a12 arc length of between point 1 and point 2 (degrees).
297  *
298  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
299  * azi1 should be in the range [&minus;540&deg;, 540&deg;). The values of
300  * \e lon2 and \e azi2 returned are in the range [&minus;180&deg;,
301  * 180&deg;).
302  *
303  * If either point is at a pole, the azimuth is defined by keeping the
304  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
305  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
306  * 180&deg; signifies a geodesic which is not a shortest path. (For a
307  * prolate ellipsoid, an additional condition is necessary for a shortest
308  * path: the longitudinal extent must not exceed of 180&deg;.)
309  *
310  * The following functions are overloaded versions of Geodesic::Direct
311  * which omit some of the output parameters. Note, however, that the arc
312  * length is always computed and returned as the function value.
313  **********************************************************************/
314  double Direct(double lat1, double lon1, double azi1, double s12,
315  [System::Runtime::InteropServices::Out] double% lat2,
316  [System::Runtime::InteropServices::Out] double% lon2,
317  [System::Runtime::InteropServices::Out] double% azi2,
318  [System::Runtime::InteropServices::Out] double% m12,
319  [System::Runtime::InteropServices::Out] double% M12,
320  [System::Runtime::InteropServices::Out] double% M21,
321  [System::Runtime::InteropServices::Out] double% S12);
322 
323  /**
324  * See the documentation for Geodesic::Direct.
325  **********************************************************************/
326  double Direct(double lat1, double lon1, double azi1, double s12,
327  [System::Runtime::InteropServices::Out] double% lat2,
328  [System::Runtime::InteropServices::Out] double% lon2);
329 
330  /**
331  * See the documentation for Geodesic::Direct.
332  **********************************************************************/
333  double Direct(double lat1, double lon1, double azi1, double s12,
334  [System::Runtime::InteropServices::Out] double% lat2,
335  [System::Runtime::InteropServices::Out] double% lon2,
336  [System::Runtime::InteropServices::Out] double% azi2);
337 
338  /**
339  * See the documentation for Geodesic::Direct.
340  **********************************************************************/
341  double Direct(double lat1, double lon1, double azi1, double s12,
342  [System::Runtime::InteropServices::Out] double% lat2,
343  [System::Runtime::InteropServices::Out] double% lon2,
344  [System::Runtime::InteropServices::Out] double% azi2,
345  [System::Runtime::InteropServices::Out] double% m12);
346 
347  /**
348  * See the documentation for Geodesic::Direct.
349  **********************************************************************/
350  double Direct(double lat1, double lon1, double azi1, double s12,
351  [System::Runtime::InteropServices::Out] double% lat2,
352  [System::Runtime::InteropServices::Out] double% lon2,
353  [System::Runtime::InteropServices::Out] double% azi2,
354  [System::Runtime::InteropServices::Out] double% M12,
355  [System::Runtime::InteropServices::Out] double% M21);
356 
357  /**
358  * See the documentation for Geodesic::Direct.
359  **********************************************************************/
360  double Direct(double lat1, double lon1, double azi1, double s12,
361  [System::Runtime::InteropServices::Out] double% lat2,
362  [System::Runtime::InteropServices::Out] double% lon2,
363  [System::Runtime::InteropServices::Out] double% azi2,
364  [System::Runtime::InteropServices::Out] double% m12,
365  [System::Runtime::InteropServices::Out] double% M12,
366  [System::Runtime::InteropServices::Out] double% M21);
367  ///@}
368 
369  /** \name Direct geodesic problem specified in terms of arc length.
370  **********************************************************************/
371  ///@{
372  /**
373  * Solve the direct geodesic problem where the length of the geodesic
374  * is specified in terms of arc length.
375  *
376  * @param[in] lat1 latitude of point 1 (degrees).
377  * @param[in] lon1 longitude of point 1 (degrees).
378  * @param[in] azi1 azimuth at point 1 (degrees).
379  * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
380  * be negative.
381  * @param[out] lat2 latitude of point 2 (degrees).
382  * @param[out] lon2 longitude of point 2 (degrees).
383  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
384  * @param[out] s12 distance between point 1 and point 2 (meters).
385  * @param[out] m12 reduced length of geodesic (meters).
386  * @param[out] M12 geodesic scale of point 2 relative to point 1
387  * (dimensionless).
388  * @param[out] M21 geodesic scale of point 1 relative to point 2
389  * (dimensionless).
390  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
391  *
392  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
393  * azi1 should be in the range [&minus;540&deg;, 540&deg;). The values of
394  * \e lon2 and \e azi2 returned are in the range [&minus;180&deg;,
395  * 180&deg;).
396  *
397  * If either point is at a pole, the azimuth is defined by keeping the
398  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
399  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
400  * 180&deg; signifies a geodesic which is not a shortest path. (For a
401  * prolate ellipsoid, an additional condition is necessary for a shortest
402  * path: the longitudinal extent must not exceed of 180&deg;.)
403  *
404  * The following functions are overloaded versions of Geodesic::Direct
405  * which omit some of the output parameters.
406  **********************************************************************/
407  void ArcDirect(double lat1, double lon1, double azi1, double a12,
408  [System::Runtime::InteropServices::Out] double% lat2,
409  [System::Runtime::InteropServices::Out] double% lon2,
410  [System::Runtime::InteropServices::Out] double% azi2,
411  [System::Runtime::InteropServices::Out] double% s12,
412  [System::Runtime::InteropServices::Out] double% m12,
413  [System::Runtime::InteropServices::Out] double% M12,
414  [System::Runtime::InteropServices::Out] double% M21,
415  [System::Runtime::InteropServices::Out] double% S12);
416 
417  /**
418  * See the documentation for Geodesic::ArcDirect.
419  **********************************************************************/
420  void ArcDirect(double lat1, double lon1, double azi1, double a12,
421  [System::Runtime::InteropServices::Out] double% lat2,
422  [System::Runtime::InteropServices::Out] double% lon2);
423 
424  /**
425  * See the documentation for Geodesic::ArcDirect.
426  **********************************************************************/
427  void ArcDirect(double lat1, double lon1, double azi1, double a12,
428  [System::Runtime::InteropServices::Out] double% lat2,
429  [System::Runtime::InteropServices::Out] double% lon2,
430  [System::Runtime::InteropServices::Out] double% azi2);
431 
432  /**
433  * See the documentation for Geodesic::ArcDirect.
434  **********************************************************************/
435  void ArcDirect(double lat1, double lon1, double azi1, double a12,
436  [System::Runtime::InteropServices::Out] double% lat2,
437  [System::Runtime::InteropServices::Out] double% lon2,
438  [System::Runtime::InteropServices::Out] double% azi2,
439  [System::Runtime::InteropServices::Out] double% s12);
440 
441  /**
442  * See the documentation for Geodesic::ArcDirect.
443  **********************************************************************/
444  void ArcDirect(double lat1, double lon1, double azi1, double a12,
445  [System::Runtime::InteropServices::Out] double% lat2,
446  [System::Runtime::InteropServices::Out] double% lon2,
447  [System::Runtime::InteropServices::Out] double% azi2,
448  [System::Runtime::InteropServices::Out] double% s12,
449  [System::Runtime::InteropServices::Out] double% m12);
450 
451  /**
452  * See the documentation for Geodesic::ArcDirect.
453  **********************************************************************/
454  void ArcDirect(double lat1, double lon1, double azi1, double a12,
455  [System::Runtime::InteropServices::Out] double% lat2,
456  [System::Runtime::InteropServices::Out] double% lon2,
457  [System::Runtime::InteropServices::Out] double% azi2,
458  [System::Runtime::InteropServices::Out] double% s12,
459  [System::Runtime::InteropServices::Out] double% M12,
460  [System::Runtime::InteropServices::Out] double% M21);
461 
462  /**
463  * See the documentation for Geodesic::ArcDirect.
464  **********************************************************************/
465  void ArcDirect(double lat1, double lon1, double azi1, double a12,
466  [System::Runtime::InteropServices::Out] double% lat2,
467  [System::Runtime::InteropServices::Out] double% lon2,
468  [System::Runtime::InteropServices::Out] double% azi2,
469  [System::Runtime::InteropServices::Out] double% s12,
470  [System::Runtime::InteropServices::Out] double% m12,
471  [System::Runtime::InteropServices::Out] double% M12,
472  [System::Runtime::InteropServices::Out] double% M21);
473  ///@}
474 
475  /** \name General version of the direct geodesic solution.
476  **********************************************************************/
477  ///@{
478 
479  /**
480  * The general direct geodesic problem. Geodesic::Direct and
481  * Geodesic::ArcDirect are defined in terms of this function.
482  *
483  * @param[in] lat1 latitude of point 1 (degrees).
484  * @param[in] lon1 longitude of point 1 (degrees).
485  * @param[in] azi1 azimuth at point 1 (degrees).
486  * @param[in] arcmode boolean flag determining the meaning of the \e
487  * s12_a12.
488  * @param[in] s12_a12 if \e arcmode is false, this is the distance between
489  * point 1 and point 2 (meters); otherwise it is the arc length between
490  * point 1 and point 2 (degrees); it can be negative.
491  * @param[in] outmask a bitor'ed combination of Geodesic::mask values
492  * specifying which of the following parameters should be set.
493  * @param[out] lat2 latitude of point 2 (degrees).
494  * @param[out] lon2 longitude of point 2 (degrees).
495  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
496  * @param[out] s12 distance between point 1 and point 2 (meters).
497  * @param[out] m12 reduced length of geodesic (meters).
498  * @param[out] M12 geodesic scale of point 2 relative to point 1
499  * (dimensionless).
500  * @param[out] M21 geodesic scale of point 1 relative to point 2
501  * (dimensionless).
502  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
503  * @return \e a12 arc length of between point 1 and point 2 (degrees).
504  *
505  * The Geodesic::mask values possible for \e outmask are
506  * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2;
507  * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2;
508  * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
509  * - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
510  * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
511  * m12;
512  * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
513  * M12 and \e M21;
514  * - \e outmask |= Geodesic::AREA for the area \e S12;
515  * - \e outmask |= Geodesic::ALL for all of the above;
516  * - \e outmask |= Geodesic::LONG_NOWRAP stops the returned value of \e
517  * lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
518  * .
519  * The function value \e a12 is always computed and returned and this
520  * equals \e s12_a12 is \e arcmode is true. If \e outmask includes
521  * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12.
522  * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this
523  * is automatically included is \e arcmode is false.
524  *
525  * With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
526  * indicates how many times the geodesic wrapped around the ellipsoid.
527  * Because \e lon2 might be outside the normal allowed range for
528  * longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it with
529  * Math::AngNormalize2 before using it in other GeographicLib calls.
530  **********************************************************************/
531  double GenDirect(double lat1, double lon1, double azi1,
532  bool arcmode, double s12_a12,
533  Geodesic::mask outmask,
534  [System::Runtime::InteropServices::Out] double% lat2,
535  [System::Runtime::InteropServices::Out] double% lon2,
536  [System::Runtime::InteropServices::Out] double% azi2,
537  [System::Runtime::InteropServices::Out] double% s12,
538  [System::Runtime::InteropServices::Out] double% m12,
539  [System::Runtime::InteropServices::Out] double% M12,
540  [System::Runtime::InteropServices::Out] double% M21,
541  [System::Runtime::InteropServices::Out] double% S12);
542  ///@}
543 
544  /** \name Inverse geodesic problem.
545  **********************************************************************/
546  ///@{
547  /**
548  * Solve the inverse geodesic problem.
549  *
550  * @param[in] lat1 latitude of point 1 (degrees).
551  * @param[in] lon1 longitude of point 1 (degrees).
552  * @param[in] lat2 latitude of point 2 (degrees).
553  * @param[in] lon2 longitude of point 2 (degrees).
554  * @param[out] s12 distance between point 1 and point 2 (meters).
555  * @param[out] azi1 azimuth at point 1 (degrees).
556  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
557  * @param[out] m12 reduced length of geodesic (meters).
558  * @param[out] M12 geodesic scale of point 2 relative to point 1
559  * (dimensionless).
560  * @param[out] M21 geodesic scale of point 1 relative to point 2
561  * (dimensionless).
562  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
563  * @return \e a12 arc length of between point 1 and point 2 (degrees).
564  *
565  * \e lat1 and \e lat2 should be in the range [&minus;90&deg;, 90&deg;]; \e
566  * lon1 and \e lon2 should be in the range [&minus;540&deg;, 540&deg;).
567  * The values of \e azi1 and \e azi2 returned are in the range
568  * [&minus;180&deg;, 180&deg;).
569  *
570  * If either point is at a pole, the azimuth is defined by keeping the
571  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
572  * and taking the limit &epsilon; &rarr; 0+.
573  *
574  * The solution to the inverse problem is found using Newton's method. If
575  * this fails to converge (this is very unlikely in geodetic applications
576  * but does occur for very eccentric ellipsoids), then the bisection method
577  * is used to refine the solution.
578  *
579  * The following functions are overloaded versions of Geodesic::Inverse
580  * which omit some of the output parameters. Note, however, that the arc
581  * length is always computed and returned as the function value.
582  **********************************************************************/
583  double Inverse(double lat1, double lon1, double lat2, double lon2,
584  [System::Runtime::InteropServices::Out] double% s12,
585  [System::Runtime::InteropServices::Out] double% azi1,
586  [System::Runtime::InteropServices::Out] double% azi2,
587  [System::Runtime::InteropServices::Out] double% m12,
588  [System::Runtime::InteropServices::Out] double% M12,
589  [System::Runtime::InteropServices::Out] double% M21,
590  [System::Runtime::InteropServices::Out] double% S12);
591 
592  /**
593  * See the documentation for Geodesic::Inverse.
594  **********************************************************************/
595  double Inverse(double lat1, double lon1, double lat2, double lon2,
596  [System::Runtime::InteropServices::Out] double% s12);
597 
598  /**
599  * See the documentation for Geodesic::Inverse.
600  **********************************************************************/
601  double Inverse(double lat1, double lon1, double lat2, double lon2,
602  [System::Runtime::InteropServices::Out] double% azi1,
603  [System::Runtime::InteropServices::Out] double% azi2);
604 
605  /**
606  * See the documentation for Geodesic::Inverse.
607  **********************************************************************/
608  double Inverse(double lat1, double lon1, double lat2, double lon2,
609  [System::Runtime::InteropServices::Out] double% s12,
610  [System::Runtime::InteropServices::Out] double% azi1,
611  [System::Runtime::InteropServices::Out] double% azi2);
612 
613  /**
614  * See the documentation for Geodesic::Inverse.
615  **********************************************************************/
616  double Inverse(double lat1, double lon1, double lat2, double lon2,
617  [System::Runtime::InteropServices::Out] double% s12,
618  [System::Runtime::InteropServices::Out] double% azi1,
619  [System::Runtime::InteropServices::Out] double% azi2,
620  [System::Runtime::InteropServices::Out] double% m12);
621 
622  /**
623  * See the documentation for Geodesic::Inverse.
624  **********************************************************************/
625  double Inverse(double lat1, double lon1, double lat2, double lon2,
626  [System::Runtime::InteropServices::Out] double% s12,
627  [System::Runtime::InteropServices::Out] double% azi1,
628  [System::Runtime::InteropServices::Out] double% azi2,
629  [System::Runtime::InteropServices::Out] double% M12,
630  [System::Runtime::InteropServices::Out] double% M21);
631 
632  /**
633  * See the documentation for Geodesic::Inverse.
634  **********************************************************************/
635  double Inverse(double lat1, double lon1, double lat2, double lon2,
636  [System::Runtime::InteropServices::Out] double% s12,
637  [System::Runtime::InteropServices::Out] double% azi1,
638  [System::Runtime::InteropServices::Out] double% azi2,
639  [System::Runtime::InteropServices::Out] double% m12,
640  [System::Runtime::InteropServices::Out] double% M12,
641  [System::Runtime::InteropServices::Out] double% M21);
642  ///@}
643 
644  /** \name General version of inverse geodesic solution.
645  **********************************************************************/
646  ///@{
647  /**
648  * The general inverse geodesic calculation. Geodesic::Inverse is defined
649  * in terms of this function.
650  *
651  * @param[in] lat1 latitude of point 1 (degrees).
652  * @param[in] lon1 longitude of point 1 (degrees).
653  * @param[in] lat2 latitude of point 2 (degrees).
654  * @param[in] lon2 longitude of point 2 (degrees).
655  * @param[in] outmask a bitor'ed combination of Geodesic::mask values
656  * specifying which of the following parameters should be set.
657  * @param[out] s12 distance between point 1 and point 2 (meters).
658  * @param[out] azi1 azimuth at point 1 (degrees).
659  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
660  * @param[out] m12 reduced length of geodesic (meters).
661  * @param[out] M12 geodesic scale of point 2 relative to point 1
662  * (dimensionless).
663  * @param[out] M21 geodesic scale of point 1 relative to point 2
664  * (dimensionless).
665  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
666  * @return \e a12 arc length of between point 1 and point 2 (degrees).
667  *
668  * The Geodesic::mask values possible for \e outmask are
669  * - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
670  * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
671  * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
672  * m12;
673  * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
674  * M12 and \e M21;
675  * - \e outmask |= Geodesic::AREA for the area \e S12;
676  * - \e outmask |= Geodesic::ALL for all of the above.
677  * .
678  * The arc length is always computed and returned as the function value.
679  **********************************************************************/
680  double GenInverse(double lat1, double lon1, double lat2, double lon2,
681  Geodesic::mask outmask,
682  [System::Runtime::InteropServices::Out] double% s12,
683  [System::Runtime::InteropServices::Out] double% azi1,
684  [System::Runtime::InteropServices::Out] double% azi2,
685  [System::Runtime::InteropServices::Out] double% m12,
686  [System::Runtime::InteropServices::Out] double% M12,
687  [System::Runtime::InteropServices::Out] double% M21,
688  [System::Runtime::InteropServices::Out] double% S12);
689  ///@}
690 
691  /** \name Interface to GeodesicLine.
692  **********************************************************************/
693  ///@{
694 
695  /**
696  * Set up to compute several points on a single geodesic.
697  *
698  * @param[in] lat1 latitude of point 1 (degrees).
699  * @param[in] lon1 longitude of point 1 (degrees).
700  * @param[in] azi1 azimuth at point 1 (degrees).
701  * @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
702  * specifying the capabilities the GeodesicLine object should possess,
703  * i.e., which quantities can be returned in calls to
704  * GeodesicLine::Position.
705  * @return a GeodesicLine object.
706  *
707  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 and \e
708  * azi1 should be in the range [&minus;540&deg;, 540&deg;).
709  *
710  * The NETGeographicLib::Mask values are
711  * - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is
712  * added automatically;
713  * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
714  * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is
715  * added automatically;
716  * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
717  * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12;
718  * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12
719  * and \e M21;
720  * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
721  * - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
722  * geodesic to be given in terms of \e s12; without this capability the
723  * length can only be specified in terms of arc length;
724  * - \e caps |= NETGeographicLib::Mask::ALL for all of the above.
725  * .
726  *
727  * If the point is at a pole, the azimuth is defined by keeping \e lon1
728  * fixed, writing \e lat1 = &plusmn;(90 &minus; &epsilon;), and taking the
729  * limit &epsilon; &rarr; 0+.
730  **********************************************************************/
731  GeodesicLine^ Line(double lat1, double lon1, double azi1,
732  NETGeographicLib::Mask caps );
733 
734  ///@}
735 
736  /** \name Inspector functions.
737  **********************************************************************/
738  ///@{
739 
740  /**
741  * @return \e a the equatorial radius of the ellipsoid (meters). This is
742  * the value used in the constructor.
743  **********************************************************************/
744  property double MajorRadius { double get(); }
745 
746  /**
747  * @return \e f the flattening of the ellipsoid. This is the
748  * value used in the constructor.
749  **********************************************************************/
750  property double Flattening { double get(); }
751 
752  /**
753  * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
754  * polygon encircling a pole can be found by adding
755  * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
756  * polygon.
757  **********************************************************************/
758  property double EllipsoidArea { double get(); }
759 
760  /**
761  * %return The unmanaged pointer to the GeographicLib::Geodesic.
762  *
763  * This function is for internal use only.
764  **********************************************************************/
765  System::IntPtr^ GetUnmanaged();
766  ///@}
767  };
768 } // 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:273