Class Quadrant
java.lang.Object
org.locationtech.jts.geom.Quadrant
Utility functions for working with quadrants of the Euclidean plane.
Quadrants are referenced and numbered as follows:
1 - NW | 0 - NE -------+------- 2 - SW | 3 - SE
- Version:
- 1.7
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcommonHalfPlane(int quad1, int quad2) Returns the right-hand quadrant of the halfplane defined by the two quadrants, or -1 if the quadrants are opposite, or the quadrant if they are identical.static booleanisInHalfPlane(int quad, int halfPlane) Returns whether the given quadrant lies within the given halfplane (specified by its right-hand quadrant).static booleanisNorthern(int quad) Returns true if the given quadrant is 0 or 1.static booleanisOpposite(int quad1, int quad2) Returns true if the quadrants are 1 and 3, or 2 and 4static intquadrant(double dx, double dy) Returns the quadrant of a directed line segment (specified as x and y displacements, which cannot both be 0).static intquadrant(Coordinate p0, Coordinate p1) Returns the quadrant of a directed line segment from p0 to p1.
-
Field Details
-
NE
public static final int NE- See Also:
-
NW
public static final int NW- See Also:
-
SW
public static final int SW- See Also:
-
SE
public static final int SE- See Also:
-
-
Constructor Details
-
Quadrant
public Quadrant()
-
-
Method Details
-
quadrant
public static int quadrant(double dx, double dy) Returns the quadrant of a directed line segment (specified as x and y displacements, which cannot both be 0).- Throws:
IllegalArgumentException- if the displacements are both 0
-
quadrant
Returns the quadrant of a directed line segment from p0 to p1.- Throws:
IllegalArgumentException- if the points are equal
-
isOpposite
public static boolean isOpposite(int quad1, int quad2) Returns true if the quadrants are 1 and 3, or 2 and 4 -
commonHalfPlane
public static int commonHalfPlane(int quad1, int quad2) Returns the right-hand quadrant of the halfplane defined by the two quadrants, or -1 if the quadrants are opposite, or the quadrant if they are identical. -
isInHalfPlane
public static boolean isInHalfPlane(int quad, int halfPlane) Returns whether the given quadrant lies within the given halfplane (specified by its right-hand quadrant). -
isNorthern
public static boolean isNorthern(int quad) Returns true if the given quadrant is 0 or 1.
-