graphene.matrix
Module for Matrix class
class Matrix
Types 1
classMatrix : gobject.boxed.Boxed
A structure capable of holding a 4x4 matrix.
The contents of the #graphene_matrix_t structure are private and should never be accessed directly.
Methods
graphene.matrix.Matrix alloc()Allocates a new #graphene_matrix_t. Returns: the newly allocated matrixbool decompose(out graphene.vec3.Vec3 translate, out graphene.vec3.Vec3 scale, out graphene.quaternion.Quaternion rotate, out graphene.vec3.Vec3 shear, out graphene.vec4.Vec4 perspective)Decomposes a transformation matrix into its component transformations.float determinant()Computes the determinant of the given matrix. Returns: the value of the determinantbool equal(graphene.matrix.Matrix b)Checks whether the two given #graphene_matrix_t matrices are equal.bool equalFast(graphene.matrix.Matrix b)Checks whether the two given #graphene_matrix_t matrices are byte-by-byte equal.void getRow(uint index, out graphene.vec4.Vec4 res)Retrieves the given row vector at index_ inside a matrix.float getValue(uint row, uint col)Retrieves the value at the given row and col index.float getXScale()Retrieves the scaling factor on the X axis in `m`. Returns: the value of the scaling factorfloat getXTranslation()Retrieves the translation component on the X axis from `m`. Returns: the translation componentfloat getYScale()Retrieves the scaling factor on the Y axis in `m`. Returns: the value of the scaling factorfloat getYTranslation()Retrieves the translation component on the Y axis from `m`. Returns: the translation componentfloat getZScale()Retrieves the scaling factor on the Z axis in `m`. Returns: the value of the scaling factorfloat getZTranslation()Retrieves the translation component on the Z axis from `m`. Returns: the translation componentgraphene.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.graphene.matrix.Matrix initFromFloat(float[] v)Initializes a #graphene_matrix_t with the given array of floating point values.graphene.matrix.Matrix initFromMatrix(graphene.matrix.Matrix src)Initializes a #graphene_matrix_t using the values of the given matrix.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.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.graphene.matrix.Matrix initIdentity()Initializes a #graphene_matrix_t with the identity matrix. Returns: the initialized matrixgraphene.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...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.graphene.matrix.Matrix initPerspective(float fovy, float aspect, float zNear, float zFar)Initializes a #graphene_matrix_t with a perspective projection.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.graphene.matrix.Matrix initScale(float x, float y, float z)Initializes a #graphene_matrix_t with the given scaling factors.graphene.matrix.Matrix initSkew(float xSkew, float ySkew)Initializes a #graphene_matrix_t with a skew transformation with the given factors.graphene.matrix.Matrix initTranslate(graphene.point3_d.Point3D p)Initializes a #graphene_matrix_t with a translation to the given coordinates.void interpolate(graphene.matrix.Matrix b, double factor, out graphene.matrix.Matrix res)Linearly interpolates the two given #graphene_matrix_t by interpolating the decomposed transformations separately.bool inverse(out graphene.matrix.Matrix res)Inverts the given matrix.bool is2d()Checks whether the given #graphene_matrix_t is compatible with an a 2D affine transformation matrix. Returns: `true` if the matrix is compatible with an affine transformation matrixbool isBackfaceVisible()Checks whether a #graphene_matrix_t has a visible back face. Returns: `true` if the back face of the matrix is visiblebool isIdentity()Checks whether the given #graphene_matrix_t is the identity matrix. Returns: `true` if the matrix is the identity matrixbool isSingular()Checks whether a matrix is singular. Returns: `true` if the matrix is singularvoid multiply(graphene.matrix.Matrix b, out graphene.matrix.Matrix res)Multiplies two #graphene_matrix_t.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.void normalize(out graphene.matrix.Matrix res)Normalizes the given #graphene_matrix_t.void perspective(float depth, out graphene.matrix.Matrix res)Applies a perspective of depth to the matrix.void print()Prints the contents of a matrix to the standard error stream.void projectPoint(graphene.point.Point p, out graphene.point.Point res)Projects a #graphene_point_t using the matrix `m`.void projectRect(graphene.rect.Rect r, out graphene.quad.Quad res)Projects all corners of a #graphene_rect_t using the given matrix.void projectRectBounds(graphene.rect.Rect r, out graphene.rect.Rect res)Projects a #graphene_rect_t using the given matrix.void rotate(float angle, graphene.vec3.Vec3 axis)Adds a rotation transformation to `m`, using the given angle and axis vector.void rotateEuler(graphene.euler.Euler e)Adds a rotation transformation to `m`, using the given #graphene_euler_t.void rotateQuaternion(graphene.quaternion.Quaternion q)Adds a rotation transformation to `m`, using the given #graphene_quaternion_t.void rotateX(float angle)Adds a rotation transformation around the X axis to `m`, using the given angle.void rotateY(float angle)Adds a rotation transformation around the Y axis to `m`, using the given angle.void rotateZ(float angle)Adds a rotation transformation around the Z axis to `m`, using the given angle.void scale(float factorX, float factorY, float factorZ)Adds a scaling transformation to `m`, using the three given factors.void skewXy(float factor)Adds a skew of factor on the X and Y axis to the given matrix.void skewXz(float factor)Adds a skew of factor on the X and Z axis to the given matrix.void skewYz(float factor)Adds a skew of factor on the Y and Z axis to the given matrix.bool to2d(out double xx, out double yx, out double xy, out double yy, out double x0, out double y0)Converts a #graphene_matrix_t to an affine transformation matrix, if the given matrix is compatible.void toFloat(ref float[] v)Converts a #graphene_matrix_t to an array of floating point values.void transformBounds(graphene.rect.Rect r, out graphene.rect.Rect res)Transforms each corner of a #graphene_rect_t using the given matrix `m`.void transformBox(graphene.box.Box b, out graphene.box.Box res)Transforms the vertices of a #graphene_box_t using the given matrix `m`.void transformPoint(graphene.point.Point p, out graphene.point.Point res)Transforms the given #graphene_point_t using the matrix `m`.void transformPoint3d(graphene.point3_d.Point3D p, out graphene.point3_d.Point3D res)Transforms the given #graphene_point3d_t using the matrix `m`.void transformRay(graphene.ray.Ray r, out graphene.ray.Ray res)Transform a #graphene_ray_t using the given matrix `m`.void transformRect(graphene.rect.Rect r, out graphene.quad.Quad res)Transforms each corner of a #graphene_rect_t using the given matrix `m`.void transformSphere(graphene.sphere.Sphere s, out graphene.sphere.Sphere res)Transforms a #graphene_sphere_t using the given matrix `m`. The result is the bounding sphere containing the transformed sphere.void transformVec3(graphene.vec3.Vec3 v, out graphene.vec3.Vec3 res)Transforms the given #graphene_vec3_t using the matrix `m`.void transformVec4(graphene.vec4.Vec4 v, out graphene.vec4.Vec4 res)Transforms the given #graphene_vec4_t using the matrix `m`.void translate(graphene.point3_d.Point3D pos)Adds a translation transformation to `m` using the coordinates of the given #graphene_point3d_t.void transpose(out graphene.matrix.Matrix res)Transposes the given matrix.void unprojectPoint3d(graphene.matrix.Matrix modelview, graphene.point3_d.Point3D point, out graphene.point3_d.Point3D res)Unprojects the given point using the projection matrix and a modelview matrix.void untransformBounds(graphene.rect.Rect r, graphene.rect.Rect bounds, out 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.bool untransformPoint(graphene.point.Point p, graphene.rect.Rect bounds, out graphene.point.Point res)Undoes the transformation of a #graphene_point_t using the given matrix, within the given axis aligned rectangular bounds.