


compute edge lengths of a V-polytope Syntax: edgeLength = computeEdgeLengthVrep(vrep, dirMatrix) This function calculates a vector of edge lengths for all directions in dirMatrix (one direction in each row). The direction specifies a normal vector for the hyperplane to obtain the corresponding support set. The given direction for an edge must be normal to the edge and between the normal vectors of the adjacent facets. computeEdgeLengthVrep(..., zerotol) allows to set the tolerance for underlying algorithms (determining flat polytopes; default in elkZerotol). See also: computeEdgeLengthHrep, computeFacetAreaVrep, computeVolumeVrep, computeProjectionAreaVrep, computeFeretVrep, computeSupportValueVrep


0001 function edgeLength = computeEdgeLengthVrep(vrep, dirMatrix, zerotol) 0002 % compute edge lengths of a V-polytope 0003 % 0004 % Syntax: edgeLength = computeEdgeLengthVrep(vrep, dirMatrix) 0005 % 0006 % This function calculates a vector of edge lengths for all directions 0007 % in dirMatrix (one direction in each row). The direction specifies a 0008 % normal vector for the hyperplane to obtain the corresponding support 0009 % set. The given direction for an edge must be normal to the edge and 0010 % between the normal vectors of the adjacent facets. 0011 % 0012 % computeEdgeLengthVrep(..., zerotol) allows to set the tolerance for 0013 % underlying algorithms (determining flat polytopes; default in 0014 % elkZerotol). 0015 % 0016 % See also: computeEdgeLengthHrep, computeFacetAreaVrep, 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 %% do for each edge 0042 edgeLength = zeros(1, size(dirMatrix, 1)); 0043 for iEdge = 1:size(dirMatrix, 1) 0044 % Get support set in direction 0045 supportVrep = computeSupportSetVrep(vrep, dirMatrix(iEdge, :), zerotol); 0046 0047 % Calculate volume of support set (1-D Volume) 0048 if size(supportVrep.V, 2) == 1 0049 edgeLength(iEdge) = computeVolumeVrep(supportVrep, zerotol); 0050 elseif size(supportVrep.V, 2) == 0 0051 edgeLength(iEdge) = 0; 0052 else 0053 % this case is also taken as 0, because otherwise the vectors that 0054 % describe the edges must be artificially distorted so that they 0055 % do not match a facet in a different unified partition. 0056 edgeLength(iEdge) = 0; 0057 end 0058 end