///<summary> /// 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. ///</summary> ///<param name="a"></param> ///<param name="b"></param> ///<returns>the connected edge</returns> public static QuadEdge Connect(QuadEdge a, QuadEdge b) { QuadEdge e = MakeEdge(a.Destination, b.Origin); Splice(e, a.LeftNext); Splice(e.Sym(), b); return(e); }
///<summary> /// Tests if this quadedge and another have the same line segment geometry /// with the same orientation. ///</summary> ///<param name="qe">a quadege</param> ///<returns>true if the quadedges are based on the same line segment</returns> public Boolean EqualsOriented(QuadEdge qe) { if (Origin.Equals(qe.Origin) && Destination.Equals(qe.Destination)) { return(true); } return(false); }
///<summary> /// Tests if this quadedge and another have the same line segment geometry, ///</summary> ///<param name="qe">a quadege</param> ///<returns>true if the quadedges are based on the same line segment regardless of orientation regardless of orientation.</returns> public Boolean EqualsNonOriented(QuadEdge qe) { if (EqualsOriented(qe)) { return(true); } if (EqualsOriented(qe.Sym())) { return(true); } return(false); }
///<summary> /// Turns an edge counterclockwise inside its enclosing quadrilateral. ///</summary> ///<param name="e">the quadedge to turn</param> public static void Swap(QuadEdge e) { QuadEdge a = e.OriginPrev; QuadEdge b = e.Sym().OriginPrev; Splice(e, a); Splice(e.Sym(), b); Splice(e, a.LeftNext); Splice(e.Sym(), b.LeftNext); e.Origin = a.Destination; e.Destination = b.Destination; }
///<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"></param> ///<param name="b"></param> public static void Splice(QuadEdge a, QuadEdge b) { QuadEdge alpha = a.OriginNext.Rot; QuadEdge beta = b.OriginNext.Rot; QuadEdge t1 = b.OriginNext; QuadEdge t2 = a.OriginNext; QuadEdge t3 = beta.OriginNext; QuadEdge t4 = alpha.OriginNext; a.Next = t1; b.Next = t2; alpha.Next = t3; beta.Next = t4; }
///<summary> /// Creates a new QuadEdge quartet from {@link Vertex} o to {@link 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(FVec3 o, FVec3 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.Next = q0; q1.Next = q3; q2.Next = q2; q3.Next = q1; QuadEdge baseQE = q0; baseQE.Origin = o; baseQE.Destination = d; return(baseQE); }
///<summary> /// Marks this quadedge as being deleted. /// This does not free the memory used by /// this quadedge quartet, but indicates /// that this edge no longer participates /// in a subdivision. ///</summary> public void Delete() { _rot = null; }