pub type Matrix3<T> = Matrix<T, U3, U3, ArrayStorage<T, 3, 3>>;Expand description
A stack-allocated, column-major, 3x3 square matrix.
Because this is an alias, not all its methods are listed here. See the Matrix type too.
Aliased Type§
pub struct Matrix3<T> {
pub data: ArrayStorage<T, 3, 3>,
/* private fields */
}Fields§
§data: ArrayStorage<T, 3, 3>The data storage that contains all the matrix components. Disappointed?
Well, if you came here to see how you can access the matrix components,
you may be in luck: you can access the individual components of all vectors with compile-time
dimensions <= 6 using field notation like this:
vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:
let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);Similarly, for matrices with compile-time dimensions <= 6, you can use field notation
like this: mat.m11, mat.m42, etc. The first digit identifies the row to address
and the second digit identifies the column to address. So mat.m13 identifies the component
at the first row and third column (note that the count of rows and columns start at 1 instead
of 0 here. This is so we match the mathematical notation).
For all matrices and vectors, independently from their size, individual components can
be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing
starts at 0 as you would expect.
Implementations§
Source§impl<T: RealField> Matrix3<T>
§2D transformations as a Matrix3
impl<T: RealField> Matrix3<T>
§2D transformations as a Matrix3
Sourcepub fn new_rotation(angle: T) -> Self
pub fn new_rotation(angle: T) -> Self
Builds a 2 dimensional homogeneous rotation matrix from an angle in radian.
Sourcepub fn new_nonuniform_scaling_wrt_point(
scaling: &Vector2<T>,
pt: &Point2<T>,
) -> Self
pub fn new_nonuniform_scaling_wrt_point( scaling: &Vector2<T>, pt: &Point2<T>, ) -> Self
Creates a new homogeneous matrix that applies a scaling factor for each dimension with respect to point.
Can be used to implement zoom_to functionality.
Trait Implementations§
Source§impl<T> CreateFrom for Matrix3<T>where
Self: FromMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + CreateFrom,
Available on crate feature encase only.
impl<T> CreateFrom for Matrix3<T>where
Self: FromMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + CreateFrom,
encase only.fn create_from<B: BufferRef>(reader: &mut Reader<B>) -> Self
Source§impl<T: SimdRealField> From<Unit<Complex<T>>> for Matrix3<T>where
T::Element: SimdRealField,
impl<T: SimdRealField> From<Unit<Complex<T>>> for Matrix3<T>where
T::Element: SimdRealField,
Source§fn from(q: UnitComplex<T>) -> Matrix3<T>
fn from(q: UnitComplex<T>) -> Matrix3<T>
Source§impl<T: SimdRealField> From<Unit<Quaternion<T>>> for Matrix3<T>where
T::Element: SimdRealField,
impl<T: SimdRealField> From<Unit<Quaternion<T>>> for Matrix3<T>where
T::Element: SimdRealField,
Source§fn from(q: UnitQuaternion<T>) -> Self
fn from(q: UnitQuaternion<T>) -> Self
Source§impl<T> ReadFrom for Matrix3<T>where
Self: AsMutMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + ReadFrom,
Available on crate feature encase only.
impl<T> ReadFrom for Matrix3<T>where
Self: AsMutMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + ReadFrom,
encase only.Source§impl<T> ShaderSize for Matrix3<T>where
T: ShaderSize,
Available on crate feature encase only.
impl<T> ShaderSize for Matrix3<T>where
T: ShaderSize,
encase only.Source§const SHADER_SIZE: NonZero<u64> = _
const SHADER_SIZE: NonZero<u64> = _
ShaderType::min_size)Source§impl<T> ShaderType for Matrix3<T>where
T: ShaderSize,
Available on crate feature encase only.
impl<T> ShaderType for Matrix3<T>where
T: ShaderSize,
encase only.Source§fn assert_uniform_compat()
fn assert_uniform_compat()
Self meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read moreSource§impl<T> WriteInto for Matrix3<T>where
Self: AsRefMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + WriteInto,
Available on crate feature encase only.
impl<T> WriteInto for Matrix3<T>where
Self: AsRefMatrixParts<T, 3, 3> + ShaderType<ExtraMetadata = MatrixMetadata>,
T: MatrixScalar + WriteInto,
encase only.