public static List<double> ComputeAngle(TriMesh.Face face) { List<double> angles = new List<double>(); double angle1 = ComputeAngle(face.GetVertex(0).HalfEdge); double angle2 = ComputeAngle(face.GetVertex(1).HalfEdge); double angle3 = ComputeAngle(face.GetVertex(2).HalfEdge); angles.Add(angle1); angles.Add(angle2); angles.Add(angle3); return angles; }
//face area public static double ComputeAreaFaceTwo(TriMesh.Face face) { Vector3D v1 = new Vector3D(face.GetVertex(0).Traits.Position.x, face.GetVertex(0).Traits.Position.y, face.GetVertex(0).Traits.Position.z); Vector3D v2 = new Vector3D(face.GetVertex(1).Traits.Position.x, face.GetVertex(1).Traits.Position.y, face.GetVertex(1).Traits.Position.z); Vector3D v3 = new Vector3D(face.GetVertex(2).Traits.Position.x, face.GetVertex(2).Traits.Position.y, face.GetVertex(2).Traits.Position.z); double a = Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) +(v1.y - v2.y) * (v1.y - v2.y) +(v1.z - v2.z) * (v1.z - v2.z)); double b = Math.Sqrt((v3.x - v2.x) * (v3.x - v2.x) +(v3.y - v2.y) * (v3.y - v2.y) +(v3.z - v2.z) * (v3.z - v2.z)); double c = Math.Sqrt((v1.x - v3.x) * (v1.x - v3.x) +(v1.y - v3.y) * (v1.y - v3.y) +(v1.z - v3.z) * (v1.z - v3.z)); double p = (a + b + c) / 2; double area=Math.Sqrt(p * (p - a) * (p - b) * (p - c)); return area; }
public Vector3D ComputeFaceNormals(TriMesh.Face f) { Vector3D p0 = f.GetVertex(0).Traits.Position; Vector3D p1 = f.GetVertex(1).Traits.Position; Vector3D p2 = f.GetVertex(2).Traits.Position; return (p1 - p0).Cross(p2 - p0).Normalize(); }