home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: news.nic.surfnet.nl!hhinsi!news
- From: robv@si.hhs.nl (Veer)
- Subject: Re: TMapping again!
- Message-ID: <DLA1p3.A2n@si.hhs.nl>
- Sender: news@si.hhs.nl
- Reply-To: robv@si.hhs.nl
- Organization: Sector Informatica, Haagse HogeSchool, the NetherLands
- References: <mq2Xx*aB0@mkmk.in-chemnitz.de>
- Date: Tue, 16 Jan 1996 14:03:02 GMT
-
- In article aB0@mkmk.in-chemnitz.de, floh@mkmk.in-chemnitz.de (Andre Weissflog) writes:
- > In article <38232018@kone.fipnet.fi>, "Jyrki Saarinen" writes:
- >
- > Instead of 2 divs, one can also use 1 div and 2 muls:
- >
- > z' = 1 / one_div_z
- > u = u_div_z * z'
- > v = v_div_z * z'
- >
-
- This can even be done faster using a precalc table.
- Remember: a*b = log(a+b).
-
- So you can precalc a log-table (which might get big) but you could eliminate ALL
- divisions and multiplications this way.
-
- ++Pseudocode mode ON
-
- /* create a table of longwords */
- for(t=0x0000;t<0xFFFF;t++)
- {
- /* I didn't account for the fixed-point calculcations */
- table[t] = log(1/t);
- }
-
- ---
- /* now, when you need to convert 3D to 2D, do this */
-
- u = table[u_div_z + one_div_z];
- v = table[v_div_z + one_div_z];
-
- ++Pseudocode mode OFF
-
- Ofcourse, the size of the table can be minimize by examining the results of the log
- table and the required precision. If the resulting values need not to be fixed-point
- values between 0 and 512 the size of the table could be modified accordingly.
-
- Though I have never tested this principle, I think a major speedup in calculations can
- be achieved.
-
- CYa,
-
- Rob.
-
- ---
- Think about this for a while:
-
- Only fools can develop fool-proof applications.
-
-
-
-