/// <summary> /// Calculates Normal Unit Vector of each given triangle. /// </summary> public static void CalculateTriangleNormals() { // Calculate all triangle normals. for (int x = 0; x < GeometryData.Triangles.Count; x++) { // Grab the vertices from the vertices array onto the Vertex vertexOne = GeometryData.Vertices[GeometryData.Triangles[x].VertexOne]; Vertex vertexTwo = GeometryData.Vertices[GeometryData.Triangles[x].VertexTwo]; Vertex vertexThree = GeometryData.Vertices[GeometryData.Triangles[x].VertexThree]; GeometryData.Triangles[x].Normals = TriangleUtilities.CalculateNormal(vertexOne, vertexTwo, vertexThree); } }
/// <summary> /// Calculates the normal unit vector of each individual triangle by performing a cross /// product of two of the vertices (relative to a specific point of vertex 1 "simulated 0,0"). /// </summary> private void CalculateTriangleNormals() { TriangleUtilities.CalculateTriangleNormals(); }