Matrix

A structure capable of holding a 4x4 matrix.

The contents of the #graphene_matrix_t structure are private and should never be accessed directly.

class Matrix : Boxed {}

Members

Functions

decompose
bool decompose(graphene.vec3.Vec3 translate, graphene.vec3.Vec3 scale, graphene.quaternion.Quaternion rotate, graphene.vec3.Vec3 shear, graphene.vec4.Vec4 perspective)

Decomposes a transformation matrix into its component transformations.

determinant
float determinant()

Computes the determinant of the given matrix.

equal
bool equal(graphene.matrix.Matrix b)

Checks whether the two given #graphene_matrix_t matrices are equal.

equalFast
bool equalFast(graphene.matrix.Matrix b)

Checks whether the two given #graphene_matrix_t matrices are byte-by-byte equal.

getRow
void getRow(uint index, graphene.vec4.Vec4 res)

Retrieves the given row vector at index_ inside a matrix.

getValue
float getValue(uint row, uint col)

Retrieves the value at the given row and col index.

getXScale
float getXScale()

Retrieves the scaling factor on the X axis in m.

getXTranslation
float getXTranslation()

Retrieves the translation component on the X axis from m.

getYScale
float getYScale()

Retrieves the scaling factor on the Y axis in m.

getYTranslation
float getYTranslation()

Retrieves the translation component on the Y axis from m.

getZScale
float getZScale()

Retrieves the scaling factor on the Z axis in m.

getZTranslation
float getZTranslation()

Retrieves the translation component on the Z axis from m.

initFrom2d
graphene.matrix.Matrix initFrom2d(double xx, double yx, double xy, double yy, double x0, double y0)

Initializes a #graphene_matrix_t from the values of an affine transformation matrix.

initFromFloat
graphene.matrix.Matrix initFromFloat(float[] v)

Initializes a #graphene_matrix_t with the given array of floating point values.

initFromMatrix
graphene.matrix.Matrix initFromMatrix(graphene.matrix.Matrix src)

Initializes a #graphene_matrix_t using the values of the given matrix.

initFromVec4
graphene.matrix.Matrix initFromVec4(graphene.vec4.Vec4 v0, graphene.vec4.Vec4 v1, graphene.vec4.Vec4 v2, graphene.vec4.Vec4 v3)

Initializes a #graphene_matrix_t with the given four row vectors.

initFrustum
graphene.matrix.Matrix initFrustum(float left, float right, float bottom, float top, float zNear, float zFar)

Initializes a #graphene_matrix_t compatible with #graphene_frustum_t.

initIdentity
graphene.matrix.Matrix initIdentity()

Initializes a #graphene_matrix_t with the identity matrix.

initLookAt
graphene.matrix.Matrix initLookAt(graphene.vec3.Vec3 eye, graphene.vec3.Vec3 center, graphene.vec3.Vec3 up)

Initializes a #graphene_matrix_t 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.

initOrtho
graphene.matrix.Matrix initOrtho(float left, float right, float top, float bottom, float zNear, float zFar)

Initializes a #graphene_matrix_t with an orthographic projection.

initPerspective
graphene.matrix.Matrix initPerspective(float fovy, float aspect, float zNear, float zFar)

Initializes a #graphene_matrix_t with a perspective projection.

initRotate
graphene.matrix.Matrix initRotate(float angle, graphene.vec3.Vec3 axis)

Initializes m to represent a rotation of angle degrees on the axis represented by the axis vector.

initScale
graphene.matrix.Matrix initScale(float x, float y, float z)

Initializes a #graphene_matrix_t with the given scaling factors.

initSkew
graphene.matrix.Matrix initSkew(float xSkew, float ySkew)

Initializes a #graphene_matrix_t with a skew transformation with the given factors.

initTranslate
graphene.matrix.Matrix initTranslate(graphene.point3_d.Point3D p)

Initializes a #graphene_matrix_t with a translation to the given coordinates.

interpolate
void interpolate(graphene.matrix.Matrix b, double factor, graphene.matrix.Matrix res)

Linearly interpolates the two given #graphene_matrix_t by interpolating the decomposed transformations separately.

inverse
bool inverse(graphene.matrix.Matrix res)

Inverts the given matrix.

is2d
bool is2d()

Checks whether the given #graphene_matrix_t is compatible with an a 2D affine transformation matrix.

isBackfaceVisible
bool isBackfaceVisible()

Checks whether a #graphene_matrix_t has a visible back face.

isIdentity
bool isIdentity()

Checks whether the given #graphene_matrix_t is the identity matrix.

isSingular
bool isSingular()

Checks whether a matrix is singular.

multiply
void multiply(graphene.matrix.Matrix b, graphene.matrix.Matrix res)

Multiplies two #graphene_matrix_t.

near
bool near(graphene.matrix.Matrix b, float epsilon)

Compares the two given #graphene_matrix_t matrices and checks whether their values are within the given epsilon of each other.

normalize
void normalize(graphene.matrix.Matrix res)

Normalizes the given #graphene_matrix_t.

perspective
void perspective(float depth, graphene.matrix.Matrix res)

Applies a perspective of depth to the matrix.

print
void print()

Prints the contents of a matrix to the standard error stream.

projectPoint
void projectPoint(graphene.point.Point p, graphene.point.Point res)

Projects a #graphene_point_t using the matrix m.

projectRect
void projectRect(graphene.rect.Rect r, graphene.quad.Quad res)

Projects all corners of a #graphene_rect_t using the given matrix.

projectRectBounds
void projectRectBounds(graphene.rect.Rect r, graphene.rect.Rect res)

Projects a #graphene_rect_t using the given matrix.

rotate
void rotate(float angle, graphene.vec3.Vec3 axis)

Adds a rotation transformation to m, using the given angle and axis vector.

rotateEuler
void rotateEuler(graphene.euler.Euler e)

Adds a rotation transformation to m, using the given #graphene_euler_t.

rotateQuaternion
void rotateQuaternion(graphene.quaternion.Quaternion q)

Adds a rotation transformation to m, using the given #graphene_quaternion_t.

rotateX
void rotateX(float angle)

Adds a rotation transformation around the X axis to m, using the given angle.

rotateY
void rotateY(float angle)

Adds a rotation transformation around the Y axis to m, using the given angle.

rotateZ
void rotateZ(float angle)

Adds a rotation transformation around the Z axis to m, using the given angle.

scale
void scale(float factorX, float factorY, float factorZ)

Adds a scaling transformation to m, using the three given factors.

skewXy
void skewXy(float factor)

Adds a skew of factor on the X and Y axis to the given matrix.

skewXz
void skewXz(float factor)

Adds a skew of factor on the X and Z axis to the given matrix.

skewYz
void skewYz(float factor)

Adds a skew of factor on the Y and Z axis to the given matrix.

to2d
bool to2d(double xx, double yx, double xy, double yy, double x0, double y0)

Converts a #graphene_matrix_t to an affine transformation matrix, if the given matrix is compatible.

toFloat
void toFloat(float[] v)

Converts a #graphene_matrix_t to an array of floating point values.

transformBounds
void transformBounds(graphene.rect.Rect r, graphene.rect.Rect res)

Transforms each corner of a #graphene_rect_t using the given matrix m.

transformBox
void transformBox(graphene.box.Box b, graphene.box.Box res)

Transforms the vertices of a #graphene_box_t using the given matrix m.

transformPoint
void transformPoint(graphene.point.Point p, graphene.point.Point res)

Transforms the given #graphene_point_t using the matrix m.

transformPoint3d
void transformPoint3d(graphene.point3_d.Point3D p, graphene.point3_d.Point3D res)

Transforms the given #graphene_point3d_t using the matrix m.

transformRay
void transformRay(graphene.ray.Ray r, graphene.ray.Ray res)

Transform a #graphene_ray_t using the given matrix m.

transformRect
void transformRect(graphene.rect.Rect r, graphene.quad.Quad res)

Transforms each corner of a #graphene_rect_t using the given matrix m.

transformSphere
void transformSphere(graphene.sphere.Sphere s, graphene.sphere.Sphere res)

Transforms a #graphene_sphere_t using the given matrix m. The result is the bounding sphere containing the transformed sphere.

transformVec3
void transformVec3(graphene.vec3.Vec3 v, graphene.vec3.Vec3 res)

Transforms the given #graphene_vec3_t using the matrix m.

transformVec4
void transformVec4(graphene.vec4.Vec4 v, graphene.vec4.Vec4 res)

Transforms the given #graphene_vec4_t using the matrix m.

translate
void translate(graphene.point3_d.Point3D pos)

Adds a translation transformation to m using the coordinates of the given #graphene_point3d_t.

transpose
void transpose(graphene.matrix.Matrix res)

Transposes the given matrix.

unprojectPoint3d
void unprojectPoint3d(graphene.matrix.Matrix modelview, graphene.point3_d.Point3D point, graphene.point3_d.Point3D res)

Unprojects the given point using the projection matrix and a modelview matrix.

untransformBounds
void untransformBounds(graphene.rect.Rect r, graphene.rect.Rect bounds, graphene.rect.Rect res)

Undoes the transformation on the corners of a #graphene_rect_t using the given matrix, within the given axis aligned rectangular bounds.

untransformPoint
bool untransformPoint(graphene.point.Point p, graphene.rect.Rect bounds, graphene.point.Point res)

Undoes the transformation of a #graphene_point_t using the given matrix, within the given axis aligned rectangular bounds.

Static functions

alloc
graphene.matrix.Matrix alloc()

Allocates a new #graphene_matrix_t.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.