Example #1
0
        /// <summary>
        /// Creates a new edge from eOrg->Dst to eDst->Org, and returns the corresponding half-edge eNew.
        /// If eOrg->Lface == eDst->Lface, this splits one loop into two,
        /// and the newly created loop is eNew->Lface.  Otherwise, two disjoint
        /// loops are merged into one, and the loop eDst->Lface is destroyed.
        ///
        /// If (eOrg == eDst), the new face will have only two edges.
        /// If (eOrg->Lnext == eDst), the old face is reduced to a single edge.
        /// If (eOrg->Lnext->Lnext == eDst), the old face is reduced to two edges.
        /// </summary>
        public MeshUtils.Edge Connect(MeshUtils.Edge eOrg, MeshUtils.Edge eDst)
        {
            var eNew    = MeshUtils.MakeEdge(eOrg);
            var eNewSym = eNew._Sym;

            bool joiningLoops = false;

            if (eDst._Lface != eOrg._Lface)
            {
                // We are connecting two disjoint loops -- destroy eDst->Lface
                joiningLoops = true;
                MeshUtils.KillFace(eDst._Lface, eOrg._Lface);
            }

            // Connect the new edge appropriately
            MeshUtils.Splice(eNew, eOrg._Lnext);
            MeshUtils.Splice(eNewSym, eDst);

            // Set the vertex and face information
            eNew._Org    = eOrg._Sym._Org;
            eNewSym._Org = eDst._Org;
            eNew._Lface  = eNewSym._Lface = eOrg._Lface;

            // Make sure the old face points to a valid half-edge
            eOrg._Lface._anEdge = eNewSym;

            if (!joiningLoops)
            {
                MeshUtils.MakeFace(MeshUtils.Face.Create(), eNew, eOrg._Lface);
            }

            return(eNew);
        }
Example #2
0
 public MeshUtils.Edge MakeEdge()
 {
     MeshUtils.Edge edge = MeshUtils.MakeEdge(_eHead);
     MeshUtils.MakeVertex(edge, _vHead);
     MeshUtils.MakeVertex(edge._Sym, _vHead);
     MeshUtils.MakeFace(edge, _fHead);
     return(edge);
 }
Example #3
0
        /// <summary>
        /// Creates one edge, two vertices and a loop (face).
        /// The loop consists of the two new half-edges.
        /// </summary>
        public MeshUtils.Edge MakeEdge()
        {
            var e = MeshUtils.MakeEdge(_eHead);

            MeshUtils.MakeVertex(MeshUtils.Vertex.Create(), e, _vHead);
            MeshUtils.MakeVertex(MeshUtils.Vertex.Create(), e._Sym, _vHead);
            MeshUtils.MakeFace(MeshUtils.Face.Create(), e, _fHead);

            return(e);
        }
Example #4
0
 public MeshUtils.Edge AddEdgeVertex(MeshUtils.Edge eOrg)
 {
     MeshUtils.Edge edge = MeshUtils.MakeEdge(eOrg);
     MeshUtils.Edge sym  = edge._Sym;
     MeshUtils.Splice(edge, eOrg._Lnext);
     edge._Org = eOrg._Dst;
     MeshUtils.MakeVertex(sym, edge._Org);
     edge._Lface = (sym._Lface = eOrg._Lface);
     return(edge);
 }
Example #5
0
        /// <summary>
        /// Creates one edge, two vertices and a loop (face).
        /// The loop consists of the two new half-edges.
        /// </summary>
        public MeshUtils.Edge MakeEdge(IPool pool)
        {
            var e = MeshUtils.MakeEdge(pool, _eHead);

            MeshUtils.MakeVertex(pool, e, _vHead);
            MeshUtils.MakeVertex(pool, e._Sym, _vHead);
            MeshUtils.MakeFace(pool, e, _fHead);

            return(e);
        }
Example #6
0
        /// <summary>
        /// Creates a new edge such that eNew == eOrg.Lnext and eNew.Dst is a newly created vertex.
        /// eOrg and eNew will have the same left face.
        /// </summary>
        public MeshUtils.Edge AddEdgeVertex(MeshUtils.Edge eOrg)
        {
            var eNew    = MeshUtils.MakeEdge(eOrg);
            var eNewSym = eNew._Sym;

            // Connect the new edge appropriately
            MeshUtils.Splice(eNew, eOrg._Lnext);

            // Set vertex and face information
            eNew._Org = eOrg._Sym._Org;
            MeshUtils.MakeVertex(MeshUtils.Vertex.Create(), eNewSym, eNew._Org);
            eNew._Lface = eNewSym._Lface = eOrg._Lface;

            return(eNew);
        }
Example #7
0
        public MeshUtils.Edge Connect(MeshUtils.Edge eOrg, MeshUtils.Edge eDst)
        {
            MeshUtils.Edge edge = MeshUtils.MakeEdge(eOrg);
            MeshUtils.Edge sym  = edge._Sym;
            bool           flag = false;

            if (eDst._Lface != eOrg._Lface)
            {
                flag = true;
                MeshUtils.KillFace(eDst._Lface, eOrg._Lface);
            }
            MeshUtils.Splice(edge, eOrg._Lnext);
            MeshUtils.Splice(sym, eDst);
            edge._Org           = eOrg._Dst;
            sym._Org            = eDst._Org;
            edge._Lface         = (sym._Lface = eOrg._Lface);
            eOrg._Lface._anEdge = sym;
            if (!flag)
            {
                MeshUtils.MakeFace(edge, eOrg._Lface);
            }
            return(edge);
        }