Struct radiant_rs::Mat4
[−]
[src]
pub struct Mat4<T: Debug + Float + NumCast = f32>(pub [[T; 4]; 4]);
A 4x4 matrix.
Methods
impl<T> Mat4<T> where T: Debug + Float + NumCast
[src]
fn new() -> Mat4<T>
Creates a zero matrix.
fn identity() -> Mat4<T>
Creates an identity matrix.
fn viewport(width: T, height: T) -> Mat4<T>
Creates viewport matrix mapping viewport top left to (0.0, 0.0) and bottom right to (width, height)
fn look_at<E, C, U>(eye: E, target: C, up: U) -> Mat4<T> where E: VecType<T>, C: VecType<T>, U: VecType<T>
Creates a look-at matrix with the given eye position, target position, and up-vector.
fn ortho<R>(rectangle: R, near: T, far: T) -> Mat4<T> where Rect<T>: From<R>
Creates an orthogonal projection matrix with the given rectangular bounds at the near and far clipping plane.
fn frustum<R>(rectangle: R, near: T, far: T) -> Mat4<T> where Rect<T>: From<R>
Creates a frustum projection matrix with the given rectangular bounds at the near clipping plane and rectangle * (far / near) at the far clipping plane.
fn perspective(fov_y: T, aspect: T, near: T, far: T) -> Mat4<T>
Creates a perspective projection matrix with the given field of view, aspect and near/far clipping planes.
fn translate<V>(&mut self, translation_vector: V) -> &mut Self where V: VecType<T>
Translate matrix by given vector.
fn scale<V>(&mut self, scaling_vector: V) -> &mut Self where V: VecType<T>
Scale matrix by given vector.
fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self where P: VecType<T>, V: VecType<T>
Scales at given position.
fn rotate(&mut self, radians: T) -> &mut Self
Rotates the origin around z.
fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Self where P: VecType<T>
Rotates around z at given position.
fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self where Vec3<T>: From<V>
Rotates around axis.
fn rotate_axis_at<P, V>(&mut self,
position: P,
radians: T,
axis: V)
-> &mut Self where P: VecType<T>, Vec3<T>: From<V>
position: P,
radians: T,
axis: V)
-> &mut Self where P: VecType<T>, Vec3<T>: From<V>
Rotates around axis at given position.
fn set(&mut self, other: Mat4<T>)
Sets the matrix value from another matrix.
fn get_rotation(&self) -> Mat4<T>
Returns a pure rotation matrix for given matrix
fn get_translation(&self) -> Vec3<T>
Returns the matrix's translation vector.
fn get_scale(&self) -> Vec3<T>
Returns the matrix's scaling vector.
fn get_euler(&self) -> Vec3<T>
Get rotation matrix euler angles
Trait Implementations
impl<T: Copy + Debug + Float + NumCast> Copy for Mat4<T>
[src]
impl<T: Clone + Debug + Float + NumCast> Clone for Mat4<T>
[src]
fn clone(&self) -> Mat4<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T> From<[[T; 4]; 4]> for Mat4<T> where T: Debug + Float
[src]
impl<T: Debug + Float> Mul<T> for Mat4<T>
[src]
type Output = Mat4<T>
The resulting type after applying the *
operator
fn mul(self, other: T) -> Mat4<T>
The method for the *
operator
impl<T> Mul<Vec2<T>> for Mat4<T> where T: Debug + Float
[src]
type Output = Vec2<T>
The resulting type after applying the *
operator
fn mul(self, other: Vec2<T>) -> Vec2<T>
Multiplies the matrix with given vector operand, using 0 as z-component and 1 as w-component of the vector.
impl<T> Mul<Vec3<T>> for Mat4<T> where T: Debug + Float
[src]
type Output = Vec3<T>
The resulting type after applying the *
operator
fn mul(self, other: Vec3<T>) -> Vec3<T>
Multiplies the matrix with given vector operand using 1 as w-component of the vector.
impl<T: Debug + Float> Mul<Mat4<T>> for Mat4<T>
[src]
type Output = Mat4<T>
The resulting type after applying the *
operator
fn mul(self, other: Mat4<T>) -> Mat4<T>
The method for the *
operator