Matrix

class Matrix(pointer: <Error class: unknown class><<Error class: unknown class>>)

A structure capable of holding a 4x4 matrix.

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

Skipped during bindings generation

  • parameter v: Array parameter of type gfloat is not supported

  • parameter xx: xx: Out parameter is not supported

  • parameter v: v: Out parameter is not supported

  • field value: Record field value is private

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val grapheneMatrixPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun decompose(translate: Vec3, scale: Vec3, rotate: Quaternion, shear: Vec3, perspective: Vec4): Boolean

Decomposes a transformation matrix into its component transformations.

Link copied to clipboard

Computes the determinant of the given matrix.

Link copied to clipboard

Checks whether the two given #graphene_matrix_t matrices are equal.

Link copied to clipboard

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

Link copied to clipboard
fun free()

Frees the resources allocated by graphene_matrix_alloc().

Link copied to clipboard
fun getRow(index: <Error class: unknown class>, res: Vec4)

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

Link copied to clipboard
fun getValue(row: <Error class: unknown class>, col: <Error class: unknown class>): Float

Retrieves the value at the given @row and @col index.

Link copied to clipboard

Retrieves the scaling factor on the X axis in @m.

Link copied to clipboard

Retrieves the translation component on the X axis from @m.

Link copied to clipboard

Retrieves the scaling factor on the Y axis in @m.

Link copied to clipboard

Retrieves the translation component on the Y axis from @m.

Link copied to clipboard

Retrieves the scaling factor on the Z axis in @m.

Link copied to clipboard

Retrieves the translation component on the Z axis from @m.

Link copied to clipboard
fun initFrom2d(xx: Double, yx: Double, xy: Double, yy: Double, x0: Double, y0: Double): Matrix

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

Link copied to clipboard

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

Link copied to clipboard
fun initFromVec4(v0: Vec4, v1: Vec4, v2: Vec4, v3: Vec4): Matrix

Initializes a #graphene_matrix_t with the given four row vectors.

Link copied to clipboard
fun initFrustum(left: Float, right: Float, bottom: Float, top: Float, zNear: Float, zFar: Float): Matrix

Initializes a #graphene_matrix_t compatible with #graphene_frustum_t.

Link copied to clipboard

Initializes a #graphene_matrix_t with the identity matrix.

Link copied to clipboard
fun initLookAt(eye: Vec3, center: Vec3, up: Vec3): Matrix

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.

Link copied to clipboard
fun initOrtho(left: Float, right: Float, top: Float, bottom: Float, zNear: Float, zFar: Float): Matrix

Initializes a #graphene_matrix_t with an orthographic projection.

Link copied to clipboard
fun initPerspective(fovy: Float, aspect: Float, zNear: Float, zFar: Float): Matrix

Initializes a #graphene_matrix_t with a perspective projection.

Link copied to clipboard
fun initRotate(angle: Float, axis: Vec3): Matrix

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

Link copied to clipboard
fun initScale(x: Float, y: Float, z: Float): Matrix

Initializes a #graphene_matrix_t with the given scaling factors.

Link copied to clipboard
fun initSkew(xSkew: Float, ySkew: Float): Matrix

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

Link copied to clipboard

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

Link copied to clipboard
fun interpolate(b: Matrix, factor: Double, res: Matrix)

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

Link copied to clipboard

Inverts the given matrix.

Link copied to clipboard
fun is2d(): Boolean

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

Link copied to clipboard

Checks whether a #graphene_matrix_t has a visible back face.

Link copied to clipboard

Checks whether the given #graphene_matrix_t is the identity matrix.

Link copied to clipboard

Checks whether a matrix is singular.

Link copied to clipboard
fun multiply(b: Matrix, res: Matrix)

Multiplies two #graphene_matrix_t.

Link copied to clipboard
fun near(b: Matrix, epsilon: Float): Boolean

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

Link copied to clipboard
fun normalize(res: Matrix)

Normalizes the given #graphene_matrix_t.

Link copied to clipboard
fun perspective(depth: Float, res: Matrix)

Applies a perspective of @depth to the matrix.

Link copied to clipboard
fun print()

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

Link copied to clipboard
fun projectPoint(p: Point, res: Point)

Projects a #graphene_point_t using the matrix @m.

Link copied to clipboard
fun projectRect(r: Rect, res: Quad)

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

Link copied to clipboard

Projects a #graphene_rect_t using the given matrix.

Link copied to clipboard
fun rotate(angle: Float, axis: Vec3)

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
fun rotateX(angle: Float)

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

Link copied to clipboard
fun rotateY(angle: Float)

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

Link copied to clipboard
fun rotateZ(angle: Float)

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

Link copied to clipboard
fun scale(factorX: Float, factorY: Float, factorZ: Float)

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

Link copied to clipboard
fun skewXy(factor: Float)

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

Link copied to clipboard
fun skewXz(factor: Float)

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

Link copied to clipboard
fun skewYz(factor: Float)

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

Link copied to clipboard
fun transformBounds(r: Rect, res: Rect)

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

Link copied to clipboard
fun transformBox(b: Box, res: Box)

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

Link copied to clipboard
fun transformPoint(p: Point, res: Point)

Transforms the given #graphene_point_t using the matrix @m.

Link copied to clipboard

Transforms the given #graphene_point3d_t using the matrix @m.

Link copied to clipboard
fun transformRay(r: Ray, res: Ray)

Transform a #graphene_ray_t using the given matrix @m.

Link copied to clipboard
fun transformRect(r: Rect, res: Quad)

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

Link copied to clipboard

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

Link copied to clipboard
fun transformVec3(v: Vec3, res: Vec3)

Transforms the given #graphene_vec3_t using the matrix @m.

Link copied to clipboard
fun transformVec4(v: Vec4, res: Vec4)

Transforms the given #graphene_vec4_t using the matrix @m.

Link copied to clipboard
fun translate(pos: Point3D)

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

Link copied to clipboard
fun transpose(res: Matrix)

Transposes the given matrix.

Link copied to clipboard
fun unprojectPoint3d(modelview: Matrix, point: Point3D, res: Point3D)

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

Link copied to clipboard
fun untransformBounds(r: Rect, bounds: Rect, res: Rect)

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

Link copied to clipboard
fun untransformPoint(p: Point, bounds: Rect, res: Point): Boolean

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