/// <summary> /// 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. /// </summary> /// <param name="a">an edge to splice</param> /// <param name="b">an edge to splice</param> public static void Splice(QuadEdge a, QuadEdge b) { var alpha = a.ONext.Rot; var beta = b.ONext.Rot; var t1 = b.ONext; var t2 = a.ONext; var t3 = beta.ONext; var t4 = alpha.ONext; a.SetNext(t1); b.SetNext(t2); alpha.SetNext(t3); beta.SetNext(t4); }
/// <summary> /// Creates a new QuadEdge quartet from <see cref="Vertex"/>o to <see cref="Vertex"/> d. /// </summary> /// <param name="o">the origin Vertex</param> /// <param name="d">the destination Vertex</param> /// <returns>the new QuadEdge quartet</returns> public static QuadEdge MakeEdge(Vertex o, Vertex d) { var q0 = new QuadEdge(); var q1 = new QuadEdge(); var q2 = new QuadEdge(); var 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); var baseQE = q0; baseQE.Orig = o; baseQE.Dest = d; return(baseQE); }