Commit 79d8f57c by Marco Berzborn

### added individual polygon surface area calculation method to AC3D Model class

parent ddd0c900
 ... ... @@ -339,6 +339,47 @@ classdef itaAc3dModel S = obj.totalSurface; end function [surfacePolygons, surfacePolygonsMaterial] = getSurfacePolygons(obj) % Calculate the surface area of individual mesh polygons. % First return value is the surface of all polygons. Second % return value is the surface of all polygons grouped by their % assigned materials. triaID = 1; for matID = 1:length(obj.bcGroups) for polyID = 1:length(obj.bcGroups{matID}.polygons) for vertID = 1:(length(obj.bcGroups{matID}.polygons{polyID}(:,1))-2) node1 = obj.nodes(obj.bcGroups{matID}.polygons{polyID}(1 ),:); node2 = obj.nodes(obj.bcGroups{matID}.polygons{polyID}(vertID+1),:); node3 = obj.nodes(obj.bcGroups{matID}.polygons{polyID}(vertID+2),:); % Dreieck nach Triangulation abspeichern triangles{triaID} = [node1;node2;node3]; % Fl?chenberechnung f?r Dreieck a = norm( node1 - node2 ); b = norm( node1 - node3 ); c = norm( node2 - node3 ); surfPoly = real( 1/4 * sqrt( (a+b+c) * (-a+b+c) * (a-b+c) * (a+b-c) ) ); surfacePolygons(triaID) = surfPoly; surfacePolygonsMaterial{matID}(polyID) = surfPoly; % Normalenberechnung f?r Dreieck if norm( cross( (node2-node1), (node3-node1) ) ) == 0 % Schutz gegen Kr?ppel Linien Polygone normals{triaID} = [0 0 0]; else normals{triaID} = cross( (node2-node1), (node3-node1) ) / norm( cross( (node2-node1), (node3-node1) ) ); end % Index inkrement triaID = triaID+1; end end end end function SMat = getMaterialSurface(obj,materialName) % sometimes multiple materials with the same name are defined. in this case, sum up all of them ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!