#[repr(C)]pub struct mat3<T>(/* private fields */);
Expand description
3x3 matrix
Implementations§
§impl<T> mat3<T>where
T: Num,
impl<T> mat3<T>where
T: Num,
pub fn from_orts(x: vec2<T>, y: vec2<T>) -> mat3<T>
pub fn from_orts(x: vec2<T>, y: vec2<T>) -> mat3<T>
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);
§impl<T> mat3<T>
impl<T> mat3<T>
pub fn scale_uniform(factor: T) -> mat3<T>
pub fn scale_uniform(factor: T) -> mat3<T>
Construct a uniform scale matrix.
§Examples
let matrix = mat3::scale_uniform(2);
assert_eq!(matrix * vec3(1, 2, 1), vec3(2, 4, 1));
pub fn scale_uniform_around(p: vec2<T>, scale: T) -> mat3<T>
pub fn scale_uniform_around(p: vec2<T>, scale: T) -> mat3<T>
Construct matrix that performs uniform scaling around a specified point
pub fn scale_around(p: vec2<T>, scale: vec2<T>) -> mat3<T>
pub fn scale_around(p: vec2<T>, scale: vec2<T>) -> mat3<T>
Construct matrix that performs scaling around a specified point
§impl<T> mat3<T>
impl<T> mat3<T>
pub fn as_flat_array(&self) -> &[T; 9]
pub fn as_flat_array(&self) -> &[T; 9]
Get self as a flat array
pub 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§
§impl<T> AddAssign for mat3<T>
impl<T> AddAssign for mat3<T>
§fn add_assign(&mut self, rhs: mat3<T>)
fn add_assign(&mut self, rhs: mat3<T>)
Performs the
+=
operation. Read more§impl<T> Approx for mat3<T>where
T: Float,
impl<T> Approx for mat3<T>where
T: Float,
§fn approx_distance_to(&self, other: &mat3<T>) -> f32
fn approx_distance_to(&self, other: &mat3<T>) -> f32
Get an approximated distance between two values
§fn approx_eq(&self, other: &Self) -> bool
fn approx_eq(&self, other: &Self) -> bool
Check if values are approximately equal using DEFAULT_EPS
§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
§impl<'de, T> Deserialize<'de> for mat3<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for mat3<T>where
T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<mat3<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<mat3<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> DivAssign<T> for mat3<T>
impl<T> DivAssign<T> for mat3<T>
§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/=
operation. Read more§impl<T> MulAssign<T> for mat3<T>
impl<T> MulAssign<T> for mat3<T>
§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read more§impl<T> MulAssign for mat3<T>
impl<T> MulAssign for mat3<T>
§fn mul_assign(&mut self, rhs: mat3<T>)
fn mul_assign(&mut self, rhs: mat3<T>)
Performs the
*=
operation. Read more§impl<T> Serialize for mat3<T>where
T: Serialize,
impl<T> Serialize for mat3<T>where
T: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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
§impl<T> SubAssign for mat3<T>
impl<T> SubAssign for mat3<T>
§fn sub_assign(&mut self, rhs: mat3<T>)
fn sub_assign(&mut self, rhs: mat3<T>)
Performs the
-=
operation. Read moresource§impl VertexAttribute for mat3<f32>
impl VertexAttribute for mat3<f32>
impl<T> Copy for mat3<T>where
T: Copy,
Auto Trait Implementations§
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.