2
$\begingroup$

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?

$\endgroup$

1 Answer 1

5
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ Awesome, thanks. Exactly what I needed. $\endgroup$
    – berry120
    Commented Mar 4, 2013 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .