graphics-drawingcombinators-1.5.1: A functional interface to 2D drawing in OpenGL

Safe HaskellNone
LanguageHaskell98

Graphics.DrawingCombinators.Affine

Description

An affine transformation is a linear transformation followed by a translation; i.e. it is a function

\x -> A*x + b

Where A is a linear transformation. Affine transformations are the set of image transformations supported by Graphics.DrawingCombinators, roughly translate, rotate, scale, and compositions thereof.

Synopsis

Documentation

type R2 = (R, R) Source

data Affine Source

An Affine transformation from R2 to R2.

[[Affine]] = R2 -> R2

With the Monoid instance (identity, compose)

Instances

compose :: Affine -> Affine -> Affine Source

[[compose a b]] = [[a]] . [[b]]

apply :: Affine -> R2 -> R2 Source

[[apply a]] = [[a]]

identity :: Affine Source

[[identity]] = id

translate :: R2 -> Affine Source

[[translate t]] x = [[t]] x + t

rotate :: R -> Affine Source

[[rotate r]] (x,y) = (cos(r)x - sin(r)y, sin(r)x + cos(r)y)

scale :: R -> R -> Affine Source

[[scale xs ys]] (x,y) = (xs*x, ys*y)

inverse :: Affine -> Affine Source

[[inverse x]] = inverse [[x]]

If the transformation is not invertible, this operation is undefined.

multGLmatrix :: Affine -> IO () Source

Multiply this Affine by the top of the OpenGL matrix stack. Don't mind this, it's an implementation detail.