Struct vek::mat::repr_c::row_major::mat3::Mat3
[−]
[src]
#[repr(C)]pub struct Mat3<T> { pub rows: CVec3<Vec3<T>>, }
3x3 matrix.
Fields
rows: CVec3<Vec3<T>>
Methods
impl<T> Mat3<T>
[src]
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());
fn zero() -> Self where
T: Zero,
[src]
T: Zero,
The matrix with all elements set to zero.
fn numcast<D>(self) -> Option<Mat3<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());
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, ));
fn with_diagonal(d: Vec3<T>) -> Self where
T: Zero + Copy,
[src]
T: Zero + Copy,
Initializes a matrix by its diagonal, setting other elements to zero.
fn diagonal(self) -> Vec3<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);
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);
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);
fn row_count(&self) -> usize
[src]
Convenience for getting the number of rows of this matrix.
fn col_count(&self) -> usize
[src]
Convenience for getting the number of columns of this matrix.
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> Mat3<T>
[src]
fn map_rows<D, F>(self, f: F) -> Mat3<D> where
F: FnMut(Vec3<T>) -> Vec3<D>,
[src]
F: FnMut(Vec3<T>) -> Vec3<D>,
Returns a row-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_rows(|row| row.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 ));
fn into_row_array(self) -> [T; 9]
[src]
Converts this matrix into a fixed-size array of elements.
use vek::mat::repr_c::row_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);
fn from_row_array(array: [T; 9]) -> Self
[src]
Converts a fixed-size array of elements into a matrix.
use vek::mat::repr_c::row_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));
fn into_col_array(self) -> [T; 9]
[src]
Converts this matrix into a fixed-size array of elements.
use vek::mat::repr_c::row_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);
fn from_col_array(array: [T; 9]) -> Self
[src]
Converts a fixed-size array of elements into a matrix.
use vek::mat::repr_c::row_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));
fn as_row_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.
fn as_mut_row_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.
fn as_row_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.
fn as_mut_row_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> Mat3<T>
[src]
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.
const GL_SHOULD_TRANSPOSE: bool
GL_SHOULD_TRANSPOSE: bool = true
The transpose
parameter to pass to OpenGL glUniformMatrix*()
functions.
impl<T> Mat3<T>
[src]
fn map<D, F>(self, f: F) -> Mat3<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 ));
fn transposed(self) -> Self
[src]
The matrix's transpose.
For orthogonal matrices, the transpose is the same as the inverse. All pure rotation matrices are orthogonal, and therefore can be inverted faster by simply computing their transpose.
use std::f32::consts::PI; let m = Mat3::new( 0, 1, 2, 4, 5, 6, 8, 9, 0 ); let t = Mat3::new( 0, 4, 8, 1, 5, 9, 2, 6, 0 ); assert_eq!(m.transposed(), t); assert_eq!(m, m.transposed().transposed()); let m = Mat3::rotation_x(PI/7.); assert_relative_eq!(m * m.transposed(), Mat3::identity()); assert_relative_eq!(m.transposed() * m, Mat3::identity());
fn transpose(&mut self)
[src]
Transpose this matrix.
let mut m = Mat3::new( 0, 1, 2, 4, 5, 6, 8, 9, 0 ); let t = Mat3::new( 0, 4, 8, 1, 5, 9, 2, 6, 0 ); m.transpose(); assert_eq!(m, t);
fn determinant(self) -> T where
T: Copy + Mul<T, Output = T> + Sub<T, Output = T> + Add<T, Output = T>,
[src]
T: Copy + Mul<T, Output = T> + Sub<T, Output = T> + Add<T, Output = T>,
Get this matrix's determinant.
A matrix is invertible if its determinant is non-zero.
fn translate_2d<V: Into<Vec2<T>>>(&mut self, v: V) where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn translated_2d<V: Into<Vec2<T>>>(self, v: V) -> Self where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn translation_2d<V: Into<Vec2<T>>>(v: V) -> Self where
T: Zero + One,
[src]
T: Zero + One,
fn scale_3d<V: Into<Vec3<T>>>(&mut self, v: V) where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn scaled_3d<V: Into<Vec3<T>>>(self, v: V) -> Self where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn scaling_3d<V: Into<Vec3<T>>>(v: V) -> Self where
T: Zero,
[src]
T: Zero,
fn rotate_x(&mut self, angle_radians: T) where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotated_x(self, angle_radians: T) -> Self where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotation_x(angle_radians: T) -> Self where
T: Float,
[src]
T: Float,
fn rotate_y(&mut self, angle_radians: T) where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotated_y(self, angle_radians: T) -> Self where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotation_y(angle_radians: T) -> Self where
T: Float,
[src]
T: Float,
fn rotate_z(&mut self, angle_radians: T) where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotated_z(self, angle_radians: T) -> Self where
T: Float + MulAdd<T, T, Output = T>,
[src]
T: Float + MulAdd<T, T, Output = T>,
fn rotation_z(angle_radians: T) -> Self where
T: Float,
[src]
T: Float,
fn rotate_3d<V: Into<Vec3<T>>>(&mut self, angle_radians: T, axis: V) where
T: Float + MulAdd<T, T, Output = T> + Sum,
[src]
T: Float + MulAdd<T, T, Output = T> + Sum,
fn rotated_3d<V: Into<Vec3<T>>>(self, angle_radians: T, axis: V) -> Self where
T: Float + MulAdd<T, T, Output = T> + Sum,
[src]
T: Float + MulAdd<T, T, Output = T> + Sum,
fn rotation_3d<V: Into<Vec3<T>>>(angle_radians: T, axis: V) -> Self where
T: Float + Sum,
[src]
T: Float + Sum,
3D rotation matrix. axis
is not required to be normalized.
use std::f32::consts::PI; let angles = 32; for i in 0..angles { let theta = PI * 2. * (i as f32) / (angles as f32); assert_relative_eq!(Mat3::rotation_x(theta), Mat3::from(Quaternion::rotation_x(theta)), epsilon = 0.000001); assert_relative_eq!(Mat3::rotation_y(theta), Mat3::from(Quaternion::rotation_y(theta)), epsilon = 0.000001); assert_relative_eq!(Mat3::rotation_z(theta), Mat3::from(Quaternion::rotation_z(theta)), epsilon = 0.000001); assert_relative_eq!(Mat3::rotation_x(theta), Mat3::rotation_3d(theta, Vec3::unit_x())); assert_relative_eq!(Mat3::rotation_y(theta), Mat3::rotation_3d(theta, Vec3::unit_y())); assert_relative_eq!(Mat3::rotation_z(theta), Mat3::rotation_3d(theta, Vec3::unit_z())); assert_relative_eq!(Mat3::rotation_x(theta), Mat3::from(Mat4::rotation_3d(theta, Vec3::unit_x()))); assert_relative_eq!(Mat3::rotation_y(theta), Mat3::from(Mat4::rotation_3d(theta, Vec3::unit_y()))); assert_relative_eq!(Mat3::rotation_z(theta), Mat3::from(Mat4::rotation_3d(theta, Vec3::unit_z()))); assert_relative_eq!(Mat4::rotation_x(theta), Mat4::from(Mat3::rotation_3d(theta, Vec3::unit_x()))); assert_relative_eq!(Mat4::rotation_y(theta), Mat4::from(Mat3::rotation_3d(theta, Vec3::unit_y()))); assert_relative_eq!(Mat4::rotation_z(theta), Mat4::from(Mat3::rotation_3d(theta, Vec3::unit_z()))); // See what rotating unit vectors do for most angles between 0 and 2*PI. // It's helpful to picture this as a right-handed coordinate system. let v = Vec3::unit_y(); let m = Mat3::rotation_x(theta); assert_relative_eq!(m * v, Vec3::new(0., theta.cos(), theta.sin())); let v = Vec3::unit_z(); let m = Mat3::rotation_y(theta); assert_relative_eq!(m * v, Vec3::new(theta.sin(), 0., theta.cos())); let v = Vec3::unit_x(); let m = Mat3::rotation_z(theta); assert_relative_eq!(m * v, Vec3::new(theta.cos(), theta.sin(), 0.)); }
fn rotation_from_to_3d<V: Into<Vec3<T>>>(from: V, to: V) -> Self where
T: Float + Sum,
[src]
T: Float + Sum,
Creates a matrix that would rotate a from
direction to to
.
let (from, to) = (Vec3::<f32>::unit_x(), Vec3::<f32>::unit_z()); let m = Mat3::<f32>::rotation_from_to_3d(from, to); assert_relative_eq!(m * from, to); let (from, to) = (Vec3::<f32>::unit_x(), -Vec3::<f32>::unit_x()); let m = Mat3::<f32>::rotation_from_to_3d(from, to); assert_relative_eq!(m * from, to);
impl<T> Mat3<T>
[src]
fn new(
m00: T,
m01: T,
m02: T,
m10: T,
m11: T,
m12: T,
m20: T,
m21: T,
m22: T
) -> Self
[src]
m00: T,
m01: T,
m02: T,
m10: T,
m11: T,
m12: T,
m20: T,
m21: T,
m22: T
) -> Self
Creates a new 3x3 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: Debug> Debug for Mat3<T>
[src]
impl<T: Clone> Clone for Mat3<T>
[src]
fn clone(&self) -> Mat3<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy> Copy for Mat3<T>
[src]
impl<T: Hash> Hash for Mat3<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Eq> Eq for Mat3<T>
[src]
impl<T: PartialEq> PartialEq for Mat3<T>
[src]
fn eq(&self, __arg_0: &Mat3<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Mat3<T>) -> bool
[src]
This method tests for !=
.
impl<T: Zero + One> Default for Mat3<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 Mat3<T>
[src]
fn zero() -> Self
[src]
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
[src]
Returns true
if self
is equal to the additive identity.
impl<T: Zero + One + Copy + MulAdd<T, T, Output = T>> One for Mat3<T>
[src]
impl<T> Mul<T> for Mat3<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]
Performs the *
operation.
impl<T> MulAssign for Mat3<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]
Performs the *=
operation.
impl<T> MulAssign<T> for Mat3<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]
Performs the *=
operation.
impl<T> Add for Mat3<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]
Performs the +
operation.
impl<T> Sub for Mat3<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]
Performs the -
operation.
impl<T> Div for Mat3<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]
Performs the /
operation.
impl<T> Rem for Mat3<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]
Performs the %
operation.
impl<T> Neg for Mat3<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]
Performs the unary -
operation.
impl<T> Add<T> for Mat3<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]
Performs the +
operation.
impl<T> Sub<T> for Mat3<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]
Performs the -
operation.
impl<T> Div<T> for Mat3<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]
Performs the /
operation.
impl<T> Rem<T> for Mat3<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]
Performs the %
operation.
impl<T: Add<Output = T> + Copy> AddAssign for Mat3<T>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
Performs the +=
operation.
impl<T: Add<Output = T> + Copy> AddAssign<T> for Mat3<T>
[src]
fn add_assign(&mut self, rhs: T)
[src]
Performs the +=
operation.
impl<T: Sub<Output = T> + Copy> SubAssign for Mat3<T>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
Performs the -=
operation.
impl<T: Sub<Output = T> + Copy> SubAssign<T> for Mat3<T>
[src]
fn sub_assign(&mut self, rhs: T)
[src]
Performs the -=
operation.
impl<T: Div<Output = T> + Copy> DivAssign for Mat3<T>
[src]
fn div_assign(&mut self, rhs: Self)
[src]
Performs the /=
operation.
impl<T: Div<Output = T> + Copy> DivAssign<T> for Mat3<T>
[src]
fn div_assign(&mut self, rhs: T)
[src]
Performs the /=
operation.
impl<T: Rem<Output = T> + Copy> RemAssign for Mat3<T>
[src]
fn rem_assign(&mut self, rhs: Self)
[src]
Performs the %=
operation.
impl<T: Rem<Output = T> + Copy> RemAssign<T> for Mat3<T>
[src]
fn rem_assign(&mut self, rhs: T)
[src]
Performs the %=
operation.
impl<T: ApproxEq> ApproxEq for Mat3<T> where
T::Epsilon: Copy,
[src]
T::Epsilon: Copy,
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> T::Epsilon
[src]
The default tolerance to use when testing values that are close together. Read more
fn default_max_relative() -> T::Epsilon
[src]
The default relative tolerance for testing values that are far-apart. Read more
fn default_max_ulps() -> u32
[src]
The default ULPs to tolerate when testing values that are far-apart. Read more
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
A test for equality that uses a relative comparison if the values are far apart.
fn ulps_eq(&self, other: &Self, epsilon: T::Epsilon, max_ulps: u32) -> bool
[src]
A test for equality that uses units in the last place (ULP) if the values are far apart.
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
The inverse of ApproxEq::relative_eq
.
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
The inverse of ApproxEq::ulps_eq
.
impl<T: Display> Display for Mat3<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.
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T> Index<(usize, usize)> for Mat3<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]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<(usize, usize)> for Mat3<T>
[src]
fn index_mut(&mut self, t: (usize, usize)) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Vec3<T>> for Mat3<T>
[src]
Multiplies a row-major matrix with a column vector, giving a column vector.
use vek::mat::row_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 = Vec3<T>
The resulting type after applying the *
operator.
fn mul(self, v: Vec3<T>) -> Self::Output
[src]
Performs the *
operation.
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul for Mat3<T>
[src]
Multiplies a row-major matrix with another.
use vek::mat::row_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]
Performs the *
operation.
impl<T: MulAdd<T, T, Output = T> + Mul<Output = T> + Copy> Mul<Transpose<T>> for Mat3<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]
Performs the *
operation.
impl<T> From<Transpose<T>> for Mat3<T>
[src]
impl<T> From<Mat4<T>> for Mat3<T>
[src]
impl<T> From<Mat2<T>> for Mat3<T> where
T: Zero + One,
[src]
T: Zero + One,
impl<T> From<Quaternion<T>> for Mat3<T> where
T: Copy + Zero + One + Mul<Output = T> + Add<Output = T> + Sub<Output = T>,
[src]
T: Copy + Zero + One + Mul<Output = T> + Add<Output = T> + Sub<Output = T>,
fn from(q: Quaternion<T>) -> Self
[src]
Performs the conversion.