Exemple #1
0
        protected double GetValue(TriMesh.HalfEdge hf)
        {
            Vector3D top   = hf.FromVertex.Traits.Position;
            Vector3D right = hf.ToVertex.Traits.Position;

            Vector3D[] vi     = this.GetV(hf);
            double     volume = 0;

            for (int i = 0; i < vi.Length - 1; i++)
            {
                volume += TriMeshUtil.ComputeVolume(top, right, vi[i], vi[i + 1]);
            }
            return(Math.Abs(volume));
        }
Exemple #2
0
        public static Dictionary <string, string> BuildMeshInfo(TriMesh mesh)
        {
            Dictionary <string, string> meshinfo = new Dictionary <string, string>();

            meshinfo.Add("Verties", mesh.Vertices.Count.ToString());
            meshinfo.Add("Edges", mesh.Edges.Count.ToString());
            meshinfo.Add("Faces", mesh.Faces.Count.ToString());

            meshinfo.Add("Elur Formula For Genus=0", "V-E+F = 2");
            meshinfo.Add("General Elur Formula on Genus !=0", "V-E+F=2(C-G)-B, C is Component Number,G is Genus Number,B is boundary Number");
            meshinfo.Add("Elur Characteristic is ", "2(C-G)-B or V-E+F");
            meshinfo.Add("Elur Characteristic on Current Mesh",
                         "V-E+F = " +
                         mesh.Vertices.Count.ToString() + " - " +
                         mesh.Edges.Count.ToString() + " + " +
                         mesh.Faces.Count.ToString() + " = " +
                         CountEulerCharacteristic(mesh).ToString());
            meshinfo.Add("Component", CountComponents(mesh, false).ToString());
            meshinfo.Add("Boundary Number", TriMeshUtil.CountBoundary(mesh).ToString());
            meshinfo.Add("Genus", "G=-((V-E+F)+B)/2+C");

            meshinfo.Add("Genus on Current mesh", CountGenus(mesh).ToString());
            meshinfo.Add("Total Gaussian Curvature is ", TriMeshUtil.ComputeTotalGaussianCurvarture(mesh).ToString());
            meshinfo.Add("Gaussian-Bonnet Theroem", "2*PI*(V-E+F) = SUM(Gaussian Curvature)");
            meshinfo.Add("Current Gaussian-Bonnet Theroem",
                         "2*PI*(V-E+F)=" +
                         "2 x 3.1415 x " + CountEulerCharacteristic(mesh).ToString() + " = " +
                         (Math.PI * 2 * CountEulerCharacteristic(mesh))
                         + " ??=  " + TriMeshUtil.ComputeTotalGaussianCurvarture(mesh)
                         );
            meshinfo.Add("Average Area", TriMeshUtil.ComputeAreaAverage(mesh).ToString());
            meshinfo.Add("Volume", TriMeshUtil.ComputeVolume(mesh).ToString());
            meshinfo.Add("Total Area", TriMeshUtil.ComputeAreaTotal(mesh).ToString());

            return(meshinfo);
        }