com.vividsolutions.jts.algorithm
Class RobustCGAlgorithms

java.lang.Object
  extended bycom.vividsolutions.jts.algorithm.CGAlgorithms
      extended bycom.vividsolutions.jts.algorithm.RobustCGAlgorithms

public class RobustCGAlgorithms
extends CGAlgorithms

Robust versions of various fundamental Computational Geometric algorithms. The algorithms are made robust by use of the RobustDeterminant class.

Version:
1.4.0

Field Summary
 
Fields inherited from class com.vividsolutions.jts.algorithm.CGAlgorithms
CLOCKWISE, COLLINEAR, COUNTERCLOCKWISE, LEFT, RIGHT, STRAIGHT
 
Constructor Summary
RobustCGAlgorithms()
           
 
Method Summary
 int computeOrientation(Coordinate p1, Coordinate p2, Coordinate q)
          Computes the orientation of a point q to the directed line segment p1-p2.
 boolean isCCW(Coordinate[] ring)
          Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise.
 boolean isOnLine(Coordinate p, Coordinate[] pt)
          Test whether a point lies on the line segments defined by a list of coordinates.
 boolean isPointInRing(Coordinate p, Coordinate[] ring)
          This algorithm does not attempt to first check the point against the envelope of the ring.
static int orientationIndex(Coordinate p1, Coordinate p2, Coordinate q)
          Returns the index of the direction of the point q relative to a vector specified by p1-p2.
 
Methods inherited from class com.vividsolutions.jts.algorithm.CGAlgorithms
distanceLineLine, distancePointLine, distancePointLinePerpendicular, length, signedArea
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RobustCGAlgorithms

public RobustCGAlgorithms()
Method Detail

orientationIndex

public static int orientationIndex(Coordinate p1,
                                   Coordinate p2,
                                   Coordinate q)
Returns the index of the direction of the point q relative to a vector specified by p1-p2.

Parameters:
p1 - the origin point of the vector
p2 - the final point of the vector
q - the point to compute the direction to
Returns:
1 if q is counter-clockwise (left) from p1-p2

isCCW

public boolean isCCW(Coordinate[] ring)
Computes whether a ring defined by an array of Coordinate is oriented counter-clockwise.

This algorithm is valid only for coordinate lists which do not contain repeated points.

Specified by:
isCCW in class CGAlgorithms
Parameters:
ring - an array of coordinates forming a ring
Returns:
true if the ring is oriented counter-clockwise.

isPointInRing

public boolean isPointInRing(Coordinate p,
                             Coordinate[] ring)
This algorithm does not attempt to first check the point against the envelope of the ring.

Specified by:
isPointInRing in class CGAlgorithms
Parameters:
ring - assumed to have first point identical to last point
Returns:
true if the point lies in the interior of the ring

isOnLine

public boolean isOnLine(Coordinate p,
                        Coordinate[] pt)
Description copied from class: CGAlgorithms
Test whether a point lies on the line segments defined by a list of coordinates.

Specified by:
isOnLine in class CGAlgorithms
Returns:
true true if the point is a vertex of the line or lies in the interior of a line segment in the linestring

computeOrientation

public int computeOrientation(Coordinate p1,
                              Coordinate p2,
                              Coordinate q)
Description copied from class: CGAlgorithms
Computes the orientation of a point q to the directed line segment p1-p2. The orientation of a point relative to a directed line segment indicates which way you turn to get to q after travelling from p1 to p2.

Specified by:
computeOrientation in class CGAlgorithms
Returns:
1 if q is counter-clockwise from p1-p2