NETGeographicLib  1.49
GeodesicExact.h
Go to the documentation of this file.
1 #pragma once
2 /**
3  * \file NETGeographicLib/GeodesicExact.h
4  * \brief Header for NETGeographicLib::GeodesicExact class
5  *
6  * NETGeographicLib is copyright (c) Scott Heiman (2013)
7  * GeographicLib is Copyright (c) Charles Karney (2010-2012)
8  * <charles@karney.com> and licensed under the MIT/X11 License.
9  * For more information, see
10  * https://geographiclib.sourceforge.io/
11  **********************************************************************/
12 #include "NETGeographicLib.h"
13 
14 namespace NETGeographicLib
15 {
16  ref class GeodesicLineExact;
17  /*!
18  \brief .NET wrapper for GeographicLib::GeodesicExact.
19 
20  This class allows .NET applications to access GeographicLib::GeodesicExact.
21  */
22  /**
23  * \brief .NET wrapper for GeographicLib::GeodesicExact.
24  *
25  * This class allows .NET applications to access GeographicLib::GeodesicExact.
26  *
27  * The equations for geodesics on an ellipsoid can be expressed in terms of
28  * incomplete elliptic integrals. The Geodesic class expands these integrals
29  * in a series in the flattening \e f and this provides an accurate solution
30  * for \e f &isin [-0.01, 0.01]. The GeodesicExact class computes the
31  * ellitpic integrals directly and so provides a solution which is valid for
32  * all \e f. However, in practice, its use should be limited to about \e
33  * b/\e a &isin; [0.01, 100] or \e f &isin; [-99, 0.99].
34  *
35  * For the WGS84 ellipsoid, these classes are 2--3 times \e slower than the
36  * series solution and 2--3 times \e less \e accurate (because it's less easy
37  * to control round-off errors with the elliptic integral formulation); i.e.,
38  * the error is about 40 nm (40 nanometers) instead of 15 nm. However the
39  * error in the series solution scales as <i>f</i><sup>7</sup> while the
40  * error in the elliptic integral solution depends weakly on \e f. If the
41  * quarter meridian distance is 10000 km and the ratio \e b/\e a = 1 &minus;
42  * \e f is varied then the approximate maximum error (expressed as a
43  * distance) is <pre>
44  * 1 - f error (nm)
45  * 1/128 387
46  * 1/64 345
47  * 1/32 269
48  * 1/16 210
49  * 1/8 115
50  * 1/4 69
51  * 1/2 36
52  * 1 15
53  * 2 25
54  * 4 96
55  * 8 318
56  * 16 985
57  * 32 2352
58  * 64 6008
59  * 128 19024
60  * </pre>
61  *
62  * The computation of the area in these classes is via a 30th order series.
63  * This gives accurate results for \e b/\e a &isin; [1/2, 2]; the accuracy is
64  * about 8 decimal digits for \e b/\e a &isin; [1/4, 4].
65  *
66  * See \ref geodellip for the formulation. See the documentation on the
67  * Geodesic class for additional information on the geodesics problems.
68  *
69  * C# Example:
70  * \include example-GeodesicExact.cs
71  * Managed C++ Example:
72  * \include example-GeodesicExact.cpp
73  * Visual Basic Example:
74  * \include example-GeodesicExact.vb
75  *
76  * <B>INTERFACE DIFFERENCES:</B><BR>
77  * A default constructor is provided that assumes WGS84 parameters.
78  *
79  * The MajorRadius, Flattening, and EllipsoidArea functions are
80  * implemented as properties.
81  *
82  * The GenDirect, GenInverse, and Line functions accept the
83  * "capabilities mask" as a NETGeographicLib::Mask rather than an
84  * unsigned.
85  **********************************************************************/
86  public ref class GeodesicExact
87  {
88  private:
89  enum class captype {
90  CAP_NONE = 0U,
91  CAP_E = 1U<<0,
92  // Skip 1U<<1 for compatibility with Geodesic (not required)
93  CAP_D = 1U<<2,
94  CAP_H = 1U<<3,
95  CAP_C4 = 1U<<4,
96  CAP_ALL = 0x1FU,
97  CAP_MASK = CAP_ALL,
98  OUT_ALL = 0x7F80U,
99  OUT_MASK = 0xFF80U, // Includes LONG_UNROLL
100  };
101  // pointer to the unmanaged GeographicLib::GeodesicExact.
102  const GeographicLib::GeodesicExact* m_pGeodesicExact;
103 
104  // the finalizer deletes the unmanaged memory.
105  !GeodesicExact();
106  public:
107  /**
108  * Bit masks for what calculations to do. These masks do double duty.
109  * They signify to the GeodesicLineExact::GeodesicLineExact constructor and
110  * to GeodesicExact::Line what capabilities should be included in the
111  * GeodesicLineExact object. They also specify which results to return in
112  * the general routines GeodesicExact::GenDirect and
113  * GeodesicExact::GenInverse routines. GeodesicLineExact::mask is a
114  * duplication of this enum.
115  **********************************************************************/
116  enum class mask {
117  /**
118  * No capabilities, no output.
119  * @hideinitializer
120  **********************************************************************/
121  NONE = 0U,
122  /**
123  * Calculate latitude \e lat2. (It's not necessary to include this as a
124  * capability to GeodesicLineExact because this is included by default.)
125  * @hideinitializer
126  **********************************************************************/
127  LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE),
128  /**
129  * Calculate longitude \e lon2.
130  * @hideinitializer
131  **********************************************************************/
132  LONGITUDE = 1U<<8 | unsigned(captype::CAP_H),
133  /**
134  * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
135  * include this as a capability to GeodesicLineExact because this is
136  * included by default.)
137  * @hideinitializer
138  **********************************************************************/
139  AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE),
140  /**
141  * Calculate distance \e s12.
142  * @hideinitializer
143  **********************************************************************/
144  DISTANCE = 1U<<10 | unsigned(captype::CAP_E),
145  /**
146  * Allow distance \e s12 to be used as input in the direct geodesic
147  * problem.
148  * @hideinitializer
149  **********************************************************************/
150  DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_E),
151  /**
152  * Calculate reduced length \e m12.
153  * @hideinitializer
154  **********************************************************************/
155  REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_D),
156  /**
157  * Calculate geodesic scales \e M12 and \e M21.
158  * @hideinitializer
159  **********************************************************************/
160  GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_D),
161  /**
162  * Calculate area \e S12.
163  * @hideinitializer
164  **********************************************************************/
165  AREA = 1U<<14 | unsigned(captype::CAP_C4),
166  /**
167  * Unroll \e lon2 in the direct calculation.
168  * @hideinitializer
169  **********************************************************************/
170  LONG_UNROLL = 1U<<15,
171  /**
172  * All capabilities, calculate everything. (LONG_UNROLL is not
173  * included in this mask.)
174  * @hideinitializer
175  **********************************************************************/
176  ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_ALL),
177  };
178 
179  /** \name Constructor
180  **********************************************************************/
181  ///@{
182  /**
183  * Constructor for a WGS84 ellipsoid
184  **********************************************************************/
185  GeodesicExact();
186 
187  /**
188  * Constructor for a ellipsoid with
189  *
190  * @param[in] a equatorial radius (meters).
191  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
192  * Negative \e f gives a prolate ellipsoid.
193  * @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
194  * positive.
195  **********************************************************************/
196  GeodesicExact(double a, double f);
197  ///@}
198 
199  /**
200  * The desstructor calls the finalizer.
201  **********************************************************************/
203  { this->!GeodesicExact(); }
204 
205  /** \name Direct geodesic problem specified in terms of distance.
206  **********************************************************************/
207  ///@{
208  /**
209  * Perform the direct geodesic calculation where the length of the geodesic
210  * is specified in terms of distance.
211  *
212  * @param[in] lat1 latitude of point 1 (degrees).
213  * @param[in] lon1 longitude of point 1 (degrees).
214  * @param[in] azi1 azimuth at point 1 (degrees).
215  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
216  * signed.
217  * @param[out] lat2 latitude of point 2 (degrees).
218  * @param[out] lon2 longitude of point 2 (degrees).
219  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
220  * @param[out] m12 reduced length of geodesic (meters).
221  * @param[out] M12 geodesic scale of point 2 relative to point 1
222  * (dimensionless).
223  * @param[out] M21 geodesic scale of point 1 relative to point 2
224  * (dimensionless).
225  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
226  * @return \e a12 arc length of between point 1 and point 2 (degrees).
227  *
228  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;];. The
229  * values of \e lon2 and \e azi2 returned are in the range
230  * [&minus;180&deg;, 180&deg;).
231  *
232  * If either point is at a pole, the azimuth is defined by keeping the
233  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
234  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
235  * 180&deg; signifies a geodesic which is not a shortest path. (For a
236  * prolate ellipsoid, an additional condition is necessary for a shortest
237  * path: the longitudinal extent must not exceed of 180&deg;.)
238  *
239  * The following functions are overloaded versions of GeodesicExact::Direct
240  * which omit some of the output parameters. Note, however, that the arc
241  * length is always computed and returned as the function value.
242  **********************************************************************/
243  double Direct(double lat1, double lon1, double azi1, double s12,
244  [System::Runtime::InteropServices::Out] double% lat2,
245  [System::Runtime::InteropServices::Out] double% lon2,
246  [System::Runtime::InteropServices::Out] double% azi2,
247  [System::Runtime::InteropServices::Out] double% m12,
248  [System::Runtime::InteropServices::Out] double% M12,
249  [System::Runtime::InteropServices::Out] double% M21,
250  [System::Runtime::InteropServices::Out] double% S12);
251 
252  /**
253  * See the documentation for GeodesicExact::Direct.
254  **********************************************************************/
255  double Direct(double lat1, double lon1, double azi1, double s12,
256  [System::Runtime::InteropServices::Out] double% lat2,
257  [System::Runtime::InteropServices::Out] double% lon2);
258 
259  /**
260  * See the documentation for GeodesicExact::Direct.
261  **********************************************************************/
262  double Direct(double lat1, double lon1, double azi1, double s12,
263  [System::Runtime::InteropServices::Out] double% lat2,
264  [System::Runtime::InteropServices::Out] double% lon2,
265  [System::Runtime::InteropServices::Out] double% azi2);
266 
267  /**
268  * See the documentation for GeodesicExact::Direct.
269  **********************************************************************/
270  double Direct(double lat1, double lon1, double azi1, double s12,
271  [System::Runtime::InteropServices::Out] double% lat2,
272  [System::Runtime::InteropServices::Out] double% lon2,
273  [System::Runtime::InteropServices::Out] double% azi2,
274  [System::Runtime::InteropServices::Out] double% m12);
275 
276  /**
277  * See the documentation for GeodesicExact::Direct.
278  **********************************************************************/
279  double Direct(double lat1, double lon1, double azi1, double s12,
280  [System::Runtime::InteropServices::Out] double% lat2,
281  [System::Runtime::InteropServices::Out] double% lon2,
282  [System::Runtime::InteropServices::Out] double% azi2,
283  [System::Runtime::InteropServices::Out] double% M12,
284  [System::Runtime::InteropServices::Out] double% M21);
285 
286  /**
287  * See the documentation for GeodesicExact::Direct.
288  **********************************************************************/
289  double Direct(double lat1, double lon1, double azi1, double s12,
290  [System::Runtime::InteropServices::Out] double% lat2,
291  [System::Runtime::InteropServices::Out] double% lon2,
292  [System::Runtime::InteropServices::Out] double% azi2,
293  [System::Runtime::InteropServices::Out] double% m12,
294  [System::Runtime::InteropServices::Out] double% M12,
295  [System::Runtime::InteropServices::Out] double% M21);
296  ///@}
297 
298  /** \name Direct geodesic problem specified in terms of arc length.
299  **********************************************************************/
300  ///@{
301  /**
302  * Perform the direct geodesic calculation where the length of the geodesic
303  * is specified in terms of arc length.
304  *
305  * @param[in] lat1 latitude of point 1 (degrees).
306  * @param[in] lon1 longitude of point 1 (degrees).
307  * @param[in] azi1 azimuth at point 1 (degrees).
308  * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
309  * be signed.
310  * @param[out] lat2 latitude of point 2 (degrees).
311  * @param[out] lon2 longitude of point 2 (degrees).
312  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
313  * @param[out] s12 distance between point 1 and point 2 (meters).
314  * @param[out] m12 reduced length of geodesic (meters).
315  * @param[out] M12 geodesic scale of point 2 relative to point 1
316  * (dimensionless).
317  * @param[out] M21 geodesic scale of point 1 relative to point 2
318  * (dimensionless).
319  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
320  *
321  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]. The
322  * values of \e lon2 and \e azi2 returned are in the range
323  * [&minus;180&deg;, 180&deg;).
324  *
325  * If either point is at a pole, the azimuth is defined by keeping the
326  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
327  * and taking the limit &epsilon; &rarr; 0+. An arc length greater that
328  * 180&deg; signifies a geodesic which is not a shortest path. (For a
329  * prolate ellipsoid, an additional condition is necessary for a shortest
330  * path: the longitudinal extent must not exceed of 180&deg;.)
331  *
332  * The following functions are overloaded versions of GeodesicExact::Direct
333  * which omit some of the output parameters.
334  **********************************************************************/
335  void ArcDirect(double lat1, double lon1, double azi1, double a12,
336  [System::Runtime::InteropServices::Out] double% lat2,
337  [System::Runtime::InteropServices::Out] double% lon2,
338  [System::Runtime::InteropServices::Out] double% azi2,
339  [System::Runtime::InteropServices::Out] double% s12,
340  [System::Runtime::InteropServices::Out] double% m12,
341  [System::Runtime::InteropServices::Out] double% M12,
342  [System::Runtime::InteropServices::Out] double% M21,
343  [System::Runtime::InteropServices::Out] double% S12);
344 
345  /**
346  * See the documentation for GeodesicExact::ArcDirect.
347  **********************************************************************/
348  void ArcDirect(double lat1, double lon1, double azi1, double a12,
349  [System::Runtime::InteropServices::Out] double% lat2,
350  [System::Runtime::InteropServices::Out] double% lon2);
351 
352  /**
353  * See the documentation for GeodesicExact::ArcDirect.
354  **********************************************************************/
355  void ArcDirect(double lat1, double lon1, double azi1, double a12,
356  [System::Runtime::InteropServices::Out] double% lat2,
357  [System::Runtime::InteropServices::Out] double% lon2,
358  [System::Runtime::InteropServices::Out] double% azi2);
359 
360  /**
361  * See the documentation for GeodesicExact::ArcDirect.
362  **********************************************************************/
363  void ArcDirect(double lat1, double lon1, double azi1, double a12,
364  [System::Runtime::InteropServices::Out] double% lat2,
365  [System::Runtime::InteropServices::Out] double% lon2,
366  [System::Runtime::InteropServices::Out] double% azi2,
367  [System::Runtime::InteropServices::Out] double% s12);
368 
369  /**
370  * See the documentation for GeodesicExact::ArcDirect.
371  **********************************************************************/
372  void ArcDirect(double lat1, double lon1, double azi1, double a12,
373  [System::Runtime::InteropServices::Out] double% lat2,
374  [System::Runtime::InteropServices::Out] double% lon2,
375  [System::Runtime::InteropServices::Out] double% azi2,
376  [System::Runtime::InteropServices::Out] double% s12,
377  [System::Runtime::InteropServices::Out] double% m12);
378 
379  /**
380  * See the documentation for GeodesicExact::ArcDirect.
381  **********************************************************************/
382  void ArcDirect(double lat1, double lon1, double azi1, double a12,
383  [System::Runtime::InteropServices::Out] double% lat2,
384  [System::Runtime::InteropServices::Out] double% lon2,
385  [System::Runtime::InteropServices::Out] double% azi2,
386  [System::Runtime::InteropServices::Out] double% s12,
387  [System::Runtime::InteropServices::Out] double% M12,
388  [System::Runtime::InteropServices::Out] double% M21);
389 
390  /**
391  * See the documentation for GeodesicExact::ArcDirect.
392  **********************************************************************/
393  void ArcDirect(double lat1, double lon1, double azi1, double a12,
394  [System::Runtime::InteropServices::Out] double% lat2,
395  [System::Runtime::InteropServices::Out] double% lon2,
396  [System::Runtime::InteropServices::Out] double% azi2,
397  [System::Runtime::InteropServices::Out] double% s12,
398  [System::Runtime::InteropServices::Out] double% m12,
399  [System::Runtime::InteropServices::Out] double% M12,
400  [System::Runtime::InteropServices::Out] double% M21);
401  ///@}
402 
403  /** \name General version of the direct geodesic solution.
404  **********************************************************************/
405  ///@{
406 
407  /**
408  * The general direct geodesic calculation. GeodesicExact::Direct and
409  * GeodesicExact::ArcDirect are defined in terms of this function.
410  *
411  * @param[in] lat1 latitude of point 1 (degrees).
412  * @param[in] lon1 longitude of point 1 (degrees).
413  * @param[in] azi1 azimuth at point 1 (degrees).
414  * @param[in] arcmode boolean flag determining the meaning of the second
415  * parameter.
416  * @param[in] s12_a12 if \e arcmode is false, this is the distance between
417  * point 1 and point 2 (meters); otherwise it is the arc length between
418  * point 1 and point 2 (degrees); it can be signed.
419  * @param[in] outmask a bitor'ed combination of GeodesicExact::mask values
420  * specifying which of the following parameters should be set.
421  * @param[out] lat2 latitude of point 2 (degrees).
422  * @param[out] lon2 longitude of point 2 (degrees).
423  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
424  * @param[out] s12 distance between point 1 and point 2 (meters).
425  * @param[out] m12 reduced length of geodesic (meters).
426  * @param[out] M12 geodesic scale of point 2 relative to point 1
427  * (dimensionless).
428  * @param[out] M21 geodesic scale of point 1 relative to point 2
429  * (dimensionless).
430  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
431  * @return \e a12 arc length of between point 1 and point 2 (degrees).
432  *
433  * The GeodesicExact::mask values possible for \e outmask are
434  * - \e outmask |= GeodesicExact::LATITUDE for the latitude \e lat2;
435  * - \e outmask |= GeodesicExact::LONGITUDE for the latitude \e lon2;
436  * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2;
437  * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12;
438  * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e
439  * m12;
440  * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e
441  * M12 and \e M21;
442  * - \e outmask |= GeodesicExact::AREA for the area \e S12;
443  * - \e outmask |= GeodesicExact::ALL for all of the above;
444  * - \e outmask |= GeodesicExact::LONG_UNROLL to unroll \e lon2 instead of
445  * wrapping it into the range [&minus;180&deg;, 180&deg;).
446  * .
447  * The function value \e a12 is always computed and returned and this
448  * equals \e s12_a12 is \e arcmode is true. If \e outmask includes
449  * GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e
450  * s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in
451  * \e outmask; this is automatically included is \e arcmode is false.
452  *
453  * With the LONG_UNROLL bit set, the quantity \e lon2 &minus; \e lon1
454  * indicates how many times and in what sense the geodesic encircles
455  * the ellipsoid.
456  **********************************************************************/
457  double GenDirect(double lat1, double lon1, double azi1,
458  bool arcmode, double s12_a12, GeodesicExact::mask outmask,
459  [System::Runtime::InteropServices::Out] double% lat2,
460  [System::Runtime::InteropServices::Out] double% lon2,
461  [System::Runtime::InteropServices::Out] double% azi2,
462  [System::Runtime::InteropServices::Out] double% s12,
463  [System::Runtime::InteropServices::Out] double% m12,
464  [System::Runtime::InteropServices::Out] double% M12,
465  [System::Runtime::InteropServices::Out] double% M21,
466  [System::Runtime::InteropServices::Out] double% S12);
467  ///@}
468 
469  /** \name Inverse geodesic problem.
470  **********************************************************************/
471  ///@{
472  /**
473  * Perform the inverse geodesic calculation.
474  *
475  * @param[in] lat1 latitude of point 1 (degrees).
476  * @param[in] lon1 longitude of point 1 (degrees).
477  * @param[in] lat2 latitude of point 2 (degrees).
478  * @param[in] lon2 longitude of point 2 (degrees).
479  * @param[out] s12 distance between point 1 and point 2 (meters).
480  * @param[out] azi1 azimuth at point 1 (degrees).
481  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
482  * @param[out] m12 reduced length of geodesic (meters).
483  * @param[out] M12 geodesic scale of point 2 relative to point 1
484  * (dimensionless).
485  * @param[out] M21 geodesic scale of point 1 relative to point 2
486  * (dimensionless).
487  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
488  * @return \e a12 arc length of between point 1 and point 2 (degrees).
489  *
490  * \e lat1 and \e lat2 should be in the range [&minus;90&deg;,
491  * 90&deg;]. The values of \e azi1 and \e azi2 returned are in the
492  * range [&minus;180&deg;, 180&deg;).
493  *
494  * If either point is at a pole, the azimuth is defined by keeping the
495  * longitude fixed, writing \e lat = &plusmn;(90&deg; &minus; &epsilon;),
496  * and taking the limit &epsilon; &rarr; 0+.
497  *
498  * The following functions are overloaded versions of GeodesicExact::Inverse
499  * which omit some of the output parameters. Note, however, that the arc
500  * length is always computed and returned as the function value.
501  **********************************************************************/
502  double Inverse(double lat1, double lon1, double lat2, double lon2,
503  [System::Runtime::InteropServices::Out] double% s12,
504  [System::Runtime::InteropServices::Out] double% azi1,
505  [System::Runtime::InteropServices::Out] double% azi2,
506  [System::Runtime::InteropServices::Out] double% m12,
507  [System::Runtime::InteropServices::Out] double% M12,
508  [System::Runtime::InteropServices::Out] double% M21,
509  [System::Runtime::InteropServices::Out] double% S12);
510 
511  /**
512  * See the documentation for GeodesicExact::Inverse.
513  **********************************************************************/
514  double Inverse(double lat1, double lon1, double lat2, double lon2,
515  [System::Runtime::InteropServices::Out] double% s12);
516 
517  /**
518  * See the documentation for GeodesicExact::Inverse.
519  **********************************************************************/
520  double Inverse(double lat1, double lon1, double lat2, double lon2,
521  [System::Runtime::InteropServices::Out] double% azi1,
522  [System::Runtime::InteropServices::Out] double% azi2);
523 
524  /**
525  * See the documentation for GeodesicExact::Inverse.
526  **********************************************************************/
527  double Inverse(double lat1, double lon1, double lat2, double lon2,
528  [System::Runtime::InteropServices::Out] double% s12,
529  [System::Runtime::InteropServices::Out] double% azi1,
530  [System::Runtime::InteropServices::Out] double% azi2);
531 
532  /**
533  * See the documentation for GeodesicExact::Inverse.
534  **********************************************************************/
535  double Inverse(double lat1, double lon1, double lat2, double lon2,
536  [System::Runtime::InteropServices::Out] double% s12,
537  [System::Runtime::InteropServices::Out] double% azi1,
538  [System::Runtime::InteropServices::Out] double% azi2,
539  [System::Runtime::InteropServices::Out] double% m12);
540 
541  /**
542  * See the documentation for GeodesicExact::Inverse.
543  **********************************************************************/
544  double Inverse(double lat1, double lon1, double lat2, double lon2,
545  [System::Runtime::InteropServices::Out] double% s12,
546  [System::Runtime::InteropServices::Out] double% azi1,
547  [System::Runtime::InteropServices::Out] double% azi2,
548  [System::Runtime::InteropServices::Out] double% M12,
549  [System::Runtime::InteropServices::Out] double% M21);
550 
551  /**
552  * See the documentation for GeodesicExact::Inverse.
553  **********************************************************************/
554  double Inverse(double lat1, double lon1, double lat2, double lon2,
555  [System::Runtime::InteropServices::Out] double% s12,
556  [System::Runtime::InteropServices::Out] double% azi1,
557  [System::Runtime::InteropServices::Out] double% azi2,
558  [System::Runtime::InteropServices::Out] double% m12,
559  [System::Runtime::InteropServices::Out] double% M12,
560  [System::Runtime::InteropServices::Out] double% M21);
561  ///@}
562 
563  /** \name General version of inverse geodesic solution.
564  **********************************************************************/
565  ///@{
566  /**
567  * The general inverse geodesic calculation. GeodesicExact::Inverse is
568  * defined in terms of this function.
569  *
570  * @param[in] lat1 latitude of point 1 (degrees).
571  * @param[in] lon1 longitude of point 1 (degrees).
572  * @param[in] lat2 latitude of point 2 (degrees).
573  * @param[in] lon2 longitude of point 2 (degrees).
574  * @param[in] outmask a bitor'ed combination of GeodesicExact::mask values
575  * specifying which of the following parameters should be set.
576  * @param[out] s12 distance between point 1 and point 2 (meters).
577  * @param[out] azi1 azimuth at point 1 (degrees).
578  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
579  * @param[out] m12 reduced length of geodesic (meters).
580  * @param[out] M12 geodesic scale of point 2 relative to point 1
581  * (dimensionless).
582  * @param[out] M21 geodesic scale of point 1 relative to point 2
583  * (dimensionless).
584  * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
585  * @return \e a12 arc length of between point 1 and point 2 (degrees).
586  *
587  * The GeodesicExact::mask values possible for \e outmask are
588  * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12;
589  * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2;
590  * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e
591  * m12;
592  * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e
593  * M12 and \e M21;
594  * - \e outmask |= GeodesicExact::AREA for the area \e S12;
595  * - \e outmask |= GeodesicExact::ALL for all of the above.
596  * .
597  * The arc length is always computed and returned as the function value.
598  **********************************************************************/
599  double GenInverse(double lat1, double lon1, double lat2, double lon2,
600  GeodesicExact::mask outmask,
601  [System::Runtime::InteropServices::Out] double% s12,
602  [System::Runtime::InteropServices::Out] double% azi1,
603  [System::Runtime::InteropServices::Out] double% azi2,
604  [System::Runtime::InteropServices::Out] double% m12,
605  [System::Runtime::InteropServices::Out] double% M12,
606  [System::Runtime::InteropServices::Out] double% M21,
607  [System::Runtime::InteropServices::Out] double% S12);
608  ///@}
609 
610  /** \name Interface to GeodesicLineExact.
611  **********************************************************************/
612  ///@{
613 
614  /**
615  * Set up to compute several points on a single geodesic.
616  *
617  * @param[in] lat1 latitude of point 1 (degrees).
618  * @param[in] lon1 longitude of point 1 (degrees).
619  * @param[in] azi1 azimuth at point 1 (degrees).
620  * @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
621  * specifying the capabilities the GeodesicLineExact object should
622  * possess, i.e., which quantities can be returned in calls to
623  * GeodesicLineExact::Position.
624  * @return a GeodesicLineExact object.
625  *
626  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
627  *
628  * The GeodesicExact::mask values are
629  * - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is
630  * added automatically;
631  * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
632  * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is
633  * added automatically;
634  * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
635  * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12;
636  * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12
637  * and \e M21;
638  * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
639  * - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
640  * geodesic to be given in terms of \e s12; without this capability the
641  * length can only be specified in terms of arc length;
642  * - \e caps |= GeodesicExact::ALL for all of the above.
643  * .
644  * The default value of \e caps is GeodesicExact::ALL which turns on all
645  * the capabilities.
646  *
647  * If the point is at a pole, the azimuth is defined by keeping \e lon1
648  * fixed, writing \e lat1 = &plusmn;(90 &minus; &epsilon;), and taking the
649  * limit &epsilon; &rarr; 0+.
650  **********************************************************************/
651  GeodesicLineExact^ Line(double lat1, double lon1, double azi1,
652  NETGeographicLib::Mask caps );
653 
654  /**
655  * Define a GeodesicLineExact in terms of the inverse geodesic problem.
656  *
657  * @param[in] lat1 latitude of point 1 (degrees).
658  * @param[in] lon1 longitude of point 1 (degrees).
659  * @param[in] lat2 latitude of point 2 (degrees).
660  * @param[in] lon2 longitude of point 2 (degrees).
661  * @param[in] caps bitor'ed combination of GeodesicExact::mask values
662  * specifying the capabilities the GeodesicLineExact object should
663  * possess, i.e., which quantities can be returned in calls to
664  * GeodesicLineExact::Position.
665  * @return a GeodesicLineExact object.
666  *
667  * This function sets point 3 of the GeodesicLineExact to correspond to
668  * point 2 of the inverse geodesic problem.
669  *
670  * \e lat1 and \e lat2 should be in the range [&minus;90&deg;, 90&deg;].
671  **********************************************************************/
672  GeodesicLineExact^ InverseLine(double lat1, double lon1, double lat2,
673  double lon2, NETGeographicLib::Mask caps );
674 
675  /**
676  * Define a GeodesicLineExact in terms of the direct geodesic problem
677  * specified in terms of distance.
678  *
679  * @param[in] lat1 latitude of point 1 (degrees).
680  * @param[in] lon1 longitude of point 1 (degrees).
681  * @param[in] azi1 azimuth at point 1 (degrees).
682  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
683  * negative.
684  * @param[in] caps bitor'ed combination of GeodesicExact::mask values
685  * specifying the capabilities the GeodesicLineExact object should
686  * possess, i.e., which quantities can be returned in calls to
687  * GeodesicLineExact::Position.
688  * @return a GeodesicLineExact object.
689  *
690  * This function sets point 3 of the GeodesicLineExact to correspond to
691  * point 2 of the direct geodesic problem.
692  *
693  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
694  **********************************************************************/
695  GeodesicLineExact^ DirectLine(double lat1, double lon1, double azi1,
696  double s12, NETGeographicLib::Mask caps);
697 
698  /**
699  * Define a GeodesicLineExact in terms of the direct geodesic problem
700  * specified in terms of arc length.
701  *
702  * @param[in] lat1 latitude of point 1 (degrees).
703  * @param[in] lon1 longitude of point 1 (degrees).
704  * @param[in] azi1 azimuth at point 1 (degrees).
705  * @param[in] a12 arc length between point 1 and point 2 (degrees); it can
706  * be negative.
707  * @param[in] caps bitor'ed combination of GeodesicExact::mask values
708  * specifying the capabilities the GeodesicLineExact object should
709  * possess, i.e., which quantities can be returned in calls to
710  * GeodesicLineExact::Position.
711  * @return a GeodesicLineExact object.
712  *
713  * This function sets point 3 of the GeodesicLineExact to correspond to
714  * point 2 of the direct geodesic problem.
715  *
716  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
717  **********************************************************************/
718  GeodesicLineExact^ ArcDirectLine(double lat1, double lon1, double azi1,
719  double a12, NETGeographicLib::Mask caps);
720 
721  /**
722  * Define a GeodesicLineExact in terms of the direct geodesic problem
723  * specified in terms of either distance or arc length.
724  *
725  * @param[in] lat1 latitude of point 1 (degrees).
726  * @param[in] lon1 longitude of point 1 (degrees).
727  * @param[in] azi1 azimuth at point 1 (degrees).
728  * @param[in] arcmode boolean flag determining the meaning of the \e
729  * s12_a12.
730  * @param[in] s12_a12 if \e arcmode is false, this is the distance between
731  * point 1 and point 2 (meters); otherwise it is the arc length between
732  * point 1 and point 2 (degrees); it can be negative.
733  * @param[in] caps bitor'ed combination of GeodesicExact::mask values
734  * specifying the capabilities the GeodesicLineExact object should
735  * possess, i.e., which quantities can be returned in calls to
736  * GeodesicLineExact::Position.
737  * @return a GeodesicLineExact object.
738  *
739  * This function sets point 3 of the GeodesicLineExact to correspond to
740  * point 2 of the direct geodesic problem.
741  *
742  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
743  **********************************************************************/
744  GeodesicLineExact^ GenDirectLine(double lat1, double lon1, double azi1,
745  bool arcmode, double s12_a12, NETGeographicLib::Mask caps);
746  ///@}
747 
748  /** \name Inspector functions.
749  **********************************************************************/
750  ///@{
751 
752  /**
753  * @return \e a the equatorial radius of the ellipsoid (meters). This is
754  * the value used in the constructor.
755  **********************************************************************/
756  property double MajorRadius { double get(); }
757 
758  /**
759  * @return \e f the flattening of the ellipsoid. This is the
760  * value used in the constructor.
761  **********************************************************************/
762  property double Flattening { double get(); }
763 
764  /**
765  * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
766  * polygon encircling a pole can be found by adding
767  * GeodesicExact::EllipsoidArea()/2 to the sum of \e S12 for each side of
768  * the polygon.
769  **********************************************************************/
770  property double EllipsoidArea { double get(); }
771  ///@}
772 
773  /**
774  * @return A pointer to the unmanaged GeographicLib::GeodesicExact.
775  *
776  * This function is for internal use only.
777  **********************************************************************/
778  System::IntPtr^ GetUnmanaged();
779  };
780 } // namespace NETGeographicLib
System::IntPtr ^ GetUnmanaged()
GeodesicLineExact ^ ArcDirectLine(double lat1, double lon1, double azi1, double a12, NETGeographicLib::Mask caps)
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)
GeodesicLineExact ^ Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps)
Header for NETGeographicLib::NETGeographicLib objects.
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)
GeodesicLineExact ^ GenDirectLine(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, NETGeographicLib::Mask caps)
GeodesicLineExact ^ DirectLine(double lat1, double lon1, double azi1, double s12, NETGeographicLib::Mask caps)
GeodesicLineExact ^ InverseLine(double lat1, double lon1, double lat2, double lon2, NETGeographicLib::Mask caps)
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::GeodesicLineExact.
.NET wrapper for GeographicLib::GeodesicExact.
Definition: GeodesicExact.h:86
double GenInverse(double lat1, double lon1, double lat2, double lon2, GeodesicExact::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)
double GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, GeodesicExact::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)