예제 #1
0
        // What this basically does is search for common faces in the two linkedFaces lists
        // It uses & destroys face marks
        public void CollectVertexPairFaces(VertexPair pair, IndexList commonFaces)
        {
            IndexList il0 = vertices[pair.v[0]].linkedFaces;             // surrounding faces
            IndexList il1 = vertices[pair.v[1]].linkedFaces;             // surrounding faces

            int[] v0Faces = il0.array;
            int[] v1Faces = il1.array;
            int   v0Count = il0.Count;
            int   v1Count = il1.Count;
            int   tag     = GetUniqueTag();

            commonFaces.GrowToCapacity(v1Count);
            for (int i = 0; i < v0Count; ++i)
            {
                faces[v0Faces[i]].mark = tag;
            }
            for (int i = 0; i < v1Count; ++i)
            {
                int faceIndex = v1Faces[i];
                if (faces[faceIndex].mark == tag)
                {
                    commonFaces.AddUnsafe(faceIndex);
                }
            }
        }
예제 #2
0
        public void CollectCollapseFacesForVertexPair(VertexPair pair, IndexList changeFaces0, IndexList changeFaces1, IndexList commonFaces)
        {
            IndexList il0 = vertices[pair.v[0]].linkedFaces;
            IndexList il1 = vertices[pair.v[1]].linkedFaces;

            int[] v0Faces = il0.array;
            int[] v1Faces = il1.array;
            int   v0Count = il0.Count;
            int   v1Count = il1.Count;
            int   tag     = GetUniqueTag();

            // Grow target lists to save on checks later
            changeFaces0.GrowToCapacity(v0Count);
            changeFaces1.GrowToCapacity(v1Count);
            commonFaces.GrowToCapacity(v0Count);             // could be min(v0count, v1count), but that's probably slower

            for (int i = 0; i < v1Count; ++i)
            {
                faces[v1Faces[i]].mark = tag;
            }
            for (int i = 0; i < v0Count; ++i)
            {
                int  faceIndex = v0Faces[i];
                Face f         = faces[faceIndex];
                //	if (f.valid) {
                if (f.mark == tag)
                {
                    commonFaces.AddUnsafe(faceIndex);
                    f.mark = 0;
                }
                else
                {
                    changeFaces0.AddUnsafe(faceIndex);
                }
                //	}
            }
            for (int i = 0; i < v1Count; ++i)
            {
                int  faceIndex = v1Faces[i];
                Face f         = faces[faceIndex];
                if (/*f.valid &&*/ f.mark == tag)
                {
                    changeFaces1.AddUnsafe(faceIndex);
                }
            }
        }