Path following

edited August 2015 in How To...

For my project I need two things: 1) to create a Bézier curve (or any curve, for that matter) 2) for a ball to follow that curve

My initial plan was to draw an ellipse with the center in the ball and find the intersection between this ellipse and the curve (which I will have two, as the radius of the ellipse will be just outside that of the ball). However, then it dawned on me that even though I can DRAW a curve - I don't have its explicit function, so I won't be able to find any intersection at all.

What if it is not a curve - but some optional path drawn by the user? I won't be able to calculate its function easily as well.

What might be the standard procedure? Creating waypoints and approximating any path to a set of lines?

Answers

  • Answer ✓

    Creating waypoints and approximating any path to a set of lines?

    That would be one way to do. An alternative would be to convert the waypoints to a Bezier spline. This discussion might help there.

  • Thanks, I will start with the simpler linearizing option, and at the same time read about the splines.

  • Answer ✓

    However, then it dawned on me that even though I can DRAW a curve - I don't have its explicit function

    there's a method for that: https://processing.org/reference/bezierPoint_.html

Sign In or Register to comment.