Description
Polygon2D does not detect crossing if the triangle crosses through points of the polygon and none of the points are inside it. For example:
public void testLineCrossingPolygonPoints() { Polygon p = new Polygon(new double[] {0, -1, 0, 1, 0}, new double[] {-1, 0, 1, 0, -1}); Polygon2D polygon2D = Polygon2D.create(p); PointValues.Relation rel = polygon2D.relateTriangle(GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(-1.5)), GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0)), GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(1.5)), GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0)), GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(-1.5)), GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0))); assertEquals(PointValues.Relation.CELL_CROSSES_QUERY, rel); }
nknize you might want to look at this as I am not sure what to do.
Attachments
Attachments
Issue Links
- links to