rotateVrep2d

PURPOSE ^

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

SYNOPSIS ^

function vrep = rotateVrep2d(vrep, angle, x0)

DESCRIPTION ^

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

 Syntax: vrep = rotateVrep(vrep, axis, radian)
   or    vrep = rotateVrep(vrep, 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, rotateVrep3d, rotateHrep2d

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vrep = rotateVrep2d(vrep, angle, x0)
0002 % rotates a polytope in V-representation by given axis and angle
0003 %
0004 % Syntax: vrep = rotateVrep(vrep, axis, radian)
0005 %   or    vrep = rotateVrep(vrep, 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, rotateVrep3d, rotateHrep2d
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 %% Input
0030 if nargin < 3
0031     x0 = [];
0032 end
0033 
0034 if isempty(x0)
0035     vrep.V = (getRotationMatrix2d(angle) * vrep.V')';
0036 else
0037     vrep = moveVrep(vrep, -x0);
0038     vrep.V = (getRotationMatrix2d(angle) * vrep.V')';
0039     vrep = moveVrep(vrep, x0);
0040 end
0041 
0042 end

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