[−][src]Struct vek::mat::repr_c::column_major::mat2::Mat2
2x2 matrix.
Fields
cols: CVec2<Vec2<T>>
Methods
impl<T> Mat2<T>
[src]
pub fn identity() -> Self where
T: Zero + One,
[src]
T: Zero + One,
The identity matrix, which is also the default value for square matrices.
assert_eq!(Mat4::<f32>::default(), Mat4::<f32>::identity());
pub fn zero() -> Self where
T: Zero,
[src]
T: Zero,
The matrix with all elements set to zero.
pub fn apply<F>(&mut self, f: F) where
T: Copy,
F: FnMut(T) -> T,
[src]
T: Copy,
F: FnMut(T) -> T,
Applies the function f to each element of this matrix, in-place.
For an example, see the map()
method.
pub fn apply2<F, S>(&mut self, other: Mat2<S>, f: F) where
T: Copy,
F: FnMut(T, S) -> T,
[src]
T: Copy,
F: FnMut(T, S) -> T,
Applies the function f to each element of this matrix, in-place.
For an example, see the map2()
method.
pub fn numcast<D>(self) -> Option<Mat2<D>> where
T: NumCast,
D: NumCast,
[src]
T: NumCast,
D: NumCast,
Returns a memberwise-converted copy of this matrix, using NumCast
.
let m = Mat4::<f32>::identity(); let m: Mat4<i32> = m.numcast().unwrap(); assert_eq!(m, Mat4::identity());
pub fn broadcast_diagonal(val: T) -> Self where
T: Zero + Copy,
[src]
T: Zero + Copy,
Initializes a new matrix with elements of the diagonal set to val
and the other to zero.
In a way, this is the same as single-argument matrix constructors in GLSL and GLM.
assert_eq!(Mat4::broadcast_diagonal(0), Mat4::zero()); assert_eq!(Mat4::broadcast_diagonal(1), Mat4::identity()); assert_eq!(Mat4::broadcast_diagonal(2), Mat4::new( 2,0,0,0, 0,2,0,0, 0,0,2,0, 0,0,0,2, ));
pub fn with_diagonal(d: Vec2<T>) -> Self where
T: Zero + Copy,
[src]
T: Zero + Copy,
Initializes a matrix by its diagonal, setting other elements to zero.
pub fn diagonal(self) -> Vec2<T>
[src]
Gets the matrix's diagonal into a vector.
assert_eq!(Mat4::<u32>::zero().diagonal(), Vec4::zero()); assert_eq!(Mat4::<u32>::identity().diagonal(), Vec4::one()); let mut m = Mat4::zero(); m[(0, 0)] = 1; m[(1, 1)] = 2; m[(2, 2)] = 3; m[(3, 3)] = 4; assert_eq!(m.diagonal(), Vec4::new(1, 2, 3, 4)); assert_eq!(m.diagonal(), Vec4::iota() + 1);
pub fn trace(self) -> T where
T: Sum,
[src]
T: Sum,
The sum of the diagonal's elements.
assert_eq!(Mat4::<u32>::zero().trace(), 0); assert_eq!(Mat4::<u32>::identity().trace(), 4);
pub fn mul_memberwise(self, m: Self) -> Self where
T: Mul<Output = T>,
[src]
T: Mul<Output = T>,
Multiply elements of this matrix with another's.
let m = Mat4::new( 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, ); let r = Mat4::new( 0, 1, 4, 9, 1, 4, 9, 16, 4, 9, 16, 25, 9, 16, 25, 36, ); assert_eq!(m.mul_memberwise(m), r);
pub fn row_count(&self) -> usize
[src]
Convenience for getting the number of rows of this matrix.
pub fn col_count(&self) -> usize
[src]
Convenience for getting the number of columns of this matrix.
pub const ROW_COUNT: usize
[src]
Convenience constant representing the number of rows for matrices of this type.
pub const COL_COUNT: usize
[src]
Convenience constant representing the number of columns for matrices of this type.
pub fn is_packed(&self) -> bool
[src]
Are all elements of this matrix tightly packed together in memory ?
This might not be the case for matrices in the repr_simd
module
(it depends on the target architecture).
impl<T> Mat2<T>
[src]
pub fn map_cols<D, F>(self, f: F) -> Mat2<D> where
F: FnMut(Vec2<T>) -> Vec2<D>,
[src]
F: FnMut(Vec2<T>) -> Vec2<D>,
Returns a column-wise-converted copy of this matrix, using the given conversion closure.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<f32>::new( 0.25, 1.25, 5.56, 8.66, 8.53, 2.92, 3.86, 9.36, 1.02, 0.28, 5.52, 6.06, 6.20, 7.01, 4.90, 5.26 ); let m = m.map_cols(|col| col.map(|x| x.round() as i32)); assert_eq!(m, Mat4::new( 0, 1, 6, 9, 9, 3, 4, 9, 1, 0, 6, 6, 6, 7, 5, 5 ));
pub fn into_col_array(self) -> [T; 4]
[src]
Converts this matrix into a fixed-size array of elements.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 ]; assert_eq!(m.into_col_array(), array);
pub fn into_col_arrays(self) -> [[T; 2]; 2]
[src]
Converts this matrix into a fixed-size array of fixed-size arrays of elements.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ [ 0, 4, 8, 12, ], [ 1, 5, 9, 13, ], [ 2, 6, 10, 14, ], [ 3, 7, 11, 15, ], ]; assert_eq!(m.into_col_arrays(), array);
pub fn from_col_array(array: [T; 4]) -> Self
[src]
Converts a fixed-size array of elements into a matrix.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 ]; assert_eq!(m, Mat4::from_col_array(array));
pub fn from_col_arrays(array: [[T; 2]; 2]) -> Self
[src]
Converts a fixed-size array of fixed-size arrays of elements into a matrix.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ [ 0, 4, 8, 12, ], [ 1, 5, 9, 13, ], [ 2, 6, 10, 14, ], [ 3, 7, 11, 15, ], ]; assert_eq!(m, Mat4::from_col_arrays(array));
pub fn into_row_array(self) -> [T; 4]
[src]
Converts this matrix into a fixed-size array of elements.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]; assert_eq!(m.into_row_array(), array);
pub fn into_row_arrays(self) -> [[T; 2]; 2]
[src]
Converts this matrix into a fixed-size array of fixed-size arrays of elements.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ [ 0, 1, 2, 3, ], [ 4, 5, 6, 7, ], [ 8, 9, 10, 11, ], [ 12, 13, 14, 15, ], ]; assert_eq!(m.into_row_arrays(), array);
pub fn from_row_array(array: [T; 4]) -> Self
[src]
Converts a fixed-size array of elements into a matrix.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]; assert_eq!(m, Mat4::from_row_array(array));
pub fn from_row_arrays(array: [[T; 2]; 2]) -> Self
[src]
Converts a fixed-size array of fixed-size array of elements into a matrix.
use vek::mat::repr_c::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); let array = [ [ 0, 1, 2, 3, ], [ 4, 5, 6, 7, ], [ 8, 9, 10, 11, ], [ 12, 13, 14, 15, ], ]; assert_eq!(m, Mat4::from_row_arrays(array));
pub fn as_col_ptr(&self) -> *const T
[src]
Gets a const pointer to this matrix's elements.
Panics
Panics if the matrix's elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
pub fn as_mut_col_ptr(&mut self) -> *mut T
[src]
Gets a mut pointer to this matrix's elements.
Panics
Panics if the matrix's elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
pub fn as_col_slice(&self) -> &[T]
[src]
View this matrix as an immutable slice.
Panics
Panics if the matrix's elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
pub fn as_mut_col_slice(&mut self) -> &mut [T]
[src]
View this matrix as a mutable slice.
Panics
Panics if the matrix's elements are not tightly packed in memory,
which may be the case for matrices in the repr_simd
module.
You may check this with the is_packed()
method.
impl<T> Mat2<T>
[src]
pub fn gl_should_transpose(&self) -> bool
[src]
Gets the transpose
parameter to pass to OpenGL glUniformMatrix*()
functions.
The return value is a plain bool
which you may directly cast
to a GLboolean
.
This takes &self
to prevent surprises when changing the type
of matrix you plan to send.
pub const GL_SHOULD_TRANSPOSE: bool
[src]
The transpose
parameter to pass to OpenGL glUniformMatrix*()
functions.
impl<T> Mat2<T>
[src]
pub fn map<D, F>(self, f: F) -> Mat2<D> where
F: FnMut(T) -> D,
[src]
F: FnMut(T) -> D,
Returns an element-wise-converted copy of this matrix, using the given conversion closure.
use vek::mat::repr_c::row_major::Mat4; let m = Mat4::<f32>::new( 0.25, 1.25, 5.56, 8.66, 8.53, 2.92, 3.86, 9.36, 1.02, 0.28, 5.52, 6.06, 6.20, 7.01, 4.90, 5.26 ); let m = m.map(|x| x.round() as i32); assert_eq!(m, Mat4::new( 0, 1, 6, 9, 9, 3, 4, 9, 1, 0, 6, 6, 6, 7, 5, 5 ));
pub fn map2<D, F, S>(self, other: Mat2<S>, f: F) -> Mat2<D> where
F: FnMut(T, S) -> D,
[src]
F: FnMut(T, S) -> D,
Applies the function f to each element of two matrices, pairwise, and returns the result.
use vek::mat::repr_c::row_major::Mat4; let a = Mat4::<f32>::new( 0.25, 1.25, 2.52, 2.99, 0.25, 1.25, 2.52, 2.99, 0.25, 1.25, 2.52, 2.99, 0.25, 1.25, 2.52, 2.99 ); let b = Mat4::<i32>::new( 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); let m = a.map2(b, |a, b| a.round() as i32 + b); assert_eq!(m, Mat4::new( 0, 2, 3, 3, 1, 1, 3, 3, 0, 1, 4, 3, 0, 1, 3, 4 ));
pub fn transposed(self) -> Self
[src]
The matrix's transpose.
let m = Mat2::new( 0, 1, 4, 5 ); let t = Mat2::new( 0, 4, 1, 5 ); assert_eq!(m.transposed(), t); assert_eq!(m, m.transposed().transposed());
pub fn transpose(&mut self)
[src]
Transpose this matrix.
let mut m = Mat2::new( 0, 1, 4, 5 ); let t = Mat2::new( 0, 4, 1, 5 ); m.transpose(); assert_eq!(m, t);
pub fn determinant(self) -> T where
T: Mul<T, Output = T> + Sub<T, Output = T>,
[src]
T: Mul<T, Output = T> + Sub<T, Output = T>,
Get this matrix's determinant.
A matrix is invertible if its determinant is non-zero.
let (a,b,c,d) = (0,1,2,3); let m = Mat2::new(a,b,c,d); assert_eq!(m.determinant(), a*d - c*b);
pub fn rotate_z(&mut self, angle_radians: T) where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Rotates this matrix around the Z axis (counter-clockwise rotation in 2D).
pub fn rotated_z(self, angle_radians: T) -> Self where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Rotates this matrix around the Z axis (counter-clockwise rotation in 2D).
pub fn rotation_z(angle_radians: T) -> Self where
T: Real,
[src]
T: Real,
Creates a matrix that rotates around the Z axis (counter-clockwise rotation in 2D).
pub fn scale_2d<V: Into<Vec2<T>>>(&mut self, v: V) where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Scales this matrix in 2D.
pub fn scaled_2d<V: Into<Vec2<T>>>(self, v: V) -> Self where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Returns this matrix scaled in 2D.
pub fn scaling_2d<V: Into<Vec2<T>>>(v: V) -> Self where
T: Zero,
[src]
T: Zero,
Creates a 2D scaling matrix.
pub fn shear_x(&mut self, k: T) where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Shears this matrix along the X axis.
pub fn sheared_x(self, k: T) -> Self where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Returns this matrix sheared along the X axis.
pub fn shearing_x(k: T) -> Self where
T: Zero + One,
[src]
T: Zero + One,
Creates a 2D shearing matrix along the X axis.
pub fn shear_y(&mut self, k: T) where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Shears this matrix along the Y axis.
pub fn sheared_y(self, k: T) -> Self where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
Returns this matrix sheared along the Y axis.
pub fn shearing_y(k: T) -> Self where
T: Zero + One,
[src]
T: Zero + One,
Creates a 2D shearing matrix along the Y axis.
impl<T> Mat2<T>
[src]
pub fn new(m00: T, m01: T, m10: T, m11: T) -> Self
[src]
Creates a new 2x2 matrix from elements in a layout-agnostic way.
The parameters are named mij
where i
is the row index and
j
the column index. Their order is always the same regardless
of the matrix's layout.
Trait Implementations
impl<T> From<Mat2<T>> for Mat4<T> where
T: Zero + One,
[src]
T: Zero + One,
impl<T> From<Mat2<T>> for Mat3<T> where
T: Zero + One,
[src]
T: Zero + One,
impl<T> From<Mat2<T>> for Mat2<T>
[src]
impl<T> From<Mat3<T>> for Mat2<T>
[src]
impl<T> From<Mat4<T>> for Mat2<T>
[src]
impl<T> From<Mat2<T>> for Mat2<T>
[src]
impl<T: Display> Display for Mat2<T>
[src]
Displays this matrix using the following format:
(i
being the number of rows and j
the number of columns)
( m00 ... m0j
... ... ...
mi0 ... mij )
Note that elements are not comma-separated.
This format doesn't depend on the matrix's storage layout.
impl<T: Debug> Debug for Mat2<T>
[src]
impl<T> Div<Mat2<T>> for Mat2<T> where
T: Div<Output = T>,
[src]
T: Div<Output = T>,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self::Output
[src]
impl<T> Div<T> for Mat2<T> where
T: Copy + Div<Output = T>,
[src]
T: Copy + Div<Output = T>,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Self::Output
[src]
impl<T> Rem<Mat2<T>> for Mat2<T> where
T: Rem<Output = T>,
[src]
T: Rem<Output = T>,
type Output = Self
The resulting type after applying the %
operator.
fn rem(self, rhs: Self) -> Self::Output
[src]
impl<T> Rem<T> for Mat2<T> where
T: Copy + Rem<Output = T>,
[src]
T: Copy + Rem<Output = T>,
type Output = Self
The resulting type after applying the %
operator.
fn rem(self, rhs: T) -> Self::Output
[src]
impl<T> Sub<Mat2<T>> for Mat2<T> where
T: Sub<Output = T>,
[src]
T: Sub<Output = T>,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self::Output
[src]
impl<T> Sub<T> for Mat2<T> where
T: Copy + Sub<Output = T>,
[src]
T: Copy + Sub<Output = T>,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Self::Output
[src]
impl<T: PartialEq> PartialEq<Mat2<T>> for Mat2<T>
[src]
impl<T: Eq> Eq for Mat2<T>
[src]
impl<T> Add<Mat2<T>> for Mat2<T> where
T: Add<Output = T>,
[src]
T: Add<Output = T>,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl<T> Add<T> for Mat2<T> where
T: Copy + Add<Output = T>,
[src]
T: Copy + Add<Output = T>,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Self::Output
[src]
impl<T> Mul<T> for Mat2<T> where
T: Copy + Zero + Add<Output = T> + Mul<Output = T>,
[src]
T: Copy + Zero + Add<Output = T> + Mul<Output = T>,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Self::Output
[src]
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Mat2<T>> for Vec2<T>
[src]
Multiplies a row vector with a column-major matrix, giving a row vector.
use vek::mat::column_major::Mat4; use vek::vec::Vec4; let m = Mat4::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let v = Vec4::new(0, 1, 2, 3); let r = Vec4::new(26, 32, 18, 24); assert_eq!(v * m, r);
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Mat2<T>) -> Self::Output
[src]
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Vec2<T>> for Mat2<T>
[src]
Multiplies a column-major matrix with a column vector, giving a column vector.
With SIMD vectors, this is the most efficient way.
use vek::mat::column_major::Mat4; use vek::vec::Vec4; let m = Mat4::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let v = Vec4::new(0, 1, 2, 3); let r = Vec4::new(14, 38, 12, 26); assert_eq!(m * v, r);
type Output = Vec2<T>
The resulting type after applying the *
operator.
fn mul(self, v: Vec2<T>) -> Self::Output
[src]
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Mat2<T>> for Mat2<T>
[src]
Multiplies a column-major matrix with another.
use vek::mat::column_major::Mat4; let m = Mat4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let r = Mat4::<u32>::new( 26, 32, 18, 24, 82, 104, 66, 88, 38, 56, 74, 92, 54, 68, 42, 56 ); assert_eq!(m * m, r); assert_eq!(m, m * Mat4::<u32>::identity()); assert_eq!(m, Mat4::<u32>::identity() * m);
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self::Output
[src]
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Mat2<T>> for Mat2<T>
[src]
Multiplies a column-major matrix with a row-major matrix.
use vek::mat::row_major::Mat4 as Rows4; use vek::mat::column_major::Mat4 as Cols4; let m = Cols4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let b = Rows4::from(m); let r = Rows4::<u32>::new( 26, 32, 18, 24, 82, 104, 66, 88, 38, 56, 74, 92, 54, 68, 42, 56 ); assert_eq!(m * b, r); assert_eq!(m * Rows4::<u32>::identity(), m.into()); assert_eq!(Cols4::<u32>::identity() * b, m.into());
type Output = Transpose<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: Transpose<T>) -> Self::Output
[src]
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Mat2<T>> for Mat2<T>
[src]
Multiplies a row-major matrix with a column-major matrix, producing a column-major matrix.
use vek::mat::row_major::Mat4 as Rows4; use vek::mat::column_major::Mat4 as Cols4; let m = Rows4::<u32>::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let b = Cols4::from(m); let r = Cols4::<u32>::new( 26, 32, 18, 24, 82, 104, 66, 88, 38, 56, 74, 92, 54, 68, 42, 56 ); assert_eq!(m * b, r); assert_eq!(m * Cols4::<u32>::identity(), m.into()); assert_eq!(Rows4::<u32>::identity() * b, m.into());
type Output = Transpose<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: Transpose<T>) -> Self::Output
[src]
impl<T> Mul<QuadraticBezier2<T>> for Cols2<T> where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
type Output = QuadraticBezier2<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: QuadraticBezier2<T>) -> QuadraticBezier2<T>
[src]
impl<T> Mul<CubicBezier2<T>> for Cols2<T> where
T: Real + MulAdd<T, T, Output = T>,
[src]
T: Real + MulAdd<T, T, Output = T>,
type Output = CubicBezier2<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: CubicBezier2<T>) -> CubicBezier2<T>
[src]
impl<T> Neg for Mat2<T> where
T: Neg<Output = T>,
[src]
T: Neg<Output = T>,
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<T: Add<Output = T> + Copy> AddAssign<Mat2<T>> for Mat2<T>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl<T: Add<Output = T> + Copy> AddAssign<T> for Mat2<T>
[src]
fn add_assign(&mut self, rhs: T)
[src]
impl<T: Sub<Output = T> + Copy> SubAssign<Mat2<T>> for Mat2<T>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl<T: Sub<Output = T> + Copy> SubAssign<T> for Mat2<T>
[src]
fn sub_assign(&mut self, rhs: T)
[src]
impl<T> MulAssign<Mat2<T>> for Mat2<T> where
T: Copy + Zero + Add<Output = T> + Mul<Output = T> + MulAdd<T, T, Output = T>,
[src]
T: Copy + Zero + Add<Output = T> + Mul<Output = T> + MulAdd<T, T, Output = T>,
fn mul_assign(&mut self, rhs: Self)
[src]
impl<T> MulAssign<T> for Mat2<T> where
T: Copy + Zero + Add<Output = T> + Mul<Output = T>,
[src]
T: Copy + Zero + Add<Output = T> + Mul<Output = T>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T: Div<Output = T> + Copy> DivAssign<Mat2<T>> for Mat2<T>
[src]
fn div_assign(&mut self, rhs: Self)
[src]
impl<T: Div<Output = T> + Copy> DivAssign<T> for Mat2<T>
[src]
fn div_assign(&mut self, rhs: T)
[src]
impl<T: Rem<Output = T> + Copy> RemAssign<Mat2<T>> for Mat2<T>
[src]
fn rem_assign(&mut self, rhs: Self)
[src]
impl<T: Rem<Output = T> + Copy> RemAssign<T> for Mat2<T>
[src]
fn rem_assign(&mut self, rhs: T)
[src]
impl<T> Index<(usize, usize)> for Mat2<T>
[src]
Index this matrix in a layout-agnostic way with an (i, j)
(row index, column index) tuple.
Matrices cannot be indexed by Vec2
s because that would be likely to cause confusion:
should x
be the row index (because it's the first element) or the column index
(because it's a horizontal position) ?
type Output = T
The returned type after indexing.
fn index(&self, t: (usize, usize)) -> &Self::Output
[src]
impl<T> IndexMut<(usize, usize)> for Mat2<T>
[src]
impl<T: Hash> Hash for Mat2<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Copy> Copy for Mat2<T>
[src]
impl<T> StructuralPartialEq for Mat2<T>
[src]
impl<T> StructuralEq for Mat2<T>
[src]
impl<T: Clone> Clone for Mat2<T>
[src]
impl<T: Zero + One> Default for Mat2<T>
[src]
The default value for a square matrix is the identity.
assert_eq!(Mat4::<f32>::default(), Mat4::<f32>::identity());
impl<T: Zero + PartialEq> Zero for Mat2<T>
[src]
impl<T: Zero + One + Copy + MulAdd<T, T, Output = T>> One for Mat2<T>
[src]
fn one() -> Self
[src]
fn set_one(&mut self)
[src]
fn is_one(&self) -> bool where
Self: PartialEq<Self>,
[src]
Self: PartialEq<Self>,
impl<T: ApproxEq> ApproxEq for Mat2<T> where
T::Epsilon: Copy,
[src]
T::Epsilon: Copy,
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> T::Epsilon
[src]
fn default_max_relative() -> T::Epsilon
[src]
fn default_max_ulps() -> u32
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
fn ulps_eq(&self, other: &Self, epsilon: T::Epsilon, max_ulps: u32) -> bool
[src]
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
Auto Trait Implementations
impl<T> Unpin for Mat2<T> where
T: Unpin,
T: Unpin,
impl<T> Send for Mat2<T> where
T: Send,
T: Send,
impl<T> Sync for Mat2<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for Mat2<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Mat2<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for 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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,