GEOS
3.9.1dev
|
Functions to compute the orientation of basic geometric structures including point triplets (triangles) and rings. More...
#include <Orientation.h>
Public Types | |
enum | { CLOCKWISE = -1, COLLINEAR = 0, COUNTERCLOCKWISE = 1, RIGHT = -1, LEFT = 1, STRAIGHT = 0 } |
Static Public Member Functions | |
static int | index (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q) |
Returns the orientation index of the direction of the point q relative to a directed infinite line specified by p1-p2. More... | |
static bool | isCCW (const geom::CoordinateSequence *ring) |
Functions to compute the orientation of basic geometric structures including point triplets (triangles) and rings.
Orientation is a fundamental property of planar geometries (and more generally geometry on two-dimensional manifolds).
Orientation is notoriously subject to numerical precision errors in the case of collinear or nearly collinear points. JTS uses extended-precision arithmetic to increase the robustness of the computation.
Definition at line 43 of file Orientation.h.
anonymous enum |
Enumerator | |
---|---|
CLOCKWISE | |
COLLINEAR | |
COUNTERCLOCKWISE | |
RIGHT | |
LEFT | |
STRAIGHT |
Definition at line 47 of file Orientation.h.
|
static |
Returns the orientation index of the direction of the point q relative to a directed infinite line specified by p1-p2.
The index indicates whether the point lies to the Orientation::LEFT
or Orientation::RIGHT
of the line, or lies on it Orientation::COLLINEAR
. The index also indicates the orientation of the triangle formed by the three points ( Orientation::COUNTERCLOCKWISE
, Orientation::CLOCKWISE
, or Orientation::STRAIGHT
)
|
static |
Computes whether a ring defined by a geom::CoordinateSequence is oriented counter-clockwise.
This algorithm is guaranteed to work with valid rings. It also works with "mildly invalid" rings which contain collapsed (coincident) flat segments along the top of the ring. If the ring is "more" invalid (e.g. self-crosses or touches), the computed result may not be correct.
ring | a CoordinateSequence forming a ring (with first and last point identical) |
IllegalArgumentException | if there are too few points to determine orientation (< 4) |