Search in sources :

Example 1 with LocateFailureException

use of com.revolsys.elevation.tin.quadedge.LocateFailureException in project com.revolsys.open by revolsys.

the class TriangulationFunctions method delaunayTrianglesWithToleranceNoError.

public static Polygonal delaunayTrianglesWithToleranceNoError(final Geometry geom, final double tolerance) {
    GeometryFactory geometryFactory = geom.getGeometryFactory();
    geometryFactory = geometryFactory.convertScales(tolerance, tolerance, tolerance);
    final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
    builder.insertVertices(geom);
    try {
        final Polygonal triangles = builder.getTrianglesPolygonal();
        return triangles;
    } catch (final LocateFailureException ex) {
        System.out.println(ex);
    // ignore this exception and drop thru
    }
    /**
     * Get the triangles created up until the error
     */
    final Polygonal triangles = builder.getSubdivision().getTrianglesPolygonal(geom.getGeometryFactory());
    return triangles;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Polygonal(com.revolsys.geometry.model.Polygonal) LocateFailureException(com.revolsys.elevation.tin.quadedge.LocateFailureException) QuadEdgeDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)

Aggregations

LocateFailureException (com.revolsys.elevation.tin.quadedge.LocateFailureException)1 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Polygonal (com.revolsys.geometry.model.Polygonal)1