Home > atmlab > math > rot2D.m

rot2D

PURPOSE ^

ROT2D Two dimemnsion rotation

SYNOPSIS ^

function [x,y] = rot2D(x,y,alpha)

DESCRIPTION ^

 ROT2D   Two dimemnsion rotation

    Performs a clockwise rotation in two dimensions.

 FORMAT   [x,y] = rot2D(x,y,alpha)
        
 OUT   x       x-coordinate after rotation
       y       y-coordinate after rotation 
 IN    x       x-coordinate before rotation
       y       y-coordinate before rotation 
       alpaha  Rotation angle [rad]

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

rot2D.m

SOURCE CODE ^

0001 % ROT2D   Two dimemnsion rotation
0002 %
0003 %    Performs a clockwise rotation in two dimensions.
0004 %
0005 % FORMAT   [x,y] = rot2D(x,y,alpha)
0006 %
0007 % OUT   x       x-coordinate after rotation
0008 %       y       y-coordinate after rotation
0009 % IN    x       x-coordinate before rotation
0010 %       y       y-coordinate before rotation
0011 %       alpaha  Rotation angle [rad]
0012 
0013 % 2006-03-26   Created by Patrick Eriksson
0014 
0015 
0016 function [x,y] = rot2D(x,y,alpha)
0017 
0018 
0019 A = [ cos(alpha) sin(alpha); -sin(alpha) cos(alpha) ];
0020 
0021 b = A * [vec2row(x); vec2row(y)];
0022 
0023 x = reshape( b(1,:), size(x) );
0024 y = reshape( b(2,:), size(y) );

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005