Re: [stella] Polar to Cartesian Co-Ordinate Converter

Subject: Re: [stella] Polar to Cartesian Co-Ordinate Converter
From: "Roger Williams" <mer02@xxxxxxxxxxxxx>
Date: Mon, 22 Oct 2001 16:21:49 -0700
> Especially the fast division may open some new opportunites. To bad, that
I can't use them for my new demo, since I need the remainder too

> You don't know a formula for this, do you?

No, that's a hard one with the 6502 set.  The log trick works because I
accept the rounding
errors, which are big enough to make it unacceptable for some functions --
for example,
you couldn't use it to do base conversion because there are a lot of +-1
errors even
close in.  But for drawing a display which can be approximate, it does the
job.

The cartesian to polar conversion is even less accurate than the polar to
cartesian, but
that's not as important because it's mainly used for back conversions and
the errors
aren't as "visible" the way I'm using it.

> I guess, the rounding error could be further reduced by using 16 bit value
tables (for LOG only of course :-) Correct?

Yes, the larger the log table the more accurate the results will be (but
they will never
be quite perfect).  Remember a full 16-bit log table would be 64K, but you
could get
a lot of midrange improvement (+-1 pixel at 128, for example) with a log
table 3 or
4 pages long.  But this would give you ALL the overhead of 16-bit math in
the
conversion.  (Going to 1/1024 circle angular resolution is also trivial with
a 256-byte
trig table, but again you get 16-bit angles.)  In this version I was going
for sheer
blazing speed.

--Roger Williams



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

Current Thread