Sep. 2004, Author: Adrian Colomitchi
The present article explores the points in which a cubic Bezier curve changes its bending direction: the inflection points. It presents the parametric equation that allows the computation of the inflection point position and the number of this inflection points, showing that there are at most 2.
Dividing a cubic Bezier in its points of inflection will result in a set of curve segments that will have an uniform bending direction: the resulted curve segments will turn either clockwise or counterclockwise, not both. Therefore, the position of the inflection points becomes important in applications where the uniformity of bending direction does matter, e.g. the approximation of cubic Bezier curves by sets of connected quadratic Bezier segments.
A special case is where, even the bending direction stays the same, a cubic Bezier displays a cusp (angle with curved sides). Even the exact conditions for a cubic Bezier to display a cusp is not investigated, this aspect is also touched by the article.
No special mathematical background is necessary to the reader, except the definition of the first and second derivatives and solving second degree equations.
The article is sustained by interactive Bezier applets: to modify the configuration of the anchor/control points, one will need just to click-n-drag them with the mouse pointer.
Inflection points - points where a curve changes the direction of bending.
Parametric curve - a curve described by expressing the position
of any and all its points as function of one parameter:
(Px, Py) = (fx(t), fy(t)).
See for example the parametric expression of a cubic or a quadratic Bezier curve in a previous article.
With this definitions, the following statement acts as the basis for this article:
X P"(t) =
P'(t) stands for the first derivative vector - (f'x(t), f'y(t))
P"(t) stands for the second derivative vector - (f"x(t), f"y(t))
X stands for the cross product
between the two vectors —
= f'x(t)•f"y(t) - f'y(t)•f"x(t)
Demonstrating of the above statement is possiblenote
1 but beyond the scope of the article. Still an intuitive justification
is still provided: anyone that went skating (skiing,
cycling or even running) should remember that, for changing the direction
of movement, one should apply a certain force in the direction
of intended turn, thus the direction of movement and the one of the applied
force should not be coincident. If the two directions are coincident, the
trajectory would be a straight line.
To change the direction of trajectory bending, one should change the direction of the applied force from one side of the movement direction to the other side. If this transition is done smoothlynote 2 , there will be a moment when the direction of movement will be colinear (aligned) with the one of the applied force . In this very moment, the trajectory will change its bending direction.
Defining a little bit more exactly the terms:
XP"(t) = f'x(t)•f"y(t) - f'y(t)•f"x(t) =
On the applet below, one can explore the behaviour of the first derivative (figured as an yellow segment) and the second derivative (figured as a magenta segment) in different points of some chosen cubic curves. Different positions on the curve may be obtained by adjusting the t parameter value using the slider below the applet:
As noted above, one should compute the solution of the
X P"(t) = f'x(t)•f"y(t) - f'y(t)•f"x(t) =
equation. For the beginning, a parametric representation for a cubic Bezier that will be more appropriate for derivation is to be obtained: what is making harder the derivation is the presence of the (1-t) terms mixed with t terms in the parametric representation previously derived. For simplifying the computation, in applying the de Casteljau algorithm it will be used the
D = E + t•(F - E)
M = A + t•(B - A) =
= P1 + 2•t•(C1 - P1) + t2•(C2 - 2•C1 + P1)
N = B + t•(C - B) =
= C1 + 2•t•(C2 - C1) + t2•(P2 - 2•C2 + C1)
3, the coordinates of the P point will be:
P = M + t•(N - M)
with the final result of:
leading to the following expressions for the first and second derivatives:
P' =3•(C1 - P1) + 6•t•(C2 - 2•C1 + P1) + 3•t2•(P2 - 3•C2 + 3•C1 - P1) and
P" = 6•(C2 - 2•C1 + P1) + 6•t•(P2 - 3•C2 + 3•C1 - P1) (3)
For simplification of calculus required for solving the P'
X P" =
equation, the following notationsnote
3 will be made:
b = C2 - 2•C1 + P1 = C2 - C1 - a (4)
c = P2 - 3•C2 + 3•C1 - P1 = P2 - C2 - a -2•b
With these notations, one may put the expression of derivatives under the form:
P' =3•(a + 2•b•t + c•t2) and
P" = 6•(b + c•t) (5)
With this, the equation (1) becomes:
(ax + 2•bx•t
+ cx•t2)•(by +
cy•t) - (ay + 2•by•t
+ cy•t2)•(bx +
After some more straight forward calculations, the equation to be solved for getting the position of the inflections points of a cubic Bezier is:
ax•by - ay•bx
+ t•(ax•cy - ay•cx)
+ t2•(bx•cy - by•cx)
Because only the inflection points that lay on
the cubic Bezier segment are to be found, any solution of the above equation
is considered only if it falls in the (
interval (excluding the interval ends). Afterwards, the correspondent position
for the inflection points (if any) can be obtained either:
Since the equation (6) is quadratic, it can have at most 2 solutions.
Thus, a cubic Bezier segment may have at most two inflection points.
The applet on the left depicts the following configurations:
1). No points of inflection - the curve keeps uniform its bending direction;
1) range. One point of inflection - the curve change the bending direction once;
1) range. Two points of inflection - the curve change the bending direction twice;
1) range - the first derivative is null in this point. A single point of inflection - the curve displays a spike/corner.
XP"(t))/|P'(t)|3 for studying the location of the inflection points . In this case, one should note that in points where the first derivative becomes null (the velocity of movement on the trajectory vanishes), the curvature is not well defined: for the general case, the curve behaviour is governed by the direction and value of its second derivative (acceleration) in this kind of points. A non-degenerated (i.e. curves with one control point that is coincident with its correspondent anchor point) cubic Bezier curve will display a cusp in this location, like in the example shown in the 4th configuration on the first applet. It should mean that, for non-degenerated cubic Bezier curves, the points where the first derivative is null are also inflection points. But this is a statement I'm not willing to demonstrate right now, nor even check its truthfulness.
Note: for the readers that don't recalls how to solve a quadratic equation, here's a hint:
the equation a + 2•b•t
+ c•t2 =
has the solutions given by
t1 = (- b - sqrt(dis))/(2*a) and
t2 = (- b + sqrt(dis))/(2*a)
The content of this site is copyrighted by Adrian Colomitchi. Please consult the copyright notice before doing anything except reading/browsing/printing pages of this site.