Search in sources :

Example 1 with IncrementalDelaunayTriangulator

use of org.locationtech.jts.triangulate.IncrementalDelaunayTriangulator in project graphhopper by graphhopper.

the class QuadEdgeSubdivisionTest method testJtsDelaunayTriangulator.

@Test
public void testJtsDelaunayTriangulator() {
    Vertex v1 = new Vertex(0.0, 0.0, 0.0);
    Vertex v2 = new Vertex(1.0, -1.0, 1.0);
    Vertex v3 = new Vertex(1.0, 1.0, 0.0);
    Vertex v4 = new Vertex(2.0, 0.0, 0.0);
    Vertex v5 = new Vertex(1.0, -3.0, 0.0);
    QuadEdgeSubdivision quadEdgeSubdivision = new QuadEdgeSubdivision(new Envelope(0.0, 2.0, -1.0, 1.0), 0.001);
    IncrementalDelaunayTriangulator triangulator = new IncrementalDelaunayTriangulator(quadEdgeSubdivision);
    triangulator.insertSite(v1);
    triangulator.insertSite(v2);
    triangulator.insertSite(v3);
    triangulator.insertSite(v4);
    triangulator.insertSite(v5);
    assertEquals(5, quadEdgeSubdivision.getVertices(false).size());
}
Also used : Vertex(org.locationtech.jts.triangulate.quadedge.Vertex) IncrementalDelaunayTriangulator(org.locationtech.jts.triangulate.IncrementalDelaunayTriangulator) Envelope(org.locationtech.jts.geom.Envelope) QuadEdgeSubdivision(org.locationtech.jts.triangulate.quadedge.QuadEdgeSubdivision) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Envelope (org.locationtech.jts.geom.Envelope)1 IncrementalDelaunayTriangulator (org.locationtech.jts.triangulate.IncrementalDelaunayTriangulator)1 QuadEdgeSubdivision (org.locationtech.jts.triangulate.quadedge.QuadEdgeSubdivision)1 Vertex (org.locationtech.jts.triangulate.quadedge.Vertex)1