Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!sdcsvax!ucsdhub!jack!crash!pnet01!haitex From: haitex@pnet01.cts.com (Wade Bickel) Newsgroups: comp.sys.amiga Subject: Re: Window Clipping Message-ID: <2439@crash.cts.com> Date: 29 Jan 88 01:36:11 GMT Sender: news@crash.cts.com Organization: People-Net [pnet01], El Cajon CA Lines: 46 bmacintyre@watsol.waterloo.edu (Blair MacIntyre) writes: > >I have recently started a three-d fly-down-the-tunnel type game ( for >the fun of it ). As anyone who has ever done three-d anything knows, >this requires a lot of line clipping after the three to two-d >transformation. I was under the impression that the layers library >would handle this, but ... > when I get line that go very far off screen, the line drawing routines >behave very strangly ( I first thought it was the program, but when >I wrote my own clipping routine, everything started working ). >The strange behaviour was as follows: > - draw a line from point a to point b, both onscreen. ok. > - draw a line from point c to point b, with point c far of to the > lower left of the screen ( ie. large +y, large -x ). > - the line drawn: > - does not connect with point b. It connects corrently in the > x direction, but they values are off. > - is not even a line. The result is a jagged series of vertical and > sloped connected line segments. > >Anyone seen anything like this? Is the layers library supposed to handle >this offscreen clipping? Or, if I have to continue to clip myself, does >anyone have a very efficient clipping algorithm? > >Help!! If you are calculatating perspectives, I recently posted an article to comp.sys.graphics on this topic. Basically, I recommend that you do your own clipping. First clip in z before translating from 3-D to 2-D. Then translate to 2-d, and then clip in x and y. X and y clipping tends to be a special case which can be optimized according to needs. I tryed using the Layers Lib, but it seemed to do more of some things and not enough of others for my needs. Thanks, Wade. UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex ARPA: crash!pnet01!haitex@nosc.mil INET: haitex@pnet01.CTS.COM