/** * Gets the edges for the triangle to the left of the given {@link QuadEdge}. * * @param startQE * @param triEdge * * @throws IllegalArgumentException * if the edges do not form a triangle */ public static void getTriangleEdges(QuadEdge startQE, QuadEdge[] triEdge) { triEdge[0] = startQE; triEdge[1] = triEdge[0].lNext(); triEdge[2] = triEdge[1].lNext(); if (triEdge[2].lNext() != triEdge[0]) throw new IllegalArgumentException("Edges do not form a triangle"); }
curr = curr.lNext(); } while (curr != edge);
/** * 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; }
/** * 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()); }
base = connect(e, base.sym()); e = base.oPrev(); } while (e.lNext() != startEdge);
base = subdiv.connect(e, base.sym()); e = base.oPrev(); } while (e.lNext() != startEdge);