Package org.locationtech.jts.algorithm
Class RectangleLineIntersector
- java.lang.Object
-
- org.locationtech.jts.algorithm.RectangleLineIntersector
-
public class RectangleLineIntersector extends java.lang.Object
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
Fields Modifier and Type Field Description private Coordinate
diagDown0
private Coordinate
diagDown1
private Coordinate
diagUp0
private Coordinate
diagUp1
private LineIntersector
li
private Envelope
rectEnv
-
Constructor Summary
Constructors Constructor Description RectangleLineIntersector(Envelope rectEnv)
Creates a new intersector for the given query rectangle, specified as anEnvelope
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
intersects(Coordinate p0, Coordinate p1)
Tests whether the query rectangle intersects a given line segment.
-
-
-
Field Detail
-
li
private LineIntersector li
-
rectEnv
private Envelope rectEnv
-
diagUp0
private Coordinate diagUp0
-
diagUp1
private Coordinate diagUp1
-
diagDown0
private Coordinate diagDown0
-
diagDown1
private Coordinate diagDown1
-
-
Method Detail
-
intersects
public boolean intersects(Coordinate p0, Coordinate p1)
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
-
-