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;
75 LineSegment(
double x0,
double y0,
double x1,
double y1);
84 const Coordinate& operator[](std::size_t i)
const;
90 double getLength()
const;
96 bool isHorizontal()
const;
102 bool isVertical()
const;
125 int orientationIndex(
const LineSegment& seg)
const;
128 int orientationIndex(
const LineSegment* seg)
const;
146 int orientationIndex(
const Coordinate& p)
const;
159 double angle()
const;
177 double distancePerpendicular(
const Coordinate& p)
const;
193 void pointAlong(
double segmentLengthFraction,
Coordinate& ret)
const;
219 void pointAlongOffset(
double segmentLengthFraction,
220 double offsetDistance,
240 double projectionFactor(
const Coordinate& p)
const;
257 double segmentFraction(
const Coordinate& inputPt)
const;
324 std::array<Coordinate, 2> closestPoints(
const LineSegment& line);
326 std::array<Coordinate, 2> closestPoints(
const LineSegment* line);
366 std::unique_ptr<LineString> toGeometry(
const GeometryFactory& gf)
const;
370 size_t h = std::hash<double>{}(s.p0.
x);
371 h ^= (std::hash<double>{}(s.p0.
y) << 1);
372 h ^= (std::hash<double>{}(s.
p1.
x) << 1);
373 return h ^ (std::hash<double>{}(s.
p1.
y) << 1);
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: IndexedNestedRingTester.h:25
double x
x-coordinate
Definition: Coordinate.h:80
bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.