From 885c2c6aa36f9f083ce5a774aedac35caa4ec075 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 6 Mar 2017 17:40:14 +0100 Subject: Use Math.hypot() in preference to sqrt(a sum of squares) It's likely more accurate and may well be optimised, too. Change-Id: Iba38b80be16ca97a5f818e3dbc880a821cd9900a Reviewed-by: Sean Harmer --- examples/qt3d/planets-qml/SolarSystem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/qt3d/planets-qml/SolarSystem.qml b/examples/qt3d/planets-qml/SolarSystem.qml index f9353d6dc..3a717e62a 100644 --- a/examples/qt3d/planets-qml/SolarSystem.qml +++ b/examples/qt3d/planets-qml/SolarSystem.qml @@ -395,7 +395,7 @@ Entity { var v = Math.atan2(yv, xv) // Calculate the distance (radius) - var r = Math.sqrt(xv * xv + yv * yv) + var r = Math.hypot(xv, yv) // From http://www.davidcolarusso.com/astro/ // Modified to compensate for the right handed coordinate system of OpenGL -- cgit v1.2.3