From 93f9eb814bf8532129e1fa4a241bca3a0b69e4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 23 Jul 2023 12:49:03 +0200 Subject: [PATCH] python: adapt to deprecated Math::angle() for quaternions. It's renamed to half_angle() here as well. No API deprecation, sorry. --- src/python/magnum/math.cpp | 6 ++++-- src/python/magnum/test/test_math.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/python/magnum/math.cpp b/src/python/magnum/math.cpp index 4e87233..fff1189 100644 --- a/src/python/magnum/math.cpp +++ b/src/python/magnum/math.cpp @@ -269,8 +269,10 @@ template void quaternion(py::module_& m, py::class_& c) { m .def("dot", static_cast(&Math::dot), "Dot product between two quaternions") - .def("angle", [](const T& a, const T& b) { - return Radd(Math::angle(a, b)); + .def("half_angle", [](const T& a, const T& b) { + /** @todo switch back to angle() once it's reintroduced with the + correct output again */ + return Radd(Math::halfAngle(a, b)); }, "Angle between normalized quaternions", py::arg("normalized_a"), py::arg("normalized_b")) .def("lerp", static_cast(&Math::lerp), "Linear interpolation of two quaternions", py::arg("normalized_a"), py::arg("normalized_b"), py::arg("t")) diff --git a/src/python/magnum/test/test_math.py b/src/python/magnum/test/test_math.py index 6df7e1d..0a71492 100644 --- a/src/python/magnum/test/test_math.py +++ b/src/python/magnum/test/test_math.py @@ -1144,8 +1144,8 @@ class Quaternion_(unittest.TestCase): self.assertAlmostEqual(float(Deg(a.angle())), float(Deg(45.0)), 4) def test_functions(self): - a = math.angle(Quaterniond.rotation(Deg(45.0), Vector3d.x_axis()), - Quaterniond.rotation(Deg(75.0), Vector3d.x_axis())) + a = math.half_angle(Quaterniond.rotation(Deg(45.0), Vector3d.x_axis()), + Quaterniond.rotation(Deg(75.0), Vector3d.x_axis())) self.assertEqual(Deg(a), Deg(15.0)) def test_properties(self):