Skip to content
On this page

geos.GEOSOrientationIndex ⇒ number

Computes 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 LEFT or RIGHT of the line, or lies on it COLLINEAR. The index also indicates the orientation of the triangle formed by the three points (COUNTERCLOCKWISE, CLOCKWISE, or STRAIGHT).

Kind: Exported member
Returns: number - The orientation index: 1 (LEFT), 0 (COLLINEAR), or -1 (RIGHT).
See: https://libgeos.org/doxygen/classgeos_1_1algorithm_1_1Orientation.html#a5b9f8c4a7c6f0a3f3a4e7c8d6b9a5d7b

ParamTypeDescription
axnumberThe x coordinate of p1.
aynumberThe y coordinate of p1.
bxnumberThe x coordinate of p2.
bynumberThe y coordinate of p2.
pxnumberThe x coordinate of q.
pynumberThe y coordinate of q.

geos.GEOSOrientationIndex_r ⇒ number

Computes the orientation index of the direction of the point q relative to the directed line segment p1-p2.

Kind: Exported member
Returns: number - -1 if q lies to the left of p1-p2, 0 if q is collinear with p1-p2, 1 if q lies to the right of p1-p2.
See: https://libgeos.org/doxygen/geos__c_8h.html

ParamTypeDescription
handlenumberA pointer to the GEOS context handle.
AxnumberThe x-coordinate of the first point of the line segment.
AynumberThe y-coordinate of the first point of the line segment.
BxnumberThe x-coordinate of the second point of the line segment.
BynumberThe y-coordinate of the second point of the line segment.
PxnumberThe x-coordinate of the point to test.
PynumberThe y-coordinate of the point to test.