From: Chris Holmes Newsgroups: comp.os.msdos.djgpp Subject: Re: 3d Date: Sun, 08 Aug 1999 16:33:36 -0400 Organization: Georgia Institute of Technology, Atlanta GA, USA Lines: 40 Message-ID: <37ADE9A0.4060@surfsouth.com> References: NNTP-Posting-Host: r69h109.res.gatech.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news-int.gatech.edu 934150423 20135 128.61.69.109 (8 Aug 1999 22:13:43 GMT) X-Complaints-To: usenet AT news DOT gatech DOT edu NNTP-Posting-Date: 8 Aug 1999 22:13:43 GMT X-Mailer: Mozilla 3.04Gold (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Anthony Graham wrote: > > I've got a 3d world thing working but i don't know to draw the faces in > order, I've geen getting the vector that is the average (and so the center > of my polygon (all of them are flat surfaces but the orientation varies)) > and using pythagoras determined the distance of this point from the camera's > coordinates. After the shapes are drawn in descending distance order. This > works only on simple shapes. This works fast but i need some more effective > code which gives the correct order at most times. The Z coordinate (or depth into the screen) you should use is not the average or center point, but by the extreme points. > the information available is the 3d coords of camera, and of all the 3d > coords of each polygon. I've done the un-needed shape removal (off screen > and back face culling). All i need to do is order the faces. If it makes it > simpler you don't need to account for intersecting polygons as there will be > none. So you know, "un-needed shape removal" is called HSR or Hidden Surface Removal. Back-face culling is a method of HSR. So is Z-buffering (which is something I'm still clueless about). > given the 3d coords of the flat polygons is there a quick way to see if a > line (anywhere between 2 3d coords) goes through a 3d polygon? If the way of > which you know only works for convex polygons (or any other restriction) > tell me any way. I'm working on the math for that right now for something different. I'll let you know what I come up with. Chris -- I know that I will never be politically correct, and I don't give a damn about my lack of etiquette! -- Meatloaf