stretchVrep

PURPOSE ^

stretch the polytope in arbitrary representation along axes

SYNOPSIS ^

function vrep = stretchVrep(vrep, scale, x0)

DESCRIPTION ^

 stretch the polytope in arbitrary representation along axes

 Syntax: vrep = stretchVrep(vrep, 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 stretchVrep(vrep, 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: stretchPolytope, obtainPolytope, movePolytope, rotatePolytope

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vrep = stretchVrep(vrep, scale, x0)
0002 % stretch the polytope in arbitrary representation along axes
0003 %
0004 % Syntax: vrep = stretchVrep(vrep, 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 stretchVrep(vrep, scale, x0) the polytope is stretched with x0 as
0011 %   origin. If x0 is a point of the polytope this point remains at its
0012 %   position after stretching.
0013 %
0014 % See also: stretchPolytope, 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 if length(scale) == 1
0034     scale = ones(1, size(vrep.V, 2))*scale;
0035 elseif length(scale) ~= size(vrep.V, 2)
0036     error('elk:polytope:wrongType', ...
0037         'dimension of the scaling vector must match the dimension of the polytope');
0038 end
0039 if nargin < 3
0040     x0 = [];
0041 end
0042 
0043 %% stretch
0044 if isempty(x0)
0045     vrep.V = vrep.V * diag(scale);
0046 else
0047     vrep = moveVrep(vrep, -x0);
0048     vrep.V = vrep.V * diag(scale);
0049     vrep = moveVrep(vrep, x0);
0050 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005