Skip to content
On this page

geos.GEOSSegmentIntersection ⇒ number

Computes the intersection point of two line segments, if there is one.

Kind: Exported member
Returns: number - 1 if an intersection point is found, 0 if no intersection point is found, or -1 on error.

ParamTypeDescription
p0xnumberThe x-coordinate of the first endpoint of the first segment.
p0ynumberThe y-coordinate of the first endpoint of the first segment.
p1xnumberThe x-coordinate of the second endpoint of the first segment.
p1ynumberThe y-coordinate of the second endpoint of the first segment.
q0xnumberThe x-coordinate of the first endpoint of the second segment.
q0ynumberThe y-coordinate of the first endpoint of the second segment.
q1xnumberThe x-coordinate of the second endpoint of the second segment.
q1ynumberThe y-coordinate of the second endpoint of the second segment.
rxnumberA pointer to a double where the x-coordinate of the intersection point will be stored, if any.
rynumberA pointer to a double where the y-coordinate of the intersection point will be stored, if any.

geos.GEOSSegmentIntersection_r ⇒ number

Computes the intersection point of two line segments, if there is one. This is a reentrant version that takes a GEOS context handle as an argument.

Kind: Exported member
Returns: number - 1 if an intersection point is found, 0 if no intersection point is found, or -1 on error.

ParamTypeDescription
handlenumberA pointer to the GEOS context handle.
p0xnumberThe x-coordinate of the first endpoint of the first segment.
p0ynumberThe y-coordinate of the first endpoint of the first segment.
p1xnumberThe x-coordinate of the second endpoint of the first segment.
p1ynumberThe y-coordinate of the second endpoint of the first segment.
q0xnumberThe x-coordinate of the first endpoint of the second segment.
q0ynumberThe y-coordinate of the first endpoint of the second segment.
q1xnumberThe x-coordinate of the second endpoint of the second segment.
q1ynumberThe y-coordinate of the second endpoint of the second segment.
rxnumberA pointer to a double where the x-coordinate of the intersection point will be stored, if any.
rynumberA pointer to a double where the y-coordinate of the intersection point will be stored, if any.