Matching Cubic Bézier to match Cubic Polynomial

165 Views Asked by At

I have a series of cubic polynomials that are being used to create a trajectory. Where some constraints can be applied to each polynomial, such that these 4 parameters are satisfied. -Initial Position -final Position -Initial Velocity -final Velocity

The polynomials are pieced together such that the ends of one polynomial are identical to the beginnings of the next to preserve continuity.

I instead want to represent these polynomials as cubic Bézier curves.

How would I find the x,y position of each control point for the cubic Bézier curves, such that it matches the curvature of the cubic polynomial.

Here is what I have so far, made in desmos.

https://www.desmos.com/calculator/agsywptfno

Currently the bezier curve is defined as a binomial, with a polynomial for X and or Y e.g. Bezier = (X(t), Y(t))

2

There are 2 best solutions below

1
On

First control point = initial position (obviously).

Second control point = initial position plus 1/3 of initial velocity.

Third control point = final position minus 1/3 of final velocity.

Fourth control point = final position (obviously).

0
On

Where P1 P2 P3 P4 are the control points V0 and Vf are initial and final velocities at points P1 and P4 P2.x = (P4.x - P1.x)/3 P2.y = (P1.y + V0*(P4.x - P1.x)/3 P3.x = (P4.x-P1.x) - (P4.x - P1.x)/3 P3.y = P4.x - Vf*((P4.x-P1.x) - (P4.x - P1.x)/3)/2

Here is the link if you're a visual person like me. The dotted orange lines are always 1/3 of the way to the next point or previous point.