pub type MatrixN<N, D> = MatrixMN<N, D, D>;
Expand description
A statically sized column-major square matrix with D
rows and columns.
Implementations§
source§impl<N, D: DimName> MatrixN<N, D>where
N: Scalar + Ring,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: DimName> MatrixN<N, D>where
N: Scalar + Ring,
DefaultAllocator: Allocator<N, D, D>,
sourcepub fn new_scaling(scaling: N) -> Self
pub fn new_scaling(scaling: N) -> Self
Creates a new homogeneous matrix that applies the same scaling factor on each dimension.
sourcepub fn new_nonuniform_scaling<SB>(
scaling: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Selfwhere
D: DimNameSub<U1>,
SB: Storage<N, DimNameDiff<D, U1>>,
pub fn new_nonuniform_scaling<SB>(
scaling: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Selfwhere
D: DimNameSub<U1>,
SB: Storage<N, DimNameDiff<D, U1>>,
Creates a new homogeneous matrix that applies a distinct scaling factor for each dimension.
sourcepub fn new_translation<SB>(
translation: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Selfwhere
D: DimNameSub<U1>,
SB: Storage<N, DimNameDiff<D, U1>>,
pub fn new_translation<SB>(
translation: &Vector<N, DimNameDiff<D, U1>, SB>
) -> Selfwhere
D: DimNameSub<U1>,
SB: Storage<N, DimNameDiff<D, U1>>,
Creates a new homogeneous matrix that applies a pure translation.
source§impl<N, D: Dim> MatrixN<N, D>where
N: Scalar,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: Dim> MatrixN<N, D>where
N: Scalar,
DefaultAllocator: Allocator<N, D, D>,
sourcepub fn from_diagonal<SB: Storage<N, D>>(diag: &Vector<N, D, SB>) -> Selfwhere
N: Zero,
pub fn from_diagonal<SB: Storage<N, D>>(diag: &Vector<N, D, SB>) -> Selfwhere
N: Zero,
Creates a square matrix with its diagonal set to diag
and all other entries set to 0.
Example
let m = Matrix3::from_diagonal(&Vector3::new(1.0, 2.0, 3.0));
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal(&DVector::from_row_slice(3, &[1.0, 2.0, 3.0]));
assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 3.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 3.0);
Trait Implementations§
source§impl<N, D: DimName> AbstractMagma<Multiplicative> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedAdd + ClosedMul,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: DimName> AbstractMagma<Multiplicative> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedAdd + ClosedMul,
DefaultAllocator: Allocator<N, D, D>,
source§impl<N: Real, D: DimName, R> From<Isometry<N, D, R>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
R: SubsetOf<MatrixN<N, DimNameSum<D, U1>>>,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>> + Allocator<N, D>,
impl<N: Real, D: DimName, R> From<Isometry<N, D, R>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
R: SubsetOf<MatrixN<N, DimNameSum<D, U1>>>,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>> + Allocator<N, D>,
source§impl<N: Real, D: DimName, R> From<Similarity<N, D, R>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
R: SubsetOf<MatrixN<N, DimNameSum<D, U1>>>,
DefaultAllocator: Allocator<N, D> + Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
impl<N: Real, D: DimName, R> From<Similarity<N, D, R>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
R: SubsetOf<MatrixN<N, DimNameSum<D, U1>>>,
DefaultAllocator: Allocator<N, D> + Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
source§fn from(sim: Similarity<N, D, R>) -> Self
fn from(sim: Similarity<N, D, R>) -> Self
Converts to this type from the input type.
source§impl<N: Real, D: DimName, C> From<Transform<N, D, C>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
impl<N: Real, D: DimName, C> From<Transform<N, D, C>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
C: TCategory,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
source§impl<N: Scalar + Zero + One, D: DimName> From<Translation<N, D>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
DefaultAllocator: Allocator<N, D> + Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
impl<N: Scalar + Zero + One, D: DimName> From<Translation<N, D>> for MatrixN<N, DimNameSum<D, U1>>where
D: DimNameAdd<U1>,
DefaultAllocator: Allocator<N, D> + Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
source§fn from(t: Translation<N, D>) -> Self
fn from(t: Translation<N, D>) -> Self
Converts to this type from the input type.
source§impl<N, D: DimName> Identity<Multiplicative> for MatrixN<N, D>where
N: Scalar + Zero + One,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: DimName> Identity<Multiplicative> for MatrixN<N, D>where
N: Scalar + Zero + One,
DefaultAllocator: Allocator<N, D, D>,
source§impl<N, D: DimName> One for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: DimName> One for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
source§impl<'a, N, D: DimName> Product<&'a Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
impl<'a, N, D: DimName> Product<&'a Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
source§impl<N, D: DimName> Product<Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
impl<N, D: DimName> Product<Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>> for MatrixN<N, D>where
N: Scalar + Zero + One + ClosedMul + ClosedAdd,
DefaultAllocator: Allocator<N, D, D>,
source§impl<N: Real, D: DimNameSub<U1>> Transformation<Point<N, <D as DimNameSub<U1>>::Output>> for MatrixN<N, D>where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimNameDiff<D, U1>> + Allocator<N, DimNameDiff<D, U1>, DimNameDiff<D, U1>>,
impl<N: Real, D: DimNameSub<U1>> Transformation<Point<N, <D as DimNameSub<U1>>::Output>> for MatrixN<N, D>where
DefaultAllocator: Allocator<N, D, D> + Allocator<N, DimNameDiff<D, U1>> + Allocator<N, DimNameDiff<D, U1>, DimNameDiff<D, U1>>,
source§fn transform_vector(
&self,
v: &VectorN<N, DimNameDiff<D, U1>>
) -> VectorN<N, DimNameDiff<D, U1>>
fn transform_vector(
&self,
v: &VectorN<N, DimNameDiff<D, U1>>
) -> VectorN<N, DimNameDiff<D, U1>>
Applies this group’s action on a vector from the euclidean space. Read more
source§fn transform_point(
&self,
pt: &Point<N, DimNameDiff<D, U1>>
) -> Point<N, DimNameDiff<D, U1>>
fn transform_point(
&self,
pt: &Point<N, DimNameDiff<D, U1>>
) -> Point<N, DimNameDiff<D, U1>>
Applies this group’s action on a point from the euclidean space.