We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › mouseovers on a bezier
Page Index Toggle Pages: 1
mouseovers on a bezier (Read 431 times)
mouseovers on a bezier
Apr 21st, 2009, 3:52pm
 
Hello! I'm very new to programming but I'm hitting a wall and wondering how to mouseover a bezier curve? Do I have to make an array with each x and each y in the curve and then do a for loop that checks to see whether or not the mouse is on each point? Is there an easier way? Thanks!

Re: mouseovers on a bezier
Reply #1 - Apr 21st, 2009, 5:01pm
 
Oh and yeah. How the heck do I get all of the points in a bezier into an array? I mean, is that business accessible at all? thanks!
Re: mouseovers on a bezier
Reply #2 - Apr 21st, 2009, 11:25pm
 
Somebody asked the question a while ago and I searched a solution. That's not that easy if you need to be efficient.
Storing the x, y coordinates isn't possible, you have an infinity of coordinates, and it is hard to do if you map to pixels...
bezierPoint() might be useful anyway.
Re: mouseovers on a bezier
Reply #3 - Apr 22nd, 2009, 3:06am
 
get x y
where you use the mouse coördinates, if they have the color of the beziercurve then you know you hit it with your mouse.

If this give's a problem because more things have the same color then you meight be able to draw first the beziercurve and immeiatly after that check the x-y before drawning other things.
Re: mouseovers on a bezier
Reply #4 - Apr 22nd, 2009, 5:34pm
 
Thanks! I will try checking the pixel color (although there are a few hundred beziers all of the same color so I may have to change the colors or just scrap that functionality for now). On the other hand, that bezierpoint is great and solves another problem I was having (making the beziers thin on one end and thick at the other).

Thanks!!!
Page Index Toggle Pages: 1