RE: Programming question

From: Clay Cowgill <ClayC_at_diamondmm.com>
Date: Fri Oct 29 1999 - 12:47:41 EDT

> Clay, I threw a few numbers into these equations
> "real dist" = sqrt(x^2+y^2), "fake dist" = ((X*2)+(Y*2))/4
> and in a circular obit, the gravity gets stronger when you have only an x
> or
> y offset and weaker when your at one of the 45 degree angles from the sun.
> (making the gravity rings a square turned 45 degrees). But this might be
> ok
> consider how little time it takes to calculate.
>
Yeah, the diagonal is the one to watch out for, but it's easy to check.
Between the first shift into the carry bit (which can be tested with BCS)
and the top bit (which can be tested with a BMI) you can get a feel for the
relative magnitude of the distances. Once the distances reach a certain
point past the gravity source just subtract the X and Y distances. A small
answer means it's close to the diagonal, a large answer means it's not. If
you're close to the diagonal (and past a certain range) subtract some the
gravity (like maybe do two more shifts right on your distance and subtract
that from the previous answer). So basically you're flattening the corners
on that 45 degree rotated square...

Either way, I bet you're only looking maybe 10-12 instructions per pass with
a couple tests worst case. Should be pretty quick I'd think.

-Clay
Received on Fri Oct 29 11:48:11 1999

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:32:48 EDT