00001 /** 00002 * \file GeodesicLine.hpp 00003 * \brief Header for GeographicLib::GeodesicLine class 00004 * 00005 * Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licensed 00006 * under the MIT/X11 License. For more information, see 00007 * http://geographiclib.sourceforge.net/ 00008 **********************************************************************/ 00009 00010 #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) 00011 #define GEOGRAPHICLIB_GEODESICLINE_HPP 1 00012 00013 #include <GeographicLib/Constants.hpp> 00014 #include <GeographicLib/Geodesic.hpp> 00015 00016 namespace GeographicLib { 00017 00018 /** 00019 * \brief A geodesic line 00020 * 00021 * GeodesicLine facilitates the determination of a series of points on a 00022 * single geodesic. The starting point (\e lat1, \e lon1) and the azimuth \e 00023 * azi1 are specified in the constructor. GeodesicLine.Position returns the 00024 * location of point 2 a distance \e s12 along the geodesic. Alternatively 00025 * GeodesicLine.ArcPosition gives the position of point 2 an arc length \e 00026 * a12 along the geodesic. 00027 * 00028 * The default copy constructor and assignment operators work with this 00029 * class. Similarly, a vector can be used to hold GeodesicLine objects. 00030 * 00031 * The calculations are accurate to better than 15 nm (15 nanometers). See 00032 * Sec. 9 of 00033 * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for 00034 * details. The algorithms used by this class are based on series expansions 00035 * using the flattening \e f as a small parameter. These are only accurate 00036 * for |<i>f</i>| < 0.02; however reasonably accurate results will be 00037 * obtained for |<i>f</i>| < 0.2. For very eccentric ellipsoids, use 00038 * GeodesicLineExact instead. 00039 * 00040 * The algorithms are described in 00041 * - C. F. F. Karney, 00042 * <a href="http://dx.doi.org/10.1007/s00190-012-0578-z"> 00043 * Algorithms for geodesics</a>, 00044 * J. Geodesy <b>87</b>, 43--55 (2013); 00045 * DOI: <a href="http://dx.doi.org/10.1007/s00190-012-0578-z"> 00046 * 10.1007/s00190-012-0578-z</a>; 00047 * addenda: <a href="http://geographiclib.sf.net/geod-addenda.html"> 00048 * geod-addenda.html</a>. 00049 * . 00050 * For more information on geodesics see \ref geodesic. 00051 * 00052 * Example of use: 00053 * \include example-GeodesicLine.cpp 00054 * 00055 * <a href="GeodSolve.1.html">GeodSolve</a> is a command-line utility 00056 * providing access to the functionality of Geodesic and GeodesicLine. 00057 **********************************************************************/ 00058 00059 class GEOGRAPHICLIB_EXPORT GeodesicLine { 00060 private: 00061 typedef Math::real real; 00062 friend class Geodesic; 00063 static const int nC1_ = Geodesic::nC1_; 00064 static const int nC1p_ = Geodesic::nC1p_; 00065 static const int nC2_ = Geodesic::nC2_; 00066 static const int nC3_ = Geodesic::nC3_; 00067 static const int nC4_ = Geodesic::nC4_; 00068 00069 real tiny_; 00070 real _lat1, _lon1, _azi1; 00071 real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, 00072 _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1, 00073 _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; 00074 // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused 00075 real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_], 00076 _C4a[nC4_]; // all the elements of _C4a are used 00077 unsigned _caps; 00078 00079 enum captype { 00080 CAP_NONE = Geodesic::CAP_NONE, 00081 CAP_C1 = Geodesic::CAP_C1, 00082 CAP_C1p = Geodesic::CAP_C1p, 00083 CAP_C2 = Geodesic::CAP_C2, 00084 CAP_C3 = Geodesic::CAP_C3, 00085 CAP_C4 = Geodesic::CAP_C4, 00086 CAP_ALL = Geodesic::CAP_ALL, 00087 OUT_ALL = Geodesic::OUT_ALL, 00088 }; 00089 public: 00090 00091 /** 00092 * Bit masks for what calculations to do. They signify to the 00093 * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what 00094 * capabilities should be included in the GeodesicLine object. This is 00095 * merely a duplication of Geodesic::mask. 00096 **********************************************************************/ 00097 enum mask { 00098 /** 00099 * No capabilities, no output. 00100 * @hideinitializer 00101 **********************************************************************/ 00102 NONE = Geodesic::NONE, 00103 /** 00104 * Calculate latitude \e lat2. (It's not necessary to include this as a 00105 * capability to GeodesicLine because this is included by default.) 00106 * @hideinitializer 00107 **********************************************************************/ 00108 LATITUDE = Geodesic::LATITUDE, 00109 /** 00110 * Calculate longitude \e lon2. 00111 * @hideinitializer 00112 **********************************************************************/ 00113 LONGITUDE = Geodesic::LONGITUDE, 00114 /** 00115 * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to 00116 * include this as a capability to GeodesicLine because this is included 00117 * by default.) 00118 * @hideinitializer 00119 **********************************************************************/ 00120 AZIMUTH = Geodesic::AZIMUTH, 00121 /** 00122 * Calculate distance \e s12. 00123 * @hideinitializer 00124 **********************************************************************/ 00125 DISTANCE = Geodesic::DISTANCE, 00126 /** 00127 * Allow distance \e s12 to be used as input in the direct geodesic 00128 * problem. 00129 * @hideinitializer 00130 **********************************************************************/ 00131 DISTANCE_IN = Geodesic::DISTANCE_IN, 00132 /** 00133 * Calculate reduced length \e m12. 00134 * @hideinitializer 00135 **********************************************************************/ 00136 REDUCEDLENGTH = Geodesic::REDUCEDLENGTH, 00137 /** 00138 * Calculate geodesic scales \e M12 and \e M21. 00139 * @hideinitializer 00140 **********************************************************************/ 00141 GEODESICSCALE = Geodesic::GEODESICSCALE, 00142 /** 00143 * Calculate area \e S12. 00144 * @hideinitializer 00145 **********************************************************************/ 00146 AREA = Geodesic::AREA, 00147 /** 00148 * All capabilities, calculate everything. 00149 * @hideinitializer 00150 **********************************************************************/ 00151 ALL = Geodesic::ALL, 00152 }; 00153 00154 /** \name Constructors 00155 **********************************************************************/ 00156 ///@{ 00157 00158 /** 00159 * Constructor for a geodesic line staring at latitude \e lat1, longitude 00160 * \e lon1, and azimuth \e azi1 (all in degrees). 00161 * 00162 * @param[in] g A Geodesic object used to compute the necessary information 00163 * about the GeodesicLine. 00164 * @param[in] lat1 latitude of point 1 (degrees). 00165 * @param[in] lon1 longitude of point 1 (degrees). 00166 * @param[in] azi1 azimuth at point 1 (degrees). 00167 * @param[in] caps bitor'ed combination of GeodesicLine::mask values 00168 * specifying the capabilities the GeodesicLine object should possess, 00169 * i.e., which quantities can be returned in calls to 00170 * GeodesicLine::Position. 00171 * 00172 * \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e 00173 * azi1 should be in the range [−540°, 540°). 00174 * 00175 * The GeodesicLine::mask values are 00176 * - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this is 00177 * added automatically; 00178 * - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2; 00179 * - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is 00180 * added automatically; 00181 * - \e caps |= GeodesicLine::DISTANCE for the distance \e s12; 00182 * - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m12; 00183 * - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12 00184 * and \e M21; 00185 * - \e caps |= GeodesicLine::AREA for the area \e S12; 00186 * - \e caps |= GeodesicLine::DISTANCE_IN permits the length of the 00187 * geodesic to be given in terms of \e s12; without this capability the 00188 * length can only be specified in terms of arc length; 00189 * - \e caps |= GeodesicLine::ALL for all of the above. 00190 * . 00191 * The default value of \e caps is GeodesicLine::ALL. 00192 * 00193 * If the point is at a pole, the azimuth is defined by keeping \e lon1 00194 * fixed, writing \e lat1 = ±(90° − ε), and taking 00195 * the limit ε → 0+. 00196 **********************************************************************/ 00197 GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, 00198 unsigned caps = ALL); 00199 00200 /** 00201 * A default constructor. If GeodesicLine::Position is called on the 00202 * resulting object, it returns immediately (without doing any 00203 * calculations). The object can be set with a call to Geodesic::Line. 00204 * Use Init() to test whether object is still in this uninitialized state. 00205 **********************************************************************/ 00206 GeodesicLine() : _caps(0U) {} 00207 ///@} 00208 00209 /** \name Position in terms of distance 00210 **********************************************************************/ 00211 ///@{ 00212 00213 /** 00214 * Compute the position of point 2 which is a distance \e s12 (meters) from 00215 * point 1. 00216 * 00217 * @param[in] s12 distance between point 1 and point 2 (meters); it can be 00218 * negative. 00219 * @param[out] lat2 latitude of point 2 (degrees). 00220 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00221 * GeodesicLine object was constructed with \e caps |= 00222 * GeodesicLine::LONGITUDE. 00223 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00224 * @param[out] m12 reduced length of geodesic (meters); requires that the 00225 * GeodesicLine object was constructed with \e caps |= 00226 * GeodesicLine::REDUCEDLENGTH. 00227 * @param[out] M12 geodesic scale of point 2 relative to point 1 00228 * (dimensionless); requires that the GeodesicLine object was constructed 00229 * with \e caps |= GeodesicLine::GEODESICSCALE. 00230 * @param[out] M21 geodesic scale of point 1 relative to point 2 00231 * (dimensionless); requires that the GeodesicLine object was constructed 00232 * with \e caps |= GeodesicLine::GEODESICSCALE. 00233 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00234 * that the GeodesicLine object was constructed with \e caps |= 00235 * GeodesicLine::AREA. 00236 * @return \e a12 arc length of between point 1 and point 2 (degrees). 00237 * 00238 * The values of \e lon2 and \e azi2 returned are in the range 00239 * [−180°, 180°). 00240 * 00241 * The GeodesicLine object \e must have been constructed with \e caps |= 00242 * GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no 00243 * parameters are set. Requesting a value which the GeodesicLine object is 00244 * not capable of computing is not an error; the corresponding argument 00245 * will not be altered. 00246 * 00247 * The following functions are overloaded versions of 00248 * GeodesicLine::Position which omit some of the output parameters. Note, 00249 * however, that the arc length is always computed and returned as the 00250 * function value. 00251 **********************************************************************/ 00252 Math::real Position(real s12, 00253 real& lat2, real& lon2, real& azi2, 00254 real& m12, real& M12, real& M21, 00255 real& S12) const { 00256 real t; 00257 return GenPosition(false, s12, 00258 LATITUDE | LONGITUDE | AZIMUTH | 00259 REDUCEDLENGTH | GEODESICSCALE | AREA, 00260 lat2, lon2, azi2, t, m12, M12, M21, S12); 00261 } 00262 00263 /** 00264 * See the documentation for GeodesicLine::Position. 00265 **********************************************************************/ 00266 Math::real Position(real s12, real& lat2, real& lon2) const { 00267 real t; 00268 return GenPosition(false, s12, 00269 LATITUDE | LONGITUDE, 00270 lat2, lon2, t, t, t, t, t, t); 00271 } 00272 00273 /** 00274 * See the documentation for GeodesicLine::Position. 00275 **********************************************************************/ 00276 Math::real Position(real s12, real& lat2, real& lon2, 00277 real& azi2) const { 00278 real t; 00279 return GenPosition(false, s12, 00280 LATITUDE | LONGITUDE | AZIMUTH, 00281 lat2, lon2, azi2, t, t, t, t, t); 00282 } 00283 00284 /** 00285 * See the documentation for GeodesicLine::Position. 00286 **********************************************************************/ 00287 Math::real Position(real s12, real& lat2, real& lon2, 00288 real& azi2, real& m12) const { 00289 real t; 00290 return GenPosition(false, s12, 00291 LATITUDE | LONGITUDE | 00292 AZIMUTH | REDUCEDLENGTH, 00293 lat2, lon2, azi2, t, m12, t, t, t); 00294 } 00295 00296 /** 00297 * See the documentation for GeodesicLine::Position. 00298 **********************************************************************/ 00299 Math::real Position(real s12, real& lat2, real& lon2, 00300 real& azi2, real& M12, real& M21) 00301 const { 00302 real t; 00303 return GenPosition(false, s12, 00304 LATITUDE | LONGITUDE | 00305 AZIMUTH | GEODESICSCALE, 00306 lat2, lon2, azi2, t, t, M12, M21, t); 00307 } 00308 00309 /** 00310 * See the documentation for GeodesicLine::Position. 00311 **********************************************************************/ 00312 Math::real Position(real s12, 00313 real& lat2, real& lon2, real& azi2, 00314 real& m12, real& M12, real& M21) 00315 const { 00316 real t; 00317 return GenPosition(false, s12, 00318 LATITUDE | LONGITUDE | AZIMUTH | 00319 REDUCEDLENGTH | GEODESICSCALE, 00320 lat2, lon2, azi2, t, m12, M12, M21, t); 00321 } 00322 00323 ///@} 00324 00325 /** \name Position in terms of arc length 00326 **********************************************************************/ 00327 ///@{ 00328 00329 /** 00330 * Compute the position of point 2 which is an arc length \e a12 (degrees) 00331 * from point 1. 00332 * 00333 * @param[in] a12 arc length between point 1 and point 2 (degrees); it can 00334 * be negative. 00335 * @param[out] lat2 latitude of point 2 (degrees). 00336 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00337 * GeodesicLine object was constructed with \e caps |= 00338 * GeodesicLine::LONGITUDE. 00339 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00340 * @param[out] s12 distance between point 1 and point 2 (meters); requires 00341 * that the GeodesicLine object was constructed with \e caps |= 00342 * GeodesicLine::DISTANCE. 00343 * @param[out] m12 reduced length of geodesic (meters); requires that the 00344 * GeodesicLine object was constructed with \e caps |= 00345 * GeodesicLine::REDUCEDLENGTH. 00346 * @param[out] M12 geodesic scale of point 2 relative to point 1 00347 * (dimensionless); requires that the GeodesicLine object was constructed 00348 * with \e caps |= GeodesicLine::GEODESICSCALE. 00349 * @param[out] M21 geodesic scale of point 1 relative to point 2 00350 * (dimensionless); requires that the GeodesicLine object was constructed 00351 * with \e caps |= GeodesicLine::GEODESICSCALE. 00352 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00353 * that the GeodesicLine object was constructed with \e caps |= 00354 * GeodesicLine::AREA. 00355 * 00356 * The values of \e lon2 and \e azi2 returned are in the range 00357 * [−180°, 180°). 00358 * 00359 * Requesting a value which the GeodesicLine object is not capable of 00360 * computing is not an error; the corresponding argument will not be 00361 * altered. 00362 * 00363 * The following functions are overloaded versions of 00364 * GeodesicLine::ArcPosition which omit some of the output parameters. 00365 **********************************************************************/ 00366 void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, 00367 real& s12, real& m12, real& M12, real& M21, 00368 real& S12) const { 00369 GenPosition(true, a12, 00370 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | 00371 REDUCEDLENGTH | GEODESICSCALE | AREA, 00372 lat2, lon2, azi2, s12, m12, M12, M21, S12); 00373 } 00374 00375 /** 00376 * See the documentation for GeodesicLine::ArcPosition. 00377 **********************************************************************/ 00378 void ArcPosition(real a12, real& lat2, real& lon2) 00379 const { 00380 real t; 00381 GenPosition(true, a12, 00382 LATITUDE | LONGITUDE, 00383 lat2, lon2, t, t, t, t, t, t); 00384 } 00385 00386 /** 00387 * See the documentation for GeodesicLine::ArcPosition. 00388 **********************************************************************/ 00389 void ArcPosition(real a12, 00390 real& lat2, real& lon2, real& azi2) 00391 const { 00392 real t; 00393 GenPosition(true, a12, 00394 LATITUDE | LONGITUDE | AZIMUTH, 00395 lat2, lon2, azi2, t, t, t, t, t); 00396 } 00397 00398 /** 00399 * See the documentation for GeodesicLine::ArcPosition. 00400 **********************************************************************/ 00401 void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, 00402 real& s12) const { 00403 real t; 00404 GenPosition(true, a12, 00405 LATITUDE | LONGITUDE | AZIMUTH | DISTANCE, 00406 lat2, lon2, azi2, s12, t, t, t, t); 00407 } 00408 00409 /** 00410 * See the documentation for GeodesicLine::ArcPosition. 00411 **********************************************************************/ 00412 void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, 00413 real& s12, real& m12) const { 00414 real t; 00415 GenPosition(true, a12, 00416 LATITUDE | LONGITUDE | AZIMUTH | 00417 DISTANCE | REDUCEDLENGTH, 00418 lat2, lon2, azi2, s12, m12, t, t, t); 00419 } 00420 00421 /** 00422 * See the documentation for GeodesicLine::ArcPosition. 00423 **********************************************************************/ 00424 void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, 00425 real& s12, real& M12, real& M21) 00426 const { 00427 real t; 00428 GenPosition(true, a12, 00429 LATITUDE | LONGITUDE | AZIMUTH | 00430 DISTANCE | GEODESICSCALE, 00431 lat2, lon2, azi2, s12, t, M12, M21, t); 00432 } 00433 00434 /** 00435 * See the documentation for GeodesicLine::ArcPosition. 00436 **********************************************************************/ 00437 void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, 00438 real& s12, real& m12, real& M12, real& M21) 00439 const { 00440 real t; 00441 GenPosition(true, a12, 00442 LATITUDE | LONGITUDE | AZIMUTH | 00443 DISTANCE | REDUCEDLENGTH | GEODESICSCALE, 00444 lat2, lon2, azi2, s12, m12, M12, M21, t); 00445 } 00446 ///@} 00447 00448 /** \name The general position function. 00449 **********************************************************************/ 00450 ///@{ 00451 00452 /** 00453 * The general position function. GeodesicLine::Position and 00454 * GeodesicLine::ArcPosition are defined in terms of this function. 00455 * 00456 * @param[in] arcmode boolean flag determining the meaning of the second 00457 * parameter; if arcmode is false, then the GeodesicLine object must have 00458 * been constructed with \e caps |= GeodesicLine::DISTANCE_IN. 00459 * @param[in] s12_a12 if \e arcmode is false, this is the distance between 00460 * point 1 and point 2 (meters); otherwise it is the arc length between 00461 * point 1 and point 2 (degrees); it can be negative. 00462 * @param[in] outmask a bitor'ed combination of GeodesicLine::mask values 00463 * specifying which of the following parameters should be set. 00464 * @param[out] lat2 latitude of point 2 (degrees). 00465 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00466 * GeodesicLine object was constructed with \e caps |= 00467 * GeodesicLine::LONGITUDE. 00468 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00469 * @param[out] s12 distance between point 1 and point 2 (meters); requires 00470 * that the GeodesicLine object was constructed with \e caps |= 00471 * GeodesicLine::DISTANCE. 00472 * @param[out] m12 reduced length of geodesic (meters); requires that the 00473 * GeodesicLine object was constructed with \e caps |= 00474 * GeodesicLine::REDUCEDLENGTH. 00475 * @param[out] M12 geodesic scale of point 2 relative to point 1 00476 * (dimensionless); requires that the GeodesicLine object was constructed 00477 * with \e caps |= GeodesicLine::GEODESICSCALE. 00478 * @param[out] M21 geodesic scale of point 1 relative to point 2 00479 * (dimensionless); requires that the GeodesicLine object was constructed 00480 * with \e caps |= GeodesicLine::GEODESICSCALE. 00481 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00482 * that the GeodesicLine object was constructed with \e caps |= 00483 * GeodesicLine::AREA. 00484 * @return \e a12 arc length of between point 1 and point 2 (degrees). 00485 * 00486 * The GeodesicLine::mask values possible for \e outmask are 00487 * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2; 00488 * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2; 00489 * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2; 00490 * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12; 00491 * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \e 00492 * m12; 00493 * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e 00494 * M12 and \e M21; 00495 * - \e outmask |= GeodesicLine::AREA for the area \e S12; 00496 * - \e outmask |= GeodesicLine::ALL for all of the above. 00497 * . 00498 * Requesting a value which the GeodesicLine object is not capable of 00499 * computing is not an error; the corresponding argument will not be 00500 * altered. Note, however, that the arc length is always computed and 00501 * returned as the function value. 00502 **********************************************************************/ 00503 Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, 00504 real& lat2, real& lon2, real& azi2, 00505 real& s12, real& m12, real& M12, real& M21, 00506 real& S12) const; 00507 00508 ///@} 00509 00510 /** \name Inspector functions 00511 **********************************************************************/ 00512 ///@{ 00513 00514 /** 00515 * @return true if the object has been initialized. 00516 **********************************************************************/ 00517 bool Init() const { return _caps != 0U; } 00518 00519 /** 00520 * @return \e lat1 the latitude of point 1 (degrees). 00521 **********************************************************************/ 00522 Math::real Latitude() const 00523 { return Init() ? _lat1 : Math::NaN(); } 00524 00525 /** 00526 * @return \e lon1 the longitude of point 1 (degrees). 00527 **********************************************************************/ 00528 Math::real Longitude() const 00529 { return Init() ? _lon1 : Math::NaN(); } 00530 00531 /** 00532 * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. 00533 **********************************************************************/ 00534 Math::real Azimuth() const 00535 { return Init() ? _azi1 : Math::NaN(); } 00536 00537 /** 00538 * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses 00539 * the equator in a northward direction. 00540 **********************************************************************/ 00541 Math::real EquatorialAzimuth() const { 00542 using std::atan2; 00543 return Init() ? 00544 atan2(_salp0, _calp0) / Math::degree() : Math::NaN(); 00545 } 00546 00547 /** 00548 * @return \e a1 the arc length (degrees) between the northward equatorial 00549 * crossing and point 1. 00550 **********************************************************************/ 00551 Math::real EquatorialArc() const { 00552 using std::atan2; 00553 return Init() ? 00554 atan2(_ssig1, _csig1) / Math::degree() : Math::NaN(); 00555 } 00556 00557 /** 00558 * @return \e a the equatorial radius of the ellipsoid (meters). This is 00559 * the value inherited from the Geodesic object used in the constructor. 00560 **********************************************************************/ 00561 Math::real MajorRadius() const 00562 { return Init() ? _a : Math::NaN(); } 00563 00564 /** 00565 * @return \e f the flattening of the ellipsoid. This is the value 00566 * inherited from the Geodesic object used in the constructor. 00567 **********************************************************************/ 00568 Math::real Flattening() const 00569 { return Init() ? _f : Math::NaN(); } 00570 00571 /// \cond SKIP 00572 /** 00573 * <b>DEPRECATED</b> 00574 * @return \e r the inverse flattening of the ellipsoid. 00575 **********************************************************************/ 00576 Math::real InverseFlattening() const 00577 { return Init() ? 1/_f : Math::NaN(); } 00578 /// \endcond 00579 00580 /** 00581 * @return \e caps the computational capabilities that this object was 00582 * constructed with. LATITUDE and AZIMUTH are always included. 00583 **********************************************************************/ 00584 unsigned Capabilities() const { return _caps; } 00585 00586 /** 00587 * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. 00588 * @return true if the GeodesicLine object has all these capabilities. 00589 **********************************************************************/ 00590 bool Capabilities(unsigned testcaps) const { 00591 testcaps &= OUT_ALL; 00592 return (_caps & testcaps) == testcaps; 00593 } 00594 ///@} 00595 00596 }; 00597 00598 } // namespace GeographicLib 00599 00600 #endif // GEOGRAPHICLIB_GEODESICLINE_HPP