static List <int> GetPerVertexFaces(int vertex, ref HullFaceData data)
        {
            var         set = new List <int>();
            VertexFaces vf  = data.VertexFaces[vertex];

            for (int j = 0; j < vf.NumFaces; ++j)
            {
                set.Add(data.FaceIndices[vf.FirstFace + j]);
            }
            return(set);
        }
Пример #2
0
        /// <summary>
        /// Computes vertex adjacency for the whole mesh and stores it in the appropriate dictionaries.
        /// </summary>
        public void ComputeVertexAdjacency()
        {
            foreach (MeshVertex vertex in mesh.Vertices)
            {
                foreach (MeshVertex adjacent in vertex.AdjacentVertices())
                {
                    if (!VertexVertex.ContainsKey(vertex.Index))
                    {
                        VertexVertex.Add(vertex.Index, new List <int>()
                        {
                            adjacent.Index
                        });
                    }
                    else
                    {
                        VertexVertex[vertex.Index].Add(adjacent.Index);
                    }
                }

                foreach (MeshFace adjacent in vertex.AdjacentFaces())
                {
                    if (!VertexFaces.ContainsKey(vertex.Index))
                    {
                        VertexFaces.Add(vertex.Index, new List <int>()
                        {
                            adjacent.Index
                        });
                    }
                    else
                    {
                        VertexFaces[vertex.Index].Add(adjacent.Index);
                    }
                }

                foreach (MeshEdge adjacent in vertex.AdjacentEdges())
                {
                    if (!VertexEdges.ContainsKey(vertex.Index))
                    {
                        VertexEdges.Add(vertex.Index, new List <int>()
                        {
                            adjacent.Index
                        });
                    }
                    else
                    {
                        VertexEdges[vertex.Index].Add(adjacent.Index);
                    }
                }
            }
        }