use of com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder in project com.revolsys.open by revolsys.
the class DelaunayTest method testBoundaryDo.
public void testBoundaryDo(final Geometry expected) {
final QuadEdgeDelaunayTinBuilder tinBuilder = new QuadEdgeDelaunayTinBuilder(this.geometryFactory);
tinBuilder.insertVertices(expected);
final Geometry actual = tinBuilder.getBoundary();
Assert.assertEquals(expected, actual);
}
use of com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder in project com.revolsys.open by revolsys.
the class DelaunayTest method runDelaunay.
void runDelaunay(final String sitesWKT, final boolean computeTriangles, final String expectedWKT) throws ParseException {
final Geometry sites = this.geometryFactory.geometry(sitesWKT);
final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(this.geometryFactory);
builder.insertVertices(sites);
Geometry result = null;
if (computeTriangles) {
result = builder.getTrianglesPolygonal();
} else {
result = builder.getEdges();
}
// System.out.println(result);
Geometry expected = this.geometryFactory.geometry(expectedWKT);
result = result.normalize();
expected = expected.normalize();
if (!expected.equalsExact(result, COMPARISON_TOLERANCE)) {
System.err.println(expected.convertAxisCount(2));
System.err.println(result.convertAxisCount(2));
Assert.fail("Not equal");
}
}
use of com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder 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;
}
use of com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder in project com.revolsys.open by revolsys.
the class TriangulationFunctions method delaunayTriangles.
public static Polygonal delaunayTriangles(final Geometry geometry) {
final GeometryFactory geometryFactory = geometry.getGeometryFactory();
final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
builder.insertVertices(geometry);
final Polygonal triangles = builder.getTrianglesPolygonal();
return triangles;
}
Aggregations