Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!spool.mu.edu!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: Clicking on irregular shapes? Message-ID: Date: 5 Apr 91 19:09:01 GMT References: <1991Mar27.212214.6204@orfeo.radig.de> <2710@sirius.ucs.adelaide.edu.au> <20181@cbmvax.commodore.com> <1991Mar29.022042.14110@leland.Stanford.EDU> <1757.tnews@templar.actrix.gen.nz> <2151@pdxgate.UUCP> <1991Ap umueller@iiic.ethz.ch (Urban Dominik Mueller) writes: >There have already been many answers to this question, but none of them >complete. > >The basic solution has been mentioned: Draw an imaginary line from the point >the user clicked on to a point in nowhereland, far away in any case. A hori- >zontal line would be best. Now count the number of times this line would >intersect with edges of the polygon. If that number is even, you're outside, >otherwise you're inside. >But that's not all of it. Assume your imaginary line passes exactly through I think the best solution is to simply have a grainy bitmap of the object and just compare the coordinate against the grainy bitmap (e.g. a 16x16 bitmap = 32 bytes) (for this case) > Urban Mueller, umueller@iiic.ethz.ch -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA