affine v0.1.0 Affine.Operations

The Operations module simply defines the multiply and transform functions in the Matrix library for convienence. Additionally, aliases are provided using ‘t’ for ‘transform’ and ‘m’ for ‘multiply’.

Summary

Functions

Multiplies two transformations to get a new one. Order of matrix multiplication is not communitative; order is important. Effectively, the t2 tranform matrix is done first when applying the combined result

Transforms the provided point with the specified transform. Returns the transformed point. The point may be 1, 2 or 3 dimensional

Types

matrix()
matrix() :: [[number]]
point()
point() :: [number]

Functions

m(matrix1, matrix2)

See Affine.Operations.multiply/2.

multiply(t1, t2)
multiply(matrix, matrix) :: matrix

Multiplies two transformations to get a new one. Order of matrix multiplication is not communitative; order is important. Effectively, the t2 tranform matrix is done first when applying the combined result.

An example of usage is:

t_scale = Affine.Transforms.scale (2.0, 2.0, 2.0)
t_scale_then_translate = Affine.Operations.multiply t_translate, t_scale
point = Affine.transform t_scale_then_translate [ 1.0, 2.0, 3.0 ]
assert point == [ 5.0, 8.0, 11.0 ]

Note that the multiply function is also aliased as Affine.multiply and Affine.m.

t(matrix, point)
t(matrix, point) :: point

See Affine.Operations.transform/2.

transform(t, point)
transform(matrix, point) :: point

Transforms the provided point with the specified transform. Returns the transformed point. The point may be 1, 2 or 3 dimensional.

An example of usage is:

t1 = Affine.Transforms.translate (3.0, 4.0, 5.0)
t2 = Affine.Transforms.scale (2.0, 2.0, 2.0)
t = Affine.Operations.multiply t1, t2

point = Affine.transform t [ 1.0, 2.0, 3.0 ]