Gtk2HsContentsIndex
Graphics.Rendering.Cairo.Matrix
Portabilityportable
Stabilityexperimental
Maintainerp.martini@neuralnoise.com
Description
Matrix math
Synopsis
data Matrix = Matrix !Double !Double !Double !Double !Double !Double
type MatrixPtr = Ptr Matrix
identity :: Matrix
translate :: Double -> Double -> Matrix -> Matrix
scale :: Double -> Double -> Matrix -> Matrix
rotate :: Double -> Matrix -> Matrix
transformDistance :: Matrix -> (Double, Double) -> (Double, Double)
transformPoint :: Matrix -> (Double, Double) -> (Double, Double)
scalarMultiply :: Double -> Matrix -> Matrix
adjoint :: Matrix -> Matrix
invert :: Matrix -> Matrix
Documentation
data Matrix

Representation of a 2-D affine transformation as a matrix.

The Matrix type actually represents as 3x3 matrix but with some elements are constant and so are not included. Specifically if we assume that our coordinates are row vectors then correspondence is:

    Matrix xx yx xy yy x0 y0
 ==
    / xx yx 0 \
    | xy yy 0 |
    \ x0 y0 1 /

and the matrix operates on (x,y) coordinates:

 (x y 1) / xx yx 0 \  = (x' y' 1)
         | xy yy 0 |  where x' = xx * x + xy * y + x0
         \ x0 y0 1 /        y' = yx * x + yy * y + y0
Constructors
Matrix !Double !Double !Double !Double !Double !Double
show/hide Instances
type MatrixPtr = Ptr Matrix
identity :: Matrix
translate :: Double -> Double -> Matrix -> Matrix
scale :: Double -> Double -> Matrix -> Matrix
rotate :: Double -> Matrix -> Matrix
transformDistance :: Matrix -> (Double, Double) -> (Double, Double)
transformPoint :: Matrix -> (Double, Double) -> (Double, Double)
scalarMultiply :: Double -> Matrix -> Matrix
adjoint :: Matrix -> Matrix
invert :: Matrix -> Matrix
Produced by Haddock version 0.8