
Write a function that finds the area of any 3 d surface represented by the as the set of 3 d points P (a Nx3 matrix) and triangles T (a Mx3 matrix) that contains the three are of the triangles (as a row indices of the matrix P). The surface area is essentially the sum of all the triangle areas. Note that the triangles are in 3 d.
Find the equation for the area of a triangle from this webpage http://mathworld.wolfram.com/TriangleArea.html.
Example: the Three sides of a cube.
Input P=[1 0 0 0 0 0;; 1 1 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1].
T=[1 2 3; 1, 3, 4, 1, 4, 5, 1, 5 6; 1 6, 7, 1 2 7);
The Output
Area=3
CodePudding user response:
