generic_array_storage

Type Alias GenericMatrix

Source
pub type GenericMatrix<T, R, C> = Matrix<T, <R as Conv>::Nalg, <C as Conv>::Nalg, GenericArrayStorage<T, R, C>>;
Expand description

Alias to nalgebra::Matrix, completely “hiding” const usizes away. See crate’s documentation on how this is possible.

Aliased Type§

struct GenericMatrix<T, R, C> {
    pub data: GenericArrayStorage<T, R, C>,
    /* private fields */
}

Fields§

§data: GenericArrayStorage<T, R, C>

The data storage that contains all the matrix components. Disappointed?

Well, if you came here to see how you can access the matrix components, you may be in luck: you can access the individual components of all vectors with compile-time dimensions <= 6 using field notation like this: vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:

let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);

Similarly, for matrices with compile-time dimensions <= 6, you can use field notation like this: mat.m11, mat.m42, etc. The first digit identifies the row to address and the second digit identifies the column to address. So mat.m13 identifies the component at the first row and third column (note that the count of rows and columns start at 1 instead of 0 here. This is so we match the mathematical notation).

For all matrices and vectors, independently from their size, individual components can be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing starts at 0 as you would expect.

Trait Implementations§

Source§

impl<T: Scalar, R: Conv, C: Conv> GenericMatrixExt for GenericMatrix<T, R, C>

Source§

type T = T

Type of the elements. Read more
Source§

type R = R

Type defining rows count
Source§

type C = C

Type defining column count
Source§

fn into_regular_matrix( self, ) -> OMatrix<Self::T, <Self::R as Conv>::Nalg, <Self::C as Conv>::Nalg>
where DefaultAllocator: Allocator<<Self::R as Conv>::Nalg, <Self::C as Conv>::Nalg>,

Converts GenericMatrix into regular nalgebra matrix, backed by core array (it’s opaque about that though)
Source§

fn conv<NewR: Conv<TNum = <Self::R as Conv>::TNum>, NewC: Conv<TNum = <Self::C as Conv>::TNum>>( self, ) -> GenericMatrix<Self::T, NewR, NewC>

Changes type of GenericMatrix to a different row and column count descriptors.