Exemple #1
0
        public void ComputeVertexMatricesForTriangles()
        {
            var triangles = TriangleList;
            var vertices  = VertexList;

            FourthVertexForTriangle = new Vector3[NumberOfTriangles];

            for (int i = 0; i < NumberOfTriangles; i++)
            {
                int v1 = triangles[i * 3 + 0];
                int v2 = triangles[i * 3 + 1];
                int v3 = triangles[i * 3 + 2];

                FourthVertexForTriangle[i] = TriangleUtils.CalculateFourthVertex(vertices[v1], vertices[v2], vertices[v3]);

                var vertexMat = TriangleUtils.CreateTriangleMatrix(vertices[v1], vertices[v2], vertices[v3]);

                VertexMatrices.Add(vertexMat);
                InverseVertexMatrices.Add(vertexMat.Inverse());

                Debug.Log("Matrix for Tri #" + i + " : " + vertexMat.ToString());
                Debug.Log("Inverse Matrix for Tri #" + i + " : " + InverseVertexMatrices[i].ToString());
            }
        }