Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.Graphene.Structs.Matrix
Contents
- Exported types
- Methods
- alloc
- decompose
- determinant
- equal
- equalFast
- free
- getRow
- getValue
- getXScale
- getXTranslation
- getYScale
- getYTranslation
- getZScale
- getZTranslation
- initFrom2d
- initFromFloat
- initFromMatrix
- initFromVec4
- initFrustum
- initIdentity
- initLookAt
- initOrtho
- initPerspective
- initRotate
- initScale
- initSkew
- initTranslate
- interpolate
- inverse
- is2d
- isBackfaceVisible
- isIdentity
- isSingular
- multiply
- near
- normalize
- perspective
- projectPoint
- projectRect
- projectRectBounds
- rotate
- rotateEuler
- rotateQuaternion
- rotateX
- rotateY
- rotateZ
- scale
- skewXy
- skewXz
- skewYz
- to2d
- transformBounds
- transformBox
- transformPoint
- transformPoint3d
- transformRay
- transformRect
- transformSphere
- transformVec3
- transformVec4
- translate
- transpose
- unprojectPoint3d
- untransformBounds
- untransformPoint
Description
A structure capable of holding a 4x4 matrix.
The contents of the Matrix
structure are private and
should never be accessed directly.
Synopsis
- newtype Matrix = Matrix (ManagedPtr Matrix)
- newZeroMatrix :: MonadIO m => m Matrix
- matrixAlloc :: (HasCallStack, MonadIO m) => m Matrix
- matrixDecompose :: (HasCallStack, MonadIO m) => Matrix -> m (Bool, Vec3, Vec3, Quaternion, Vec3, Vec4)
- matrixDeterminant :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixEqual :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m Bool
- matrixEqualFast :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m Bool
- matrixFree :: (HasCallStack, MonadIO m) => Matrix -> m ()
- matrixGetRow :: (HasCallStack, MonadIO m) => Matrix -> Word32 -> m Vec4
- matrixGetValue :: (HasCallStack, MonadIO m) => Matrix -> Word32 -> Word32 -> m Float
- matrixGetXScale :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixGetXTranslation :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixGetYScale :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixGetYTranslation :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixGetZScale :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixGetZTranslation :: (HasCallStack, MonadIO m) => Matrix -> m Float
- matrixInitFrom2d :: (HasCallStack, MonadIO m) => Matrix -> Double -> Double -> Double -> Double -> Double -> Double -> m Matrix
- matrixInitFromFloat :: (HasCallStack, MonadIO m) => Matrix -> [Float] -> m Matrix
- matrixInitFromMatrix :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m Matrix
- matrixInitFromVec4 :: (HasCallStack, MonadIO m) => Matrix -> Vec4 -> Vec4 -> Vec4 -> Vec4 -> m Matrix
- matrixInitFrustum :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> Float -> Float -> Float -> Float -> m Matrix
- matrixInitIdentity :: (HasCallStack, MonadIO m) => Matrix -> m Matrix
- matrixInitLookAt :: (HasCallStack, MonadIO m) => Matrix -> Vec3 -> Vec3 -> Vec3 -> m Matrix
- matrixInitOrtho :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> Float -> Float -> Float -> Float -> m Matrix
- matrixInitPerspective :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> Float -> Float -> m Matrix
- matrixInitRotate :: (HasCallStack, MonadIO m) => Matrix -> Float -> Vec3 -> m Matrix
- matrixInitScale :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> Float -> m Matrix
- matrixInitSkew :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> m Matrix
- matrixInitTranslate :: (HasCallStack, MonadIO m) => Matrix -> Point3D -> m Matrix
- matrixInterpolate :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> Double -> m Matrix
- matrixInverse :: (HasCallStack, MonadIO m) => Matrix -> m (Bool, Matrix)
- matrixIs2d :: (HasCallStack, MonadIO m) => Matrix -> m Bool
- matrixIsBackfaceVisible :: (HasCallStack, MonadIO m) => Matrix -> m Bool
- matrixIsIdentity :: (HasCallStack, MonadIO m) => Matrix -> m Bool
- matrixIsSingular :: (HasCallStack, MonadIO m) => Matrix -> m Bool
- matrixMultiply :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> m Matrix
- matrixNear :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> Float -> m Bool
- matrixNormalize :: (HasCallStack, MonadIO m) => Matrix -> m Matrix
- matrixPerspective :: (HasCallStack, MonadIO m) => Matrix -> Float -> m Matrix
- matrixPrint :: (HasCallStack, MonadIO m) => Matrix -> m ()
- matrixProjectPoint :: (HasCallStack, MonadIO m) => Matrix -> Point -> m Point
- matrixProjectRect :: (HasCallStack, MonadIO m) => Matrix -> Rect -> m Quad
- matrixProjectRectBounds :: (HasCallStack, MonadIO m) => Matrix -> Rect -> m Rect
- matrixRotate :: (HasCallStack, MonadIO m) => Matrix -> Float -> Vec3 -> m ()
- matrixRotateEuler :: (HasCallStack, MonadIO m) => Matrix -> Euler -> m ()
- matrixRotateQuaternion :: (HasCallStack, MonadIO m) => Matrix -> Quaternion -> m ()
- matrixRotateX :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixRotateY :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixRotateZ :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixScale :: (HasCallStack, MonadIO m) => Matrix -> Float -> Float -> Float -> m ()
- matrixSkewXy :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixSkewXz :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixSkewYz :: (HasCallStack, MonadIO m) => Matrix -> Float -> m ()
- matrixTo2d :: (HasCallStack, MonadIO m) => Matrix -> m (Bool, Double, Double, Double, Double, Double, Double)
- matrixTransformBounds :: (HasCallStack, MonadIO m) => Matrix -> Rect -> m Rect
- matrixTransformBox :: (HasCallStack, MonadIO m) => Matrix -> Box -> m Box
- matrixTransformPoint :: (HasCallStack, MonadIO m) => Matrix -> Point -> m Point
- matrixTransformPoint3d :: (HasCallStack, MonadIO m) => Matrix -> Point3D -> m Point3D
- matrixTransformRay :: (HasCallStack, MonadIO m) => Matrix -> Ray -> m Ray
- matrixTransformRect :: (HasCallStack, MonadIO m) => Matrix -> Rect -> m Quad
- matrixTransformSphere :: (HasCallStack, MonadIO m) => Matrix -> Sphere -> m Sphere
- matrixTransformVec3 :: (HasCallStack, MonadIO m) => Matrix -> Vec3 -> m Vec3
- matrixTransformVec4 :: (HasCallStack, MonadIO m) => Matrix -> Vec4 -> m Vec4
- matrixTranslate :: (HasCallStack, MonadIO m) => Matrix -> Point3D -> m ()
- matrixTranspose :: (HasCallStack, MonadIO m) => Matrix -> m Matrix
- matrixUnprojectPoint3d :: (HasCallStack, MonadIO m) => Matrix -> Matrix -> Point3D -> m Point3D
- matrixUntransformBounds :: (HasCallStack, MonadIO m) => Matrix -> Rect -> Rect -> m Rect
- matrixUntransformPoint :: (HasCallStack, MonadIO m) => Matrix -> Point -> Rect -> m (Bool, Point)
Exported types
Memory-managed wrapper type.
Instances
Eq Matrix Source # | |
GBoxed Matrix Source # | |
Defined in GI.Graphene.Structs.Matrix | |
ManagedPtrNewtype Matrix Source # | |
Defined in GI.Graphene.Structs.Matrix Methods toManagedPtr :: Matrix -> ManagedPtr Matrix | |
TypedObject Matrix Source # | |
Defined in GI.Graphene.Structs.Matrix | |
HasParentTypes Matrix Source # | |
Defined in GI.Graphene.Structs.Matrix | |
tag ~ 'AttrSet => Constructible Matrix tag Source # | |
IsGValue (Maybe Matrix) Source # | Convert |
Defined in GI.Graphene.Structs.Matrix Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Matrix -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Matrix) | |
type ParentTypes Matrix Source # | |
Defined in GI.Graphene.Structs.Matrix |
Methods
Click to display all available methods, including inherited ones
Methods
decompose, determinant, equal, equalFast, free, initFrom2d, initFromFloat, initFromMatrix, initFromVec4, initFrustum, initIdentity, initLookAt, initOrtho, initPerspective, initRotate, initScale, initSkew, initTranslate, interpolate, inverse, is2d, isBackfaceVisible, isIdentity, isSingular, multiply, near, normalize, perspective, print, projectPoint, projectRect, projectRectBounds, rotate, rotateEuler, rotateQuaternion, rotateX, rotateY, rotateZ, scale, skewXy, skewXz, skewYz, to2d, transformBounds, transformBox, transformPoint, transformPoint3d, transformRay, transformRect, transformSphere, transformVec3, transformVec4, translate, transpose, unprojectPoint3d, untransformBounds, untransformPoint.
Getters
getRow, getValue, getXScale, getXTranslation, getYScale, getYTranslation, getZScale, getZTranslation.
Setters
None.
alloc
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Matrix | Returns: the newly allocated matrix |
Allocates a new Matrix
.
Since: 1.0
decompose
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m (Bool, Vec3, Vec3, Quaternion, Vec3, Vec4) | Returns: |
Decomposes a transformation matrix into its component transformations.
The algorithm for decomposing a matrix is taken from the CSS3 Transforms specification; specifically, the decomposition code is based on the equivalent code published in "Graphics Gems II", edited by Jim Arvo, and available online.
determinant
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the value of the determinant |
Computes the determinant of the given matrix.
Since: 1.0
equal
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> m Bool | Returns: |
Checks whether the two given Matrix
matrices are equal.
Since: 1.10
equalFast
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> m Bool | Returns: |
Checks whether the two given Matrix
matrices are
byte-by-byte equal.
While this function is faster than matrixEqual
, it
can also return false negatives, so it should be used in
conjuction with either matrixEqual
or
matrixNear
. For instance:
C code
if (graphene_matrix_equal_fast (a, b)) { // matrices are definitely the same } else { if (graphene_matrix_equal (a, b)) // matrices contain the same values within an epsilon of FLT_EPSILON else if (graphene_matrix_near (a, b, 0.0001)) // matrices contain the same values within an epsilon of 0.0001 else // matrices are not equal }
Since: 1.10
free
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m () |
Frees the resources allocated by matrixAlloc
.
Since: 1.0
getRow
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Word32 |
|
-> m Vec4 |
Retrieves the given row vector at index_
inside a matrix.
Since: 1.0
getValue
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Word32 |
|
-> Word32 |
|
-> m Float | Returns: the value at the given indices |
Retrieves the value at the given row
and col
index.
Since: 1.0
getXScale
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the value of the scaling factor |
Retrieves the scaling factor on the X axis in m
.
Since: 1.0
getXTranslation
matrixGetXTranslation Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the translation component |
Retrieves the translation component on the X axis from m
.
Since: 1.10
getYScale
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the value of the scaling factor |
Retrieves the scaling factor on the Y axis in m
.
Since: 1.0
getYTranslation
matrixGetYTranslation Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the translation component |
Retrieves the translation component on the Y axis from m
.
Since: 1.10
getZScale
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the value of the scaling factor |
Retrieves the scaling factor on the Z axis in m
.
Since: 1.0
getZTranslation
matrixGetZTranslation Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Float | Returns: the translation component |
Retrieves the translation component on the Z axis from m
.
Since: 1.10
initFrom2d
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
from the values of an affine
transformation matrix.
The arguments map to the following matrix layout:
plain code
⎛ xx yx ⎞ ⎛ a b 0 ⎞ ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
This function can be used to convert between an affine matrix type
from other libraries and a Matrix
.
Since: 1.0
initFromFloat
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> [Float] |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with the given array of floating
point values.
Since: 1.0
initFromMatrix
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
using the values of the
given matrix.
Since: 1.0
initFromVec4
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Vec4 |
|
-> Vec4 |
|
-> Vec4 |
|
-> Vec4 |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with the given four row
vectors.
Since: 1.0
initFrustum
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Matrix | Returns: the initialized matrix |
initIdentity
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with the identity matrix.
Since: 1.0
initLookAt
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Vec3 |
|
-> Vec3 |
|
-> Vec3 |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
so that it positions the "camera"
at the given eye
coordinates towards an object at the center
coordinates. The top of the camera is aligned to the direction
of the up
vector.
Before the transform, the camera is assumed to be placed at the origin, looking towards the negative Z axis, with the top side of the camera facing in the direction of the Y axis and the right side in the direction of the X axis.
In theory, one could use m
to transform a model of such a camera
into world-space. However, it is more common to use the inverse of
m
to transform another object from world coordinates to the view
coordinates of the camera. Typically you would then apply the
camera projection transform to get from view to screen
coordinates.
Since: 1.0
initOrtho
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with an orthographic projection.
Since: 1.0
initPerspective
matrixInitPerspective Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with a perspective projection.
Since: 1.0
initRotate
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Vec3 |
|
-> m Matrix | Returns: the initialized matrix |
Initializes m
to represent a rotation of angle
degrees on
the axis represented by the axis
vector.
Since: 1.0
initScale
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with the given scaling factors.
Since: 1.0
initSkew
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with a skew transformation
with the given factors.
Since: 1.0
initTranslate
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Point3D |
|
-> m Matrix | Returns: the initialized matrix |
Initializes a Matrix
with a translation to the
given coordinates.
Since: 1.0
interpolate
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> Double |
|
-> m Matrix |
Linearly interpolates the two given Matrix
by
interpolating the decomposed transformations separately.
If either matrix cannot be reduced to their transformations then the interpolation cannot be performed, and this function will return an identity matrix.
Since: 1.0
inverse
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m (Bool, Matrix) | Returns: |
Inverts the given matrix.
Since: 1.0
is2d
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Bool | Returns: |
Checks whether the given Matrix
is compatible with an
a 2D affine transformation matrix.
Since: 1.0
isBackfaceVisible
matrixIsBackfaceVisible Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Bool | Returns: |
Checks whether a Matrix
has a visible back face.
Since: 1.0
isIdentity
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Bool | Returns: |
Checks whether the given Matrix
is the identity matrix.
Since: 1.0
isSingular
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Bool | Returns: |
Checks whether a matrix is singular.
Since: 1.0
multiply
Multiplies two Matrix
.
Matrix multiplication is not commutative in general; the order of the factors matters.
The product of this multiplication is (a
× b
)
Since: 1.0
near
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> Float |
|
-> m Bool | Returns: |
Compares the two given Matrix
matrices and checks
whether their values are within the given epsilon
of each
other.
Since: 1.10
normalize
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Matrix |
Normalizes the given Matrix
.
Since: 1.0
perspective
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m Matrix |
Applies a perspective of depth
to the matrix.
Since: 1.0
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m () |
Prints the contents of a matrix to the standard error stream.
This function is only useful for debugging; there are no guarantees made on the format of the output.
Since: 1.0
projectPoint
Projects a Point
using the matrix m
.
Since: 1.0
projectRect
projectRectBounds
matrixProjectRectBounds Source #
Projects a Rect
using the given matrix.
The resulting rectangle is the axis aligned bounding rectangle capable of fully containing the projected rectangle.
Since: 1.0
rotate
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Vec3 |
|
-> m () |
Adds a rotation transformation to m
, using the given angle
and axis
vector.
This is the equivalent of calling matrixInitRotate
and
then multiplying the matrix m
with the rotation matrix.
Since: 1.0
rotateEuler
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Euler |
|
-> m () |
Adds a rotation transformation to m
, using the given
Euler
.
Since: 1.2
rotateQuaternion
matrixRotateQuaternion Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Quaternion |
|
-> m () |
Adds a rotation transformation to m
, using the given
Quaternion
.
This is the equivalent of calling quaternionToMatrix
and
then multiplying m
with the rotation matrix.
Since: 1.2
rotateX
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a rotation transformation around the X axis to m
, using
the given angle
.
See also: matrixRotate
Since: 1.0
rotateY
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a rotation transformation around the Y axis to m
, using
the given angle
.
See also: matrixRotate
Since: 1.0
rotateZ
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a rotation transformation around the Z axis to m
, using
the given angle
.
See also: matrixRotate
Since: 1.0
scale
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m () |
Adds a scaling transformation to m
, using the three
given factors.
This is the equivalent of calling matrixInitScale
and then
multiplying the matrix m
with the scale matrix.
Since: 1.0
skewXy
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a skew of factor
on the X and Y axis to the given matrix.
Since: 1.0
skewXz
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a skew of factor
on the X and Z axis to the given matrix.
Since: 1.0
skewYz
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Float |
|
-> m () |
Adds a skew of factor
on the Y and Z axis to the given matrix.
Since: 1.0
to2d
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m (Bool, Double, Double, Double, Double, Double, Double) | Returns: |
Converts a Matrix
to an affine transformation
matrix, if the given matrix is compatible.
The returned values have the following layout:
plain code
⎛ xx yx ⎞ ⎛ a b 0 ⎞ ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
This function can be used to convert between a Matrix
and an affine matrix type from other libraries.
Since: 1.0
transformBounds
matrixTransformBounds Source #
Transforms each corner of a Rect
using the given matrix m
.
The result is the axis aligned bounding rectangle containing the coplanar quadrilateral.
See also: matrixTransformPoint
Since: 1.0
transformBox
Transforms the vertices of a Box
using the given matrix m
.
The result is the axis aligned bounding box containing the transformed vertices.
Since: 1.2
transformPoint
Transforms the given Point
using the matrix m
.
Unlike matrixTransformVec3
, this function will take into
account the fourth row vector of the Matrix
when computing
the dot product of each row vector of the matrix.
See also: graphene_simd4x4f_point3_mul()
Since: 1.0
transformPoint3d
matrixTransformPoint3d Source #
Transforms the given Point3D
using the matrix m
.
Unlike matrixTransformVec3
, this function will take into
account the fourth row vector of the Matrix
when computing
the dot product of each row vector of the matrix.
See also: graphene_simd4x4f_point3_mul()
Since: 1.2
transformRay
Transform a Ray
using the given matrix m
.
Since: 1.4
transformRect
Transforms each corner of a Rect
using the given matrix m
.
The result is a coplanar quadrilateral.
See also: matrixTransformPoint
Since: 1.0
transformSphere
matrixTransformSphere Source #
Transforms a Sphere
using the given matrix m
. The
result is the bounding sphere containing the transformed sphere.
Since: 1.2
transformVec3
Transforms the given Vec3
using the matrix m
.
This function will multiply the X, Y, and Z row vectors of the matrix m
with the corresponding components of the vector v
. The W row vector will
be ignored.
See also: graphene_simd4x4f_vec3_mul()
Since: 1.0
transformVec4
translate
Adds a translation transformation to m
using the coordinates
of the given Point3D
.
This is the equivalent of calling matrixInitTranslate
and
then multiplying m
with the translation matrix.
Since: 1.0
transpose
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> m Matrix |
Transposes the given matrix.
Since: 1.0
unprojectPoint3d
matrixUnprojectPoint3d Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Matrix |
|
-> Point3D |
|
-> m Point3D |
Unprojects the given point
using the projection
matrix and
a modelview
matrix.
Since: 1.2
untransformBounds
matrixUntransformBounds Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Rect |
|
-> Rect |
|
-> m Rect |
Undoes the transformation on the corners of a Rect
using the
given matrix, within the given axis aligned rectangular bounds
.
Since: 1.0
untransformPoint
matrixUntransformPoint Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Matrix |
|
-> Point |
|
-> Rect |
|
-> m (Bool, Point) | Returns: |
Undoes the transformation of a Point
using the
given matrix, within the given axis aligned rectangular bounds
.
Since: 1.0