rotateHrep3d

PURPOSE ^

rotates a polytope in H-representation by given axis and angle

SYNOPSIS ^

function Hrep = rotateHrep3d(Hrep, axis, angle, x0)

DESCRIPTION ^

 rotates a polytope in H-representation by given axis and angle

 Syntax: Hrep = rotateHrep(Hrep, axis, radian)
   or    Hrep = rotateHrep(Hrep, 'vector', v)

 This function is for 3d polytopes only. The polytope is rotated around 
   the axis 'x', 'y' or 'z' with the angle in radian (3D).  With the case 
   'vector', the rotation matrix is calculated so that the normalized 
   vector v matches the unit vector of the z-axis after rotation. This 
   operation is not uniquely defined, because any subsequent rotation
   around the z-axis would still fulfill the requirement.

 rotateHrep3d(.., x0) specifies the fixed point x0 for the rotation.

 See also: rotatePolytope, getRotationMatrix3d, rotateHrep2d, rotateVrep3d

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Hrep = rotateHrep3d(Hrep, axis, 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, 'vector', v)
0006 %
0007 % This function is for 3d polytopes only. The polytope is rotated around
0008 %   the axis 'x', 'y' or 'z' with the angle in radian (3D).  With the case
0009 %   'vector', the rotation matrix is calculated so that the normalized
0010 %   vector v matches the unit vector of the z-axis after rotation. This
0011 %   operation is not uniquely defined, because any subsequent rotation
0012 %   around the z-axis would still fulfill the requirement.
0013 %
0014 % rotateHrep3d(.., x0) specifies the fixed point x0 for the rotation.
0015 %
0016 % See also: rotatePolytope, getRotationMatrix3d, rotateHrep2d, rotateVrep3d
0017 
0018 % The elk-library: convex geometry applied to crystallization modeling.
0019 %   Copyright (C) 2012 Alexander Reinhold
0020 %
0021 % This program is free software: you can redistribute it and/or modify it
0022 %   under the terms of the GNU General Public License as published by the
0023 %   Free Software Foundation, either version 3 of the License, or (at your
0024 %   option) any later version.
0025 %
0026 % This program is distributed in the hope that it will be useful, but
0027 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0028 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0029 %   General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License along
0032 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 if nargin < 4
0035     x0 = [];
0036 end
0037 
0038 if isempty(x0)
0039     Hrep.A = (getRotationMatrix3d(axis, angle) * Hrep.A')';
0040 else
0041     Hrep = moveHrep(Hrep, -x0);
0042     Hrep.A = (getRotationMatrix3d(axis, angle) * Hrep.A')';
0043     Hrep = moveHrep(Hrep, x0);
0044 end
0045 
0046 end

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