# Angle/Vector Rotations

## tr2angvec

### Syntax

• [R] = angvec2r(theta, k)
• [T] = angvec2t(theta, k)
• [theta, k] = tr2angvec(R)
• [theta, k] = tr2angvec(T)

### Input/Output Arguments

• theta —   rotation angle (default is radian. See options below.)
• k —   a 3×1 vector representing rotation axis
• R — 3×3 rotation matrix
• T — 4×4 homogeneous transformation matrix

### Options

• Put ‘deg’ as last argument to input angle value in degree. For example,
• T=angvec2t(90,[0 -1 1]’, ‘deg’)
• [theta, v] = tr2angvec(T,’deg’)

### Description

angvec2r(), angvec2t() returns a rotation and homogeneous transformation matrix representing a rotation of angle theta around vector k. tr2angvec() just does the opposite. It receives a rotation or homogeneous transformation matrix and solves for a set of rotation axis vector and angle.

### Examples

```-->R=angvec2r(pi/4,[1 1 1]') R = 0.8047379 - 0.3106172 0.5058794 0.5058794 0.8047379 - 0.3106172 - 0.3106172 0.5058794 0.8047379   -->[theta,v]=tr2angvec(R) v = 0.5773503 0.5773503 0.5773503 theta = 0.7853982```