#[repr(C)]pub struct mat3<T>(/* private fields */);
Expand description
3x3 matrix
Implementations§
Source§impl<T: Num> mat3<T>
impl<T: Num> mat3<T>
Sourcepub fn from_orts(x: vec2<T>, y: vec2<T>) -> Self
pub fn from_orts(x: vec2<T>, y: vec2<T>) -> Self
Construct a transformation matrix with given orts
§Examples
let e1 = vec2(1.0, 2.0);
let e2 = vec2(3.0, 4.0);
let m = mat3::from_orts(e1, e2);
assert_eq!(vec2(1.0, 0.0).transform(m), e1);
assert_eq!(vec2(0.0, 1.0).transform(m), e2);
let v = vec2(2.0, 3.0);
assert_eq!(v.transform(m), e1 * v.x + e2 * v.y);
Source§impl<T: Num + Copy> mat3<T>
impl<T: Num + Copy> mat3<T>
Sourcepub fn scale_uniform(factor: T) -> Self
pub fn scale_uniform(factor: T) -> Self
Construct a uniform scale matrix.
§Examples
let matrix = mat3::scale_uniform(2);
assert_eq!(matrix * vec3(1, 2, 1), vec3(2, 4, 1));
Sourcepub fn scale_uniform_around(p: vec2<T>, scale: T) -> Self
pub fn scale_uniform_around(p: vec2<T>, scale: T) -> Self
Construct matrix that performs uniform scaling around a specified point
Sourcepub fn scale_around(p: vec2<T>, scale: vec2<T>) -> Self
pub fn scale_around(p: vec2<T>, scale: vec2<T>) -> Self
Construct matrix that performs scaling around a specified point
Source§impl<T> mat3<T>
impl<T> mat3<T>
Sourcepub fn as_flat_array(&self) -> &[T; 9]
pub fn as_flat_array(&self) -> &[T; 9]
Get self as a flat array
Sourcepub fn as_flat_array_mut(&mut self) -> &mut [T; 9]
pub fn as_flat_array_mut(&mut self) -> &mut [T; 9]
Get self as a mutable flat array
Trait Implementations§
Source§impl<T: Num + Copy + AddAssign> AddAssign for mat3<T>
impl<T: Num + Copy + AddAssign> AddAssign for mat3<T>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<T: Float> Approx for mat3<T>
impl<T: Float> Approx for mat3<T>
Source§fn approx_distance_to(&self, other: &Self) -> f32
fn approx_distance_to(&self, other: &Self) -> f32
Get an approximated distance between two values
Source§fn approx_eq(&self, other: &Self) -> bool
fn approx_eq(&self, other: &Self) -> bool
Check if values are approximately equal using DEFAULT_EPS
Source§fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool
fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool
Check if values are approximately equal using supplied eps value
Source§impl<'de, T> Deserialize<'de> for mat3<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for mat3<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Num + Copy + DivAssign> DivAssign<T> for mat3<T>
impl<T: Num + Copy + DivAssign> DivAssign<T> for mat3<T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/=
operation. Read moreSource§impl<T: Num + Copy + MulAssign> MulAssign<T> for mat3<T>
impl<T: Num + Copy + MulAssign> MulAssign<T> for mat3<T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read moreSource§impl<T: Num + Copy + AddAssign> MulAssign for mat3<T>
impl<T: Num + Copy + AddAssign> MulAssign for mat3<T>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl<T: Num + Copy + SubAssign> SubAssign for mat3<T>
impl<T: Num + Copy + SubAssign> SubAssign for mat3<T>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl<T: Copy> Copy for mat3<T>
Auto Trait Implementations§
impl<T> Freeze for mat3<T>where
T: Freeze,
impl<T> RefUnwindSafe for mat3<T>where
T: RefUnwindSafe,
impl<T> Send for mat3<T>where
T: Send,
impl<T> Sync for mat3<T>where
T: Sync,
impl<T> Unpin for mat3<T>where
T: Unpin,
impl<T> UnwindSafe for mat3<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more