/** * Gets the faces of the computed triangulation as a {@link GeometryCollection} * of {@link Polygon}. * * @param geomFact the geometry factory to use to create the output * @return the faces of the triangulation */ public Geometry getTriangles(GeometryFactory geomFact) { create(); return subdiv.getTriangles(geomFact); }
/** * Gets the faces of the computed triangulation as a {@link GeometryCollection} * of {@link Polygon}. * * @param geomFact the geometry factory to use to create the output * @return the faces of the triangulation */ public Geometry getTriangles(GeometryFactory geomFact) { create(); return subdiv.getTriangles(geomFact); } }
public static Geometry delaunayTrianglesWithToleranceNoError(Geometry geom, double tolerance) { DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder(); builder.setSites(geom); builder.setTolerance(tolerance); try { Geometry tris = builder.getTriangles(geom.getFactory()); return tris; } catch (LocateFailureException ex) { System.out.println(ex); // ignore this exception and drop through } /** * Get the triangles created up until the error */ Geometry tris = builder.getSubdivision().getTriangles(geom.getFactory()); return tris; }