10#if !defined(GEOGRAPHICLIB_INTERSECT_HPP)
11#define GEOGRAPHICLIB_INTERSECT_HPP 1
78 typedef std::pair<Math::real, Math::real>
Point;
87 static const int numit_ = 100;
105 {
using std::fabs;
return fabs(x) + fabs(y); }
115 : x(Math::NaN()), y(Math::NaN()), c(0)
117 XPoint(
const Point& p)
118 : x(p.first), y(p.second), c(0)
120 XPoint& operator+=(
const XPoint& p) {
125 XPoint operator+(
const XPoint& p)
const {
126 XPoint t = *
this; t += p;
return t;
129 Math::real Dist(
const XPoint& p)
const {
return d1(x - p.x, y - p.y); }
130 Point data()
const {
return Point(x, y); }
139 bool eq(
const XPoint& p,
const XPoint& q)
const {
140 return d1(p.x - q.x, p.y - q.y) <= _delta;
142 bool operator()(
const XPoint& p,
const XPoint& q)
const {
143 return !eq(p, q) && ( p.x != q.x ? p.x < q.x : p.y < q.y );
152 RankPoint(
const Point& p0) : _x(p0.first), _y(p0.second) {}
153 RankPoint(
const XPoint& p0) : _x(p0.x), _y(p0.y) {}
154 bool operator()(
const XPoint& p,
const XPoint& q)
const {
155 real dp = d1(p.x - _x, p.y - _y),
156 dq = d1(q.x - _x, q.y - _y);
157 return dp != dq ? (dp < dq) :
158 (p.x != q.x ? (p.x < q.x) : (p.y < q.y));
162 XPoint Spherical(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
163 const XPoint& p)
const;
165 XPoint Basic(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
166 const XPoint& p0)
const;
168 XPoint ClosestInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
169 const XPoint& p0)
const;
171 XPoint NextInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY)
const;
173 XPoint SegmentInt(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
177 AllInt0(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
180 AllInternal(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
182 std::vector<int>& c,
bool cp)
const;
199 static XPoint fixcoincident(
const XPoint& p0,
const XPoint& p);
200 static XPoint fixcoincident(
const XPoint& p0,
const XPoint& p,
int c);
203 return (p.x < 0 ? -1 : p.x <= sx ? 0 : 1) * 3
204 + (p.y < 0 ? -1 : p.y <= sy ? 0 : 1);
206 mutable long long _cnt0, _cnt1, _cnt2, _cnt3, _cnt4;
227 Intersect(
const Geodesic& geod);
252 const Point& p0 = Point(0, 0),
int* c =
nullptr)
const;
270 Point Closest(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
271 const Point& p0 = Point(0, 0),
int* c =
nullptr)
const;
310 int& segmode,
int* c =
nullptr)
const;
336 Point Segment(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
337 int& segmode,
int* c =
nullptr)
const;
382 Point Next(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
383 int* c =
nullptr)
const;
413 const Point& p0 = Point(0, 0))
438 Math::real maxdist,
const Point& p0 = Point(0, 0))
461 std::vector<Point> All(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
463 const Point& p0 = Point(0, 0))
485 std::vector<Point> All(
const GeodesicLine& lineX,
const GeodesicLine& lineY,
486 Math::real maxdist,
const Point& p0 = Point(0, 0))
577 return fabs(p.first - p0.first) + fabs(p.second - p0.second);
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
Header for GeographicLib::GeodesicLine class.
Header for GeographicLib::Geodesic class.
Header for GeographicLib::Math class.
const Geodesic & GeodesicObject() const
long long NumChange() const
long long NumBasic() const
long long NumInverse() const
static Math::real Dist(const Point &p, const Point &p0=Point(0, 0))
std::pair< Math::real, Math::real > Point
long long NumOverride() const
long long NumCorner() const
Namespace for GeographicLib.