Exemple #1
0
        public SparseMatrix BuildMatrixMeanCurvatureNormalize(TriMesh mesh)
        {
            int          n = mesh.Vertices.Count;
            SparseMatrix L = BuildLaplaceMatrixCotBasic(mesh);

            double[] voronoiArea = TriMeshUtil.ComputeAreaVoronoi(mesh);

            for (int i = 0; i < n; i++)
            {
                double sum = 0;

                foreach (SparseMatrix.Element e in L.Rows[i])
                {
                    e.value = e.value / (voronoiArea[e.i] * 4);
                }

                foreach (SparseMatrix.Element e in L.Rows[i])
                {
                    sum += e.value;
                }

                foreach (SparseMatrix.Element e in L.Rows[i])
                {
                    e.value = e.value / sum;
                }

                L.AddValueTo(i, i, -1);
            }

            L.SortElement();
            return(L);
        }