/** * Gets the CCW edge around the left face before this edge. * * @return the previous left face edge. */ public final QuadEdge lPrev() { return next.sym(); }
/** * Gets the dual of this edge, directed from its left to its right. * * @return the inverse rotated edge. */ public final QuadEdge invRot() { return rot.sym(); }
/** * Sets the vertex for this edge's destination * * @param d the destination vertex */ void setDest(Vertex d) { sym().setOrig(d); }
/** * 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(); }
/** * Gets the vertex for the edge's destination * * @return the destination vertex */ public final Vertex dest() { return sym().orig(); }
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; }
/** * 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; }
public QuadEdgeTriangle getAdjacentTriangleAcrossEdge(int edgeIndex) { return (QuadEdgeTriangle) getEdge(edgeIndex).sym().getData(); }
/** * Tests if this quadedge and another have the same line segment geometry, * regardless of orientation. * * @param qe a quadege * @return true if the quadedges are based on the same line segment regardless of orientation */ public boolean equalsNonOriented(QuadEdge qe) { if (equalsOriented(qe)) return true; if (equalsOriented(qe.sym())) return true; return false; }
QuadEdge sym = curr.sym(); if (! visitedEdges.contains(sym)) edgeStack.push(sym);
private void process(QuadEdgeTriangle currTri, TraversalVisitor visitor) { currTri.getNeighbours(); for (int i = 0; i < 3; i++) { QuadEdgeTriangle neighTri = (QuadEdgeTriangle) currTri.getEdge(i).sym().getData(); if (neighTri == null) continue; if (visitor.visit(currTri, i, neighTri)) triQueue.addLast(neighTri); } }
/** * Deletes a quadedge from the subdivision. Linked quadedges are updated to * reflect the deletion. * * @param e * the quadedge to delete */ public void delete(QuadEdge e) { QuadEdge.splice(e, e.oPrev()); QuadEdge.splice(e.sym(), e.sym().oPrev()); QuadEdge eSym = e.sym(); QuadEdge eRot = e.rot(); QuadEdge eRotSym = e.rot().sym(); // this is inefficient on an ArrayList, but this method should be called infrequently quadEdges.remove(e); quadEdges.remove(eSym); quadEdges.remove(eRot); quadEdges.remove(eRotSym); e.delete(); eSym.delete(); eRot.delete(); eRotSym.delete(); }
public int getAdjacentTriangleEdgeIndex(int i) { return getAdjacentTriangleAcrossEdge(i).getEdgeIndex(getEdge(i).sym()); }
/** * Turns an edge counterclockwise inside its enclosing quadrilateral. * * @param e the quadedge to turn */ public static void swap(QuadEdge e) { QuadEdge a = e.oPrev(); QuadEdge b = e.sym().oPrev(); splice(e, a); splice(e.sym(), b); splice(e, a.lNext()); splice(e.sym(), b.lNext()); e.setOrig(a.dest()); e.setDest(b.dest()); }
/** * Gets the primary edge of this quadedge and its <tt>sym</tt>. * The primary edge is the one for which the origin * and destination coordinates are ordered * according to the standard {@link Coordinate} ordering * * @return the primary quadedge */ public QuadEdge getPrimary() { if (orig().getCoordinate().compareTo(dest().getCoordinate()) <= 0) return this; else return sym(); }
/** * Tests whether a QuadEdge is an edge on the border of the frame facets and * the internal facets. E.g. an edge which does not itself touch a frame * vertex, but which touches an edge which does. * * @param e * the edge to test * @return true if the edge is on the border of the frame */ public boolean isFrameBorderEdge(QuadEdge e) { // MD debugging QuadEdge[] leftTri = new QuadEdge[3]; getTriangleEdges(e, leftTri); // System.out.println(new QuadEdgeTriangle(leftTri).toString()); QuadEdge[] rightTri = new QuadEdge[3]; getTriangleEdges(e.sym(), rightTri); // System.out.println(new QuadEdgeTriangle(rightTri).toString()); // check other vertex of triangle to left of edge Vertex vLeftTriOther = e.lNext().dest(); if (isFrameVertex(vLeftTriOther)) return true; // check other vertex of triangle to right of edge Vertex vRightTriOther = e.sym().lNext().dest(); if (isFrameVertex(vRightTriOther)) return true; return false; }
/** * Creates a new QuadEdge connecting the destination of a to the origin of * b, in such a way that all three have the same left face after the * connection is complete. Additionally, the data pointers of the new edge * are set. * * @return the connected edge. */ public static QuadEdge connect(QuadEdge a, QuadEdge b) { QuadEdge e = makeEdge(a.dest(), b.orig()); splice(e, a.lNext()); splice(e.sym(), b); return e; }
/** * 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; }