21 #ifndef GEOS_GEOM_LINESEGMENT_H 22 #define GEOS_GEOM_LINESEGMENT_H 24 #include <geos/export.h> 25 #include <geos/geom/Coordinate.h> 27 #include <geos/inline.h> 37 class CoordinateSequence;
38 class GeometryFactory;
73 LineSegment(
double x0,
double y0,
double x1,
double y1);
80 const Coordinate& operator[](std::size_t i)
const;
86 double getLength()
const;
92 bool isHorizontal()
const;
98 bool isVertical()
const;
121 int orientationIndex(
const LineSegment& seg)
const;
124 int orientationIndex(
const LineSegment* seg)
const;
142 int orientationIndex(
const Coordinate& p)
const;
155 double angle()
const;
173 double distancePerpendicular(
const Coordinate& p)
const;
189 void pointAlong(
double segmentLengthFraction,
Coordinate& ret)
const;
215 void pointAlongOffset(
double segmentLengthFraction,
216 double offsetDistance,
236 double projectionFactor(
const Coordinate& p)
const;
253 double segmentFraction(
const Coordinate& inputPt)
const;
320 std::array<Coordinate, 2> closestPoints(
const LineSegment& line);
322 std::array<Coordinate, 2> closestPoints(
const LineSegment* line);
362 std::unique_ptr<LineString> toGeometry(
const GeometryFactory& gf)
const;
365 std::size_t operator()(
const LineSegment & s)
const {
366 std::size_t h = std::hash<double>{}(s.p0.
x);
367 h ^= (std::hash<double>{}(s.p0.
y) << 1);
368 h ^= (std::hash<double>{}(s.
p1.
x) << 1);
369 return h ^ (std::hash<double>{}(s.
p1.
y) << 1);
374 void project(
double factor, Coordinate& ret)
const;
378 std::ostream&
operator<< (std::ostream& o,
const LineSegment& l);
381 bool operator==(
const LineSegment& a,
const LineSegment& b);
388 # include "geos/geom/LineSegment.inl" 391 #endif // ndef GEOS_GEOM_LINESEGMENT_H Definition: LineSegment.h:59
Coordinate p1
Segment start.
Definition: LineSegment.h:66
double y
y-coordinate
Definition: Coordinate.h:83
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26
double x
x-coordinate
Definition: Coordinate.h:80
bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.