A structure capable of holding a 4x4 matrix.
The contents of the Matrix structure are private and should never be accessed directly.
- public bool decompose (out Vec3 translate, out Vec3 scale, out Quaternion rotate, out Vec3 shear, out Vec4 perspective)
Decomposes a transformation matrix into its component transformations.
- public float determinant ()
Computes the determinant of the given matrix.
- public bool equal (Matrix b)
Checks whether the two given Matrix
matrices are equal.
- public bool equal_fast (Matrix b)
Checks whether the two given Matrix
matrices are byte-by-byte equal.
- public Vec4 get_row (uint index_)
Retrieves the given row vector at index_
inside a matrix.
- public float get_value (uint row, uint col)
Retrieves the value at the given row
and col
index.
- public float get_x_scale ()
Retrieves the scaling factor on the X axis in
this.
- public float get_x_translation ()
Retrieves the translation component on the X axis from
this.
- public float get_y_scale ()
Retrieves the scaling factor on the Y axis in
this.
- public float get_y_translation ()
Retrieves the translation component on the Y axis from
this.
- public float get_z_scale ()
Retrieves the scaling factor on the Z axis in
this.
- public float get_z_translation ()
Retrieves the translation component on the Z axis from
this.
- public unowned Matrix? init_from_2d (double xx, double yx, double xy, double yy, double x_0, double y_0)
Initializes a Matrix from the values of an
affine transformation matrix.
- public unowned Matrix? init_from_float (float[] v)
Initializes a Matrix with the given array
of floating point values.
- public unowned Matrix? init_from_matrix (Matrix src)
Initializes a Matrix using the values of
the given matrix.
- public unowned Matrix? init_from_vec4 (Vec4 v0, Vec4 v1, Vec4 v2, Vec4 v3)
Initializes a Matrix with the given four
row vectors.
- public unowned Matrix? init_frustum (float left, float right, float bottom, float top, float z_near, float z_far)
Initializes a Matrix compatible with
Frustum.
- public unowned Matrix? init_identity ()
Initializes a Matrix with the identity
matrix.
- public unowned Matrix? init_look_at (Vec3 eye, Vec3 center, Vec3 up)
Initializes a Matrix so that it positions
the "camera" at the given eye
coordinates towards an object at the center
coordinates.
- public unowned Matrix? init_ortho (float left, float right, float top, float bottom, float z_near, float z_far)
Initializes a Matrix with an orthographic
projection.
- public unowned Matrix? init_perspective (float fovy, float aspect, float z_near, float z_far)
Initializes a Matrix with a perspective
projection.
- public unowned Matrix? init_rotate (float angle, Vec3 axis)
Initializes this to represent a
rotation of angle
degrees on the axis represented by the axis
vector.
- public unowned Matrix? init_scale (float x, float y, float z)
Initializes a Matrix with the given
scaling factors.
- public unowned Matrix? init_skew (float x_skew, float y_skew)
Initializes a Matrix with a skew
transformation with the given factors.
- public unowned Matrix? init_translate (Point3D p)
Initializes a Matrix with a translation to
the given coordinates.
- public Matrix interpolate (Matrix b, double factor)
Linearly interpolates the two given Matrix
by interpolating the decomposed transformations separately.
- public bool inverse (out Matrix res)
Inverts the given matrix.
- public bool is_2d ()
Checks whether the given Matrix is
compatible with an a 2D affine transformation matrix.
- public bool is_backface_visible ()
Checks whether a Matrix has a visible back
face.
- public bool is_identity ()
Checks whether the given Matrix is the
identity matrix.
- public bool is_singular ()
Checks whether a matrix is singular.
- public Matrix multiply (Matrix b)
Multiplies two Matrix.
- public bool near (Matrix b, float epsilon)
Compares the two given Matrix matrices and
checks whether their values are within the given epsilon
of each other.
- public Matrix normalize ()
Normalizes the given Matrix.
- public Matrix perspective (float depth)
Applies a perspective of depth
to the matrix.
- public void print ()
Prints the contents of a matrix to the standard error stream.
- public Point project_point (Point p)
Projects a Point
using the matrix this.
- public Quad project_rect (Rect r)
Projects all corners of a
Rect using the given matrix.
- public Rect project_rect_bounds (Rect r)
Projects a Rect using
the given matrix.
- public void rotate (float angle, Vec3 axis)
Adds a rotation transformation to this
, using the given angle
and axis
vector.
- public void rotate_euler (Euler e)
Adds a rotation transformation to this
, using the given Euler.
- public void rotate_quaternion (Quaternion q)
Adds a rotation transformation to this
, using the given Quaternion.
- public void rotate_x (float angle)
Adds a rotation transformation around the X axis to
this, using the given angle
.
- public void rotate_y (float angle)
Adds a rotation transformation around the Y axis to
this, using the given angle
.
- public void rotate_z (float angle)
Adds a rotation transformation around the Z axis to
this, using the given angle
.
- public void scale (float factor_x, float factor_y, float factor_z)
Adds a scaling transformation to this
, using the three given factors.
- public void skew_xy (float factor)
Adds a skew of factor
on the X and Y axis to the given
matrix.
- public void skew_xz (float factor)
Adds a skew of factor
on the X and Z axis to the given
matrix.
- public void skew_yz (float factor)
Adds a skew of factor
on the Y and Z axis to the given
matrix.
- public bool to_2d (out double xx, out double yx, out double xy, out double yy, out double x_0, out double y_0)
Converts a Matrix to an affine
transformation matrix, if the given matrix is compatible.
- public void to_float (ref float[] v)
Converts a Matrix to an array of floating
point values.
- public Rect transform_bounds (Rect r)
Transforms each corner of a
Rect using the given matrix this.
- public Box transform_box (Box b)
Transforms the vertices of a
Box using the given matrix this.
- public Point transform_point (Point p)
Transforms the given
Point using the matrix this.
- public Point3D transform_point3d (Point3D p)
Transforms the given
Point3D using the matrix this.
- public Ray transform_ray (Ray r)
Transform a Ray using
the given matrix this.
- public Quad transform_rect (Rect r)
Transforms each corner of a
Rect using the given matrix this.
- public Sphere transform_sphere (Sphere s)
Transforms a Sphere
using the given matrix this.
- public Vec3 transform_vec3 (Vec3 v)
Transforms the given Vec3
using the matrix this.
- public Vec4 transform_vec4 (Vec4 v)
Transforms the given Vec4
using the matrix this.
- public void translate (Point3D pos)
Adds a translation transformation to this
using the coordinates of the given Point3D.
- public Matrix transpose ()
Transposes the given matrix.
- public Point3D unproject_point3d (Matrix modelview, Point3D point)
Unprojects the given point
using the
this matrix and a modelview
matrix.
- public Rect untransform_bounds (Rect r, Rect bounds)
Undoes the transformation on the corners of a
Rect using the given matrix, within the given axis aligned rectangular bounds
.
- public bool untransform_point (Point p, Rect bounds, out Point res)
Undoes the transformation of a
Point using the given matrix, within the given axis aligned rectangular bounds
.