# Transforms

## Description

`static` `class` `Tinman.Terrain.Util.Transforms`

Helper class for dealing with Transform values.

## Public / Constants

### First

`public` `constant` `First` → `(Transform.None:Transform)`

The Transform with the minimum ordinal value.

Use this constant to iterate over all transforms.

### Last

`public` `constant` `Last` → `(Transform.DiagonalInv:Transform)`

The Transform with the maximum ordinal value.

Use this constant to iterate over all transforms.

## Public / Methods

### Combine

`[Pure]`
`public` `static` `method` `Combine` → `(2)`

first in : Transform

The transform to apply first.

second in : Transform

The transform to apply second.

returns → Transform

The resulting transform.

Solves an equation for transform concatenation.

Given the following transform concatenation

`result = first * second`

this method computes `result` from the given values for `first` and `second`.

### FlipY

`[Pure]`
`public` `static` `method` `FlipY` → `(1)`

transform in : Transform

The original transform.

returns → Transform

The flipped transform.

Returns the transforms that corresponds to the given one in a coordinate system with a flipped Y-axis.

### FromMatrix

`[Pure]`
`public` `static` `method` `FromMatrix` → `(4)`

m11 in : float64

Matrix component in first row, first column.

m12 in : float64

Matrix component in first row, second column.

m21 in : float64

Matrix component in second row, first column.

m22 in : float64

Matrix component in second row, second column.

returns → int32

The Transform value or `-1` if the matrix cannot be expressed with a simple transform.

Returns the transform that corresponds to the given matrix.

The input matrix has the following form:

```/                 \
|  S(m11)  S(m12)  |
|  S(m21)  S(m22)  |
\                 /```

where `S(x)` refers to the Maths.Sign2 function.

### Invert

`[Pure]`
`public` `static` `method` `Invert` → `(1)`

transform in : Transform

The transform.

returns → Transform

The inverse transform.

Returns the inverse of the given transform in.

### SolveLeft

`[Pure]`
`public` `static` `method` `SolveLeft` → `(2)`

second in : Transform

The transform to apply second.

result in : Transform

The resulting transform.

returns → Transform

The transform to apply first.

Solves an equation for transform concatenation.

Given the following transform concatenation

`result = first * second`

this method computes `first` from the given values for `second` and `result`.

### SolveRight

`[Pure]`
`public` `static` `method` `SolveRight` → `(2)`

first in : Transform

The transform to apply first.

result in : Transform

The resulting transform.

returns → Transform

The transform to apply second.

Solves an equation for transform concatenation.

Given the following transform concatenation

`result = first * second`

this method computes `second` from the given values for `first` and `result`.

### ToMat2D

`[Pure]`
`public` `static` `method` `ToMat2D` → `(1)`

transform in : Transform

The 2D transform.

returns → Mat2D

The matrix.

Converts the given 2D transform into a matrix, assuming that the coordinate origin is at `(0|0)`.

### ToMat2F

`[Pure]`
`public` `static` `method` `ToMat2F` → `(1)`

transform in : Transform

The 2D transform.

returns → Mat2F

The matrix.

Converts the given 2D transform into a matrix, assuming that the coordinate origin is at `(0|0)`.

### ToMat3D

`[Pure]`
`public` `static` `method` `ToMat3D` → `(2)`

transform in : Transform

The 2D transform.

center opt : Vec2D = default(Vec2D)

The coordinate origin.

returns → Mat3D

The matrix.

Converts the given 2D transform into a matrix, using the given coordinate origin.

### ToMat3F

`[Pure]`
`public` `static` `method` `ToMat3F` → `(2)`

transform in : Transform

The 2D transform.

center opt : Vec2F = default(Vec2F)

The coordinate origin.

returns → Mat3F

The matrix.

Converts the given 2D transform into a matrix, using the given coordinate origin.

### TransformPointD

`[Pure]`
`public` `static` `method` `TransformPointD` → `(5)`

in : float64

X-coordinate of point to transform.

in : float64

Y-coordinate of point to transform.

transform in : Transform

The 2D transform to apply.

anchorX opt : float64 = 0

X-coordinate of coordinate anchor.

anchorY opt : float64 = 0

Y-coordinate of coordinate anchor.

returns → Vec2D

The transformed point.

Transforms the given point using the specified 2D transform.

### TransformPointI

`[Pure]`
`public` `static` `method` `TransformPointI` → `(5)`

in : int32

X-coordinate of point to transform.

in : int32

Y-coordinate of point to transform.

transform in : Transform

The 2D transform to apply.

anchorX opt : int32 = 0

X-coordinate of coordinate anchor.

anchorY opt : int32 = 0

Y-coordinate of coordinate anchor.

returns → Vec2I

The transformed point.

Transforms the given point using the specified 2D transform.

### TransformPointL

`[Pure]`
`public` `static` `method` `TransformPointL` → `(5)`

in : int64

X-coordinate of point to transform.

in : int64

Y-coordinate of point to transform.

transform in : Transform

The 2D transform to apply.

anchorX opt : int64 = 0

X-coordinate of coordinate anchor.

anchorY opt : int64 = 0

Y-coordinate of coordinate anchor.

returns → Vec2L

The transformed point.

Transforms the given point using the specified 2D transform.

### WillSwapAxes

`[Pure]`
`public` `static` `method` `WillSwapAxes` → `(1)`

transform in : Transform

The transform.

returns → bool

`true` if transform in swaps the X- and Y-axes, `false` if not.

Returns if the given Transform will swap the X- and Y-axes.

## Configuration

### Config

`public` `static` `attribute` `Config` → `(get)`

value : IConfigurator<Transform>

`[not-null]`
The configuration object.

The configurator object for this type.