Members - Reputation: 432
Posted 09 May 2012 - 06:04 PM
Now, let's say that B is more than a point, and has a radius of R. Now we want to know the (squared) distance from A to the (nearest) outer surface of B, not just to the center of B. So we want the distance from A to (B - R).
I tried squaring R and subtracting that from the squared distance, but obviously the result was not correct.
Is there a way to calculate the reduced distance without using a sqrt to get the actual distance values? Can it be done with a reasonable level of calculation, or is sqrt the best option for this?
Members - Reputation: 389
Posted 09 May 2012 - 07:07 PM
Edited by taby, 09 May 2012 - 07:11 PM.
Crossbones+ - Reputation: 16538
Posted 09 May 2012 - 07:33 PM
d = (r^2+d^2-n)/(2*r)
As you see, everything on the right-hand side can be computed without using square roots, so you would then be able to compute d without using a square root at all. This leads me to believe that what you are after is just not possible.