JTS Topology Suite version 1.13

com.vividsolutions.jts.algorithm
Class RectangleLineIntersector

java.lang.Object
  extended by com.vividsolutions.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.

Author:
Martin Davis

Constructor Summary
RectangleLineIntersector(Envelope rectEnv)
          Creates a new intersector for the given query rectangle, specified as an Envelope.
 
Method Summary
 boolean intersects(Coordinate p0, Coordinate p1)
          Tests whether the query rectangle intersects a given line segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleLineIntersector

public RectangleLineIntersector(Envelope rectEnv)
Creates a new intersector for the given query rectangle, specified as an Envelope.

Parameters:
rectEnv - the query rectangle, specified as an Envelope
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 segment
p1 - the second endpoint of the segment
Returns:
true if the rectangle intersects the segment

JTS Topology Suite version 1.13