19 #ifndef GEOS_NODING_SEGMENTPOINTCOMPARATOR_H
20 #define GEOS_NODING_SEGMENTPOINTCOMPARATOR_H
22 #include <geos/export.h>
23 #include <geos/geom/Coordinate.h>
39 class GEOS_DLL SegmentPointComparator {
52 compare(
int octant,
const geom::Coordinate& p0,
53 const geom::Coordinate& p1)
60 int xSign = relativeSign(p0.x, p1.x);
61 int ySign = relativeSign(p0.y, p1.y);
65 return compareValue(xSign, ySign);
67 return compareValue(ySign, xSign);
69 return compareValue(ySign, -xSign);
71 return compareValue(-xSign, ySign);
73 return compareValue(-xSign, -ySign);
75 return compareValue(-ySign, -xSign);
77 return compareValue(-ySign, xSign);
79 return compareValue(xSign, -ySign);
87 relativeSign(
double x0,
double x1)
99 compareValue(
int compareSign0,
int compareSign1)
101 if(compareSign0 < 0) {
104 if(compareSign0 > 0) {
107 if(compareSign1 < 0) {
110 if(compareSign1 > 0) {
121 #endif // GEOS_NODING_SEGMENTPOINTCOMPARATOR_H