use of org.locationtech.jts.triangulate.quadedge.Vertex in project graphhopper by graphhopper.
the class QuadEdgeSubdivisionTest method createQuadEdgeSubdivisionFromTriangleList2.
@Test
public void createQuadEdgeSubdivisionFromTriangleList2() {
Triangulation triangulation = new Triangulation();
triangulation.getVertices().put(0, new Vertex(0.0, -1.0, 0.0));
triangulation.getVertices().put(1, new Vertex(0.0, 0.0, 0.0));
triangulation.getVertices().put(2, new Vertex(1.0, -1.0, 1.0));
triangulation.getVertices().put(3, new Vertex(1.0, 1.0, 0.0));
triangulation.getVertices().put(4, new Vertex(2.0, 0.0, 0.0));
triangulation.getVertices().put(5, new Vertex(1.0, -3.0, 0.0));
triangulation.makeTriangle(0, 3, 1);
triangulation.makeTriangle(1, 2, 5);
triangulation.makeTriangle(2, 4, 5);
triangulation.makeTriangle(3, 4, 2);
triangulation.makeTriangle(1, 3, 2);
ReadableTriangulation readableTriangulation = ReadableTriangulation.wrap(triangulation);
ReadableQuadEdge e1 = readableTriangulation.getEdge(1, 3);
ReadableQuadEdge e2 = readableTriangulation.getEdge(3, 2);
ReadableQuadEdge e3 = readableTriangulation.getEdge(2, 1);
ReadableQuadEdge e4 = readableTriangulation.getEdge(4, 2);
ReadableQuadEdge e41 = readableTriangulation.getEdge(3, 4);
ReadableQuadEdge e5 = readableTriangulation.getEdge(5, 1);
ReadableQuadEdge e6 = readableTriangulation.getEdge(2, 5);
ReadableQuadEdge e7 = readableTriangulation.getEdge(4, 5);
ReadableQuadEdge e0 = readableTriangulation.getEdge(1, 0);
ReadableQuadEdge e00 = readableTriangulation.getEdge(3, 0);
assertTriangle(e1, e2, e3);
assertTriangle(e4, e2.sym(), e41);
assertTriangle(e5, e3.sym(), e6);
assertTriangle(e6.sym(), e4.sym(), e7);
assertVertex(e1, e3.sym(), e5.sym(), e0);
assertVertex(e5, e6.sym(), e7.sym());
assertVertex(e7, e4, e41.sym());
assertVertex(e41, e2, e1.sym(), e00);
assertVertex(e3, e2.sym(), e4.sym(), e6);
ReadableTriangulation triangulation1 = ReadableTriangulation.wrap(triangulation);
ContourBuilder contourBuilder = new ContourBuilder(triangulation1);
Geometry geometry = contourBuilder.computeIsoline(0.5, triangulation1.getEdges());
assertEquals("MULTIPOLYGON (((0.5 -0.5, 1 -2, 1.5 -0.5, 1 0, 0.5 -0.5)))", geometry.toString());
}
Aggregations