[futurebasic] Square Root FN & Regions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1999 : Group Archive : Group : All Groups

From: Mel and Carol Patrick <mel@...>
Date: Sun, 3 Jan 1999 17:43:07 -0700
1. I'm looking for the fastest way to do a SQR root. I tried the normal FB
square root function SQR(var) and its not bad but its slower than the USR
_sqRoot(var) that returns a long int.

Since I am only interested in an integer anyway, I am using the USR _sqRoot
function as it works faster than the other SQR function. The function is
nested in a loop that can be called from 1000 to up to 49,000 times.
Obviously the more times called, the slower before the result. Basic law of
diminishing returns...;-)

The values change too much to build a lookup table so is there a faster way
to do this, or just settle for the USR option. Yes, I know the PC option
(throw more CPU power at it).

2. Is it also faster to use the toolboxs DeltaPoint or do the calcs myself?

3. Next in my list of things is simply this. I build a region (good old
fashion polygon). I know I can test to see if a simple X/Y point resides
within the region. Not a big deal (gotta love the Mac toolbox for helping
out!).

However. assume that we have two points (with a line connecting them). One
resides in the region and one is outside the region. In plain English,
using 1K words or less, is it possible to tell at what point the line
between the two points, meets the edge of the region (and convert or get
that point in X/Y coordinates)?

4. And last, why is abbreviation such a long word?

Mel Patrick - theWabbitGuy - mel@...
mailto:mel@...
http://www.intergate.bc.ca/business/mel