Skip to main content

Mat

Struct Mat 

pub struct Mat<const N: usize, T> { /* private fields */ }
Expand description

Column-major

Implementations§

§

impl<const N: usize, T> Mat<N, T>

pub const fn from_array(data: [[T; N]; N]) -> Mat<N, T>

pub const fn as_array(&self) -> &[[T; N]; N]

pub const fn as_array_mut(&mut self) -> &mut [[T; N]; N]

pub const fn try_col(&self, x: usize) -> Option<&[T; N]>

pub const fn col(&self, x: usize) -> &[T; N]

pub const fn try_col_mut(&mut self, x: usize) -> Option<&mut [T; N]>

pub const fn col_mut(&mut self, x: usize) -> &mut [T; N]

§

impl<const N: usize, T> Mat<N, T>
where T: Primitive,

pub const IDENTITY: Mat<N, T>

pub const fn into_array(self) -> [[T; N]; N]

pub const fn try_row(&self, y: usize) -> Option<[T; N]>

pub const fn row(&self, y: usize) -> [T; N]

pub const fn get(&self, x: usize, y: usize) -> Option<&T>

pub const fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut T>

pub const fn splat(v: T) -> Mat<N, T>

pub const fn transpose(&mut self)

§

impl<T> Mat<2, T>
where T: Primitive,

pub const fn offset(offset: T) -> Mat<2, T>

pub const fn scale(scale: Vec2<T>) -> Mat<2, T>

pub const fn ignored(&self, x: usize, y: usize) -> T

pub fn minors(&self) -> Mat<2, T>

§

impl<T> Mat<2, T>
where T: Number,

pub fn from_rotation(angle: f64) -> Mat<2, T>

pub fn determinant(&self) -> T

pub fn cofactor(&mut self)

pub fn inverse(&self) -> Option<Mat<2, T>>

pub fn mul_with_projection(&self, rhs: T) -> T

§

impl<T> Mat<3, T>
where T: Primitive,

pub const fn offset(offset: Vec2<T>) -> Mat<3, T>

pub const fn scale(scale: Vec3<T>) -> Mat<3, T>

pub const fn into_4x4(&self) -> Mat<4, T>

pub const fn into_4x4_with_offset(&self, offset: Vec3<T>) -> Mat<4, T>

pub const fn ignored(&self, x: usize, y: usize) -> Mat<2, T>

§

impl<T> Mat<3, T>
where T: Number,

pub fn rotation_x(angle: f64) -> Mat<3, T>

pub fn rotation_y(angle: f64) -> Mat<3, T>

pub fn rotation_z(angle: f64) -> Mat<3, T>

pub fn rotation_euler(euler: Vec3<f64>) -> Mat<3, T>

pub fn determinant(&self) -> T

pub fn minors(&self) -> Mat<3, T>

pub fn cofactor(&mut self)

pub fn inverse(&self) -> Option<Mat<3, T>>

pub fn mul_with_projection(self, rhs: Vec2<T>) -> Vec2<T>

pub fn to_lossy_scale(&self) -> Vec3<T>

pub fn to_lossy_scale_rotation(&self) -> (Vec3<T>, Quat<T>)

§

impl<T> Mat<4, T>
where T: Primitive,

pub const fn offset(offset: Vec3<T>) -> Mat<4, T>

pub const fn scale(scale: Vec4<T>) -> Mat<4, T>

pub const fn ignored(&self, x: usize, y: usize) -> Mat<3, T>

§

impl<T> Mat<4, T>
where T: Number,

pub fn determinant(&self) -> T

pub fn minors(&self) -> Mat<4, T>

pub fn cofactor(&mut self)

pub fn inverse(&self) -> Option<Mat<4, T>>

pub fn mul_with_projection(self, rhs: Vec3<T>) -> Vec3<T>

pub fn mul_with_projection_as_dir(self, rhs: Vec3<T>) -> Vec3<T>

Trait Implementations§

§

impl<const N: usize, T> AllBitVariationsValid for Mat<N, T>

§

impl<const N: usize, T> AllBitsInit for Mat<N, T>
where T: AllBitsInit,

§

impl<const N: usize, T> Clone for Mat<N, T>
where T: Clone,

§

fn clone(&self) -> Mat<N, T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<const N: usize, T> Copy for Mat<N, T>
where T: Copy,

§

impl<const N: usize, T> Debug for Mat<N, T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<const N: usize, T> Default for Mat<N, T>
where [[T; N]; N]: Default,

§

fn default() -> Mat<N, T>

Returns the “default value” for a type. Read more
§

impl<'de, const N: usize, T> Deserialize<'de> for Mat<N, T>
where T: Deserialize<'de>,

§

fn deserialize<D>( deserializer: D, ) -> Result<Mat<N, T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<const N: usize, T> From<[[T; N]; N]> for Mat<N, T>
where T: Primitive,

§

fn from(data: [[T; N]; N]) -> Mat<N, T>

Converts to this type from the input type.
§

impl<const N: usize, T> Hash for Mat<N, T>
where T: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<const N: usize, T> Index<(usize, usize)> for Mat<N, T>
where T: Primitive,

§

type Output = T

The returned type after indexing.
§

fn index( &self, _: (usize, usize), ) -> &<Mat<N, T> as Index<(usize, usize)>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<const N: usize, T> Index<usize> for Mat<N, T>
where T: Primitive,

§

type Output = [T; N]

The returned type after indexing.
§

fn index(&self, i: usize) -> &<Mat<N, T> as Index<usize>>::Output

Performs the indexing (container[index]) operation. Read more
§

impl<const N: usize, T> IndexMut<(usize, usize)> for Mat<N, T>
where T: Primitive,

§

fn index_mut( &mut self, _: (usize, usize), ) -> &mut <Mat<N, T> as Index<(usize, usize)>>::Output

Performs the mutable indexing (container[index]) operation. Read more
§

impl<const N: usize, T> IndexMut<usize> for Mat<N, T>
where T: Primitive,

§

fn index_mut(&mut self, i: usize) -> &mut <Mat<N, T> as Index<usize>>::Output

Performs the mutable indexing (container[index]) operation. Read more
§

impl<T> Mul for Mat<2, T>
where T: Number,

§

type Output = Mat<2, T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Mat<2, T>) -> <Mat<2, T> as Mul>::Output

Performs the * operation. Read more
§

impl<T> Mul for Mat<3, T>
where T: Number,

§

type Output = Mat<3, T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Mat<3, T>) -> <Mat<3, T> as Mul>::Output

Performs the * operation. Read more
§

impl<T> Mul for Mat<4, T>
where T: Number,

§

type Output = Mat<4, T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Mat<4, T>) -> <Mat<4, T> as Mul>::Output

Performs the * operation. Read more
§

impl<const N: usize, T> Mul<T> for Mat<N, T>
where T: Number,

§

type Output = Mat<N, T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: T) -> <Mat<N, T> as Mul<T>>::Output

Performs the * operation. Read more
§

impl<T> Mul<Vec2<T>> for Mat<2, T>
where T: Number,

§

type Output = Vec2<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec2<T>) -> <Mat<2, T> as Mul<Vec2<T>>>::Output

Performs the * operation. Read more
§

impl<T> Mul<Vec3<T>> for Mat<3, T>
where T: Number,

§

type Output = Vec3<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec3<T>) -> <Mat<3, T> as Mul<Vec3<T>>>::Output

Performs the * operation. Read more
§

impl<T> Mul<Vec4<T>> for Mat<4, T>
where T: Number,

§

type Output = Vec4<T>

The resulting type after applying the * operator.
§

fn mul(self, rhs: Vec4<T>) -> <Mat<4, T> as Mul<Vec4<T>>>::Output

Performs the * operation. Read more
§

impl<const N: usize, T> PartialEq for Mat<N, T>
where T: PartialEq,

§

fn eq(&self, other: &Mat<N, T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl<const N: usize, S, T> Serializable<S> for Mat<N, T>
where S: SerializerCtxState<[[T; N]; N]>, Mat<N, T>: Default,

§

fn serialize(&self, ctx: SerializerCtx<'_, S>, path: &str) -> SerializedValue

§

fn deserialize( &mut self, ctx: SerializerCtx<'_, S>, path: &str, serialized: &SerializedValue, )

§

impl<const N: usize, T> Serialize for Mat<N, T>
where T: Serialize,

§

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<const N: usize, T> StructuralPartialEq for Mat<N, T>
where T: PartialEq,

Auto Trait Implementations§

§

impl<const N: usize, T> Forget for Mat<N, T>

§

impl<const N: usize, T> Freeze for Mat<N, T>
where [[T; N]; N]: Freeze,

§

impl<const N: usize, T> Move for Mat<N, T>

§

impl<const N: usize, T> RefUnwindSafe for Mat<N, T>

§

impl<const N: usize, T> Send for Mat<N, T>
where [[T; N]; N]: Send,

§

impl<const N: usize, T> Sync for Mat<N, T>
where [[T; N]; N]: Sync,

§

impl<const N: usize, T> Unpin for Mat<N, T>
where [[T; N]; N]: Unpin,

§

impl<const N: usize, T> UnsafeUnpin for Mat<N, T>
where [[T; N]; N]: UnsafeUnpin,

§

impl<const N: usize, T> UnwindSafe for Mat<N, T>
where [[T; N]; N]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
§

impl<T> SameType for T

§

type Same = T

§

fn same_to_self(v: <T as SameType>::Same) -> T

§

fn self_to_same(v: T) -> <T as SameType>::Same

§

fn same_to_self_ref(v: &<T as SameType>::Same) -> &T

§

fn self_to_same_ref(v: &T) -> &<T as SameType>::Same

§

fn same_to_self_mut(v: &mut <T as SameType>::Same) -> &mut T

§

fn self_to_same_mut(v: &mut T) -> &mut <T as SameType>::Same

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more