quadrantFromCoords static method
Returns the quadrant of a directed line segment from p0 to p1.
@throws IllegalArgumentException if the points are equal
Implementation
static int quadrantFromCoords(Coordinate p0, Coordinate p1) {
if (p1.x == p0.x && p1.y == p0.y)
throw ArgumentError(
"Cannot compute the quadrant for two identical points $p0");
if (p1.x >= p0.x) {
if (p1.y >= p0.y)
return NE;
else
return SE;
} else {
if (p1.y >= p0.y)
return NW;
else
return SW;
}
}