


project a V-polytope onto a plane defined by normal vector Syntax: vrep = projectVrep3d(vrep, normal) The projection set is returned in the reduced dimension so that vrep has only 2 columns. See also: computeSupportSetVrep


0001 function vrep = projectVrep3d(vrep, normal) 0002 % project a V-polytope onto a plane defined by normal vector 0003 % 0004 % Syntax: vrep = projectVrep3d(vrep, normal) 0005 % 0006 % The projection set is returned in the reduced dimension so that vrep 0007 % has only 2 columns. 0008 % 0009 % See also: computeSupportSetVrep 0010 0011 % The elk-library: convex geometry applied to crystallization modeling. 0012 % Copyright (C) 2012 Alexander Reinhold 0013 % 0014 % This program is free software: you can redistribute it and/or modify it 0015 % under the terms of the GNU General Public License as published by the 0016 % Free Software Foundation, either version 3 of the License, or (at your 0017 % option) any later version. 0018 % 0019 % This program is distributed in the hope that it will be useful, but 0020 % WITHOUT ANY WARRANTY; without even the implied warranty of 0021 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0022 % General Public License for more details. 0023 % 0024 % You should have received a copy of the GNU General Public License along 0025 % with this program. If not, see <http://www.gnu.org/licenses/>. 0026 0027 if size(vrep.V, 2) ~= 3 || length(normal) ~=3 0028 error('elk:polytope:wrongType', ... 0029 'projectVrep3d is for 3-dimensional polytopes only'); 0030 end 0031 0032 %% Rotate 0033 vrep = rotatePolytope(vrep, 'vector', normal); 0034 % so that we can project onto xy-plane 0035 vrep.V(:,end) = []; 0036 vrep = reduceVrep(vrep); 0037 0038 end