Esempio n. 1
0
        public static Face create(Vertex[] vtxArray, int[] indices)
        {
            Face     face   = new Face();
            HalfEdge hePrev = null;

            for (int i = 0; i < indices.Length; i++)
            {
                HalfEdge he = new HalfEdge(vtxArray[indices[i]], face);
                if (hePrev != null)
                {
                    he.setPrev(hePrev);
                    hePrev.setNext(he);
                }
                else
                {
                    face.he0 = he;
                }
                hePrev = he;
            }
            face.he0.setPrev(hePrev);
            hePrev.setNext(face.he0);

            // compute the normal and offset
            face.computeNormalAndCentroid();
            return(face);
        }