/** * Gets all edges which are incident on the origin of the given edge. * * @param start * the edge to start at * @return a List of edges which have their origin at the origin of the given * edge */ public static List findEdgesIncidentOnOrigin(QuadEdge start) { List incEdge = new ArrayList(); QuadEdge qe = start; do { incEdge.add(qe); qe = qe.oNext(); } while (qe != start); return incEdge; }
/** * Gets the edge around the right face ccw before this edge. * * @return the previous right face edge. */ public final QuadEdge rPrev() { return this.sym().oNext(); }
/** * Splices two edges together or apart. * Splice affects the two edge rings around the origins of a and b, and, independently, the two * edge rings around the left faces of <tt>a</tt> and <tt>b</tt>. * In each case, (i) if the two rings are distinct, * Splice will combine them into one, or (ii) if the two are the same ring, Splice will break it * into two separate pieces. Thus, Splice can be used both to attach the two edges together, and * to break them apart. * * @param a an edge to splice * @param b an edge to splice * */ public static void splice(QuadEdge a, QuadEdge b) { QuadEdge alpha = a.oNext().rot(); QuadEdge beta = b.oNext().rot(); QuadEdge t1 = b.oNext(); QuadEdge t2 = a.oNext(); QuadEdge t3 = beta.oNext(); QuadEdge t4 = alpha.oNext(); a.setNext(t1); b.setNext(t2); alpha.setNext(t3); beta.setNext(t4); }
/** * Gets the next CW edge around (into) the destination of this edge. * * @return the previous destination edge. */ public final QuadEdge dPrev() { return this.invRot().oNext().invRot(); }
/** * Gets the next CCW edge around (into) the destination of this edge. * * @return the next destination edge. */ public final QuadEdge dNext() { return this.sym().oNext().sym(); }
/** * Gets the CCW edge around the left face following this edge. * * @return the next left face edge. */ public final QuadEdge lNext() { return this.invRot().oNext().rot(); }
/** * Gets the triangles which are adjacent (include) to a * given vertex of this triangle. * * @param vertexIndex the vertex to query * @return a list of the vertex-adjacent triangles */ public List getTrianglesAdjacentToVertex(int vertexIndex) { // Assert: isVertex List adjTris = new ArrayList(); QuadEdge start = getEdge(vertexIndex); QuadEdge qe = start; do { QuadEdgeTriangle adjTri = (QuadEdgeTriangle) qe.getData(); if (adjTri != null) { adjTris.add(adjTri); } qe = qe.oNext(); } while (qe != start); return adjTris; }
/** * Locates the edge between the given vertices, if it exists in the * subdivision. * * @param p0 a coordinate * @param p1 another coordinate * @return the edge joining the coordinates, if present * or null if no such edge exists */ public QuadEdge locate(Coordinate p0, Coordinate p1) { // find an edge containing one of the points QuadEdge e = locator.locate(new Vertex(p0)); if (e == null) return null; // normalize so that p0 is origin of base edge QuadEdge base = e; if (e.dest().getCoordinate().equals2D(p0)) base = e.sym(); // check all edges around origin of base edge QuadEdge locEdge = base; do { if (locEdge.dest().getCoordinate().equals2D(p1)) return locEdge; locEdge = locEdge.oNext(); } while (locEdge != base); return null; }
/** * Gets all edges which are incident on the origin of the given edge. * * @param start * the edge to start at * @return a List of edges which have their origin at the origin of the given * edge */ public static List findEdgesIncidentOnOrigin(QuadEdge start) { List incEdge = new ArrayList(); QuadEdge qe = start; do { incEdge.add(qe); qe = qe.oNext(); } while (qe != start); return incEdge; }
/** * Gets the edge around the right face ccw before this edge. * * @return the previous right face edge. */ public final QuadEdge rPrev() { return this.sym().oNext(); }
/** * Splices two edges together or apart. * Splice affects the two edge rings around the origins of a and b, and, independently, the two * edge rings around the left faces of <tt>a</tt> and <tt>b</tt>. * In each case, (i) if the two rings are distinct, * Splice will combine them into one, or (ii) if the two are the same ring, Splice will break it * into two separate pieces. Thus, Splice can be used both to attach the two edges together, and * to break them apart. * * @param a an edge to splice * @param b an edge to splice * */ public static void splice(QuadEdge a, QuadEdge b) { QuadEdge alpha = a.oNext().rot(); QuadEdge beta = b.oNext().rot(); QuadEdge t1 = b.oNext(); QuadEdge t2 = a.oNext(); QuadEdge t3 = beta.oNext(); QuadEdge t4 = alpha.oNext(); a.setNext(t1); b.setNext(t2); alpha.setNext(t3); beta.setNext(t4); }
/** * Gets the next CCW edge around (into) the destination of this edge. * * @return the next destination edge. */ public final QuadEdge dNext() { return this.sym().oNext().sym(); }
/** * Gets the CCW edge around the left face following this edge. * * @return the next left face edge. */ public final QuadEdge lNext() { return this.invRot().oNext().rot(); }
/** * Gets the next CW edge around (into) the destination of this edge. * * @return the previous destination edge. */ public final QuadEdge dPrev() { return this.invRot().oNext().invRot(); }
/** * Gets the triangles which are adjacent (include) to a * given vertex of this triangle. * * @param vertexIndex the vertex to query * @return a list of the vertex-adjacent triangles */ public List getTrianglesAdjacentToVertex(int vertexIndex) { // Assert: isVertex List adjTris = new ArrayList(); QuadEdge start = getEdge(vertexIndex); QuadEdge qe = start; do { QuadEdgeTriangle adjTri = (QuadEdgeTriangle) qe.getData(); if (adjTri != null) { adjTris.add(adjTri); } qe = qe.oNext(); } while (qe != start); return adjTris; }
public static double interpolateZ(DelaunayTriangulationBuilder triangulation, Coordinate coordinate) { QuadEdgeSubdivision quadEdgeSubdivision = triangulation.getSubdivision(); QuadEdge edge = quadEdgeSubdivision.locate(coordinate); return new Vertex(coordinate.x, coordinate.y) .interpolateZValue(edge.orig(), edge.dest(), edge.oNext().dest()); }
/** * Locates the edge between the given vertices, if it exists in the * subdivision. * * @param p0 a coordinate * @param p1 another coordinate * @return the edge joining the coordinates, if present * or null if no such edge exists */ public QuadEdge locate(Coordinate p0, Coordinate p1) { // find an edge containing one of the points QuadEdge e = locator.locate(new Vertex(p0)); if (e == null) return null; // normalize so that p0 is origin of base edge QuadEdge base = e; if (e.dest().getCoordinate().equals2D(p0)) base = e.sym(); // check all edges around origin of base edge QuadEdge locEdge = base; do { if (locEdge.dest().getCoordinate().equals2D(p1)) return locEdge; locEdge = locEdge.oNext(); } while (locEdge != base); return null; }