Search in sources :

Example 1 with QuadEdgeConformingDelaunayTinBuilder

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

the class TriangulationFunctions method conformingDelaunayEdgesWithTolerance.

public static Lineal conformingDelaunayEdgesWithTolerance(final Geometry sites, final Geometry constraints, final double tol) {
    final QuadEdgeConformingDelaunayTinBuilder builder = new QuadEdgeConformingDelaunayTinBuilder();
    builder.setSites(sites);
    builder.setConstraints(constraints);
    builder.setTolerance(tol);
    final GeometryFactory geomFact = sites != null ? sites.getGeometryFactory() : constraints.getGeometryFactory();
    final Lineal triangles = builder.getEdgesLineal(geomFact);
    return triangles;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Lineal(com.revolsys.geometry.model.Lineal) QuadEdgeConformingDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder)

Example 2 with QuadEdgeConformingDelaunayTinBuilder

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

the class ConformingDelaunayTest method runDelaunay.

void runDelaunay(final String sitesWKT, final String constraintsWKT, final boolean computeTriangles, final String expectedWKT) throws ParseException {
    final Geometry sites = this.geometryFactory.geometry(sitesWKT);
    final Geometry constraints = this.geometryFactory.geometry(constraintsWKT);
    final QuadEdgeConformingDelaunayTinBuilder builder = new QuadEdgeConformingDelaunayTinBuilder();
    builder.setSites(sites);
    builder.setConstraints(constraints);
    final GeometryFactory geomFact = GeometryFactory.DEFAULT_3D;
    Geometry result = null;
    if (computeTriangles) {
        result = builder.getTrianglesPolygonal(geomFact);
    } else {
        result = builder.getEdgesLineal(geomFact);
    }
    // System.out.println(result);
    Geometry expectedEdges = this.geometryFactory.geometry(expectedWKT);
    result = result.normalize();
    expectedEdges = expectedEdges.normalize();
    Assert.equals("Triangulation", expectedEdges.equalsExact(result, COMPARISON_TOLERANCE), expectedEdges, result);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) QuadEdgeConformingDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder)

Example 3 with QuadEdgeConformingDelaunayTinBuilder

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

the class TriangulationFunctions method conformingDelaunayTrianglesWithTolerance.

public static Polygonal conformingDelaunayTrianglesWithTolerance(final Geometry sites, final Geometry constraints, final double tol) {
    final QuadEdgeConformingDelaunayTinBuilder builder = new QuadEdgeConformingDelaunayTinBuilder();
    builder.setSites(sites);
    builder.setConstraints(constraints);
    builder.setTolerance(tol);
    final GeometryFactory geomFact = sites != null ? sites.getGeometryFactory() : constraints.getGeometryFactory();
    final Polygonal triangles = builder.getTrianglesPolygonal(geomFact);
    return triangles;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) QuadEdgeConformingDelaunayTinBuilder(com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder) Polygonal(com.revolsys.geometry.model.Polygonal)

Aggregations

QuadEdgeConformingDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeConformingDelaunayTinBuilder)3 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)3 Geometry (com.revolsys.geometry.model.Geometry)1 Lineal (com.revolsys.geometry.model.Lineal)1 Polygonal (com.revolsys.geometry.model.Polygonal)1