[ta] = triarea3d(V); Function that calculates the area of a triangle in the 3D Cartesian space. V = the 3 x 3 coordinates matrix of the points, first column for the xs and last for the zs. ta = the area of the triangle
0001 function [ta] = triarea3d(V); 0002 %[ta] = triarea3d(V); 0003 % 0004 %Function that calculates the area of a triangle 0005 %in the 3D Cartesian space. 0006 %V = the 3 x 3 coordinates matrix of the points, first 0007 %column for the xs and last for the zs. 0008 %ta = the area of the triangle 0009 0010 p1 = [V(1,2) V(1,3) 1; V(2,2) V(2,3) 1; V(3,2) V(3,3) 1]; 0011 0012 p2 = [V(1,3) V(1,1) 1; V(2,3) V(2,1) 1; V(3,3) V(3,1) 1]; 0013 0014 p3 = [V(1,1) V(1,2) 1; V(2,1) V(2,2) 1; V(3,1) V(3,2) 1]; 0015 0016 ta = 0.5 * sqrt((det(p1))^2 + (det(p2))^2 + (det(p3))^2) ; 0017 0018 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 % This is part of the EIDORS suite. 0021 % Copyright (c) N. Polydorides 2003 0022 % Copying permitted under terms of GNU GPL 0023 % See enclosed file gpl.html for details. 0024 % EIDORS 3D version 2.0 0025 % MATLAB version 5.3 R11 0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%