Exemplo n.º 1
0
        private void RenderMaximumFaceGroup(Face fOrig)
        {
            /* We want to find the largest triangle fan or strip of unmarked faces
             * which includes the given face fOrig.  There are 3 possible fans
             * passing through fOrig (one centered at each vertex), and 3 possible
             * strips (one for each CCW permutation of the vertices).  Our strategy
             * is to try all of these, and take the primitive which uses the most
             * triangles (a greedy approach).
             */
            HalfEdge  e   = fOrig.halfEdgeThisIsLeftFaceOf;
            FaceCount max = new FaceCount(1, e, RenderTriangle);
            FaceCount newFace;

            max.size   = 1;
            max.eStart = e;

            if (!this.EdgeCallBackSet)
            {
                newFace = MaximumFan(e); if (newFace.size > max.size)
                {
                    max = newFace;
                }
                newFace = MaximumFan(e.nextEdgeCCWAroundLeftFace); if (newFace.size > max.size)
                {
                    max = newFace;
                }
                newFace = MaximumFan(e.Lprev); if (newFace.size > max.size)
                {
                    max = newFace;
                }

                newFace = MaximumStrip(e); if (newFace.size > max.size)
                {
                    max = newFace;
                }
                newFace = MaximumStrip(e.nextEdgeCCWAroundLeftFace); if (newFace.size > max.size)
                {
                    max = newFace;
                }
                newFace = MaximumStrip(e.Lprev); if (newFace.size > max.size)
                {
                    max = newFace;
                }
            }

            max.CallRender(this, max.eStart, max.size);
        }
Exemplo n.º 2
0
        void RenderMaximumFaceGroup(Face fOrig)
        {
            /* We want to find the largest triangle fan or strip of unmarked faces
            * which includes the given face fOrig.  There are 3 possible fans
            * passing through fOrig (one centered at each vertex), and 3 possible
            * strips (one for each CCW permutation of the vertices).  Our strategy
            * is to try all of these, and take the primitive which uses the most
            * triangles (a greedy approach).
            */
            HalfEdge e = fOrig.halfEdgeThisIsLeftFaceOf;
            FaceCount max = new FaceCount(1, e, new FaceCount.RenderDelegate(RenderTriangle));
            FaceCount newFace;

            max.size = 1;
            max.eStart = e;

            if (!this.EdgeCallBackSet)
            {
                newFace = MaximumFan(e); if (newFace.size > max.size) { max = newFace; }
                newFace = MaximumFan(e.nextEdgeCCWAroundLeftFace); if (newFace.size > max.size) { max = newFace; }
                newFace = MaximumFan(e.Lprev); if (newFace.size > max.size) { max = newFace; }

                newFace = MaximumStrip(e); if (newFace.size > max.size) { max = newFace; }
                newFace = MaximumStrip(e.nextEdgeCCWAroundLeftFace); if (newFace.size > max.size) { max = newFace; }
                newFace = MaximumStrip(e.Lprev); if (newFace.size > max.size) { max = newFace; }
            }

            max.CallRender(this, max.eStart, max.size);
        }