


compute the volume of a polytope in H-representation Syntax: volume = computeVolumeHrep(hrep) Compute the volume by first converting to an V-representation and subsequently using computeVolumeHrep. computeVolumeVrep(..., zerotol) allows to set the tolerance for underlying algorithms (Default in elkZerotol) See also: computeVolumeVrep, computeFacetAreaHrep, computeProjectionAreaHrep, computeFeretHrep, computeSupportValueHrep


0001 function volume = computeVolumeHrep(hrep, zerotol) 0002 % compute the volume of a polytope in H-representation 0003 % 0004 % Syntax: volume = computeVolumeHrep(hrep) 0005 % 0006 % Compute the volume by first converting to an V-representation and 0007 % subsequently using computeVolumeHrep. 0008 % 0009 % computeVolumeVrep(..., zerotol) allows to set the tolerance for 0010 % underlying algorithms (Default in elkZerotol) 0011 % 0012 % See also: computeVolumeVrep, computeFacetAreaHrep, 0013 % computeProjectionAreaHrep, computeFeretHrep, computeSupportValueHrep 0014 0015 % The elk-library: convex geometry applied to crystallization modeling. 0016 % Copyright (C) 2012 Alexander Reinhold 0017 % 0018 % This program is free software: you can redistribute it and/or modify it 0019 % under the terms of the GNU General Public License as published by the 0020 % Free Software Foundation, either version 3 of the License, or (at your 0021 % option) any later version. 0022 % 0023 % This program is distributed in the hope that it will be useful, but 0024 % WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0026 % General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License along 0029 % with this program. If not, see <http://www.gnu.org/licenses/>. 0030 0031 %% Input handling 0032 if ~exist('zerotol', 'var') 0033 zerotol = elkZerotol; 0034 end 0035 0036 %% Volume calculation falls back to getVolumeCHO 0037 vrep = convertHrepToVrep(hrep, zerotol); 0038 if ~isempty(vrep.V) 0039 volume = computeVolumeVrep(vrep); 0040 else 0041 volume = 0; 0042 end