"bob " <behzad.majidi@gmail.com> wrote in message <jej95s$o86$1@newscl01ah.mathworks.com>...
> Hey,
> I have a stl file of a 3d particle with irregular shape. I want to open this file in Matlab and measure the surface area.
> How can I do that?
          
I can't help with parsing the STL file, but the total surface area should simply be the sum of the areas of all the triangles represented there. (I assume its facets are all triangles.)
Suppose you have somehow obtained three arrays, V1, V2, and V3, each one n by 3 in size, where n is the number of triangles, and where a corresponding row in each gives the three coordinates of each of the three vertices of a represented triangle. We simply find the sum of the areas of these n triangles.
C = cross(V2V1,V3V1,2);
A = 1/2*sum(sqrt(sum(C.^2,2))); % A is the total area
Roger Stafford
