2018-05-27 03:02:24 +08:00
|
|
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
|
|
|
use base::dimension::Dynamic;
|
|
|
|
use base::dimension::{U1, U2, U3, U4, U5, U6};
|
2018-05-19 23:15:15 +08:00
|
|
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
2018-12-06 05:46:17 +08:00
|
|
|
use base::vec_storage::VecStorage;
|
2018-05-19 23:15:15 +08:00
|
|
|
use base::storage::Owned;
|
|
|
|
use base::Matrix;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Column-major matrices.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2018-09-27 05:15:57 +08:00
|
|
|
/// A statically sized column-major matrix with `R` rows and `C` columns.
|
2017-08-03 01:37:44 +08:00
|
|
|
#[deprecated(note = "This matrix name contains a typo. Use MatrixMN instead.")]
|
|
|
|
pub type MatrixNM<N, R, C> = Matrix<N, R, C, Owned<N, R, C>>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-27 05:15:57 +08:00
|
|
|
/// A statically sized column-major matrix with `R` rows and `C` columns.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type MatrixMN<N, R, C> = Matrix<N, R, C, Owned<N, R, C>>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-27 05:15:57 +08:00
|
|
|
/// A statically sized column-major square matrix with `D` rows and columns.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type MatrixN<N, D> = MatrixMN<N, D, D>;
|
|
|
|
|
|
|
|
/// A dynamically sized column-major matrix.
|
2018-05-19 23:15:15 +08:00
|
|
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type DMatrix<N> = MatrixN<N, Dynamic>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 1x1 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix1<N> = MatrixN<N, U1>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 2x2 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix2<N> = MatrixN<N, U2>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 3x3 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix3<N> = MatrixN<N, U3>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 4x4 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix4<N> = MatrixN<N, U4>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 5x5 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix5<N> = MatrixN<N, U5>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, column-major, 6x6 square matrix.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Matrix6<N> = MatrixN<N, U6>;
|
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 1x2 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix1x2<N> = MatrixMN<N, U1, U2>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 1x3 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix1x3<N> = MatrixMN<N, U1, U3>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 1x4 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix1x4<N> = MatrixMN<N, U1, U4>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 1x5 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix1x5<N> = MatrixMN<N, U1, U5>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 1x6 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix1x6<N> = MatrixMN<N, U1, U6>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 2x3 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix2x3<N> = MatrixMN<N, U2, U3>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 2x4 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix2x4<N> = MatrixMN<N, U2, U4>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 2x5 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix2x5<N> = MatrixMN<N, U2, U5>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 2x6 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix2x6<N> = MatrixMN<N, U2, U6>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 3x4 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix3x4<N> = MatrixMN<N, U3, U4>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 3x5 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix3x5<N> = MatrixMN<N, U3, U5>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 3x6 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix3x6<N> = MatrixMN<N, U3, U6>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 4x5 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix4x5<N> = MatrixMN<N, U4, U5>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 4x6 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix4x6<N> = MatrixMN<N, U4, U6>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 5x6 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix5x6<N> = MatrixMN<N, U5, U6>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 2x1 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix2x1<N> = MatrixMN<N, U2, U1>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 3x1 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix3x1<N> = MatrixMN<N, U3, U1>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 4x1 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix4x1<N> = MatrixMN<N, U4, U1>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 5x1 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix5x1<N> = MatrixMN<N, U5, U1>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 6x1 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix6x1<N> = MatrixMN<N, U6, U1>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 3x2 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix3x2<N> = MatrixMN<N, U3, U2>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 4x2 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix4x2<N> = MatrixMN<N, U4, U2>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 5x2 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix5x2<N> = MatrixMN<N, U5, U2>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 6x2 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix6x2<N> = MatrixMN<N, U6, U2>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 4x3 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix4x3<N> = MatrixMN<N, U4, U3>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 5x3 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix5x3<N> = MatrixMN<N, U5, U3>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 6x3 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix6x3<N> = MatrixMN<N, U6, U3>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 5x4 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix5x4<N> = MatrixMN<N, U5, U4>;
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 6x4 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix6x4<N> = MatrixMN<N, U6, U4>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2018-09-10 01:27:33 +08:00
|
|
|
/// A stack-allocated, column-major, 6x5 matrix.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type Matrix6x5<N> = MatrixMN<N, U6, U5>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Column vectors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/// A dynamically sized column vector.
|
2018-05-19 23:15:15 +08:00
|
|
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
2018-12-06 05:46:17 +08:00
|
|
|
pub type DVector<N> = Matrix<N, Dynamic, U1, VecStorage<N, Dynamic, U1>>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
/// A statically sized D-dimensional column vector.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type VectorN<N, D> = MatrixMN<N, D, U1>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 1-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector1<N> = VectorN<N, U1>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 2-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector2<N> = VectorN<N, U2>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 3-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector3<N> = VectorN<N, U3>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 4-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector4<N> = VectorN<N, U4>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 5-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector5<N> = VectorN<N, U5>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 6-dimensional column vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type Vector6<N> = VectorN<N, U6>;
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Row vectors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/// A dynamically sized row vector.
|
2018-05-19 23:15:15 +08:00
|
|
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
2018-12-06 05:46:17 +08:00
|
|
|
pub type RowDVector<N> = Matrix<N, U1, Dynamic, VecStorage<N, U1, Dynamic>>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
/// A statically sized D-dimensional row vector.
|
2017-08-03 01:37:44 +08:00
|
|
|
pub type RowVectorN<N, D> = MatrixMN<N, U1, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 1-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector1<N> = RowVectorN<N, U1>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 2-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector2<N> = RowVectorN<N, U2>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 3-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector3<N> = RowVectorN<N, U3>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 4-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector4<N> = RowVectorN<N, U4>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 5-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector5<N> = RowVectorN<N, U5>;
|
2017-02-13 01:17:09 +08:00
|
|
|
/// A stack-allocated, 6-dimensional row vector.
|
2016-12-05 05:44:42 +08:00
|
|
|
pub type RowVector6<N> = RowVectorN<N, U6>;
|