computeFacetAreaVrep

PURPOSE ^

surface area or facet area of a V-polytope

SYNOPSIS ^

function area = computeFacetAreaVrep(vrep, dirMatrix, zerotol)

DESCRIPTION ^

 surface area or facet area of a V-polytope

 Syntax: area = computeFacetAreaVrep(vrep, dirMatrix)
   or    area = computeFacetAreaVrep(vrep)

 The first variant calculates a vector of facet areas for all directions
   in dirMatrix that contains one direction in each row. The second
   variant calculates the surface area of the polytope. You might use
   dirMatrix = [] to obtain the same behavior.

 computeFacetAreaVrep(..., zerotol) allows to set the tolerance for 
   underlying algorithms (determining flat polytopes; default in
   elkZerotol).

 See also: computeFacetAreaHrep, computeVolumeVrep,
   computeProjectionAreaVrep, computeFeretVrep, computeSupportValueVrep

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function area = computeFacetAreaVrep(vrep, dirMatrix, zerotol)
0002 % surface area or facet area of a V-polytope
0003 %
0004 % Syntax: area = computeFacetAreaVrep(vrep, dirMatrix)
0005 %   or    area = computeFacetAreaVrep(vrep)
0006 %
0007 % The first variant calculates a vector of facet areas for all directions
0008 %   in dirMatrix that contains one direction in each row. The second
0009 %   variant calculates the surface area of the polytope. You might use
0010 %   dirMatrix = [] to obtain the same behavior.
0011 %
0012 % computeFacetAreaVrep(..., zerotol) allows to set the tolerance for
0013 %   underlying algorithms (determining flat polytopes; default in
0014 %   elkZerotol).
0015 %
0016 % See also: computeFacetAreaHrep, computeVolumeVrep,
0017 %   computeProjectionAreaVrep, computeFeretVrep, computeSupportValueVrep
0018 
0019 % The elk-library: convex geometry applied to crystallization modeling.
0020 %   Copyright (C) 2012 Alexander Reinhold
0021 %
0022 % This program is free software: you can redistribute it and/or modify it
0023 %   under the terms of the GNU General Public License as published by the
0024 %   Free Software Foundation, either version 3 of the License, or (at your
0025 %   option) any later version.
0026 %
0027 % This program is distributed in the hope that it will be useful, but
0028 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0029 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0030 %   General Public License for more details.
0031 %
0032 % You should have received a copy of the GNU General Public License along
0033 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0034 
0035 %% Input handling
0036 % default zerotol
0037 if ~exist('zerotol', 'var')
0038     zerotol = elkZerotol;
0039 end
0040 
0041 % % check dimension
0042 % if size(vrep.V, 2) == 3
0043 %     % everything OK, that is the normal case
0044 % elseif size(vrep.V, 2) == 1
0045 %     % this is trivial
0046 %     area = 0;
0047 %     return
0048 % else
0049 %     error('elk:polytope:inputError', ...
0050 %           'Only three dimensional polytopes can be handled');
0051 % end
0052 
0053 %% Handle surface calculation (no dir given)
0054 if ~exist('dirMatrix','var') || isempty(dirMatrix)
0055     hrep = convertVrepToHrep(vrep);
0056     dirMatrix = hrep.A;
0057     sumUp = 1;
0058 else
0059     sumUp = 0;
0060 end
0061 
0062 %% do for each facet
0063 area = zeros(1,size(dirMatrix, 1));
0064 nDim = size(vrep.V, 2);
0065 for iFacet = 1:size(dirMatrix, 1)
0066     % Get support set in direction
0067     supportVrep = computeSupportSetVrep(vrep, dirMatrix(iFacet, :), zerotol);
0068     
0069     % Calculate volume of support set (2-D Volume)
0070     if size(supportVrep.V, 2) == nDim-1
0071         area(iFacet) = computeVolumeVrep(supportVrep, zerotol);
0072     else
0073         area(iFacet) = 0;
0074     end
0075 end
0076 
0077 if sumUp
0078     area = sum(area);
0079 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005