World axis rotation

RTSX Help: Rotation about a world coordinate axis

trotw

Rotation of a frame about an axis X,Y, or Z of world, or fixed coordinate frame (refering to a frame with origin at [0, 0, 0]’ and never moves or rotates)

Syntax

  • [R] = trotw(R, theta, axis)
  • [T] = trotw(T,theta, axis, options)    

Input Arguments

  • R —  a 3 x 3 rotation matrix
  • T — a   4 x 4 homogeneous transformation matrix with origin at [0,0,0]’
  • theta —   rotation angle (default in radian. See options below)
  • axis — a character indicating the rotation axis ‘x’,’y’,or ‘z’ (either lower or upper case, but must be put in quotes)

Output Arguments

  • R — a 3×3 rotation matrix is returned when first input is a rotation matrix
  • T — a 4×4 homogeneous transformation matrix is returned when first input is a homogenous transformation matrix

Options

  • ‘deg’ : input angle value is in degree. Ex. Tr=trotw(T,45,’x’, ‘deg’)

Description

Compute a rotation/homogeneous transformation matrix representing a rotation around one of the world coordinate axes X, Y, Z, depending on the choice of third input argument. The origin of world and rotated frame must be at the same point [0,0,0]’.

Examples

This example demonstrates a combination of two rotations. First we rotate 45 degree about X axis, then rotate 90 degree about the *world* Z axis (not the current Z axis). Use the function trplot() to see the resulting rotated frame below.

-->T=trotw(trotx(pi/4),pi/2,'z')
 T  =
     0.  - 0.7071068    0.7071068    0.  
    1.    0.           0.           0.  
    0.    0.7071068    0.7071068    0.  
    0.    0.           0.           1.  
 -->trplot(T,'world')


Figure 1: rotation about a world coordinate axis

See Also