From 2784de6c62b763d3f1b144ecd5033c79273058cc Mon Sep 17 00:00:00 2001 From: Alexander Fabisch Date: Tue, 19 Nov 2024 17:39:53 +0100 Subject: [PATCH] Test norm_axis_angles --- pytransform3d/test/test_batch_rotations.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pytransform3d/test/test_batch_rotations.py b/pytransform3d/test/test_batch_rotations.py index 2b1c68edb..93e0a4972 100644 --- a/pytransform3d/test/test_batch_rotations.py +++ b/pytransform3d/test/test_batch_rotations.py @@ -42,6 +42,18 @@ def test_norm_vectors_zero(): assert_array_almost_equal(V_unit, V) +def test_norm_axis_angles(): + rng = np.random.default_rng(843) + A = np.hstack(( + pbr.norm_vectors(rng.standard_normal(size=(10, 3))), + np.pi + rng.uniform(size=(10, 1)) + )) + A_norm = pbr.norm_axis_angles(A) + for a, a_norm in zip(A, A_norm): + assert pytest.approx(a[3]) != a_norm[3] + assert_array_almost_equal(a_norm, pr.norm_axis_angle(a)) + + def test_angles_between_vectors_0dims(): rng = np.random.default_rng(228) A = rng.standard_normal(size=3)