Package org.locationtech.jts.algorithm
Class RectangleLineIntersector
java.lang.Object
org.locationtech.jts.algorithm.RectangleLineIntersector
Computes whether a rectangle intersects line segments.
Rectangles contain a large amount of inherent symmetry (or to put it another way, although they contain four coordinates they only actually contain 4 ordinates worth of information). The algorithm used takes advantage of the symmetry of the geometric situation to optimize performance by minimizing the number of line intersection tests.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Coordinate
private Coordinate
private Coordinate
private Coordinate
private LineIntersector
private Envelope
-
Constructor Summary
ConstructorsConstructorDescriptionRectangleLineIntersector
(Envelope rectEnv) Creates a new intersector for the given query rectangle, specified as anEnvelope
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
intersects
(Coordinate p0, Coordinate p1) Tests whether the query rectangle intersects a given line segment.
-
Field Details
-
li
-
rectEnv
-
diagUp0
-
diagUp1
-
diagDown0
-
diagDown1
-
-
Constructor Details
-
RectangleLineIntersector
Creates a new intersector for the given query rectangle, specified as anEnvelope
.- Parameters:
rectEnv
- the query rectangle, specified as an Envelope
-
-
Method Details
-
intersects
Tests whether the query rectangle intersects a given line segment.- Parameters:
p0
- the first endpoint of the segmentp1
- the second endpoint of the segment- Returns:
- true if the rectangle intersects the segment
-