10 #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP)
11 #define GEOGRAPHICLIB_POLYGONAREA_HPP 1
63 template <
class GeodType = Geodesic>
74 real _lat0, _lon0, _lat1, _lon1;
75 static inline int transit(real lon1, real lon2) {
83 lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 :
84 (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0);
89 static inline int transitdirect(real lon1, real lon2) {
96 #if GEOGRAPHICLIB_CXX11_MATH && GEOGRAPHICLIB_PRECISION != 4
98 lon1 = remainder(lon1, real(720)); lon2 = remainder(lon2, real(720));
99 return ( (lon2 >= 0 && lon2 < 360 ? 0 : 1) -
100 (lon1 >= 0 && lon1 < 360 ? 0 : 1) );
103 lon1 = fmod(lon1, real(720)); lon2 = fmod(lon2, real(720));
104 return ( ((lon2 >= 0 && lon2 < 360) || lon2 < -360 ? 0 : 1) -
105 ((lon1 >= 0 && lon1 < 360) || lon1 < -360 ? 0 : 1) );
119 , _area0(_earth.EllipsoidArea())
120 , _polyline(polyline)
121 , _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE |
122 (_polyline ? GeodType::NONE :
123 GeodType::AREA | GeodType::LONG_UNROLL))
134 _lat0 = _lon0 = _lat1 = _lon1 =
Math::NaN();
156 void AddEdge(real azi, real s);
172 unsigned Compute(
bool reverse,
bool sign,
173 real& perimeter, real& area)
const;
200 unsigned TestPoint(real lat, real lon,
bool reverse,
bool sign,
201 real& perimeter, real& area)
const;
226 unsigned TestEdge(real azi, real s,
bool reverse,
bool sign,
227 real& perimeter, real& area)
const;
234 unsigned TestCompute(real lat, real lon,
bool reverse,
bool sign,
235 real& perimeter, real& area)
const {
236 return TestPoint(lat, lon, reverse, sign, perimeter, area);
266 { lat = _lat1; lon = _lon1; }
296 #endif // GEOGRAPHICLIB_POLYGONAREA_HPP
static T AngNormalize(T x)
void CurrentPoint(real &lat, real &lon) const
unsigned TestEdge(real azi, real s, bool reverse, bool sign, real &perimeter, real &area) const
unsigned TestPoint(real lat, real lon, bool reverse, bool sign, real &perimeter, real &area) const
PolygonAreaT< Rhumb > PolygonAreaRhumb
Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes.
void AddEdge(real azi, real s)
Math::real Flattening() const
PolygonAreaT(const GeodType &earth, bool polyline=false)
Header for GeographicLib::Geodesic class.
PolygonAreaT< GeodesicExact > PolygonAreaExact
Header for GeographicLib::Accumulator class.
unsigned Compute(bool reverse, bool sign, real &perimeter, real &area) const
Namespace for GeographicLib.
static T AngDiff(T x, T y)
void AddPoint(real lat, real lon)
Header for GeographicLib::GeodesicExact class.
Math::real MajorRadius() const
PolygonAreaT< Geodesic > PolygonArea