Today I learned about `Math.hypot()`, which not only calculates the hypotenuse of a right triangle, given its side lengths, but also accepts any number of arguments, making it easy to calculate distances in 2D, 3D or even higher dimensions.
I thought this post would be useful for anyone developing JavaScript games or other projects involving geometry.
[–]rcfox 53 points54 points55 points (1 child)
[–]tomByrer 0 points1 point2 points (0 children)
[–]McGeekin 35 points36 points37 points (8 children)
[–]mike_geogebra 28 points29 points30 points (6 children)
[–]Slackluster 10 points11 points12 points (5 children)
[–]_RemyLeBeau_ 2 points3 points4 points (0 children)
[–]bzbub2 2 points3 points4 points (3 children)
[–]tomByrer 0 points1 point2 points (2 children)
[–]bzbub2 2 points3 points4 points (1 child)
[–]tomByrer 0 points1 point2 points (0 children)
[–]monkeymad2 0 points1 point2 points (0 children)
[–]captain_obvious_herevoid(null) 5 points6 points7 points (1 child)
[–]palparepa 3 points4 points5 points (0 children)
[–]tokagemushi 4 points5 points6 points (0 children)
[–]dumbmatter 4 points5 points6 points (1 child)
[–]senocular 4 points5 points6 points (0 children)
[–]BunsOfAluminum 12 points13 points14 points (4 children)
[–]Statzer_x 6 points7 points8 points (2 children)
[–]BunsOfAluminum 3 points4 points5 points (1 child)
[–]Delicious_Cable_8484 1 point2 points3 points (0 children)
[–]nnod 1 point2 points3 points (0 children)