# tform2rotm

Extract rotation matrix from homogeneous transformation

## Syntax

``rotm = tform2rotm(tform)``

## Description

example

````rotm = tform2rotm(tform)` extracts the rotational component from a homogeneous transformation, `tform`, and returns it as an orthonormal rotation matrix, `rotm`. The translational components of `tform` are ignored. The input homogeneous transformation must be in the pre-multiply form for transformations. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).```

## Examples

collapse all

```tform = [1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 1]; rotm = tform2rotm(tform)```
```rotm = 3×3 1 0 0 0 -1 0 0 0 -1 ```

## Input Arguments

collapse all

Homogeneous transformation matrix, specified by a 4-by-4-by-n matrix of n homogeneous transformations. The input homogeneous transformation must be in the pre-multiply form for transformations.

Example: `[0 0 1 0; 0 1 0 0; -1 0 0 0; 0 0 0 1]`

## Output Arguments

collapse all

Rotation matrix, returned as a 3-by-3-by-n matrix containing n rotation matrices. Each rotation matrix has a size of 3-by-3 and is orthonormal. When using the rotation matrix, premultiply it with the coordinates to be rotated (as opposed to postmultiplying).

Example: `[0 0 1; 0 1 0; -1 0 0]`