Пример #1
0
        private void InitVertexInfo()
        {
            this.dataGridViewVertex.Rows.Clear();

            foreach (TriMesh.Vertex vertex in Mesh.Vertices)
            {
                this.dataGridViewVertex.Rows.Add(vertex.Index, vertex.Traits.Position.x, vertex.Traits.Position.y, vertex.Traits.Position.z);
            }
            foreach (TriMesh.Face face in Mesh.Faces)
            {
                this.dataGridViewFace.Rows.Add(face.Index, face.GetVertex(0).Index, face.GetVertex(1).Index, face.GetVertex(2).Index, TriMeshUtil.ComputeAreaFace(face));
            }

            foreach (TriMesh.Edge edge in Mesh.Edges)
            {
                string face0 = "null";
                string face1 = "null";
                if (edge.Face0 != null)
                {
                    face0 = edge.Face0.Index.ToString();
                }
                if (edge.Face1 != null)
                {
                    face1 = edge.Face1.Index.ToString();
                }
                this.dataGridViewEdge.Rows.Add(edge.Index,
                                               edge.Vertex0.Index,
                                               edge.Vertex1.Index, face0,
                                               face1, TriMeshUtil.ComputeEdgeLength(edge),
                                               TriMeshUtil.ComputeDihedralAngle(edge) / 3.14 * 180);
            }
        }
Пример #2
0
        public double[] ColorEdgeByDihedralAngle(TriMesh mesh, double dehidraAngleMin, double dehidraAngleMax)
        {
            double[] angles = TriMeshUtil.ComputeDihedralAngle(mesh);

            for (int i = 0; i < angles.Length; i++)
            {
                angles[i] *= (360 / Math.PI);
            }

            ColorEdge(mesh, angles, dehidraAngleMin, dehidraAngleMax);

            return(angles);
        }
Пример #3
0
        public void SetRange(TriMesh mesh, EnumColorItem item, ref CriteriaRange criteriaRange)
        {
            double[] range = null;
            switch (item)
            {
            case EnumColorItem.DihedralAngle:
                range = TriMeshUtil.ComputeDihedralAngle(mesh);
                break;

            case EnumColorItem.Gaussian:
                range = TriMeshUtil.ComputeGaussianCurvatureIntegrated(mesh);
                break;

            case EnumColorItem.Mean:
                range = TriMeshUtil.ComputeMeanCurvature(mesh);
                break;
            }

            criteriaRange.Max = TriMeshFunction.Instance.ComputeMax(range);
            criteriaRange.Min = TriMeshFunction.Instance.ComputeMin(range);
        }