[−][src]Struct hektor::Mat2
A 2x2 column-major Matrix.
There's two columns, and each column is itself a Vec2
.
Methods
impl Mat2
[src]
pub fn x_axis(self) -> Vec2
[src]
Obtains the x_axis
column of this matrix
pub fn y_axis(self) -> Vec2
[src]
Obtains the y_axis
column of this matrix
pub fn x_axis_mut(&mut self) -> &mut Vec2
[src]
&mut
to the x_axis
column of this matrix
pub fn y_axis_mut(&mut self) -> &mut Vec2
[src]
&mut
to the y_axis
column of this matrix
impl Mat2
[src]
pub fn new(x_axis: Vec2, y_axis: Vec2) -> Self
[src]
Combines the columns given into a new Mat2
pub fn splat(v: f32) -> Self
[src]
Splats the given value across all columns.
pub fn diagonal(x: f32, y: f32) -> Self
[src]
Forms a diagonal matrix from the values given.
pub fn to_mat3(self, z: f32) -> Mat3
[src]
Up-converts to a Mat3
by adding the given z
as the z
of the
z_axis
. The x_axis
and y_axis
are extended with 0.0
pub fn determinant(self) -> f32
[src]
Determinant of the matrix.
This gives the scale factor of a unit square in the matrix's modified coordinate space:
- Positive means that the output orientation is generally similar.
- Negative means that the output orientation is flipped.
- Zero means that the output loses at least 1 dimension (meaning that squares become lines, or points).
pub fn transpose(self) -> Self
[src]
Transpose the matrix.
This "flips" it along the diagonal. The diagonal values stay the same.
pub fn inverse(self) -> Option<Self>
[src]
Gives the inverse matrix, if it exists.
m * m.inverse()
and m.inverse() * m
should both give an identity
matrix as the output. As we all known, with floating point there's usually
a little bit of rounding error possible so it may not work perfectly.
Failure
There's no inverse if the determinant
is zero.
Trait Implementations
impl CanDeterminant for Mat2
[src]
fn determinant(self) -> f32
[src]
impl Display for Mat2
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Display formats without labels in a 2 line style similar to standard math notation.
Passes the formatter along to the fields, so you can use any normal f32
Display format arguments that you like.
impl Debug for Mat2
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Debug formats with each axis labeled and then shown as a 2-tuple in one long line.
Passes the formatter along to the fields, so you can use any normal f32
Debug format arguments that you like.
impl UpperExp for Mat2
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
UpperExp formats like Display, but with the upper exponent.
Passes the formatter along to the fields, so you can use any normal f32
UpperExp format arguments that you like.
impl LowerExp for Mat2
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
LowerExp formats like Display, but with the lower exponent.
Passes the formatter along to the fields, so you can use any normal f32
LowerExp format arguments that you like.
impl PartialEq<Mat2> for Mat2
[src]
impl Add<Mat2> for Mat2
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self
[src]
impl Add<f32> for Mat2
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: f32) -> Self
[src]
impl Add<Mat2> for f32
[src]
type Output = Mat2
The resulting type after applying the +
operator.
fn add(self, rhs: Mat2) -> Mat2
[src]
impl Sub<Mat2> for Mat2
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self
[src]
impl Sub<f32> for Mat2
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: f32) -> Self
[src]
impl Sub<Mat2> for f32
[src]
type Output = Mat2
The resulting type after applying the -
operator.
fn sub(self, rhs: Mat2) -> Mat2
[src]
impl Mul<f32> for Mat2
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self
[src]
impl Mul<Mat2> for f32
[src]
type Output = Mat2
The resulting type after applying the *
operator.
fn mul(self, rhs: Mat2) -> Mat2
[src]
impl Mul<Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, v2: Vec2) -> Vec2
[src]
impl Mul<Mat2> for Mat2
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self
[src]
impl Neg for Mat2
[src]
impl AddAssign<Mat2> for Mat2
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl AddAssign<f32> for Mat2
[src]
fn add_assign(&mut self, rhs: f32)
[src]
impl SubAssign<Mat2> for Mat2
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl SubAssign<f32> for Mat2
[src]
fn sub_assign(&mut self, rhs: f32)
[src]
impl MulAssign<f32> for Mat2
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl MulAssign<Mat2> for Mat2
[src]
fn mul_assign(&mut self, rhs: Self)
[src]
impl Index<usize> for Mat2
[src]
impl IndexMut<usize> for Mat2
[src]
impl Copy for Mat2
[src]
impl AsRef<[Vec2; 2]> for Mat2
[src]
impl AsMut<[Vec2; 2]> for Mat2
[src]
impl From<[f32; 4]> for Mat2
[src]
impl From<Mat2> for [f32; 4]
[src]
impl Clone for Mat2
[src]
fn clone(&self) -> Mat2
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Mat2
[src]
impl Pod for Mat2
[src]
impl Zeroable for Mat2
[src]
Auto Trait Implementations
Blanket Implementations
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> From<T> for T
[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> 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,