I'm creating a game in Java where I need the user to be able to draw any kind of line on the screen, by holding and dragging the mouse across the screen.
The line could be any kind of curve. Total 'free form' line.
I also need to be able to detect collisions of a game-object with that line. And also, be able to 'pick apart' specific points on the line, in order to draw a vector between any two points on that line.
What would be a good way to go about doing that? Should I use a Path2D
object? Or a List
of Line2D
objects? Or a List
of Point
objects? Anything else?
Thanks