I have a space with bouncing balls, and when i drag mouse I want a line to be drawn in it so that balls start bouncing from it as well.
- I can draw a line consisting of small circles, and add their inside area together, and if a ball intersects this area change direction. This works. The problem is that circles don't produce solid line (as mouseDragged events are fired too rarely), but if I use Line2D instead, it doesn't enclose any area.
- In every mouse dragged event I can interpolate data between startPoint and endPoint and draw a circle at obtained x,y. It works, but everything freezes terribly
- I can check if ball's covering rectangle contains certain color (and if so, change direction), but again how should it be done -- checking every pixel doesn't seem efficient at all?
Is there a way/best way to deal with it?