Package com.geodesk.geom
Class PointInPolygon
java.lang.Object
com.geodesk.geom.PointInPolygon
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isInside
(int[] coords, double cx, double cy) static int
testFast
(int[] coords, double cx, double cy) Fast but non-robust point-in-polygon test using the ray-crossing method.static int
testFast
(com.geodesk.feature.store.StoredWay.XYIterator iter, double cx, double cy) Fast but non-robust point-in-polygon test using the ray-crossing method.
-
Constructor Details
-
PointInPolygon
public PointInPolygon()
-
-
Method Details
-
isInside
public static boolean isInside(int[] coords, double cx, double cy) -
testFast
public static int testFast(int[] coords, double cx, double cy) Fast but non-robust point-in-polygon test using the ray-crossing method. Points located on a polygon edge (or very close to it) may or may not be considered "inside." Vertexes, however, are always identified correctly. This test can be applied to multiple line strings of the polygon in succession. In that case, the result of each test must be XOR'd with the previous results.- Parameters:
coords
- pairs of x/y coordinates that form a polygon or part thereofcx
- the X-coordinate to testcy
- the Y-coordinate to test- Returns:
- 0 if even number of edges are crossed ("not inside") 1 if odd number of edges are crossed ("inside") -1 if the candidate point corresponds to a vertex
-
testFast
public static int testFast(com.geodesk.feature.store.StoredWay.XYIterator iter, double cx, double cy) Fast but non-robust point-in-polygon test using the ray-crossing method. Points located on a polygon edge (or very close to it) may or may not be considered "inside." Vertexes, however, are always identified correctly. This test can be applied to multiple line strings of the polygon in succession. In that case, the result of each test must be XOR'd with the previous results.- Parameters:
iter
- an XY iterator (consumed by this method)cx
- the X-coordinate to testcy
- the Y-coordinate to test- Returns:
- 0 if even number of edges are crossed ("not inside") 1 if odd number of edges are crossed ("inside")
-