As I mentioned in the above thread, Apjjm made that work with radius in 1.2. However, I've been looking at his script for a damn long time trying to figure out everything. I've found these two of his custom functions, relating to Pythagoras Theorem:
const uint32 _SQRTITERATIONS=5; //Maximum number of iterations for sqrt computation
const float _SQRTDELTA=0.01f; //Margin of error allowable if complete before iteration ceiling
//Determines if two numbers are approximately equal (Differ by no more than epsilon)
bool approx(float &in x, float &in y, float &in epsilon) {
float delta = x-y;
return ((delta>0?delta:-delta) <= (epsilon>0?epsilon:-epsilon));
}
//Sqrt of a number
float sqrt(float &in x) {
if(x<=0) return 0; //Early out - not valid input.
uint32 i = 0; float o = x * 0.5f;
while( i<_SQRTITERATIONS && !approx(o*o,x,_SQRTDELTA) && o != 0)
{ o = 0.5f * (o + x/o); i++; }
return o;
}
Derp.