diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2017-03-06 17:40:14 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-07-07 08:47:19 +0000 |
commit | 885c2c6aa36f9f083ce5a774aedac35caa4ec075 (patch) | |
tree | 881147e006f112e72296e304bf92421e0614bb4f /examples/qt3d/planets-qml | |
parent | 06fa003da1dc6bc16616f3e687de8513d8b40a1c (diff) |
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 <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/planets-qml')
-rw-r--r-- | examples/qt3d/planets-qml/SolarSystem.qml | 2 |
1 files changed, 1 insertions, 1 deletions
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 |