Package org.locationtech.jts.algorithm
Class ConvexHull.RadialComparator
java.lang.Object
org.locationtech.jts.algorithm.ConvexHull.RadialComparator
- All Implemented Interfaces:
Comparator
- Enclosing class:
ConvexHull
Compares
Coordinates for their angle and distance
relative to an origin.- Version:
- 1.7
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprivate static intpolarCompare(Coordinate o, Coordinate p, Coordinate q) Given two points p and q compare them with respect to their radial ordering about point o.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
origin
-
-
Constructor Details
-
RadialComparator
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator
-
polarCompare
Given two points p and q compare them with respect to their radial ordering about point o. First checks radial ordering. If points are collinear, the comparison is based on their distance to the origin.p invalid input: '<' q iff
- ang(o-p) invalid input: '<' ang(o-q) (e.g. o-p-q is CCW)
- or ang(o-p) == ang(o-q) invalid input: '&'invalid input: '&' dist(o,p) invalid input: '<' dist(o,q)
- Parameters:
o- the originp- a pointq- another point- Returns:
- -1, 0 or 1 depending on whether p is less than, equal to or greater than q
-