Transform

Description

enum Tinman.Terrain.Util.Transform

Enumeration of simple 2D affine transformations.

Each possible combination (see Transforms.Combine) of the transforms in this enum will result in a transform that is also defined in this enumeration:

Combine(a,b) := a           * b
-----------------------------------------
Rotate       := RotateInv   * Center
Rotate       := Center      * RotateInv
Rotate       := Vertical    * Diagonal
Rotate       := Horizontal  * DiagonalInv
Rotate       := Diagonal    * Horizontal
Rotate       := DiagonalInv * Vertical
-----------------------------------------
RotateInv    := Rotate      * Center
RotateInv    := Center      * Rotate
RotateInv    := Vertical    * DiagonalInv
RotateInv    := Horizontal  * Diagonal
RotateInv    := Diagonal    * Vertical
RotateInv    := DiagonalInv * Horizontal
-----------------------------------------
Center       := Rotate      * Rotate
Center       := RotateInv   * RotateInv
Center       := Vertical    * Horizontal
Center       := Horizontal  * Vertical
Center       := Diagonal    * DiagonalInv
Center       := DiagonalInv * Diagonal
-----------------------------------------
Vertical     := Rotate      * Diagonal
Vertical     := RotateInv   * DiagonalInv
Vertical     := Center      * Horizontal
Vertical     := Horizontal  * Center
Vertical     := Diagonal    * RotateInv
Vertical     := DiagonalInv * Rotate
-----------------------------------------
Horizontal   := Rotate      * DiagonalInv
Horizontal   := RotateInv   * Diagonal
Horizontal   := Center      * Vertical
Horizontal   := Vertical    * Center
Horizontal   := Diagonal    * Rotate
Horizontal   := DiagonalInv * RotateInv
-----------------------------------------
Diagonal     := Rotate      * Horizontal
Diagonal     := RotateInv   * Vertical
Diagonal     := Center      * DiagonalInv
Diagonal     := Vertical    * Rotate
Diagonal     := Horizontal  * RotateInv
Diagonal     := DiagonalInv * Center
-----------------------------------------
DiagonalInv  := Rotate      * Vertical
DiagonalInv  := RotateInv   * Horizontal
DiagonalInv  := Center      * Diagonal
DiagonalInv  := Vertical    * RotateInv
DiagonalInv  := Horizontal  * Rotate
DiagonalInv  := Diagonal    * Center
See also

Transforms

Public / Constants

None

public constant None → (0:int32)

No transformation.

+---+---+      +---+---+
| A | B |      | A | B |
+---o---+  =>  +---o---+    o := (0, 0)
| C | D |      | C | D |
+---+---+      +---+---+

This transform does not depend on the direction of the Y-axis.

Rotate

public constant Rotate → (1:int32)

Rotation of 90°

x' := -y
y' := x

+---+---+      +---+---+       ^ Y+
| A | B |      | B | D |       |
+---o---+  =>  +---o---+    ---+---> X+
| C | D |      | A | C |       |
+---+---+      +---+---+       |

+---+---+      +---+---+       |
| A | B |      | C | A |       |
+---o---+  =>  +---o---+    ---+---> X+
| C | D |      | D | B |       |
+---+---+      +---+---+       V Y+

RotateInv

public constant RotateInv → (2:int32)

Inverse rotation of 90°.

x' := y
y' := -x

+---+---+      +---+---+       ^ Y+
| A | B |      | C | A |       |
+---o---+  =>  +---o---+    ---+---> X+    o := (0, 0)
| C | D |      | D | B |       |
+---+---+      +---+---+       |

+---+---+      +---+---+       |
| A | B |      | B | D |       |
+---o---+  =>  +---o---+    ---+---> X+    o := (0, 0)
| C | D |      | A | C |       |
+---+---+      +---+---+       V Y+
See also

Transform.Rotate

Center

public constant Center → (3:int32)

Flip at center (resp. rotation of 180°).

x' := -x
y' := -y

+---+---+      +---+---+
| A | B |      | D | C |
+---o---+  =>  +---o---+    o := (0, 0)
| C | D |      | B | A |
+---+---+      +---+---+

This transform does not depend on the direction of the Y-axis.

Vertical

public constant Vertical → (4:int32)

Flip at X-axis.

x' := -y
y' := x

+---+---+      +---+---+
| A | B |      | C | D |
+---o---+  =>  +---o---+    o := (0, 0)
| C | D |      | A | B |
+---+---+      +---+---+

This transform does not depend on the direction of the Y-axis.

Horizontal

public constant Horizontal → (5:int32)

Flip at Y-axis.

x' := -x
y' := y

+---+---+      +---+---+
| A | B |      | B | A |
+---o---+  =>  +---o---+    o := (0, 0)
| C | D |      | D | C |
+---+---+      +---+---+

This transform does not depend on the direction of the Y-axis.

Diagonal

public constant Diagonal → (6:int32)

Flip at Y = X.

x' := y
y' := x

+---+---+      +---+---+       ^ Y+
| A | B |      | D | B |       |
+---o---+  =>  +---o---+    ---+---> X+    o := (0, 0)
| C | D |      | C | A |       |
+---+---+      +---+---+       |

+---+---+      +---+---+       |
| A | B |      | A | C |       |
+---o---+  =>  +---o---+    ---+---> X+    o := (0, 0)
| C | D |      | B | D |       |
+---+---+      +---+---+       V Y+

DiagonalInv

public constant DiagonalInv → (7:int32)

Flip at Y = -X.

x' := -y
y' := -x

+---+---+      +---+---+       ^ Y+
| A | B |      | A | C |       |
+---o---+  =>  +---o---+    ---o---> X+    o := (0, 0)
| C | D |      | B | D |       |
+---+---+      +---+---+       |

+---+---+      +---+---+       |
| A | B |      | D | B |       |
+---o---+  =>  +---o---+    ---o---> X+    o := (0, 0)
| C | D |      | C | A |       |
+---+---+      +---+---+       V Y+