


stretch the polytope in arbitrary representation along axes Syntax: stretchedPoly = stretchPolytope(poly, scale) The vector v must be a vector that matches the dimentsion of the polytope Vrep. First element stretches coordinates at the x-axis, second element on the y-axis and so on. With stretchPolytope(Hrep, scale, x0) the polytope is stretched with x0 as origin. If x0 is a point of the polytope this point remains at its position after stretching. See also: obtainPolytope, movePolytope, rotatePolytope


0001 function stretchedPoly = stretchPolytope(poly, scale, x0) 0002 % stretch the polytope in arbitrary representation along axes 0003 % 0004 % Syntax: stretchedPoly = stretchPolytope(poly, scale) 0005 % 0006 % The vector v must be a vector that matches the dimentsion of the polytope 0007 % Vrep. First element stretches coordinates at the x-axis, second element 0008 % on the y-axis and so on. 0009 % 0010 % With stretchPolytope(Hrep, scale, x0) the polytope is stretched with x0 0011 % as origin. If x0 is a point of the polytope this point remains at its 0012 % position after stretching. 0013 % 0014 % See also: obtainPolytope, movePolytope, rotatePolytope 0015 0016 % The elk-library: convex geometry applied to crystallization modeling. 0017 % Copyright (C) 2012 Alexander Reinhold 0018 % 0019 % This program is free software: you can redistribute it and/or modify it 0020 % under the terms of the GNU General Public License as published by the 0021 % Free Software Foundation, either version 3 of the License, or (at your 0022 % option) any later version. 0023 % 0024 % This program is distributed in the hope that it will be useful, but 0025 % WITHOUT ANY WARRANTY; without even the implied warranty of 0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0027 % General Public License for more details. 0028 % 0029 % You should have received a copy of the GNU General Public License along 0030 % with this program. If not, see <http://www.gnu.org/licenses/>. 0031 0032 %% Input handling 0033 infoP = identifyPolytope(poly); 0034 0035 %% set fixedpoint, if not specified 0036 if nargin < 3 0037 x0 = zeros(infoP.dim, 1); 0038 end 0039 0040 %% conversion 0041 if strcmpi(infoP.rep, 'Vrep') 0042 stretchedPoly = stretchVrep(poly, scale, x0); 0043 else 0044 stretchedPoly = stretchHrep(poly, scale, x0); 0045 end 0046 0047 end