0

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

Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131

1 Answers1

-1

When trying to do what you described, I found the following class very useful to base my code on:

http://cs.fit.edu/~ryan/java/programs/2d/Curve-java.html

Good Luck!

ltalhouarne
  • 4,586
  • 2
  • 22
  • 31