stretchHrep

PURPOSE ^

stretch the polytope in arbitrary representation along axes

SYNOPSIS ^

function hrep = stretchHrep(hrep, scale, x0)

DESCRIPTION ^

 stretch the polytope in arbitrary representation along axes

 Syntax: hrep = stretchHrep(hrep, 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 stretchHrep(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.

 Note that you do not obtain a normalized H-representation (length of
   facet normals equal to one).

 See also: stretchPolytope, obtainPolytope, movePolytope, rotatePolytope,
   normalizeHrep

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function hrep = stretchHrep(hrep, scale, x0)
0002 % stretch the polytope in arbitrary representation along axes
0003 %
0004 % Syntax: hrep = stretchHrep(hrep, 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 stretchHrep(Hrep, 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 % Note that you do not obtain a normalized H-representation (length of
0015 %   facet normals equal to one).
0016 %
0017 % See also: stretchPolytope, obtainPolytope, movePolytope, rotatePolytope,
0018 %   normalizeHrep
0019 
0020 % The elk-library: convex geometry applied to crystallization modeling.
0021 %   Copyright (C) 2012 Alexander Reinhold
0022 %
0023 % This program is free software: you can redistribute it and/or modify it
0024 %   under the terms of the GNU General Public License as published by the
0025 %   Free Software Foundation, either version 3 of the License, or (at your
0026 %   option) any later version.
0027 %
0028 % This program is distributed in the hope that it will be useful, but
0029 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0030 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0031 %   General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU General Public License along
0034 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0035 
0036 %% Input handling
0037 if length(scale) == 1
0038     scale = ones(1, size(hrep.A, 2))*scale;
0039 elseif length(scale) ~= size(hrep.A, 2)
0040     error('elk:polytope:wrongType', ...
0041         'dimension of the scaling vector must match the dimension of the polytope');
0042 end
0043 
0044 if nargin < 3
0045     x0 = [];
0046 end
0047 
0048 %% stretch
0049 if isempty(x0)
0050     hrep.A = hrep.A * diag(1./scale);
0051 else
0052     hrep = moveHrep(hrep, -x0);
0053     hrep.A = hrep.A * diag(1./scale);
0054     hrep = moveHrep(hrep, x0);
0055 end
0056 
0057 end

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