Cocos2D Bezier curve around object as if by gravity Cocos2D Bezier curve around object as if by gravity objective-c objective-c

Cocos2D Bezier curve around object as if by gravity


The trajectory would be a conic section (line, hyperbola, parabola, ellipse or circle).

You can represent those as a rational Bezier curve.http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB-conics.htmland http://www.cs.unc.edu/~dm/UNC/COMP236/papers/farin.pdf.

If you insist on using quadratic Bezier sections, I would use a function like thishttp://www.netlib.org/minpack/lmder.f to find optimal positions of control pointsby least-squares minimization.

I think it would be easiest if you just calculate the conic sections and draw them as line loops.

Or you implement a verlet integrator and solve the equations of motions.