# rigidtform3d

3-D rigid geometric transformation

## Description

A `rigidtform3d` object stores information about a 3-D rigid geometric transformation and enables forward and inverse transformations.

## Creation

### Syntax

``tform = rigidtform3d``
``tform = rigidtform3d(R,Translation)``
``tform = rigidtform3d(eulerAngles,Translation)``
``tform = rigidtform3d(A)``
``tform = rigidtform3d(tformIn)``

### Description

````tform = rigidtform3d` creates a `rigidtform3d` object that performs an identity transformation.```
````tform = rigidtform3d(R,Translation)` creates a `rigidtform3d` object that performs a rigid transformation based on the specified values of the `R` and `Translation` properties. These properties indicate the rotation matrix and the amounts of translation in the x-, y-, and z-directions.```

example

````tform = rigidtform3d(eulerAngles,Translation)` creates a `rigidtform3d` object that performs a rigid transformation based on Euler angles and the specified value of the `Translation` property.```
````tform = rigidtform3d(A)` creates a `rigidtform3d` object and sets the property `A` as the specified 3-D rigid transformation matrix.```
````tform = rigidtform3d(tformIn)` creates a `rigidtform3d` object from another geometric transformation object, `tformIn`, that represents a valid 3-D rigid geometric transformation.```

### Input Arguments

expand all

Euler angles in x,y,z-order in degrees, specified as a 3-element numeric vector of the form `[rx ry rz]`. The Euler angles set the `R` property as a product of three rotation matrices according to:

``` Rx = [1 0 0; 0 cosd(rx) -sind(rx); 0 sind(rx) cosd(rx)]; Ry = [cosd(ry) 0 sind(ry); 0 1 0; -sind(ry) 0 cosd(ry)]; Rz = [cosd(rz) -sind(rz) 0; sind(rz) cosd(rz) 0; 0 0 1]; R = Rz*Ry*Rx;```

Data Types: `double` | `single`

Rigid 3-D geometric transformation, specified as an `affinetform3d` object, `rigidtform3d` object, `simtform3d` object, or `transltform3d` object.

## Properties

expand all

Forward 3-D rigid transformation, specified as a nonsingular 4-by-4 numeric matrix. When you create the object, you can also specify `A` as a 3-by-4 numeric matrix. In this case, the object concatenates the row vector ```[0 0 0 1]``` to the end of the matrix, forming a 4-by-4 matrix. The default of `A` is the identity matrix.

The matrix `A` transforms the point (u, v, w) in the input coordinate space to the point (x, y, z) in the output coordinate space using the convention:

`$\left[\begin{array}{c}x\\ y\\ z\\ 1\end{array}\right]=Α×\left[\begin{array}{c}u\\ v\\ w\\ 1\end{array}\right]$`

For a rigid transformation, `A` has the form:

`$Α=\left[\begin{array}{cccc}\text{R}\left(1,1\right)& \text{R}\left(1,2\right)& \text{R}\left(1,3\right)& {t}_{x}\\ \text{R}\left(2,1\right)& \text{R}\left(2,2\right)& \text{R}\left(2,3\right)& {t}_{y}\\ \text{R}\left(3,1\right)& \text{R}\left(3,2\right)& \text{R}\left(3,3\right)& {t}_{z}\\ 0& 0& 0& 1\end{array}\right]$`

where each element `R(i,j)` is element (`i`, `j`) of the rotation matrix specified by the `R` property. tx, ty, and tz are the amount of translation in the x-, y-, and z-directions, respectively, and correspond to the `Translation` property.

Data Types: `double` | `single`

Rotation matrix, specified as a 3-by-3 numeric matrix. The rotation matrix has the effect of rotating about the z-axis first, then the y-axis, and then the x-axis.

Amount of translation, specified as a 3-element numeric vector of the form [tx ty tz].

Data Types: `double` | `single`

Dimensionality of the geometric transformation for both input and output points, specified as `3`.

Data Types: `double`

## Object Functions

 `invert` Invert geometric transformation `outputLimits` Find output spatial limits given input spatial limits `transformPointsForward` Apply forward geometric transformation `transformPointsInverse` Apply inverse geometric transformation

## Examples

collapse all

Specify Euler angles and amounts of translation.

```angles = [30 0 90]; translation = [10 20.5 15];```

Create a `rigidtform3d` object that performs the specified rotation and translation.

`tform = rigidtform3d(angles,translation)`
```tform = rigidtform3d with properties: Dimensionality: 3 R: [3x3 double] Translation: [10 20.5000 15] A: [4x4 double] ```

Examine the value of the `A` property.

`tform.A`
```ans = 4×4 0 -0.8660 0.5000 10.0000 1.0000 0 0 20.5000 0 0.5000 0.8660 15.0000 0 0 0 1.0000 ```

## Version History

Introduced in R2022b

expand all