# simtform3d

3-D similarity geometric transformation

Since R2022b

## Description

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

## Creation

### Syntax

``tform = simtform3d``
``tform = simtform3d(scale,r,translation)``
``tform = simtform3d(Scale,eulerAngles,Translation)``
``tform = simtform3d(A)``
``tform = simtform3d(tformIn)``

### Description

````tform = simtform3d` creates a `simtform3d` object that performs an identity transformation.```
````tform = simtform3d(scale,r,translation)` creates a `simtform3d` object that performs a similarity transformation based on the specified scale factor `scale`, rotation matrix `r`, and amounts of `translation` in the x-, y-, and z-directions translation. The `scale`, `r`, and `translation` arguments set the Scale, R, and Translation properties, respectively. ```

example

````tform = simtform3d(Scale,eulerAngles,Translation)` creates a `simtform3d` object that performs a similarity transformation based on Euler angles and the specified value of the `Scale` and `Translation` properties.```
````tform = simtform3d(A)` creates a `simtform3d` object and sets the property `A` to the specified 3-D similarity transformation matrix.```
````tform = simtform3d(tformIn)` creates a `simtform3d` object from another geometric transformation object, `tformIn`, that represents a valid 3-D similarity 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 (`Rx`, `Ry`, and `Rz`) 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`

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

## Properties

expand all

Forward 3-D similarity transformation, specified as a 4-by-4 numeric 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 similarity transformation, `A` has the form:

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

where s is the scale factor and corresponds to the `Scale` property. R(i,j) are the elements of the rotation matrix specified by the corresponding (i,j) indices of the `R` property. tx, ty, and tz are the amount of translation in the x-, y-, and z-directions, respectively, and correspond to the elements of the `Translation` property.

Data Types: `double` | `single`

Scale factor, specified as a nonzero number. The scale factor corresponds to the value s in the similarity transformation matrix defined by property `A`.

Data Types: `double` | `single`

Rotation matrix, specified as a 3-by-3 numeric matrix. The rotation matrix performs rotation 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 the scale factor and the amount of translation. The transformation in this example does not perform rotation, so set the Euler angles to `[0 0 0]`.

```scaleFactor = 1.5; eulerAngles = [0 0 0]; translation = [10 20.5 15];```

Create a `simtform3d` object that performs the scaling and translation.

`tform = simtform3d(scaleFactor,eulerAngles,translation)`
```tform = simtform3d with properties: Dimensionality: 3 Scale: 1.5000 Translation: [10 20.5000 15] R: [3x3 double] A: [4x4 double] ```

Examine the value of the `A` property.

`tform.A`
```ans = 4×4 1.5000 0 0 10.0000 0 1.5000 0 20.5000 0 0 1.5000 15.0000 0 0 0 1.0000 ```

## Version History

Introduced in R2022b