Skip to content

Commit ccf3cb7

Browse files
alouckselrnv
authored andcommitted
Add matrix3 look_at_[lh|rh] tests
1 parent 891a150 commit ccf3cb7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/matrix.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,35 @@ pub mod matrix3 {
726726
);
727727
}
728728
}
729+
730+
#[test]
731+
fn test_look_at_lh() {
732+
let dir = Vector3::new(1.0, 2.0, 3.0).normalize();
733+
let up = Vector3::unit_y();
734+
let m = Matrix3::look_at_lh(dir, up);
735+
736+
assert_ulps_eq!(m, Matrix3::from([
737+
[0.9486833, -0.16903085, 0.26726127],
738+
[0.0, 0.8451542, 0.53452253],
739+
[-0.31622776, -0.50709254, 0.8017838_f32]
740+
]));
741+
742+
#[allow(deprecated)]
743+
assert_ulps_eq!(m, Matrix3::look_at(dir, up));
744+
}
745+
746+
#[test]
747+
fn test_look_at_rh() {
748+
let dir = Vector3::new(1.0, 2.0, 3.0).normalize();
749+
let up = Vector3::unit_y();
750+
let m = Matrix3::look_at_rh(dir, up);
751+
752+
assert_ulps_eq!(m, Matrix3::from([
753+
[-0.9486833, -0.16903085, -0.26726127],
754+
[0.0, 0.8451542, -0.53452253],
755+
[0.31622776, -0.50709254, -0.8017838_f32]
756+
]));
757+
}
729758
}
730759

731760
pub mod matrix4 {

0 commit comments

Comments
 (0)