From 8095c33bcddefebd16b7cb08b07690caf877f600 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 21 Feb 2017 17:14:37 +0100 Subject: Use qRadiansToDegrees() and qDegreesToRadians() more widely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Marc Mutz --- tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp') diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 53af65e010..097dd111d3 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -815,7 +815,7 @@ void tst_QQuaternion::fromAxisAndAngle() // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56 // to calculate the answer we expect to get. QVector3D vector = QVector3D(x1, y1, z1).normalized(); - const float a = (angle * M_PI / 180.0) / 2.0; + const float a = qDegreesToRadians(angle) / 2.0; const float sin_a = std::sin(a); const float cos_a = std::cos(a); QQuaternion result(cos_a, -- cgit v1.2.3