#[repr(C)]pub struct Mat4 {}
Expand description
Single-precision 2x2 column major matrix.
Fields§
§m00: f32
§m01: f32
§m02: f32
§m03: f32
§m10: f32
§m11: f32
§m12: f32
§m13: f32
§m20: f32
§m21: f32
§m22: f32
§m23: f32
§m30: f32
§m31: f32
§m32: f32
§m33: f32
Implementations§
source§impl Mat4
impl Mat4
source§impl Mat4
impl Mat4
sourcepub fn determinant(self) -> f32
pub fn determinant(self) -> f32
Computes the matrix determinant.
sourcepub fn inverse(self) -> Mat4
pub fn inverse(self) -> Mat4
Computes the matrix inverse.
Panics
Panics if the matrix has no inverse (i.e. has zero determinant).
Examples found in repository?
examples/unproject.rs (line 8)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn unproject_single_precision(ndc: euler::Vec2) -> euler::Vec3 {
let projection = mat4!();
let inverse_projection = projection.inverse();
let eye = inverse_projection * vec4!(ndc, -1.0, 1.0);
let view = euler::Trs::new(
vec3!(1, 0, -1),
quat!(1, 0, 0; f32::consts::PI / 2.0),
vec3!(1.0),
)
.matrix();
let inverse_view = view.inverse();
let world = inverse_view * vec4!(eye.xy(), -1.0, 0.0);
let ray = world.xyz().normalize();
ray
}
sourcepub fn try_invert(self) -> Option<Mat4>
pub fn try_invert(self) -> Option<Mat4>
Attempts to compute the matrix inverse, returning None
if the matrix is
non-invertible (i.e. has zero determinant).
Trait Implementations§
source§impl ApproxEq for Mat4
impl ApproxEq for Mat4
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
The default ULPs to tolerate when testing values that are far-apart. Read more
source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
source§fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
source§impl PartialEq<Mat4> for Mat4
impl PartialEq<Mat4> for Mat4
impl Copy for Mat4
impl StructuralPartialEq for Mat4
Auto Trait Implementations§
impl RefUnwindSafe for Mat4
impl Send for Mat4
impl Sync for Mat4
impl Unpin for Mat4
impl UnwindSafe for Mat4
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more