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 {}

Constructors

this
this(graphene_matrix_t* graphene_matrix, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Allocates a new #graphene_matrix_t.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

decompose
bool decompose(Vec3 translate, Vec3 scale, Quaternion rotate, Vec3 shear, Vec4 perspective)

Decomposes a transformation matrix into its component transformations.

determinant
float determinant()

Computes the determinant of the given matrix.

equal
bool equal(Matrix b)

Checks whether the two given #graphene_matrix_t matrices are equal.

equalFast
bool equalFast(Matrix b)

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

free
void free()

Frees the resources allocated by graphene_matrix_alloc().

getMatrixStruct
graphene_matrix_t* getMatrixStruct(bool transferOwnership)

Get the main Gtk struct

getRow
void getRow(uint index, Vec4 res)

Retrieves the given row vector at @index_ inside a matrix.

getStruct
void* getStruct()

the main Gtk struct as a void*

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
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
Matrix initFromFloat(float[16] v)

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

initFromMatrix
Matrix initFromMatrix(Matrix src)

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

initFromVec4
Matrix initFromVec4(Vec4 v0, Vec4 v1, Vec4 v2, Vec4 v3)

Initializes a #graphene_matrix_t with the given four row vectors.

initFrustum
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
Matrix initIdentity()

Initializes a #graphene_matrix_t with the identity matrix.

initLookAt
Matrix initLookAt(Vec3 eye, Vec3 center, 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
Matrix initOrtho(float left, float right, float top, float bottom, float zNear, float zFar)

Initializes a #graphene_matrix_t with an orthographic projection.

initPerspective
Matrix initPerspective(float fovy, float aspect, float zNear, float zFar)

Initializes a #graphene_matrix_t with a perspective projection.

initRotate
Matrix initRotate(float angle, Vec3 axis)

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

initScale
Matrix initScale(float x, float y, float z)

Initializes a #graphene_matrix_t with the given scaling factors.

initSkew
Matrix initSkew(float xSkew, float ySkew)

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

initTranslate
Matrix initTranslate(Point3D p)

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

interpolate
void interpolate(Matrix b, double factor, Matrix res)

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

inverse
bool inverse(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(Matrix b, Matrix res)

Multiplies two #graphene_matrix_t.

near
bool near(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(Matrix res)

Normalizes the given #graphene_matrix_t.

perspective
void perspective(float depth, 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(Point p, Point res)

Projects a #graphene_point_t using the matrix @m.

projectRect
void projectRect(Rect r, Quad res)

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

projectRectBounds
void projectRectBounds(Rect r, Rect res)

Projects a #graphene_rect_t using the given matrix.

rotate
void rotate(float angle, Vec3 axis)

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

rotateEuler
void rotateEuler(Euler e)

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

rotateQuaternion
void rotateQuaternion(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[16] v)

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

transformBounds
void transformBounds(Rect r, Rect res)

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

transformBox
void transformBox(Box b, Box res)

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

transformPoint
void transformPoint(Point p, Point res)

Transforms the given #graphene_point_t using the matrix @m.

transformPoint3d
void transformPoint3d(Point3D p, Point3D res)

Transforms the given #graphene_point3d_t using the matrix @m.

transformRay
void transformRay(Ray r, Ray res)

Transform a #graphene_ray_t using the given matrix @m.

transformRect
void transformRect(Rect r, Quad res)

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

transformSphere
void transformSphere(Sphere s, 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(Vec3 v, Vec3 res)

Transforms the given #graphene_vec3_t using the matrix @m.

transformVec4
void transformVec4(Vec4 v, Vec4 res)

Transforms the given #graphene_vec4_t using the matrix @m.

translate
void translate(Point3D pos)

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

transpose
void transpose(Matrix res)

Transposes the given matrix.

unprojectPoint3d
void unprojectPoint3d(Matrix modelview, Point3D point, Point3D res)

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

untransformBounds
void untransformBounds(Rect r, Rect bounds, 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(Point p, Rect bounds, Point res)

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

Static functions

getType
GType getType()

Variables

graphene_matrix
graphene_matrix_t* graphene_matrix;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta