MakeEdge() public method

Creates one edge, two vertices and a loop (face). The loop consists of the two new half-edges.
public MakeEdge ( ) : LibTessDotNet.MeshUtils.Edge
return LibTessDotNet.MeshUtils.Edge
Exemplo n.º 1
0
        private void AddSentinel(float smin, float smax, float t)
        {
            MeshUtils.Edge edge = _mesh.MakeEdge();
            edge._Org._s = smax;
            edge._Org._t = t;
            edge._Dst._s = smin;
            edge._Dst._t = t;
            _event       = edge._Dst;
            ActiveRegion activeRegion = new ActiveRegion();

            activeRegion._eUp           = edge;
            activeRegion._windingNumber = 0;
            activeRegion._inside        = false;
            activeRegion._fixUpperEdge  = false;
            activeRegion._sentinel      = true;
            activeRegion._dirty         = false;
            activeRegion._nodeUp        = _dict.Insert(activeRegion);
        }
Exemplo n.º 2
0
        private void AddContourInternal(IList <ContourVertex> vertices, ContourOrientation forceOrientation)
        {
            if (_mesh == null)
            {
                _mesh = _pool.Get <Mesh>();
            }

            bool reverse = false;

            if (forceOrientation != ContourOrientation.Original)
            {
                var area = SignedArea(vertices);
                reverse = (forceOrientation == ContourOrientation.Clockwise && area < new DeterministicFloat(0)) || (forceOrientation == ContourOrientation.CounterClockwise && area > new DeterministicFloat(0));
            }

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

                int index = reverse ? vertices.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;
            }
        }
Exemplo n.º 3
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;
            }
        }