@SuppressWarnings("unchecked") // JTS is not generified private Collection<QuadEdge> getPrimaryEdges() { return (Collection<QuadEdge>) triangulation.getPrimaryEdges(true); }
continue; processed.add(e); int cut = cut(e.orig().getZ(), e.dest().getZ(), z0); if (cut == 0) { continue; // While, next edge if (triangulation.isFrameVertex(e.orig())) { cC = moveEpsilonTowards(e.dest().getCoordinate(), e.orig().getCoordinate()); } else if (triangulation.isFrameVertex(e.dest())) { cC = moveEpsilonTowards(e.orig().getCoordinate(), e.dest().getCoordinate()); } else { cC = e.orig().midPoint(e.dest()).getCoordinate(); QuadEdge E1 = ccw ? e.oNext().getPrimary() : e.oPrev().getPrimary(); QuadEdge E2 = ccw ? e.dPrev().getPrimary() : e.dNext().getPrimary(); int cut1 = E1 == null ? 0 : cut(E1.orig().getZ(), E1.dest().getZ(), z0); int cut2 = E2 == null ? 0 : cut(E2.orig().getZ(), E2.dest().getZ(), z0); boolean ok1 = cut1 != 0 && !processed.contains(E1); boolean ok2 = cut2 != 0 && !processed.contains(E2);
conformingDelaunayTriangulator.formInitialDelaunay(); QuadEdgeSubdivision tin = conformingDelaunayTriangulator.getSubdivision(); for (Vertex vertex : (Collection<Vertex>) tin.getVertices(true)) { if (tin.isFrameVertex(vertex)) { vertex.setZ(Double.MAX_VALUE);
for (Vertex vertex : (Collection<Vertex>) tin.getVertices(true)) { if (tin.isFrameVertex(vertex)) { vertex.setZ(Double.MAX_VALUE); } else { Double aDouble = z1.get(vertex.getCoordinate()); if (aDouble != null) { vertex.setZ(aDouble); } else { vertex.setZ(Double.MAX_VALUE); for (Vertex vertex : (Collection<Vertex>) tin.getVertices(true)) { JsonFeature feature = new JsonFeature(); feature.setGeometry(geometryFactory.createPoint(vertex.getCoordinate())); HashMap<String, Object> properties = new HashMap<>(); properties.put("z", vertex.getZ()); feature.setProperties(properties); response.polygons.add(feature); for (QuadEdge edge : (Collection<QuadEdge>) tin.getPrimaryEdges(false)) { JsonFeature feature = new JsonFeature(); feature.setGeometry(edge.toLineSegment().toGeometry(geometryFactory)); HashMap<String, Object> properties = new HashMap<>(); feature.setProperties(properties);
public void getEdgeSegment(int i, LineSegment seg) { seg.p0 = edge[i].orig().getCoordinate(); int nexti = (i + 1) % 3; seg.p1 = edge[nexti].orig().getCoordinate(); }
/** * Tests whether a QuadEdge is an edge incident on a frame triangle vertex. * * @param e * the edge to test * @return true if the edge is connected to the frame triangle */ public boolean isFrameEdge(QuadEdge e) { if (isFrameVertex(e.orig()) || isFrameVertex(e.dest())) return true; return false; }
/** * Gets the neighbours of this triangle. If there is no neighbour triangle, * the array element is <code>null</code> * * @return an array containing the 3 neighbours of this triangle */ public QuadEdgeTriangle[] getNeighbours() { QuadEdgeTriangle[] neigh = new QuadEdgeTriangle[3]; for (int i = 0; i < 3; i++) { neigh[i] = (QuadEdgeTriangle) getEdge(i).sym().getData(); } return neigh; }
/** * Gets the coordinates for each triangle in the subdivision as an array. * * @param includeFrame * true if the frame triangles should be included * @return a list of Coordinate[4] representing each triangle */ public List getTriangleCoordinates(boolean includeFrame) { TriangleCoordinatesVisitor visitor = new TriangleCoordinatesVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangles(); }
/** * Gets a list of the triangles in the subdivision, * specified as an array of the triangle {@link Vertex}es. * * @param includeFrame * true if the frame triangles should be included * @return a List of Vertex[3] arrays */ public List getTriangleVertices(boolean includeFrame) { TriangleVertexListVisitor visitor = new TriangleVertexListVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangleVertices(); }
public int getAdjacentTriangleEdgeIndex(int i) { return getAdjacentTriangleAcrossEdge(i).getEdgeIndex(getEdge(i).sym()); }
/** * Gets a list of the triangles * in the subdivision, specified as * an array of the primary quadedges around the triangle. * * @param includeFrame * true if the frame triangles should be included * @return a List of QuadEdge[3] arrays */ public List getTriangleEdges(boolean includeFrame) { TriangleEdgesListVisitor visitor = new TriangleEdgesListVisitor(); visitTriangles(visitor, includeFrame); return visitor.getTriangleEdges(); }
private QuadEdge initSubdiv() { // build initial subdivision from frame QuadEdge ea = makeEdge(frameVertex[0], frameVertex[1]); QuadEdge eb = makeEdge(frameVertex[1], frameVertex[2]); QuadEdge.splice(ea.sym(), eb); QuadEdge ec = makeEdge(frameVertex[2], frameVertex[0]); QuadEdge.splice(eb.sym(), ec); QuadEdge.splice(ec.sym(), ea); return ea; }
/** * Locates an edge e, such that either v is on e, or e is an edge of a triangle containing v. * The search starts from the last located edge and proceeds on the general direction of v. */ public QuadEdge locate(Vertex v) { if (! lastEdge.isLive()) { init(); } QuadEdge e = subdiv.locateFromEdge(v, lastEdge); lastEdge = e; return e; } }
/** * Finds a quadedge of a triangle containing a location * specified by a {@link Coordinate}, if one exists. * * @param p the Coordinate to locate * @return a quadedge on the edge of a triangle which touches or contains the location * or null if no such triangle exists */ public QuadEdge locate(Coordinate p) { return locator.locate(new Vertex(p)); }
/** * Creates a new triangulator using the given {@link QuadEdgeSubdivision}. * The triangulator uses the tolerance of the supplied subdivision. * * @param subdiv * a subdivision in which to build the TIN */ public IncrementalDelaunayTriangulator(QuadEdgeSubdivision subdiv) { this.subdiv = subdiv; isUsingTolerance = subdiv.getTolerance() > 0.0; }
/** * Gets the CCW edge around the left face before this edge. * * @return the previous left face edge. */ public final QuadEdge lPrev() { return next.sym(); }
public Coordinate getCoordinate(int i) { return edge[i].orig().getCoordinate(); }