# One Dimensional Cubic Bezier Curve

### Click and drag control points to change curve.

For more information, check out the post on my blog: Bezier Curves.

Cubic bezier curves have 4 control points and total up the values of the 4 functions below to get the final point at time t.

- A * (1-t)^3
- B * 3t(1-t)^2
- C * 3t^2(1-t)
- D * t^3

Parameters:

**t** - "time", but in our case we are going to use the x axis value for t.

**A** - The first control point, which is also the value of the function when x = 0.

**B** - The second control point.

**C** - The third control point.

**D** - The fourth control point, which is also the value of the function when x = 1.

In this particular case, A, B and C are scalars, which makes the curve into the function:

y = A * (1-x)^3 + B * 3x(1-x)^2 + C * 3x^2(1-x) + D * x^3

Indefinite Integral:

y = A*(-x^4/4+x^3-(3 x^2)/2+x) + B*((3 x^4)/4-2 x^3+(3 x^2)/2) + C*(x^3-(3 x^4)/4) + D*(x^4/4) + constant

Note that this bezier curve is 1 dimensional because A,B,C,D are 1 dimensional, but you could use these same equations in any dimension. Also,
these control points range from 0 to 1 on the X axis, but you could scale the X axis and/or the Y axis to get a different range of values.