Exemplo n.º 1
0
        public void AdjustFunction(TriMesh mesh, ref double[] function)
        {
            LinkedList <TriMesh.Edge> link = new LinkedList <HalfEdgeMesh.Edge>();

            foreach (TriMesh.Edge edge in  mesh.Edges)
            {
                if (function[edge.Vertex0.Index] == function[edge.Vertex1.Index])
                {
                    link.AddLast(edge);
                }
            }

            while (link.Count != 0)
            {
                TriMesh.HalfEdge[] path = TriMeshModify.Sort(link);
                //if (path[0].FromVertex != path[path.Length - 1].ToVertex)
                {
                    double adj = 0.00000001;
                    if (IsMax(path[0].FromVertex, ref function))
                    {
                        adj = -adj;
                    }
                    foreach (TriMesh.HalfEdge hf in path)
                    {
                        function[hf.ToVertex.Index] = function[hf.FromVertex.Index] + adj;
                    }
                }
            }
        }