Mat4

Mat4

  • x_axis : glam::Vec4
  • y_axis : glam::Vec4
  • z_axis : glam::Vec4
  • w_axis : glam::Vec4

Description

No Documentation 🚧

Functions

FunctionSummary
abs(_self) Takes the absolute value of each element in `self`
abs_diff_eq(_self, rhs, max_abs_diff) Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e
add(_self, rhs)No Documentation 🚧
add_mat4(_self, rhs) Adds two 4x4 matrices.
as_dmat4(_self)No Documentation 🚧
clone(_self)No Documentation 🚧
col(_self, index) Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 3.
determinant(_self) Returns the determinant of `self`.
div(_self, rhs)No Documentation 🚧
div_scalar(_self, rhs) Divides a 4x4 matrix by a scalar.
eq(_self, rhs)No Documentation 🚧
from_axis_angle(axis, angle) Creates an affine transformation matrix containing a 3D rotation around a normalized rotation `axis`
from_cols(x_axis, y_axis, z_axis, w_axis) Creates a 4x4 matrix from four column vectors.
from_diagonal(diagonal) Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0.
from_euler(order, a, b, c) Creates a affine transformation matrix containing a rotation from the given euler rotation sequenc
from_mat3(m) Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu
from_mat3a(m) Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu
from_quat(rotation) Creates an affine transformation matrix from the given `rotation` quaternion. The resulting matrix
from_rotation_translation(rotation, translation) Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can
from_rotation_x(angle) Creates an affine transformation matrix containing a 3D rotation around the x axis of `angle` (in
from_rotation_y(angle) Creates an affine transformation matrix containing a 3D rotation around the y axis of `angle` (in
from_rotation_z(angle) Creates an affine transformation matrix containing a 3D rotation around the z axis of `angle` (in
from_scale(scale) Creates an affine transformation matrix containing the given 3D non-uniform `scale`. The resulting
from_scale_rotation_translation(scale, rotation, translation) Creates an affine transformation matrix from the given 3D `scale`, `rotation` and `translation`.
from_translation(translation) Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can
inverse(_self) Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid
is_finite(_self) Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive
is_nan(_self) Returns `true` if any elements are `NaN`.
look_at_lh(eye, center, up) Creates a left-handed view matrix using a camera position, an up direction, and a focal point. Fo
look_at_rh(eye, center, up) Creates a right-handed view matrix using a camera position, an up direction, and a focal point. F
look_to_lh(eye, dir, up) Creates a left-handed view matrix using a camera position, an up direction, and a facing direction
look_to_rh(eye, dir, up) Creates a right-handed view matrix using a camera position, an up direction, and a facing directio
mul(_self, rhs)No Documentation 🚧
mul-1(arg0, arg1)No Documentation 🚧
mul-2(arg0, arg1)No Documentation 🚧
mul-3(arg0, arg1)No Documentation 🚧
mul_mat4(_self, rhs) Multiplies two 4x4 matrices.
mul_scalar(_self, rhs) Multiplies a 4x4 matrix by a scalar.
mul_vec4(_self, rhs) Transforms a 4D vector.
neg(_self)No Documentation 🚧
orthographic_lh(left, right, bottom, top, near, far) Creates a left-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
orthographic_rh(left, right, bottom, top, near, far) Creates a right-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
orthographic_rh_gl(left, right, bottom, top, near, far) Creates a right-handed orthographic projection matrix with `[-1,1]` depth range. This is the same as the OpenGL `glOrtho` function in OpenGL. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/glOrtho\.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects.
perspective_infinite_lh(fov_y_radians, aspect_ratio, z_near) Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_lh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled.
perspective_infinite_reverse_lh(fov_y_radians, aspect_ratio, z_near) Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled.
perspective_infinite_reverse_rh(fov_y_radians, aspect_ratio, z_near) Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled.
perspective_infinite_rh(fov_y_radians, aspect_ratio, z_near) Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_rh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled.
perspective_lh(fov_y_radians, aspect_ratio, z_near, z_far) Creates a left-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled.
perspective_rh(fov_y_radians, aspect_ratio, z_near, z_far) Creates a right-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled.
perspective_rh_gl(fov_y_radians, aspect_ratio, z_near, z_far) Creates a right-handed perspective projection matrix with `[-1,1]` depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGL `gluPerspective` function. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/gluPerspective\.xml
project_point3(_self, rhs) Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent
project_point3a(_self, rhs) Transforms the given [`Vec3A`] as a 3D point, applying perspective correction. This is the equivalent of multiplying the [`Vec3A`]
row(_self, index) Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 3.
sub(_self, rhs)No Documentation 🚧
sub_mat4(_self, rhs) Subtracts two 4x4 matrices.
to_cols_array(_self) Creates a `[f32; 16]` array storing data in column major order. If you require data in row major order `transpose` the matrix first.
to_cols_array_2d(_self) Creates a `[[f32; 4]; 4]` 4D array storing data in column major order. If you require data in row
to_euler(_self, order) Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain sca
transform_point3(_self, rhs) Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as
transform_point3a(_self, rhs) Transforms the given [`Vec3A`] as 3D point. This is the equivalent of multiplying the [`Vec3A`] as
transform_vector3(_self, rhs) Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector
transform_vector3a(_self, rhs) Transforms the give [`Vec3A`] as 3D vector. This is the equivalent of multiplying the [`Vec3A`] as
transpose(_self) Returns the transpose of `self`.