Say I have a cubic Bezier curve, with a starting point s, an ending point e and control points c1 and c2. Given t between 0-1, I want to find the equation of the subsection of the curve between 0 and t.

Is this possible without being too computationally expensive?

up vote 4 down vote accepted

Yes, it's possible. The deCasteljau algorithm divides a Bezier curve into two. If you search, you'll find lots of references.

Let me change your notation: let the points of the curve be $A$, $B$, $C$, $D$. So, $A$ is the start point (where $t=0$), $D$ is the end-point (where $t=1$), and $B$ and $C$ are the control points adjacent to $A$ and $D$ respectively.

Suppose you are given a value $t$ at which you want to split the curve. The deCasteljau algorithm tells you to do the following calculations:

$$L = (1-t)A + tB \quad ; \quad M = (1-t)B + tC \quad ; \quad N = (1-t)C + tD $$ $$P = (1-t)L + tM \quad ; \quad Q = (1-t)M + tN $$ $$R = (1-t)P + tQ$$

Then the control points of the "left" portion of the Bezier curve (the piece from $0$ to $t$) are $A$, $L$, $P$, $R$. And, if you're interested, the control points of the "right" portion of the Bezier curve (the piece from $t$ to $1$) are $R$, $Q$, $N$, $D$.

This picture is not accurate, but it might be helpful:

decasteljau

  • Awesome, thanks. Exactly what I needed. – berry120 Mar 4 '13 at 15:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.