10 #if !defined(GEOGRAPHICLIB_INTERSECT_HPP) 11 #define GEOGRAPHICLIB_INTERSECT_HPP 1 79 typedef std::pair<Math::real, Math::real>
Point;
88 static const int numit_ = 100;
106 {
using std::fabs;
return fabs(x) + fabs(y); }
116 : x(Math::NaN()), y(Math::NaN()), c(0)
118 XPoint(
const Point& p)
119 : x(p.first), y(p.second), c(0)
121 XPoint& operator+=(
const XPoint& p) {
126 XPoint operator+(
const XPoint& p)
const {
127 XPoint t = *
this; t += p;
return t;
130 Math::real Dist(
const XPoint& p)
const {
return d1(x - p.x, y - p.y); }
131 Point data()
const {
return Point(x, y); }
140 bool eq(
const XPoint& p,
const XPoint& q)
const {
141 return d1(p.x - q.x, p.y - q.y) <= _delta;
143 bool operator()(
const XPoint& p,
const XPoint& q)
const {
144 return !eq(p, q) && ( p.x != q.x ? p.x < q.x : p.y < q.y );
153 RankPoint(
const Point& p0) : _x(p0.first), _y(p0.second) {}
154 RankPoint(
const XPoint& p0) : _x(p0.x), _y(p0.y) {}
155 bool operator()(
const XPoint& p,
const XPoint& q)
const {
156 real dp = d1(p.x - _x, p.y - _y),
157 dq = d1(q.x - _x, q.y - _y);
158 return dp != dq ? (dp < dq) :
159 (p.x != q.x ? (p.x < q.x) : (p.y < q.y));
163 XPoint Spherical(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
164 const XPoint& p)
const;
166 XPoint Basic(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
167 const XPoint& p0)
const;
169 XPoint ClosestInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
170 const XPoint& p0)
const;
172 XPoint NextInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY)
const;
174 XPoint SegmentInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
178 AllInt0(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
181 AllInternal(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
183 std::vector<int>& c,
bool cp)
const;
200 static XPoint fixcoincident(
const XPoint& p0,
const XPoint& p);
201 static XPoint fixcoincident(
const XPoint& p0,
const XPoint& p,
int c);
204 return (p.x < 0 ? -1 : p.x <= sx ? 0 : 1) * 3
205 + (p.y < 0 ? -1 : p.y <= sy ? 0 : 1);
207 mutable long long _cnt0, _cnt1, _cnt2, _cnt3, _cnt4;
228 Intersect(
const Geodesic& geod);
253 const Point& p0 = Point(0, 0),
int* c =
nullptr)
const;
271 Point Closest(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
272 const Point& p0 = Point(0, 0),
int* c =
nullptr)
const;
311 int& segmode,
int* c =
nullptr)
const;
337 Point Segment(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
338 int& segmode,
int* c =
nullptr)
const;
383 Point Next(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
384 int* c =
nullptr)
const;
414 const Point& p0 = Point(0, 0))
439 Math::real maxdist,
const Point& p0 = Point(0, 0))
462 std::vector<Point> All(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
464 const Point& p0 = Point(0, 0))
486 std::vector<Point> All(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
487 Math::real maxdist,
const Point& p0 = Point(0, 0))
578 return fabs(p.first - p0.first) + fabs(p.second - p0.second);
584 #endif // GEOGRAPHICLIB_INTERSECT_HPP
Header for GeographicLib::GeodesicLine class.
const Geodesic & GeodesicObject() const
#define GEOGRAPHICLIB_EXPORT
long long NumInverse() const
std::pair< Math::real, Math::real > Point
static Math::real Dist(const Point &p, const Point &p0=Point(0, 0))
Header for GeographicLib::Geodesic class.
Header for GeographicLib::Math class.
long long NumOverride() const
Namespace for GeographicLib.
long long NumCorner() const
GeographicLib::Math::real real
long long NumChange() const
long long NumBasic() const