Trouble with finding the surface area given surface triangles their vertices and the vertices' normals
Show older comments
Hi, I am trying to find the surface area of a figure and as the title suggests and am unable to do so. I have tried a couple ways (a double integration of the surface normals by calling the trapz function within a trapz function) and taking the cross product to find the area of the individual triangles and then adding the areas up. I keep running into errors though and was hoping I could find help here. I think my problems lie in a misunderstanding of the triangle indices data I have and how to use them to find the surface area.
I have 3 matrices, vertices(mx3), triangles((~2*m)x3), and normals(mx3). My understanding is that the columns of vertices are the x, y, and z coordinates respectively, the columns of normals are the x, y, and z coordinates of each vector for each point in vertices, and then triangles is what I am a little confused about. I think it is the indices of the coordinate points in vertices, but am not sure. Could someone shed some light on what it probably is, and if I am right, give an explanation so that I may understand it better?
Further, if you could provide a push in the right direction to getting the surface area, I would greatly appreciate it!
the trapz within a trapz code I tried to use was influenced by the help given for this question: http://www.mathworks.com/matlabcentral/answers/84614-finding-the-surface-area-of-a-3-d-plot
x = linspace(floor(min(conc(:,1))),ceil(max(conc(:,1))));
y = linspace(floor(min(conc(:,2))),ceil(max(conc(:,2))));
S = sqrt(normals(:,1).^2 + normals(:,2).^2 + normals(:,3).^2)./normals(:,3)
SA = trapz(y,trapz(x,S));
where conc is the concatenated matrix of the matrices of vertices (there is more than one vertices matrix, but I just concatenate them vertically), and normals is the vertically concatenated matrices of surface normals.
This leads to the error "Error using trapz (line 58) LENGTH(X) must equal the length of Y in dim 1."
Thanks in advance for any help and insight!
Accepted Answer
More Answers (0)
Categories
Find more on Numerical Integration and Differentiation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!