Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: 3D stuff & quick line drawing Message-ID: Date: 22 Apr 91 03:23:28 GMT References: <1991Apr21.081925.4722@lynx.CS.ORST.EDU> Organization: Not an Organization Lines: 46 In article <1991Apr21.081925.4722@lynx.CS.ORST.EDU> divineg@prism.CS.ORST.EDU writes: > > Here's my situation: > >I've coded and coded and coded and finally found a way to crudely rotate >3 dimensional objects ... now all of you wizards out there, what's the >quickest way to draw a line? I'd like to do it with the Blitter (I can >use the processer to calculate while I draw lines) or is it better to use >the 68'? By the way, I'm using C & asm (pretty original, huh?). > Please post your responses, I'm interested in what kind of >discussion follows..... > >Yenivid Edalg 8^) >(E-Mail me at divineg@prism.cs.orst.edu) Hmm. Well, 3D is actually easy if you use standard matrix theory, any good graphics book will have it. It is all extremely general and you can do practically *anything* with it (4x4 matrices). Once you get it working in the general sense you can optimize the *ell out of the code, remove whole chunks of calculations that do not apply. Word to the wise on 3D: stick with vectors instead of polar coordinates if you want to easily code arbitrary view points & movement. You also avoid arctan completely with vectors and sin/cos are not only relegated to table lookups, you can precalculate most of what you need once per frame instead of for each object. The problem with polar coordinates is that they are not uniform -- for example, the direction represented by phi=+/-90 degrees causes theta to go wild (theta can become anything without effecting the direction). Back to line drawing: It has been shown that the processor can draw short lines much faster than the blitter can due to blitter setup overhead. I believe the breakoff point is somewhere around 150 pixels. I'd stick with standard Move/Draw in a modular routine until you get to the point where you really need to optimize, unless you have already written optimized line drawing routines, in which case you just use those. -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA