0
$\begingroup$

I do not have experience of Mathematics past a-level, so please excuse the incorrect terminology.

I am trying to better understand the fundamentals of how a cubic bezier curve works. I am going by this (parametric?) formula... (I formatted, and labelled to make my point clear)

t = time along path
r = 1-t
a = start co-ordinate
b = first handle
c = second handle
d = end co-ordinate

a * r * r * r +
b * r * r * t * 3 +
c * r * t * t * 3 +
d * t * t * t = value of x or y

As far as I understand it, the tension passes from t, to r as time passes, so that early points/handles become less influential over time, and late ones increase.

I understand that - but what I don't understand is why the value 3 is used. As far as I can see, it would work equally well with any other arbitrary value.

I expect that using another value would break the method of calculating points by tracing lines between the points at set intervals, like at t = 0.25 for example, being able to make a line between ab and bc intersecting at their respective 25% marks, and finding the point at t = 0.25 of the new line.

So, what I want to understand, is the relationship between the number 3, and the ability to calculate the points along the path in said manner.

$\endgroup$

4 Answers 4

2
$\begingroup$

The value 3 is a consequence of a different method to draw the curve, namely not by converting it to parameter form but rather by recursively refining it. That is, staring from four points $A,B,C,D$ you take successive mid points $E=\frac{A+B}2$, $F=\frac{B+C}2$, $G=\frac{C+D}2$, then midpoints of the midpoints $H=\frac{E+F}2$, $I=\frac{F+G}2$, finally $J=\frac{H+I}2$. Note that taking mid pints is a very simple operation with respect to the coordinates and may require much less precision than drawing the parametric curve.

Now the crucial point is the following: The curve determined by the four points $A,B,C,D$ is replaced by two smaller pieces of curve, the first determined by $A,E,H,J$, the other by $J,I,G,D$. Several nice properties are obeyed by this replacement so that the rough shape of the curve can be "predicted": The curve passes through end points ($A$ and $D$ of the original curve, additionally $H$ for the refined curves), the tangents there point towards $B$ resp. $C$.

Also, if the quadrangle $ABCD$ is convex, then the curve is contained inside it. Note that the refinement steps will sooner or later produce convex quadrangles and each refinement step from then on will give better and better containment estimates for the curve.

Ultimately, it is possible to calculate what the curve described by the above procedure sould look like in parametric form and it turns out that the factor 3 you observed comes into play. In effect, this is the same $3$ as in the binomial formula $(a+b)^3=a^3+3a^2b+3ab^2+b^3$. (Which means that for quadratic Bezier curves you will find a factor of $2$ and for Bezier curves of degree $4$, the numbers $4$ and $6$ will occur etc.

$\endgroup$
3
  • $\begingroup$ Well this all looks right. I don't understand it all though. As far as I can understand, what you are saying, is that the Cubic curve can be broken into quadratic curves, and the number three is there because of the level of power of the curve. So a quadratic curve has the number two, and a linear curve has the number one etc... Is that right? $\endgroup$
    – Billy Moon
    Commented Dec 18, 2012 at 10:30
  • $\begingroup$ @BillyMoon No, the cubic curve is broken into two smaller cubic curves (i.e. you get two Bezier curves with two end points and two control points each). $\endgroup$ Commented Dec 18, 2012 at 16:19
  • $\begingroup$ I think I am understanding it now. It is because there are two control points, so three lines connecting them. Therefore, the points are calculated, by iteratively connecting the connecting lines at the value of t, which happens three (<~ the magic number) times until you get a final point position. I am finding it hard to explain, but I think I am understanding now... you calculate the points on the lines connecting - EFG, then calculate the points on the new connecting lines HI and finally J. It is this threefold iteration which is the cause of the number three in the formula. Right? $\endgroup$
    – Billy Moon
    Commented Dec 18, 2012 at 16:31
1
$\begingroup$

The 3 comes from the degree of the polynomial itself. The 2 control points determine the tangent vectors at the starting and ending points. Tangent vectors are produced by derivatives and

x = a*t^3
dx/dt = 3*a*t^2
$\endgroup$
1
$\begingroup$

The "3" is called the "degree" of the curve, and there's nothing at all magical about the value 3. Bezier curves of degree 3 are the most common, but curves of higher degree are also used. Basically, you decide what degree to use by considering how many degrees of freedom you want (and how many input values you need to match). A polynomial of degree 3 has 4 coefficients, so 4 degrees of freedom. So, you can match 4 input points, or you can match 2 points and 2 tangents. If you wanted to match a higher number of inputs, you'd use a curve of higher degree.

The subdivision algorithm described in Hagen's answer works for higher degree curves, too, so that's not the reason for the "3".

$\endgroup$
1
$\begingroup$

Bézier curves essentially map each $t\in[0,1]$ to some weighted average, or convex combination, of their control points. That is, the coefficients for all control points are nonnegative and sum to $1$. Verify: $$(1-t)^3 + 3(1-t)^2t + 3(1-t)t^2 + t^3 = \left((1-t)+t\right)^3 = 1$$ If the $3$ were omitted, sums other than $1$ could result. That would break an important property of Bézier curves, namely translation invariance: If you move all control points by the same vector $u$, then all intermediate points on the curve are moved by that $u$ as well.

$\endgroup$
4
  • $\begingroup$ I initially upvoted because you are quite right, a key reason is translation invariance. But the Bezier curves do not interpolate as they don't pass through the two intermediate points. $\endgroup$
    – user65203
    Commented Oct 6, 2016 at 9:55
  • $\begingroup$ @Yves Daoust: I mean interpolation in the more general sense which is a translation-invariant way of creating subsets of the convex hull. But I see your point. $\endgroup$
    – ccorn
    Commented Oct 6, 2016 at 10:04
  • $\begingroup$ They call it approximation, instead. $\endgroup$
    – user65203
    Commented Oct 6, 2016 at 10:08
  • $\begingroup$ @Yves Daoust: Using weighted average instead. Thanks for the critique. $\endgroup$
    – ccorn
    Commented Oct 6, 2016 at 10:39

You must log in to answer this question.

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