GEOS
3.4.2
|
Specifies and implements various fundamental Computational Geometric algorithms. The algorithms supplied in this class are robust for double-precision floating point. More...
#include <CGAlgorithms.h>
Public Types | |
enum | { CLOCKWISE =-1, COLLINEAR, COUNTERCLOCKWISE } |
enum | { RIGHT =-1, LEFT, STRAIGHT } |
Static Public Member Functions | |
static bool | isPointInRing (const geom::Coordinate &p, const geom::CoordinateSequence *ring) |
Tests whether a point lies inside a ring. More... | |
static bool | isPointInRing (const geom::Coordinate &p, const std::vector< const geom::Coordinate * > &ring) |
Same as above, but taking a vector of const Coordinates (faster) | |
static int | locatePointInRing (const geom::Coordinate &p, const geom::CoordinateSequence &ring) |
Determines whether a point lies in the interior, on the boundary, or in the exterior of a ring. More... | |
static int | locatePointInRing (const geom::Coordinate &p, const std::vector< const geom::Coordinate * > &ring) |
Same as above, but taking a vector of const Coordinates. | |
static bool | isOnLine (const geom::Coordinate &p, const geom::CoordinateSequence *pt) |
Test whether a point lies on the given line segment. More... | |
static bool | isCCW (const geom::CoordinateSequence *ring) |
Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise. More... | |
static int | computeOrientation (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q) |
Computes the orientation of a point q to the directed line segment p1-p2. More... | |
static double | distancePointLine (const geom::Coordinate &p, const geom::Coordinate &A, const geom::Coordinate &B) |
Computes the distance from a point p to a line segment AB. More... | |
static double | distancePointLinePerpendicular (const geom::Coordinate &p, const geom::Coordinate &A, const geom::Coordinate &B) |
Computes the perpendicular distance from a point p to the (infinite) line containing the points AB. More... | |
static double | distanceLineLine (const geom::Coordinate &A, const geom::Coordinate &B, const geom::Coordinate &C, const geom::Coordinate &D) |
Computes the distance from a line segment AB to a line segment CD. More... | |
static double | signedArea (const geom::CoordinateSequence *ring) |
Returns the signed area for a ring. The area is positive if the ring is oriented CW. | |
static double | length (const geom::CoordinateSequence *pts) |
Computes the length of a linestring specified by a sequence of points. More... | |
static int | orientationIndex (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q) |
Returns the index of the direction of the point q relative to a vector specified by p1-p2 . More... | |
Specifies and implements various fundamental Computational Geometric algorithms. The algorithms supplied in this class are robust for double-precision floating point.
|
static |
Computes the orientation of a point q to the directed line segment p1-p2.
The orientation of a point relative to a directed line segment indicates which way you turn to get to q after travelling from p1 to p2.
|
static |
Computes the distance from a line segment AB to a line segment CD.
Note: NON-ROBUST!
A | a point of one line |
B | the second point of (must be different to A) |
C | one point of the line |
D | another point of the line (must be different to A) |
|
static |
Computes the distance from a point p to a line segment AB.
Note: NON-ROBUST!
p | the point to compute the distance for |
A | one point of the line |
B | another point of the line (must be different to A) |
|
static |
Computes the perpendicular distance from a point p to the (infinite) line containing the points AB.
p | the point to compute the distance for |
A | one point of the line |
B | another point of the line (must be different to A) |
|
static |
Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise.
This algorithm is only guaranteed to work with valid rings. If the ring is invalid (e.g. self-crosses or touches), the computed result may not be correct.
ring | an array of coordinates forming a ring |
true
if the ring is oriented counter-clockwise.
|
static |
Test whether a point lies on the given line segment.
|
static |
Tests whether a point lies inside a ring.
The ring may be oriented in either direction. A point lying exactly on the ring boundary is considered to be inside the ring.
This algorithm does not first check the point against the envelope of the ring.
p | point to check for ring inclusion |
ring | is assumed to have first point identical to last point |
true
if p is inside ring
|
static |
Computes the length of a linestring specified by a sequence of points.
pts | the points specifying the linestring |
|
static |
Determines whether a point lies in the interior, on the boundary, or in the exterior of a ring.
The ring may be oriented in either direction.
This method does not first check the point against the envelope of the ring.
p | point to check for ring inclusion |
ring | an array of coordinates representing the ring (which must have first point identical to last point) |
|
static |
Returns the index of the direction of the point q
relative to a vector specified by p1-p2
.
p1 | the origin point of the vector |
p2 | the final point of the vector |
q | the point to compute the direction to |