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

CheckOrientation() приватный Метод

private CheckOrientation ( ) : void
Результат void
        void CheckOrientation()
        {
            double area;
            Face curFace, faceHead = this.mesh.faceHead;
            ContourVertex vHead = this.mesh.vertexHead;
            HalfEdge curHalfEdge;
            /* When we compute the normal automatically, we choose the orientation
             * so that the sum of the signed areas of all contours is non-negative.
             */
            area = 0;
            for (curFace = faceHead.nextFace; curFace != faceHead; curFace = curFace.nextFace)
            {
                curHalfEdge = curFace.halfEdgeThisIsLeftFaceOf;
                if (curHalfEdge.winding <= 0)
                {
                    continue;
                }

                do
                {
                    area += (curHalfEdge.originVertex.x - curHalfEdge.directionVertex.x)
                        * (curHalfEdge.originVertex.y + curHalfEdge.directionVertex.y);
                    curHalfEdge = curHalfEdge.nextEdgeCCWAroundLeftFace;
                } while (curHalfEdge != curFace.halfEdgeThisIsLeftFaceOf);
            }

            if (area < 0)
            {
                /* Reverse the orientation by flipping all the t-coordinates */
                for (ContourVertex curVertex = vHead.nextVertex; curVertex != vHead; curVertex = curVertex.nextVertex)
                {
                    curVertex.y = -curVertex.y;
                }
            }
        }