liftHrepDimension

PURPOSE ^

lift hrep into higher dimension

SYNOPSIS ^

function hrep = liftHrepDimension(hrep, rotOrTargetDim, x0, flatness)

DESCRIPTION ^

 lift hrep into higher dimension

 Syntax: hrep = liftHrepDimension(hrep, targetDim)
   OR    hrep = liftHrepDimesnion(hrep, rotMatrix)

 The given H-representation of dimension nIn is lifted to targetDim
   dimensions while it remains embedded in the first nIn coordinate axes.
   Therefore, constraints of the type:
     [0 .. 0  1;
      0 .. 0 -1]  * x <= 0
   are added. When a rotation matrix (rotMatrix) is provided, the polytope
   is rotated afterwards while targetDim = size(rotMatrix, 1) holds.

 See also: reduceHrepDimension, obtainHrep, viewPolytope

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function hrep = liftHrepDimension(hrep, rotOrTargetDim, x0, flatness)
0002 % lift hrep into higher dimension
0003 %
0004 % Syntax: hrep = liftHrepDimension(hrep, targetDim)
0005 %   OR    hrep = liftHrepDimesnion(hrep, rotMatrix)
0006 %
0007 % The given H-representation of dimension nIn is lifted to targetDim
0008 %   dimensions while it remains embedded in the first nIn coordinate axes.
0009 %   Therefore, constraints of the type:
0010 %     [0 .. 0  1;
0011 %      0 .. 0 -1]  * x <= 0
0012 %   are added. When a rotation matrix (rotMatrix) is provided, the polytope
0013 %   is rotated afterwards while targetDim = size(rotMatrix, 1) holds.
0014 %
0015 % See also: reduceHrepDimension, obtainHrep, viewPolytope
0016 
0017 % The elk-library: convex geometry applied to crystallization modeling.
0018 %   Copyright (C) 2013 Alexander Reinhold
0019 %
0020 % This program is free software: you can redistribute it and/or modify it
0021 %   under the terms of the GNU General Public License as published by the
0022 %   Free Software Foundation, either version 3 of the License, or (at your
0023 %   option) any later version.
0024 %
0025 % This program is distributed in the hope that it will be useful, but
0026 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0027 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0028 %   General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License along
0031 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 if ~exist('flatness', 'var')
0034     flatness = 0;
0035 end
0036 
0037 if numel(rotOrTargetDim) == 1
0038     targetDim = 1;
0039     rotMatrix = [];
0040 else
0041     if size(rotOrTargetDim, 1) ~= size(rotOrTargetDim, 2)
0042     end
0043     targetDim = size(rotOrTargetDim, 1);
0044     rotMatrix = rotOrTargetDim;
0045 end
0046    
0047 
0048 % figure,viewPolytope(hrep)
0049 while size(hrep.A, 2) < targetDim
0050     nFacet = size(hrep.A, 1);
0051     nDim = size(hrep.A, 2);
0052     hrep.A = [hrep.A zeros(nFacet, 1);
0053                      zeros(1, nDim) 1;...
0054                      zeros(1, nDim) -1];
0055     hrep.h = [hrep.h; flatness/2; flatness/2];
0056 end
0057 if ~isempty(rotMatrix)
0058     hrep.A = hrep.A*rotMatrix';
0059 end
0060 if exist('x0', 'var') && ~isempty(x0)
0061     hrep = moveHrep(hrep, x0);
0062 end

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