use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class UnaryUnionTest method doTest.
private void doTest(final String expectedWKT, final String... inputWKT) throws ParseException {
Geometry result;
final Collection<Geometry> geoms = GeometryUtils.readWKT(inputWKT);
if (geoms.size() == 0) {
final GeometryFactory geometryFactory = GeometryFactory.DEFAULT_3D;
result = UnaryUnionOp.union(geoms, geometryFactory);
} else {
result = UnaryUnionOp.union(geoms);
}
Assert.assertEquals(GeometryUtils.readWKT(expectedWKT), result);
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class SimpleRayCrossingStressTest method testGrid.
public void testGrid() {
// Use fixed PM to try and get at least some points hitting the boundary
final GeometryFactory geomFactory = GeometryFactory.fixed2d(0, 1.0, 1.0);
// GeometryFactoryI geomFactory = new GeometryFactoryI();
final PerturbedGridPolygonBuilder gridBuilder = new PerturbedGridPolygonBuilder(geomFactory);
gridBuilder.setNumLines(20);
gridBuilder.setLineWidth(10.0);
final Geometry area = gridBuilder.getGeometry();
final SimpleRayCrossingPointInAreaLocator pia = new SimpleRayCrossingPointInAreaLocator(area);
final PointInAreaStressTester gridTester = new PointInAreaStressTester(geomFactory, area);
gridTester.setNumPoints(100000);
gridTester.setPIA(pia);
final boolean isCorrect = gridTester.run();
assertTrue(isCorrect);
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class TriangulationFunctions method delaunayEdges.
public static Lineal delaunayEdges(final Geometry geom) {
GeometryFactory geometryFactory = geom.getGeometryFactory();
geometryFactory = geometryFactory.convertScales(0, 0, 0);
final QuadEdgeDelaunayTinBuilder builder = new QuadEdgeDelaunayTinBuilder(geometryFactory);
builder.insertVertices(geom);
final Lineal edges = builder.getEdges();
return edges;
}
use of com.revolsys.geometry.model.GeometryFactory 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;
}
use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.
the class TriangulationFunctions method delaunayEdgesWithTolerance.
public static Geometry delaunayEdgesWithTolerance(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);
final Lineal edges = builder.getEdges();
return edges;
}
Aggregations