[12:14] static extends: object
Generated struct layout helper for GIR record Matrix.
layout ()
Returns the Panama struct layout for
Matrix.
[29:7] extends: object
A structure capable of holding a 4x4 matrix. The contents of the #graphene_matrix_t structure are private and should never be accessed directly.
GrapheneMatrix (Handle = null)
Allocates a new #graphene_matrix_t.
Handle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.decompose ()
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.
translate is the translation vector.scale is the scale vector.rotate is the rotation quaternion.shear is the shear vector.perspective is the perspective vector.true if the matrix could be decomposed.determinant ()
Computes the determinant of the given matrix.
the value of the determinant.equal (object b)
Checks whether the two given #graphene_matrix_t matrices are equal.
b is a #graphene_matrix_t.true if the two matrices are equal, and false otherwise.equal_fast (object b)
Checks whether the two given #graphene_matrix_t matrices are byte-by-byte equal. While this function is faster than graphene_matrix_equal(), it can also return false negatives, so it should be used in conjuction with either graphene_matrix_equal() or graphene_matrix_near(). For instance: |[ 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 } ]|
b is a #graphene_matrix_t.true if the matrices are equal. and false otherwise.free ()
Frees the resources allocated by graphene_matrix_alloc().
None.get_row (int index_)
Retrieves the given row vector at @index_ inside a matrix.
index_ is the index of the row vector, between 0 and 3.res is return location for the #graphene_vec4_t that is used to store the row vector.None.get_value (int row, int col)
Retrieves the value at the given @row and @col index.
row is the row index.col is the column index.the value at the given indices.get_x_scale ()
Retrieves the scaling factor on the X axis in @m.
the value of the scaling factor.get_x_translation ()
Retrieves the translation component on the X axis from @m.
the translation component.get_y_scale ()
Retrieves the scaling factor on the Y axis in @m.
the value of the scaling factor.get_y_translation ()
Retrieves the translation component on the Y axis from @m.
the translation component.get_z_scale ()
Retrieves the scaling factor on the Z axis in @m.
the value of the scaling factor.get_z_translation ()
Retrieves the translation component on the Z axis from @m.
the translation component.init_from_2d (double xx, double yx, double xy, double yy, double x_0, double y_0)
Initializes a #graphene_matrix_t from the values of an affine transformation matrix. The arguments map to the following matrix layout: |[ ⎛ 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 #graphene_matrix_t.
xx is the xx member.yx is the yx member.xy is the xy member.yy is the yy member.x_0 is the x0 member.y_0 is the y0 member.the initialized matrix.init_from_float (list v)
Initializes a #graphene_matrix_t with the given array of floating point values.
v is an array of at least 16 floating point values.the initialized matrix.init_from_matrix (object src)
Initializes a #graphene_matrix_t using the values of the given matrix.
src is a #graphene_matrix_t.the initialized matrix.init_from_vec4 (object v0, object v1, object v2, object v3)
Initializes a #graphene_matrix_t with the given four row vectors.
v0 is the first row vector.v1 is the second row vector.v2 is the third row vector.v3 is the fourth row vector.the initialized matrix.init_frustum (double left, double right, double bottom, double top, double z_near, double z_far)
Initializes a #graphene_matrix_t compatible with #graphene_frustum_t. See also: graphene_frustum_init_from_matrix()
left is distance of the left clipping plane.right is distance of the right clipping plane.bottom is distance of the bottom clipping plane.top is distance of the top clipping plane.z_near is distance of the near clipping plane.z_far is distance of the far clipping plane.the initialized matrix.init_identity ()
Initializes a #graphene_matrix_t with the identity matrix.
the initialized matrix.init_look_at (object eye, object center, object 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. 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.
eye is the vector describing the position to look from.center is the vector describing the position to look at.up is the vector describing the world's upward direction; usually, this is the graphene_vec3_y_axis() vector.the initialized matrix.init_ortho (double left, double right, double top, double bottom, double z_near, double z_far)
Initializes a #graphene_matrix_t with an orthographic projection.
left is the left edge of the clipping plane.right is the right edge of the clipping plane.top is the top edge of the clipping plane.bottom is the bottom edge of the clipping plane.z_near is the distance of the near clipping plane.z_far is the distance of the far clipping plane.the initialized matrix.init_perspective (double fovy, double aspect, double z_near, double z_far)
Initializes a #graphene_matrix_t with a perspective projection.
fovy is the field of view angle, in degrees.aspect is the aspect value.z_near is the near Z plane.z_far is the far Z plane.the initialized matrix.init_rotate (double angle, object axis)
Initializes @m to represent a rotation of @angle degrees on the axis represented by the @axis vector.
angle is the rotation angle, in degrees.axis is the axis vector as a #graphene_vec3_t.the initialized matrix.init_scale (double x, double y, double z)
Initializes a #graphene_matrix_t with the given scaling factors.
x is the scale factor on the X axis.y is the scale factor on the Y axis.z is the scale factor on the Z axis.the initialized matrix.init_skew (double x_skew, double y_skew)
Initializes a #graphene_matrix_t with a skew transformation with the given factors.
x_skew is skew factor, in radians, on the X axis.y_skew is skew factor, in radians, on the Y axis.the initialized matrix.init_translate (object p)
Initializes a #graphene_matrix_t with a translation to the given coordinates.
p is the translation coordinates.the initialized matrix.interpolate (object b, double factor)
Linearly interpolates the two given #graphene_matrix_t 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.
b is a #graphene_matrix_t.factor is the linear interpolation factor.res is return location for the interpolated matrix.None.inverse ()
Inverts the given matrix.
res is return location for the inverse matrix.true if the matrix is invertible.is_2d ()
Checks whether the given #graphene_matrix_t is compatible with an a 2D affine transformation matrix.
true if the matrix is compatible with an affine transformation matrix.is_backface_visible ()
Checks whether a #graphene_matrix_t has a visible back face.
true if the back face of the matrix is visible.is_identity ()
Checks whether the given #graphene_matrix_t is the identity matrix.
true if the matrix is the identity matrix.is_singular ()
Checks whether a matrix is singular.
true if the matrix is singular.multiply (object b)
Multiplies two #graphene_matrix_t. Matrix multiplication is not commutative in general; the order of the factors matters. The product of this multiplication is (@a × @b)
b is a #graphene_matrix_t.res is return location for the matrix result.None.near (object b, double epsilon)
Compares the two given #graphene_matrix_t matrices and checks whether their values are within the given @epsilon of each other.
b is a #graphene_matrix_t.epsilon is the threshold between the two matrices.true if the two matrices are near each other, and false otherwise.normalize ()
Normalizes the given #graphene_matrix_t.
res is return location for the normalized matrix.None.perspective (double depth)
Applies a perspective of @depth to the matrix.
depth is the depth of the perspective.res is return location for the perspective matrix.None.print ()
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.
None.project_point (object p)
Projects a #graphene_point_t using the matrix @m.
p is a #graphene_point_t.res is return location for the projected point.None.project_rect_bounds (object r)
Projects a #graphene_rect_t using the given matrix. The resulting rectangle is the axis aligned bounding rectangle capable of fully containing the projected rectangle.
r is a #graphene_rect_t.res is return location for the projected rectangle.None.rotate (double angle, object axis)
Adds a rotation transformation to @m, using the given @angle and @axis vector. This is the equivalent of calling graphene_matrix_init_rotate() and then multiplying the matrix @m with the rotation matrix.
angle is the rotation angle, in degrees.axis is the rotation axis, as a #graphene_vec3_t.None.rotate_euler (object e)
Adds a rotation transformation to @m, using the given #graphene_euler_t.
e is a rotation described by a #graphene_euler_t.None.rotate_quaternion (object q)
Adds a rotation transformation to @m, using the given #graphene_quaternion_t. This is the equivalent of calling graphene_quaternion_to_matrix() and then multiplying @m with the rotation matrix.
q is a rotation described by a #graphene_quaternion_t.None.rotate_x (double angle)
Adds a rotation transformation around the X axis to @m, using the given
See also: graphene_matrix_rotate()angle is the rotation angle, in degrees.None.rotate_y (double angle)
Adds a rotation transformation around the Y axis to @m, using the given
See also: graphene_matrix_rotate()angle is the rotation angle, in degrees.None.rotate_z (double angle)
Adds a rotation transformation around the Z axis to @m, using the given
See also: graphene_matrix_rotate()angle is the rotation angle, in degrees.None.scale (double factor_x, double factor_y, double factor_z)
Adds a scaling transformation to @m, using the three given factors. This is the equivalent of calling graphene_matrix_init_scale() and then multiplying the matrix @m with the scale matrix.
factor_x is scaling factor on the X axis.factor_y is scaling factor on the Y axis.factor_z is scaling factor on the Z axis.None.skew_xy (double factor)
Adds a skew of @factor on the X and Y axis to the given matrix.
factor is skew factor.None.skew_xz (double factor)
Adds a skew of @factor on the X and Z axis to the given matrix.
factor is skew factor.None.skew_yz (double factor)
Adds a skew of @factor on the Y and Z axis to the given matrix.
factor is skew factor.None.to_2d ()
Converts a #graphene_matrix_t to an affine transformation matrix, if the given matrix is compatible. The returned values have the following layout: |[ ⎛ xx yx ⎞ ⎛ a b 0 ⎞ ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠ ]| This function can be used to convert between a #graphene_matrix_t and an affine matrix type from other libraries.
xx is return location for the xx member.yx is return location for the yx member.xy is return location for the xy member.yy is return location for the yy member.x_0 is return location for the x0 member.y_0 is return location for the y0 member.true if the matrix is compatible with an affine transformation matrix.to_float ()
Converts a #graphene_matrix_t to an array of floating point values.
v is return location for an array of floating point values. The array must be capable of holding at least 16 values..None.transform_bounds (object r)
Transforms each corner of a #graphene_rect_t using the given matrix @m. The result is the axis aligned bounding rectangle containing the coplanar quadrilateral. See also: graphene_matrix_transform_point()
r is a #graphene_rect_t.res is return location for the bounds of the transformed rectangle.None.transform_box (object b)
Transforms the vertices of a #graphene_box_t using the given matrix @m. The result is the axis aligned bounding box containing the transformed vertices.
b is a #graphene_box_t.res is return location for the bounds of the transformed box.None.transform_point (object p)
Transforms the given #graphene_point_t using the matrix @m. Unlike graphene_matrix_transform_vec3(), this function will take into account the fourth row vector of the #graphene_matrix_t when computing the dot product of each row vector of the matrix. See also: graphene_simd4x4f_point3_mul()
p is a #graphene_point_t.res is return location for the transformed #graphene_point_t.None.transform_point3d (object p)
Transforms the given #graphene_point3d_t using the matrix @m. Unlike graphene_matrix_transform_vec3(), this function will take into account the fourth row vector of the #graphene_matrix_t when computing the dot product of each row vector of the matrix. See also: graphene_simd4x4f_point3_mul()
p is a #graphene_point3d_t.res is return location for the result.None.transform_ray (object r)
Transform a #graphene_ray_t using the given matrix @m.
r is a #graphene_ray_t.res is return location for the transformed ray.None.transform_sphere (object s)
Transforms a #graphene_sphere_t using the given matrix @m. The result is the bounding sphere containing the transformed sphere.
s is a #graphene_sphere_t.res is return location for the bounds of the transformed sphere.None.transform_vec3 (object v)
Transforms the given #graphene_vec3_t 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()
v is a #graphene_vec3_t.res is return location for a #graphene_vec3_t.None.transform_vec4 (object v)
Transforms the given #graphene_vec4_t using the matrix @m. See also: graphene_simd4x4f_vec4_mul()
v is a #graphene_vec4_t.res is return location for a #graphene_vec4_t.None.translate (object pos)
Adds a translation transformation to @m using the coordinates of the given #graphene_point3d_t. This is the equivalent of calling graphene_matrix_init_translate() and then multiplying @m with the translation matrix.
pos is a #graphene_point3d_t.None.transpose ()
Transposes the given matrix.
res is return location for the transposed matrix.None.unproject_point3d (object modelview, object point)
Unprojects the given @point using the @projection matrix and a @modelview matrix.
modelview is a #graphene_matrix_t for the modelview matrix; this is the inverse of the modelview used when projecting the point.point is a #graphene_point3d_t with the coordinates of the point.res is return location for the unprojected point.None.untransform_bounds (object r, object bounds)
Undoes the transformation on the corners of a #graphene_rect_t using the given matrix, within the given axis aligned rectangular @bounds.
r is a #graphene_rect_t.bounds is the bounds of the transformation.res is return location for the untransformed rectangle.None.untransform_point (object p, object bounds)
Undoes the transformation of a #graphene_point_t using the given matrix, within the given axis aligned rectangular @bounds.
p is a #graphene_point_t.bounds is the bounds of the transformation.res is return location for the untransformed point.true if the point was successfully untransformed.