# rigid2d

2-D rigid geometric transformation

## Description

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

## Creation

### Syntax

``tform = rigid2d``
``tform = rigid2d(t)``
``tform = rigid2d(rot,trans)``

### Description

````tform = rigid2d` creates a default `rigid2d` object that corresponds to an identity transformation.```
````tform = rigid2d(t)` creates a `rigid2d` object based on a specified forward rigid transformation matrix, `t`. The `t` input sets the `T` property.```

example

````tform = rigid2d(rot,trans)` creates a `rigid2d` object based on the rotation, `rot`, and translation, `trans`, components of the transformation. `rot` sets the `Rotation` property. `trans` sets the `Translation` property.```

## Properties

expand all

Forward rigid transformation, specified as a 3-by-3 numeric matrix.

Data Types: `single` | `double`

Dimensionality of the geometric transformation, specified as the number `2`.

Rotation component of the transformation, specified as a 2-by-2 numeric matrix.

Data Types: `single` | `double`

Translation component of the transformation, specified as a 2-element numeric row vector.

Data Types: `single` | `double`

## Object Functions

 `invert` Invert geometric transformation `isTranslation` Determine if transformation is pure translation `outputLimits` Find output spatial limits given input spatial limits `transformPointsForward` Apply forward geometric transformation `transformPointsInverse` Apply inverse geometric transformation

## Examples

collapse all

Specify an angle of rotation in degrees and create a 2-by-2 rotation matrix.

```theta = 30; rot = [ cosd(theta) sind(theta); ... -sind(theta) cosd(theta)];```

Specify the amount of horizontal and vertical translation, respectively.

`trans = [2 3];`

Create a `rigid2d` object that performs the rotation and translation.

`tform = rigid2d(rot,trans)`
```tform = rigid2d with properties: Rotation: [2x2 double] Translation: [2 3] ```

## Version History

Introduced in R2020b