geomancy-0.3.0.0: Vectors and matrix manipulation
Safe HaskellNone
LanguageHaskell2010

Geomancy.Transform

Synopsis

Documentation

newtype Transform Source #

Constructors

Transform 

Fields

Instances

Instances details
Storable Transform Source # 
Instance details

Defined in Geomancy.Transform

Monoid Transform Source # 
Instance details

Defined in Geomancy.Transform

Semigroup Transform Source # 
Instance details

Defined in Geomancy.Transform

Show Transform Source # 
Instance details

Defined in Geomancy.Transform

Block Transform Source # 
Instance details

Defined in Geomancy.Transform

Associated Types

type PackedSize Transform 
Instance details

Defined in Geomancy.Transform

Methods

alignment140 :: proxy Transform -> Int #

sizeOf140 :: proxy Transform -> Int #

isStruct :: proxy Transform -> Bool #

read140 :: MonadIO m => Ptr a -> Diff a Transform -> m Transform #

write140 :: MonadIO m => Ptr a -> Diff a Transform -> Transform -> m () #

alignment430 :: proxy Transform -> Int #

sizeOf430 :: proxy Transform -> Int #

read430 :: MonadIO m => Ptr a -> Diff a Transform -> m Transform #

write430 :: MonadIO m => Ptr a -> Diff a Transform -> Transform -> m () #

sizeOfPacked :: proxy Transform -> Int #

readPacked :: MonadIO m => Ptr a -> Diff a Transform -> m Transform #

writePacked :: MonadIO m => Ptr a -> Diff a Transform -> Transform -> m () #

type PackedSize Transform Source # 
Instance details

Defined in Geomancy.Transform

inverse :: (Coercible Mat4 a, Coercible Mat4 a) => a -> a Source #

Compute an inverse matrix, slowly.

apply :: Vec3 -> Transform -> Vec3 Source #

Apply transformation to a vector, then normalize with perspective division

(!.) :: Transform -> Vec3 -> Vec3 infixr 5 Source #

Matrix - row vector multiplication with perspective division

vOut = pv <> translate !. vIn

rotateX :: Float -> Transform Source #

Clockwise rotation around positive X axis.

Matches a -> rotateQ (axisAngle (vec3 1 0 0) a).

rotateY :: Float -> Transform Source #

Clockwise rotation around positive Y axis.

Matches a -> rotateQ (axisAngle (vec3 0 1 0) a).

rotateZ :: Float -> Transform Source #

Clockwise rotation around positive Z axis.

Can be used for 2D rotation in the XY plane. Matches a -> rotateQ (axisAngle (vec3 0 0 1) a).

In the right-handed "window coordinates" (e.g. top-left corner is 0,0) "right" becomes "down" after 90deg turn.