Tesselate.Tesselator.BeginContour C# (CSharp) Метод

BeginContour() публичный Метод

public BeginContour ( ) : void
Результат void
        public void BeginContour()
        {
            RequireState(ProcessingState.InPolygon);
            processingState = ProcessingState.InContour;
            lastHalfEdge = null;
            if (cacheCount > 0)
            {
                // Just set a flag so we don't get confused by empty contours
                emptyCache = true;
            }
        }

Usage Example

Пример #1
0
        public float[] TessPolygon(float[] vertex2dCoords, int[] contourEndPoints, out int areaCount)
        {
            vertexts.Clear();//reset
            //
            int ncoords = vertex2dCoords.Length / 2;

            if (ncoords == 0)
            {
                areaCount = 0; return(null);
            }

            int nn = 0;

            for (int i = 0; i < ncoords; ++i)
            {
                vertexts.Add(new Vertex(vertex2dCoords[nn++], vertex2dCoords[nn++]));
            }
            //-----------------------
            tessListener.Reset(vertexts);
            //-----------------------
            tess.BeginPolygon();

            int nContourCount = contourEndPoints.Length;
            int beginAt       = 0;

            for (int m = 0; m < nContourCount; ++m)
            {
                int thisContourEndAt = (contourEndPoints[m] + 1) / 2;
                tess.BeginContour();
                for (int i = beginAt; i < thisContourEndAt; ++i)
                {
                    Vertex v = vertexts[i];
                    tess.AddVertex(v.m_X, v.m_Y, 0, i);
                }
                beginAt = thisContourEndAt + 1;
                tess.EndContour();
            }


            tess.EndPolygon();
            //-----------------------
            List <Vertex> vertextList = tessListener.resultVertexList;
            //-----------------------------
            //switch how to fill polygon
            int j = vertextList.Count;

            float[] vtx = new float[j * 2];
            int     n   = 0;

            for (int p = 0; p < j; ++p)
            {
                var v = vertextList[p];
                vtx[n]     = (float)v.m_X;
                vtx[n + 1] = (float)v.m_Y;
                n         += 2;
            }
            //triangle list
            areaCount = j;
            return(vtx);
        }
All Usage Examples Of Tesselate.Tesselator::BeginContour