


compute the Feret diameter for a V-polytope in given direction Syntax: diameter = computeFeretVrep(vrep, dirMatrix) This function calculates the Feret diameter for all directions in dirMatrix that contains one direction in each row. The Feret diameter is the 1-dimensional volume of the projection of the polytope onto a line with the given direction. By this definition the Feret diameter is also known as quermass like the projection area. See also: computeFeretHrep, computeProjectionAreaVrep, computeVolumeVrep, computeSupportValueVrep, computeFacetAreaVrep


0001 function diameter = computeFeretVrep(vrep, dirMatrix) 0002 % compute the Feret diameter for a V-polytope in given direction 0003 % 0004 % Syntax: diameter = computeFeretVrep(vrep, dirMatrix) 0005 % 0006 % This function calculates the Feret diameter for all directions in 0007 % dirMatrix that contains one direction in each row. The Feret diameter 0008 % is the 1-dimensional volume of the projection of the polytope onto a 0009 % line with the given direction. By this definition the Feret diameter is 0010 % also known as quermass like the projection area. 0011 % 0012 % See also: computeFeretHrep, computeProjectionAreaVrep, computeVolumeVrep, 0013 % computeSupportValueVrep, computeFacetAreaVrep 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 %% Normalize directions 0032 for iDir = 1:size(dirMatrix, 1) 0033 dirMatrix(iDir, :) = dirMatrix(iDir, :) / norm(dirMatrix(iDir, :), 2); 0034 end 0035 0036 %% Obtain support values 0037 % they are always positive as they measure a distance 0038 supportValueVectorOne = computeSupportValueVrep(vrep, dirMatrix); 0039 supportValueVectorTwo = computeSupportValueVrep(vrep, -1*dirMatrix); 0040 0041 %% Feret diameter 0042 diameter = abs(supportValueVectorOne + supportValueVectorTwo)';