[−][src]Struct geng_core::prelude::Mat4
4x4 matrix
Implementations
impl<T> Mat4<T> where
T: Copy,
[src]
T: Copy,
pub fn transpose(self) -> Mat4<T>
[src]
Get transposed matrix.
Examples
use batbox::*; let matrix = Mat4::translate(vec3(1, 2, 3)); let matrix_transposed = matrix.transpose(); for i in 0..4 { for j in 0..4 { assert_eq!(matrix[(i, j)], matrix_transposed[(j, i)]); } }
impl<T> Mat4<T> where
T: Num,
[src]
T: Num,
impl<T> Mat4<T> where
T: Float,
[src]
T: Float,
pub fn inverse(self) -> Mat4<T>
[src]
Get inverse matrix.
Examples
use batbox::*; let matrix = Mat4::<f64>::rotate_x(0.123); let matrix_inv = matrix.inverse(); let mult = matrix * matrix_inv; for i in 0..4 { for j in 0..4 { assert!((mult[(i, j)] - if i == j { 1.0 } else { 0.0 }).abs() < 1e-5); } }
impl<T> Mat4<T> where
T: Float,
[src]
T: Float,
pub fn perspective(fov: T, aspect: T, near: T, far: T) -> Mat4<T>
[src]
Construct prespective projection matrix.
pub fn frustum(left: T, right: T, bottom: T, top: T, near: T, far: T) -> Mat4<T>
[src]
Construct frustum projection matrix.
impl<T> Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
pub fn scale_uniform(factor: T) -> Mat4<T>
[src]
Construct a uniform scale matrix.
Examples
use batbox::*; let matrix = Mat4::scale_uniform(2); assert_eq!(matrix * vec4(1, 2, 3, 1), vec4(2, 4, 6, 1));
pub fn scale(factor: Vec3<T>) -> Mat4<T>
[src]
Construct a scale matrix.
Examples
use batbox::*; let matrix = Mat4::scale(vec3(1, 2, 3)); assert_eq!(matrix * vec4(1, 2, 3, 1), vec4(1, 4, 9, 1));
pub fn translate(dv: Vec3<T>) -> Mat4<T>
[src]
Construct a translation matrix.
Examples
use batbox::*; let matrix = Mat4::translate(vec3(3, 2, 1)); assert_eq!(matrix * vec4(1, 2, 3, 1), vec4(4, 4, 4, 1));
impl<T> Mat4<T> where
T: Float,
[src]
T: Float,
pub fn rotate_x(angle: T) -> Mat4<T>
[src]
Construct matrix rotating around x axis.
pub fn rotate_y(angle: T) -> Mat4<T>
[src]
Construct matrix rotating around y axis.
pub fn rotate_z(angle: T) -> Mat4<T>
[src]
Construct matrix rotating around z axis.
pub fn rotate(v: Vec3<T>, angle: T) -> Mat4<T> where
T: SubAssign<T> + AddAssign<T>,
[src]
T: SubAssign<T> + AddAssign<T>,
impl<T> Mat4<T>
[src]
impl<T> Mat4<T> where
T: Copy,
[src]
T: Copy,
pub fn new(values: [[T; 4]; 4]) -> Mat4<T>
[src]
Construct a matrix.
Examples
use batbox::*; let matrix = Mat4::new([ [1, 2, 3, 4], [3, 4, 5, 6], [5, 6, 7, 8], [0, 5, 2, 9], ]);
pub fn row(&self, row_index: usize) -> Vec4<T>
[src]
impl<T> Mat4<T>
[src]
pub fn as_flat_array(&self) -> &[T; 16]
[src]
pub fn as_flat_array_mut(&mut self) -> &mut [T; 16]
[src]
impl<T> Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
pub fn zero() -> Mat4<T>
[src]
Construct zero matrix.
Examples
use batbox::*; let matrix = Mat4::<i32>::zero(); for i in 0..4 { for j in 0..4 { assert_eq!(matrix[(i, j)], 0); } }
pub fn identity() -> Mat4<T>
[src]
Construct identity matrix.
Examples
use batbox::*; let matrix = Mat4::<i32>::identity(); for i in 0..4 { for j in 0..4 { assert_eq!(matrix[(i, j)], if i == j { 1 } else { 0 }); } }
Trait Implementations
impl<T> Add<Mat4<T>> for Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
type Output = Mat4<T>
The resulting type after applying the +
operator.
fn add(self, rhs: Mat4<T>) -> Mat4<T>
[src]
impl<T> AddAssign<Mat4<T>> for Mat4<T> where
T: Num + Copy + AddAssign<T>,
[src]
T: Num + Copy + AddAssign<T>,
fn add_assign(&mut self, rhs: Mat4<T>)
[src]
impl<T> ApproxEq for Mat4<T> where
T: Float,
[src]
T: Float,
fn approx_distance_to(&self, other: &Mat4<T>) -> f32
[src]
fn approx_eq(&self, other: &Self) -> bool
[src]
fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool
[src]
impl<T> Clone for Mat4<T> where
T: Clone,
[src]
T: Clone,
impl<T> Copy for Mat4<T> where
T: Copy,
[src]
T: Copy,
impl<T> Debug for Mat4<T> where
T: Debug,
[src]
T: Debug,
impl<'de, T> Deserialize<'de> for Mat4<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Mat4<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Mat4<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<T> Div<T> for Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
type Output = Mat4<T>
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Mat4<T>
[src]
impl<T> DivAssign<T> for Mat4<T> where
T: Num + Copy + DivAssign<T>,
[src]
T: Num + Copy + DivAssign<T>,
fn div_assign(&mut self, rhs: T)
[src]
impl<T> From<Quat<T>> for Mat4<T> where
T: Float,
[src]
T: Float,
impl<T> Index<(usize, usize)> for Mat4<T>
[src]
type Output = T
The returned type after indexing.
fn index(&self, (usize, usize)) -> &TⓘImportant traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Important traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> IndexMut<(usize, usize)> for Mat4<T>
[src]
fn index_mut(&mut self, (usize, usize)) -> &mut TⓘImportant traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Important traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> Mul<Mat4<T>> for Mat4<T> where
T: Num + Copy + AddAssign<T>,
[src]
T: Num + Copy + AddAssign<T>,
type Output = Mat4<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: Mat4<T>) -> Mat4<T>
[src]
impl<T> Mul<T> for Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
type Output = Mat4<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Mat4<T>
[src]
impl<T> Mul<Vec4<T>> for Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
type Output = Vec4<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec4<T>) -> Vec4<T>
[src]
impl<T> MulAssign<Mat4<T>> for Mat4<T> where
T: Num + Copy + AddAssign<T>,
[src]
T: Num + Copy + AddAssign<T>,
fn mul_assign(&mut self, rhs: Mat4<T>)
[src]
impl<T> MulAssign<T> for Mat4<T> where
T: Num + Copy + MulAssign<T>,
[src]
T: Num + Copy + MulAssign<T>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T> Neg for Mat4<T> where
T: Num<Output = T> + Copy + Neg,
[src]
T: Num<Output = T> + Copy + Neg,
impl<T> Serialize for Mat4<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl<T> Sub<Mat4<T>> for Mat4<T> where
T: Num + Copy,
[src]
T: Num + Copy,
type Output = Mat4<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: Mat4<T>) -> Mat4<T>
[src]
impl<T> SubAssign<Mat4<T>> for Mat4<T> where
T: Num + Copy + SubAssign<T>,
[src]
T: Num + Copy + SubAssign<T>,
fn sub_assign(&mut self, rhs: Mat4<T>)
[src]
impl Uniform for Mat4<f32>
[src]
fn apply(&self, gl: &Context, info: &UniformInfo)
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Mat4<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Mat4<T> where
T: Send,
T: Send,
impl<T> Sync for Mat4<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Mat4<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Mat4<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ApproxEq for T where
T: Float,
[src]
T: Float,
fn approx_distance_to(&self, other: &T) -> f32
[src]
fn approx_eq(&self, other: &Self) -> bool
[src]
fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow(&self) -> &TⓘImportant traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Important traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut TⓘImportant traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Important traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Uniform for T where
T: AsUniform,
[src]
T: AsUniform,
fn apply(&self, gl: &Context, info: &UniformInfo)
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,