Thanks, everyone. Plenty of ideas here. Lazy me: I was angling for some written & tested code. But at least I know I won't be wasting my time reinventing the wheel.
The "polygon" can't be assumed convex. In fact, since I'd like to accommodate the most general shape, I'm going with either a binary pixel mask (the crudest, easiest solution) or detecting the underlying pixel color upon mouseclick. On Fri, May 11, 2012 at 5:41 PM, Ian Clark <earthspo...@gmail.com> wrote: > To save me reinventing the wheel, has anybody written routines to act > on mouseclicks inside irregularly-shaped "buttons"? > > Techniques I'm considering: > > ++ Detecting if a point is inside an arbitrary polygon > > ++ Unions and differences of rectangles, triangles and sectors > > ++ Color of the pixel under the cursor > > If it works on a simple map of the USA, it'll probably work for my purpose. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm