


surface area or facet area of a H-polytope Syntax: area = computeFacetAreaVrep(hrep, dirMatrix) or area = computeFacetAreaVrep(hrep) 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. computeFacetAreaHrep(..., zerotol) allows to set the tolerance for underlying algorithms (determining flat polytopes; default in elkZerotol). See also: computeFacetAreaVrep, computeVolumeHrep, computeProjectionAreaHrep, computeFeretHrep, computeSupportValueHrep


0001 function area = computeFacetAreaHrep(hrep, dirMatrix, zerotol) 0002 % surface area or facet area of a H-polytope 0003 % 0004 % Syntax: area = computeFacetAreaVrep(hrep, dirMatrix) 0005 % or area = computeFacetAreaVrep(hrep) 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 % computeFacetAreaHrep(..., zerotol) allows to set the tolerance for 0013 % underlying algorithms (determining flat polytopes; default in 0014 % elkZerotol). 0015 % 0016 % See also: computeFacetAreaVrep, computeVolumeHrep, 0017 % computeProjectionAreaHrep, computeFeretHrep, computeSupportValueHrep 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 %% Handle surface calculation (no dir given) 0042 if ~exist('dirMatrix','var') || isempty(dirMatrix) 0043 dirMatrix = hrep.A; 0044 sumUp = 1; 0045 else 0046 sumUp = 0; 0047 end 0048 0049 %% Calculating area 0050 % fall back to computeFacetAreaVrep 0051 vrep = convertHrepToVrep(hrep, zerotol); 0052 if ~isempty(vrep.V) 0053 area = computeFacetAreaVrep(vrep, dirMatrix, zerotol); 0054 else 0055 area = 0; 0056 end 0057 0058 if sumUp 0059 area = sum(area); 0060 end