helm-1.0.0: A functionally reactive game engine.

Safe HaskellSafe
LanguageHaskell2010

Helm.Graphics2D.Transform

Contents

Description

Contains the 2D transform matrix type and functions for composing transformation matricies.

Synopsis

Types

data Transform Source

Represents a transformation matrix that can be used to transform forms. This is more useful than just using the composing methods in the graphics API, as it can perform skewing and other complex transformation techniques.

Constructors

Transform (M33 Double) 

Composing

identity :: Transform Source

Construct an identity transformation matrix. Anything transformed by this matrix will remain the same.

matrix :: Double -> Double -> Double -> Double -> Double -> Double -> Transform Source

Construct a transformation matrix with specific row/column values.

matrix a b c d x y

/ a b x c d y /

rotation :: Double -> Transform Source

Construct a counter-clockwise rotating transformation matrix.

rotation t

/ cos t -sin t 0 sin t cos t 0 /

translation :: V2 Double -> Transform Source

Construct a translating transformation matrix.

translation (V2 x y)

/ 1 0 x 0 1 y /

scale :: V2 Double -> Transform Source

Construction a scaling transformation matrix. To scale in all directions, simply have the x and y values the same. Alternatively, to scale by only one direction, keep the excluded dimenion's vector component as 1.

scale (V2 x y)

/ x 0 0 0 y 0 /

multiply :: Transform -> Transform -> Transform Source

Multiply two transformatio nmatrices together..