/** * Creates a new QuadEdge quartet from {@link Vertex} o to {@link Vertex} d. * * @param o * the origin Vertex * @param d * the destination Vertex * @return the new QuadEdge quartet */ public static QuadEdge makeEdge(Vertex o, Vertex d) { QuadEdge q0 = new QuadEdge(); QuadEdge q1 = new QuadEdge(); QuadEdge q2 = new QuadEdge(); QuadEdge q3 = new QuadEdge(); q0.rot = q1; q1.rot = q2; q2.rot = q3; q3.rot = q0; q0.setNext(q0); q1.setNext(q3); q2.setNext(q2); q3.setNext(q1); QuadEdge base = q0; base.setOrig(o); base.setDest(d); return base; }
/** * 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); }