View Single Post
Frus
Senior Member
Join Date: Aug 2009
Old 11-10-2009 , 22:17   Re: loop optimization
Reply With Quote #6

The result of a vector distance calculation is squared at the second to last step, as a result of the math (think pythagoras, c2 = a2 + b2). To get the correct distance, the squared distance needs to be 'square-rooted'. But it is more efficient to skip the square root, and compare 2 squared distances.

Last edited by Frus; 11-10-2009 at 22:22.
Frus is offline