• Post Reply Bookmark Topic Watch Topic
  • New Topic

movement according to Path2D  RSS feed

 
Igor Pechkin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,

I've been struggling with this task for a while now. I have a curve line as Path2D shape and have to move a ball by that line.
Unfortunately I wasn't able to find the solution of how to do it properly.

I thought of one thing but think that a bit retardedsub-optimal - get the starting point of the curve than check nearby pixels
whether the path intersects it and if it does - move the ball to this one pixel.

Thanks!
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You might find this thread moved to our GUIs forum. Using adjacent pixels risks the ball moving backwards and forwards one pixel at a time forever.
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:You might find this thread moved to our GUIs forum.

Indeedy.
 
Stanislav Lapitsky
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try tse FlatteningPathIterator to get the points.

Regards,
Stas
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!