Module elmesque::transform_2d [] [src]

Ported from elm-lang's Transform2D module

A library for performing 2D matrix transformations. It is used primarily with the group_transform function from the form module and allows you to do things like rotation, scaling, translation, shearing and reflection.

Note that all the matrices in this library are 3*3 matrices of homogeneous coordinates, used for affine transformations. Since the bottom row is always 0 0 1 in these matrices, it is omitted in the diagrams below.

Structs

Transform2D

Represents a 2D transform.

Functions

identity

Create an identity transform. Transforming by the identity does not change anything, but it can come in handy as a default or base case.

matrix

Creates a transformation matrix. This lets you create transforms such as scales, shears, reflections and translations.

rotation

Create a rotation matrix. Given an angle t, it creates a counterclockwise rotation matrix.

scale

Creates a transformation matrix for scaling by all directions.

scale_x

Creates a transformation for horizontal scaling.

scale_y

Creates a transformation for vertical scaling.

translation

Creates a transformation matrix for translation.

Type Definitions

Matrix2d