FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   irregular polygon button: how?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: irregular polygon button: how?  (Read 688 times)
lunetta

7200475272004752 WWW Email
irregular polygon button: how?
« on: May 26th, 2004, 7:06pm »

Hello all beloved community
 
I'm scratching my brain to figure this out;
 
all button examples on "learning" section are rects or circles; the mouse detection is based on the rectangular or circular area of the polygon.
 
What if I have a irregular polygon, that's not either rectangular or circular?  
 
simple HTML allows me to create irregular polygon image maps, for example. How can I achieve them in an intelligent way using processing?
 
justo


Re: irregular polygon button: how?
« Reply #1 on: May 26th, 2004, 7:57pm »

depending on how "pure processing" you want to be, you could always use the Java class java.awt.Polygon's contains(x, y) method.
 
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Polygon.html
 
alternately, if you want to write it yourself:
http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/
 
lunetta

7200475272004752 WWW Email
Re: irregular polygon button: how?
« Reply #2 on: May 26th, 2004, 8:16pm »

hehehe Paul Bourke, no matter what I do I always end up on his site...
 
Thanks for the response, I'll take a look at it!
 
Pages: 1 

« Previous topic | Next topic »