예제 #1
0
        /// <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)
        {
            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);
        }
예제 #2
0
        /// <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)
        {
            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 baseQE = q0;

            baseQE.Orig = o;
            baseQE.Dest = d;
            return(baseQE);
        }