Fast square root tricks:
2D:
If dy > dx, approximated distance is
0.41 dx + 0.941246 dy
(If dy < dx, swap these values.) The difference from the exact distance is between -6% and +3%; more than 85% of all possible differences are between −3% to +3%.
3D:
in decreasing length dx, dy, dz
0.9398 dx + 0.3893 dy + 0.2987 dz
This has a max error of 6.0%, quite accurate, and can
be computed quickly with only shifts and adds (no
multiplies).
