A complex 3D surface can be represented by a triangular mesh which is a collection of planar 3D triangles as shown in the figure below.

Write a function that finds the area of any 3D surface represented by as set of 3D points P (a Nx3 matrix) and triangles T (a Mx3 matrix) that contains the three vertices of the triangles (as row indices of the matrix P). The surface area is essentially the sum of all the triangle areas. Note that the triangles are in 3D.
Find the equation for the area of a triangle from this webpage http://mathworld.wolfram.com/TriangleArea.html.
Example: Three sides of a cube.
Input P = [0 0 0; 1 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];
Output
area = 3
uj5u.com熱心網友回復:
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/24794.html
標籤:機器視覺
上一篇:關于一個簡單演算法題的時間復雜度
