Struct nannou::glam::DMat2 [−][src]
#[repr(transparent)]pub struct DMat2(_);
Expand description
A 2x2 column major matrix.
Implementations
A 2x2 identity matrix, where all diagonal elements are 1
, and all off-diagonal elements are 0
.
Creates a 2x2 matrix from two column vectors.
Creates a 2x2 matrix from a [S; 4]
array stored in column major order.
If your data is stored in row major you will need to transpose
the returned
matrix.
Creates a [S; 4]
array storing data in column major order.
If you require data in row major order transpose
the matrix first.
Creates a 2x2 matrix from a [[S; 2]; 2]
2D array stored in column major order.
If your data is in row major order you will need to transpose
the returned
matrix.
Creates a [[S; 2]; 2]
2D array storing data in column major order.
If you require data in row major order transpose
the matrix first.
Creates a 2x2 matrix with its diagonal set to diagonal
and all other entries set to 0.
Creates a 2x2 matrix containing the combining non-uniform scale
and rotation of
angle
(in radians).
Creates a 2x2 matrix containing a rotation of angle
(in radians).
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Creates a 2x2 matrix from the first 4 values in slice
.
Panics
Panics if slice
is less than 4 elements long.
Writes the columns of self
to the first 4 elements in slice
.
Panics
Panics if slice
is less than 4 elements long.
Returns a mutable reference to the matrix column for the given index
.
Panics
Panics if index
is greater than 1.
Returns true
if, and only if, all elements are finite.
If any element is either NaN
, positive or negative infinity, this will return false
.
Returns the determinant of self
.
Returns the inverse of self
.
If the matrix is not invertible the returned matrix will be invalid.
Panics
Will panic if the determinant of self
is zero when glam_assert
is enabled.
Multiplies a 2x2 matrix by a scalar.
Returns true if the absolute difference of all elements between self
and other
is less than or equal to max_abs_diff
.
This can be used to compare if two matrices contain similar elements. It works best
when comparing with a known value. The max_abs_diff
that should be used used
depends on the values being compared against.
For more see comparing floating point numbers.
Trait Implementations
Performs the +=
operation. Read more
pub fn deserialize<D>(
deserializer: D
) -> Result<DMat2, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<DMat2, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Generate a random value of T
, using rng
as the source of randomness.
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>ⓘ where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>ⓘ where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
Performs the *=
operation. Read more
Performs the *=
operation. Read more
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for DMat2
impl UnwindSafe for DMat2
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined range,
otherwise an OutOfBounds
error is returned which contains the unclamped color. Read more