com.vividsolutions.jts.algorithm
Class NonRobustCGAlgorithms

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

public class NonRobustCGAlgorithms
extends CGAlgorithms

Non-robust versions of various fundamental Computational Geometric algorithms. The non-robustness is due to rounding error in floating point computation.

Version:
1.4.0

Field Summary
 
Fields inherited from class com.vividsolutions.jts.algorithm.CGAlgorithms
CLOCKWISE, COLLINEAR, COUNTERCLOCKWISE, LEFT, RIGHT, STRAIGHT
 
Constructor Summary
NonRobustCGAlgorithms()
           
 
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)
          Tests whether a ring (simple polygon) 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)
          ring is expected to contain a closing point; i.e.
 
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

NonRobustCGAlgorithms

public NonRobustCGAlgorithms()
Method Detail

isPointInRing

public boolean isPointInRing(Coordinate p,
                             Coordinate[] ring)
ring is expected to contain a closing point; i.e. ring[0] = ring[length - 1]

Specified by:
isPointInRing in class CGAlgorithms
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

isCCW

public boolean isCCW(Coordinate[] ring)
Description copied from class: CGAlgorithms
Tests whether a ring (simple polygon) is oriented counter-clockwise. The list of points is assumed to have the first and last points equal. If the point list does not form a valid ring the result is undefined. This method is not guaranteed to work on coordinate lists which 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

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