public static Point[] getPointArray(final Geometry geometry, final int vertexCount) { final Point[] points = new Point[vertexCount]; int i = 0; for (final Vertex vertex : geometry.vertices()) { if (i > vertexCount) { break; } points[i++] = vertex.newPoint(); } return points; }
/** * Tests whether any representative point of the test Geometry intersects the target geometry. * Only handles test geometries which are Punctual (dimension 0) * * @param geom a Punctual geometry to test * @return true if any point of the argument intersects the prepared geometry */ public boolean isAnyTestPointInTarget(final Geometry geometry) { /** * This could be optimized by using the segment index on the lineal target. However, it seems * like the L/P case would be pretty rare in practice. */ final PointLocator locator = new PointLocator(); final Geometry realGeometry = getLine(); for (final Vertex vertex : geometry.vertices()) { if (realGeometry.intersects(vertex)) { return true; } } return false; }