Is it faster to use the square root in a vector length / distance operation and then comparing to some value or is it faster to square the value that is compared and then don't use the square root? So basically in pseudo code, is this:
sqrt(x * x + y * y) > a
faster then this:
x * x + y * y > a * a
I am showing this code , to let you know that how big is the square root function
Even though , we use an inbuild function , it has to go through these process
As you can see now , sqrt is a result of a looped function which has multiplication, division and addition
So if you do
x * x + y * y > a * a
it will take only lesser time than the sqrt method, which i can confirm with this.