Skip to main content

Matrix

Trait Matrix 

Source
pub trait Matrix<T>
where T: Copy,
{ // Required methods fn set<M>(&mut self, other: M) -> &mut Self where [[T; 4]; 4]: From<M>; fn translate<V>(&mut self, translation_vector: V) -> &mut Self where V: Vector<T>; fn scale<V>(&mut self, scaling_vector: V) -> &mut Self where V: Vector<T>; fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self where P: Vector<T>, V: Vector<T>; fn rotate(&mut self, radians: T) -> &mut Self; fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Self where P: Vector<T>; fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self where Vec3<T>: From<V>; fn rotate_axis_at<P, V>( &mut self, position: P, radians: T, axis: V, ) -> &mut Self where P: Vector<T>, Vec3<T>: From<V>; fn get_rotation(&self) -> Self; fn get_translation(&self) -> Vec3<T>; fn get_scale(&self) -> Vec3<T>; fn get_euler(&self) -> Vec3<T>; }
Expand description

Matrix-methods for 4x4 arrays.

Required Methods§

Source

fn set<M>(&mut self, other: M) -> &mut Self
where [[T; 4]; 4]: From<M>,

Sets the matrix value from another matrix.

Source

fn translate<V>(&mut self, translation_vector: V) -> &mut Self
where V: Vector<T>,

Translate matrix by given vector.

Source

fn scale<V>(&mut self, scaling_vector: V) -> &mut Self
where V: Vector<T>,

Scale matrix by given vector.

Source

fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self
where P: Vector<T>, V: Vector<T>,

Scales at given position.

Source

fn rotate(&mut self, radians: T) -> &mut Self

Rotates the origin around z.

Source

fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Self
where P: Vector<T>,

Rotates around z at given position.

Source

fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self
where Vec3<T>: From<V>,

Rotates around axis.

Source

fn rotate_axis_at<P, V>( &mut self, position: P, radians: T, axis: V, ) -> &mut Self
where P: Vector<T>, Vec3<T>: From<V>,

Rotates around axis at given position.

Source

fn get_rotation(&self) -> Self

Returns a pure rotation matrix for given matrix

Source

fn get_translation(&self) -> Vec3<T>

Returns the matrix’s translation vector.

Source

fn get_scale(&self) -> Vec3<T>

Returns the matrix’s scaling vector.

Source

fn get_euler(&self) -> Vec3<T>

Get rotation matrix euler angles.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> Matrix<T> for [[T; 4]; 4]
where T: Float,

Source§

fn set<M>(&mut self, other: M) -> &mut Self
where [[T; 4]; 4]: From<M>,

Source§

fn translate<V>(&mut self, translation_vector: V) -> &mut Self
where V: Vector<T>,

Source§

fn scale<V>(&mut self, scaling_vector: V) -> &mut Self
where V: Vector<T>,

Source§

fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self
where P: Vector<T>, V: Vector<T>,

Source§

fn rotate(&mut self, radians: T) -> &mut Self

Source§

fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Self
where P: Vector<T>,

Source§

fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self
where Vec3<T>: From<V>,

Source§

fn rotate_axis_at<P, V>( &mut self, position: P, radians: T, axis: V, ) -> &mut Self
where P: Vector<T>, Vec3<T>: From<V>,

Source§

fn get_rotation(&self) -> Self

Source§

fn get_translation(&self) -> Vec3<T>

Source§

fn get_scale(&self) -> Vec3<T>

Source§

fn get_euler(&self) -> Vec3<T>

Implementors§

Source§

impl<T> Matrix<T> for Mat4<T>
where T: Float,

4x4 Matrices.