Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!lll-winken!iggy.GW.Vitalink.COM!widener!dsinc!bagate!cbmvax!cbmehq!cbmger!peterk From: peterk@cbmger.UUCP (Peter Kittel GERMANY) Newsgroups: comp.sys.amiga.programmer Subject: Re: Fast 3d Graphics Keywords: fast 3d optimizing assembly cycles Message-ID: <1073@cbmger.UUCP> Date: 5 Apr 91 12:14:08 GMT References: <9529@star.cs.vu.nl> <1047@cbmger.UUCP> <20338@cbmvax.commodore.com> <9554@star.cs.vu.nl> Reply-To: peterk@cbmger.UUCP (Peter Kittel GERMANY) Organization: Commodore Bueromaschinen GmbH, West Germany Lines: 39 In article <9554@star.cs.vu.nl> mmblom@cs.vu.nl (Marc Blom) writes: > >peterk@cbmger.UUCP (Peter Kittel GERMANY) wrote: >>All I hear permanently is, use tables, tables, tables instead of real >>(or integer) calculations. At least for the sin and cos calculations. >>Estimations about real-life situations show that you don't need tremendous >>precision normally (but that depends on your real project). > >I wish I knew how to use tables without taking too much memory: I'm using >360 degrees around each angle, so to multiply a coordinate with a sin/cos >(this is one table) value i would need 360 words PER coordinate, No, you can cut down this by a factor of 4 by making use of the identities of sin and cos for offsets of n*90 degrees. This is common technique. > I'm now >using coordinates that range from -16K to + 16K. I don't even want to >calculate this ! (22.5 meg !) Offcourse i could use less percision, for >instance only rotating by an even number of degrees (0,2,4...,360) and >don't use such a large a coordinate system, but i don't want to compromise >between speed/presicion just yet ! Hmm, why is the size of the coordinate system important? In first attempt I would only make a table of sin and cos values in some arbitrary stepping. If you need high precision, then for only one quadrant in small steps; else for the whole circle in bigger steps. In this system you save the sin/cos evaluation, but you have still to multiply your coordinates with these factors. Another thought: If you don't have so many objects, would it be of advantage to build tables of every object coordinate already multiplied with all these sin/cos values? That should save you some more multipli- cations in the innermost loops. But the number of stored table entries has squared, now there you would have to choose very carefully. Anyone already done this? -- Best regards, Dr. Peter Kittel // E-Mail to \\ Only my personal opinions... Commodore Frankfurt, Germany \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk