#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) |
Test whether a point lies inside a ring. | |
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 bool | isOnLine (const geom::Coordinate &p, const geom::CoordinateSequence *pt) |
Test whether a point lies on a linestring. | |
static bool | isCCW (const geom::CoordinateSequence *ring) |
Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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 . |
static bool geos::algorithm::CGAlgorithms::isPointInRing | ( | const geom::Coordinate & | p, | |
const geom::CoordinateSequence * | ring | |||
) | [static] |
Test whether a point lies inside a ring.
The ring may be oriented in either direction. If the point lies on the ring boundary the result of this method is unspecified.
This algorithm does not attempt to first check the point against the envelope of the ring.
p | point to check for ring inclusion | |
ring | assumed to have first point identical to last point |
true
if p is inside ring static bool geos::algorithm::CGAlgorithms::isOnLine | ( | const geom::Coordinate & | p, | |
const geom::CoordinateSequence * | pt | |||
) | [static] |
Test whether a point lies on a linestring.
static bool geos::algorithm::CGAlgorithms::isCCW | ( | const geom::CoordinateSequence * | ring | ) | [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 int geos::algorithm::CGAlgorithms::computeOrientation | ( | const geom::Coordinate & | p1, | |
const geom::Coordinate & | p2, | |||
const geom::Coordinate & | q | |||
) | [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.
-1 if q is clockwise from p1-p2
0 if q is collinear with p1-p2
static double geos::algorithm::CGAlgorithms::distancePointLine | ( | const geom::Coordinate & | p, | |
const geom::Coordinate & | A, | |||
const geom::Coordinate & | B | |||
) | [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 double geos::algorithm::CGAlgorithms::distancePointLinePerpendicular | ( | const geom::Coordinate & | p, | |
const geom::Coordinate & | A, | |||
const geom::Coordinate & | B | |||
) | [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 double geos::algorithm::CGAlgorithms::distanceLineLine | ( | const geom::Coordinate & | A, | |
const geom::Coordinate & | B, | |||
const geom::Coordinate & | C, | |||
const geom::Coordinate & | D | |||
) | [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 double geos::algorithm::CGAlgorithms::length | ( | const geom::CoordinateSequence * | pts | ) | [static] |
Computes the length of a linestring specified by a sequence of points.
pts | the points specifying the linestring |
static int geos::algorithm::CGAlgorithms::orientationIndex | ( | const geom::Coordinate & | p1, | |
const geom::Coordinate & | p2, | |||
const geom::Coordinate & | q | |||
) | [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 |
-1 if q is clockwise (right) from p1-p2
0 if q is collinear with p1-p2