Test identity multiplication
This commit is contained in:
parent
4d649c735b
commit
fa5971faa4
@ -57,6 +57,21 @@ impl From<[f32; 16]> for Matrix4x4 {
|
||||
|
||||
impl Matrix4x4 {
|
||||
/// Create a `Matrix4x4` containing the identity, all zeros with ones along the diagonal.
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use rtchallenge::matrices::Matrix4x4;
|
||||
///
|
||||
/// let a = Matrix4x4::new(
|
||||
/// [0., 1., 2., 3.],
|
||||
/// [1., 2., 4., 8.],
|
||||
/// [2., 4., 8., 16.],
|
||||
/// [4., 8., 16., 32.],
|
||||
/// );
|
||||
/// let i = Matrix4x4::identity();
|
||||
///
|
||||
/// assert_eq!(a * i, a);
|
||||
/// ```
|
||||
pub fn identity() -> Matrix4x4 {
|
||||
Matrix4x4::new(
|
||||
[1., 0., 0., 0.],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user