Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!rex!wuarchive!waikato.ac.nz!comp.vuw.ac.nz!actrix!templar!jbickers From: jbickers@templar.actrix.gen.nz (John Bickers) Newsgroups: comp.sys.amiga.programmer Subject: Re: Clicking on irregular shapes? Message-ID: <1757.tnews@templar.actrix.gen.nz> Date: 29 Mar 91 20:58:34 GMT References: <1991Mar27.212214.6204@orfeo.radig.de> <2710@sirius.ucs.adelaide.edu.au> <20181@cbmvax.commodore.com> <1991Mar29.022042.14110@leland.Stanford.EDU> Organization: TAP, NZAmigaUG. Lines: 22 Quoted from <1991Mar29.022042.14110@leland.Stanford.EDU> by mmaston@leland.Stanford.EDU (Michael Maston): > object on the screen has been chosen by a mouse-click. Now this is pretty > straightforward for boxes, lines, circles and even ellipses, but how does > one do this with say an object drawn with a freehand tool? I have experimented One approach is to determine if the point is within a polygon or not. First check the point against the extent of the polygon, and if it's in, then count how many edges of the polygon a line from the point to one edge of the screen intersects. Odd and it's inside, even and it's outside. > Anyway, are there good references on this type of algorithm that the great There's comp.graphics. I think the above approach is in the FAQ posting there. The FAQ also contains a list of references for various things. > Michael Maston -- *** John Bickers, TAP, NZAmigaUG. jbickers@templar.actrix.gen.nz *** *** "Patterns multiplying, re-direct our view" - Devo. ***