


compute the support set of a V-polytope given a normal vector Syntax: vrep = computeSupportSetVrep(vrep, normal) The support set is the intersection of the polytope with a supporting hyperplane, where the supporting hyperplane is a plane that exactly touches the polytope. computeSupportSetVrep(..., zerotol) allows to set the tolerance for determining how close a vertex must be to the supporting hyperplane so that it is considered as a vertex of the support set. Default: see elkZerotol. computeSupprtSetVrep(.., zerotol, reduceDim) The support set is usually returned in the appropriately reduced dimension (reduceDim = 1). Facets return 2-dimensional polytopes (2 columns in vrep), edges 1-dimenstional polytopes (1 column in vrep) and vertices return an empty matrix. With reduceDim=0, the corresponding vertices are returned in the original dimension. See also: projectVrep3d


0001 function vrep = computeSupportSetVrep(vrep, normal, zerotol, reduceDim) 0002 % compute the support set of a V-polytope given a normal vector 0003 % 0004 % Syntax: vrep = computeSupportSetVrep(vrep, normal) 0005 % 0006 % The support set is the intersection of the polytope with a supporting 0007 % hyperplane, where the supporting hyperplane is a plane that exactly 0008 % touches the polytope. 0009 % 0010 % computeSupportSetVrep(..., zerotol) allows to set the tolerance for 0011 % determining how close a vertex must be to the supporting hyperplane so 0012 % that it is considered as a vertex of the support set. Default: see 0013 % elkZerotol. 0014 % 0015 % computeSupprtSetVrep(.., zerotol, reduceDim) The support set is usually 0016 % returned in the appropriately reduced dimension (reduceDim = 1). Facets 0017 % return 2-dimensional polytopes (2 columns in vrep), edges 0018 % 1-dimenstional polytopes (1 column in vrep) and vertices return an 0019 % empty matrix. With reduceDim=0, the corresponding vertices are returned 0020 % in the original dimension. 0021 % 0022 % See also: projectVrep3d 0023 0024 % The elk-library: convex geometry applied to crystallization modeling. 0025 % Copyright (C) 2012 Alexander Reinhold 0026 % 0027 % This program is free software: you can redistribute it and/or modify it 0028 % under the terms of the GNU General Public License as published by the 0029 % Free Software Foundation, either version 3 of the License, or (at your 0030 % option) any later version. 0031 % 0032 % This program is distributed in the hope that it will be useful, but 0033 % WITHOUT ANY WARRANTY; without even the implied warranty of 0034 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0035 % General Public License for more details. 0036 % 0037 % You should have received a copy of the GNU General Public License along 0038 % with this program. If not, see <http://www.gnu.org/licenses/>. 0039 0040 %% Input handling 0041 if ~exist('zerotol', 'var') || isempty(zerotol) 0042 zerotol = elkZerotol; 0043 end 0044 0045 if ~exist('reduceDim', 'var') 0046 reduceDim = 1; 0047 end 0048 0049 if size(normal, 1) ~= size(vrep.V, 2) 0050 normal = normal'; 0051 end 0052 0053 % if reduceDim 0054 % %% Obtain set with reduction of dimension 0055 % vrep = rotatePolytope(vrep, 'vector', normal); 0056 % % so that we can look for the outer-most point in z-direction 0057 % zMax = max(vrep.V(:,3)); 0058 % % and filter for all points that are in the same level 0059 % vrep.V = vrep.V(abs(vrep.V(:,3) - zMax) < zerotol, 1:2); 0060 % % but there might be more 0061 % vrep = reduceVrepDimension(vrep, zerotol); 0062 % vrep = reduceVrep(vrep); 0063 % else 0064 outerDistanceVector = vrep.V * normal; 0065 maxOuterDistance = max(outerDistanceVector); 0066 vrep.V = vrep.V(abs(outerDistanceVector - maxOuterDistance) < zerotol, :); 0067 0068 if reduceDim 0069 vrep = reduceVrepDimension(vrep, zerotol); 0070 end 0071 % end 0072 0073 0074 end