Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!Apple.COM!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Line selection algorithims.. Message-ID: <5835@internal.Apple.COM> Date: 18 Dec 89 21:18:01 GMT Sender: usenet@Apple.COM Organization: Objects-R-Us, Apple Computer, Inc. Lines: 26 References:<8912160053.AA00720@cadman.nyu.edu> <1989Dec17.104221.23095@santra.uucp> In article <1989Dec17.104221.23095@santra.uucp> jmunkki@kampi.hut.fi (Juri Munkki) writes: > grafport with a single pixel (or many pixels, if your pointer should > not be with single pixel resolution). Then draw all objects with a > black penpat. > > You have to draw the objects from front to back. I also recommend that You can draw the shapes back to front (the way you would draw them on the screen) and select the last one that touched the pixel. The advantage of this algorithm is that is works for any shape regardless of how complex it is. If you need to compute the distance to the shape then you need a different formula for lines, ovals, etc. > This algorithm is surprisingly fast. I guess QuickDraw clips so well I implemented this in a MacApp graphics building block, and it works very well. Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1