Re: [stella] Real 3D Space Calculations

Subject: Re: [stella] Real 3D Space Calculations
From: "Thomas Jentzsch" <tjentzsch@xxxxxx>
Date: Thu, 30 Aug 2001 09:17:35 +0200
Roger Williams wrote:
> The main problem is that all the values are going to have to be 16-bit
> to get the motion smooth enough, and you will need at least 4 16-bit
> random multiplications to do each transform in both directions. 

When I did a fractal generator for the C64, I had the same problem, because the build-in floating point multiplications where damn slow (> 1000 cycles for a 4 or 5 byte floating point number). 

I finally managed to reduced the cpu time significantly (~5 times faster) by using (if I remember it correct:) five 256 byte tables. The basic idea is not to multiply X*Y, but to use only X^2 and Y^2 and some additions and shifts. 

This is the formula: (X+Y)^2 - (X-Y)^2 = 4*X*Y  or  (X/2 + Y/2)^2 - (X/2 - Y/2)^2 = X*Y

So I stored the low and high bytes of N^2 into one table each. The other tables were used to save more time by automatically shifting, summing and carry correcting and might not all be needed with 16 bit maths. (maybe I reinvented the wheel with this, but I remember being very proud :)

This seems to be very doable on a 2600 too.

Have fun!
Thomas
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |


_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@xxxxxx, 8MB Speicher, Verschluesselung - http://freemail.web.de



-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread