


rotates a polytope in H-representation by given axis and angle Syntax: Hrep = rotateHrep(Hrep, axis, radian) or Hrep = rotateHrep(Hrep, axis, radian, x0) This function is for 2d polytopes only. The polytope is rotated counter clockwise with the angle in radian. The vector x0 specifies the fixed point for the rotation. See also: rotatePolytope, getRotationMatrix2d, rotateHrep3d, rotateVrep2d


0001 function Hrep = rotateHrep2d(Hrep, angle, x0) 0002 % rotates a polytope in H-representation by given axis and angle 0003 % 0004 % Syntax: Hrep = rotateHrep(Hrep, axis, radian) 0005 % or Hrep = rotateHrep(Hrep, axis, radian, x0) 0006 % 0007 % This function is for 2d polytopes only. The polytope is rotated counter 0008 % clockwise with the angle in radian. The vector x0 specifies the fixed 0009 % point for the rotation. 0010 % 0011 % See also: rotatePolytope, getRotationMatrix2d, rotateHrep3d, rotateVrep2d 0012 0013 % The elk-library: convex geometry applied to crystallization modeling. 0014 % Copyright (C) 2012 Alexander Reinhold 0015 % 0016 % This program is free software: you can redistribute it and/or modify it 0017 % under the terms of the GNU General Public License as published by the 0018 % Free Software Foundation, either version 3 of the License, or (at your 0019 % option) any later version. 0020 % 0021 % This program is distributed in the hope that it will be useful, but 0022 % WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0024 % General Public License for more details. 0025 % 0026 % You should have received a copy of the GNU General Public License along 0027 % with this program. If not, see <http://www.gnu.org/licenses/>. 0028 0029 if nargin < 3 0030 x0 = []; 0031 end 0032 0033 if isempty(x0) 0034 Hrep.A = (getRotationMatrix2d(angle) * Hrep.A')'; 0035 else 0036 Hrep = moveHrep(Hrep, -x0); 0037 Hrep.A = (getRotationMatrix2d(angle) * Hrep.A')'; 0038 Hrep = moveHrep(Hrep, x0); 0039 end 0040 0041 end