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

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 -> AffineSource

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

apply :: Affine -> R2 -> R2Source

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

identity :: AffineSource

 [[identity]] = id

translate :: R2 -> AffineSource

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

rotate :: R -> AffineSource

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

scale :: R -> R -> AffineSource

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

inverse :: Affine -> AffineSource

 [[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.