LibTessDotNet.Mesh.SplitEdge C# (CSharp) Method

SplitEdge() public method

Splits eOrg into two edges eOrg and eNew such that eNew == eOrg.Lnext. The new vertex is eOrg.Dst == eNew.Org. eOrg and eNew will have the same left face.
public SplitEdge ( LibTessDotNet.MeshUtils.Edge eOrg ) : LibTessDotNet.MeshUtils.Edge
eOrg LibTessDotNet.MeshUtils.Edge
return LibTessDotNet.MeshUtils.Edge
        public MeshUtils.Edge SplitEdge(MeshUtils.Edge eOrg)
        {
            var eTmp = AddEdgeVertex(eOrg);
            var eNew = eTmp._Sym;

            // Disconnect eOrg from eOrg->Dst and connect it to eNew->Org
            MeshUtils.Splice(eOrg._Sym, eOrg._Sym._Oprev);
            MeshUtils.Splice(eOrg._Sym, eNew);

            // Set the vertex and face information
            eOrg._Dst = eNew._Org;
            eNew._Dst._anEdge = eNew._Sym; // may have pointed to eOrg->Sym
            eNew._Rface = eOrg._Rface;
            eNew._winding = eOrg._winding; // copy old winding information
            eNew._Sym._winding = eOrg._Sym._winding;

            return eNew;
        }

Usage Example

Esempio n. 1
0
        public void AddContour(ContourVertex[] vertices, int count, ContourOrientation forceOrientation)
        {
            if (_mesh == null)
            {
                _mesh = new Mesh();
            }

            bool reverse = false;

            if (forceOrientation != ContourOrientation.Original)
            {
                float area = SignedArea(vertices, count);
                reverse = (forceOrientation == ContourOrientation.Clockwise && area < 0.0f) || (forceOrientation == ContourOrientation.CounterClockwise && area > 0.0f);
            }

            MeshUtils.Edge e = null;
            for (int i = 0; i < count; ++i)
            {
                if (e == null)
                {
                    e = _mesh.MakeEdge();
                    _mesh.Splice(e, e._Sym);
                }
                else
                {
                    // Create a new vertex and edge which immediately follow e
                    // in the ordering around the left face.
                    _mesh.SplitEdge(e);
                    e = e._Lnext;
                }

                int index = reverse ? count - 1 - i : i;
                // The new vertex is now e._Org.
                e._Org._coords = vertices[index].Position;
                e._Org._data   = vertices[index].Data;

                // The winding of an edge says how the winding number changes as we
                // cross from the edge's right face to its left face.  We add the
                // vertices in such an order that a CCW contour will add +1 to
                // the winding number of the region inside the contour.
                e._winding      = 1;
                e._Sym._winding = -1;
            }
        }
All Usage Examples Of LibTessDotNet.Mesh::SplitEdge