Predict branches, which results in about 2% speed-up.
Small optimisation.
Optimisation.
Add distance_squared variants, use them to calculate distance.
Use distance/distance_squared.
Correct attribute.
Use distance/distance_squared