Cubic Bezier Curves - Calculate Y for any given X

5k Views Asked by At

Possible Duplicate:
Is there an explicit form for cubic Bézier curves?

I want to calculate Y for any given X of a bezier to help me chart a graph.

X represents time and Y represents distance from an object.

I got this formula for cubic beziers:

$$X(t) = (1-t)^3 X_0 + 3(1-t)^2 t X_1 + 3(1-t) t^2 X_2 + t^3 X_3$$

$$Y(t) = (1-t)^3 Y_0 + 3(1-t)^2 t Y_1 + 3(1-t) t^2 Y_2 + t^3 Y_3$$

I need to know what $t$ is for $X$ to I can work out what $Y$ would be for $t$... right?

So I need to rearrange this formula with $t$ on the left, I think:

$$X(t) = (1-t)^3 X_0 + 3(1-t)^2 t X_1 + 3(1-t) t^2 X_2 + t^3 X_3$$

Ummmm... is this right?

1

There are 1 best solutions below

3
On

One way to graph $Y$ in terms of $X$ would be to choose { X0, X1, X2, X3 } so that $X( t ) = t$, so you can choose the control points { 0, 1/3, 2/3, 1 }.