# [metapost] turningnumber revisited

laurent at math.toronto.edu laurent at math.toronto.edu
Fri Jul 8 05:18:30 CEST 2011


Hi all,

In discussing turning number of a cyclic
piecewise bezier cubic path I deviated slightly from
the standard notations for a bezier path. So I begin
today with some clarification. My notation
\b(A,B,C,D) where A,B,C,D are points of R^2, names the
bezier path [0,1] --> R^2 that maps t to

(1-t)^3 A + 3t(1-t)^2) B + 3t^2 (1-t) C + t^3 D

(see section 4.1 of the current MP manual).  Given any
u \in R, we will occasionally also denote by
\b(A,B,C,D) the the natural composed map
[u,u+1] ---> [0,1] --> R^2 of which the first is
x |--> x - u and the second is the above displayed
formula.

The "Casteljau polygon" \c(A,B,C,D) is the
piecewise linear path from A to D with 4 vertices
A,B,C,D and the 3 oriented affine linear edges [A,B],
[B,C], [C,D]. The Casteljau construction (see the MF
book) draws the bezier cubic point-by-point using no
more than interval bisection. More importantly, the
geometry of the Casteljau polygon \c(A,B,C,D) often
dictates the shape and properties of \b(A,B,C,D).  For
example,

--- if \c(A,B,C,D) is convex (i.e. lies in the
frontier of its convex hull) then \b(A,B,C,D) is
convex too.

--- if [B,C] is parallel to [A,D] and
[C-B] = 1/3 |A-D| then \b(A,B,C,D) is quadratic bezier
path :

t |--> (1-t)^2 A  +  2t(1-t) E  + t^2 D

where E is the intersection of the lines respectively
containing [A,B] and [C,D] --- as a direct computation
confirms.

I will soon give a mathematical (but not yet
practical) calculation of turning number for:

Class \C++ of cyclic piecewise bezier cubic paths

p := p_1 & p_2 & ... & p_n,  n integer \geq 1 ,

mapping [0,n] ---> R^2 and locally topologically
immersive.

Today I give just a sketch.

I am not at all sure that turning number can be
usefully defined beyond this class \C++. So I will, in
compensation, indicate how to test a cyclic piecewise
bezier cubic path for non-membership in \C++. Roughly
speaking, for p not in \C++, there exists at least one
"folding time", near which p "backtracks" on its image.
In the interior of the parameter interval [i,i+1] of
any p_i this can occur, but at most once or twice ---
and only when the image p_i([i,i+1]) is a line interval
in R^2. It can also occur for time an integer i. But
not at other times.

If, on the other hand, p is in \C++, a geometric
and local calculation of winding number succeeds; it
can be viewed as similar to the calculation for paths
in \C+ where the turning angles at corners are added to
a "total curvature" term. For p \in \C++ \supset \C+,
in addition to corners, there are "thorn" singularities
where one must add a turning angle of either +180 degrees
or -180 degrees. There are two sorts of thorn; the
first is a unique cusp of a bezier segment p_i at a
time interior to [i,i+1]; the second is geometrically
more varied and occurs at some of the integer times. It
is not difficult to decide geometrically between +180
and -180. The coincidence of the resulting turning
number of p with the very general and "hopelessly
infinite" topological definition of turning number is
verified by observing some regular homotopies. It is
this coincidence that assures nice behavior of turning
number, in particular invariance under rotations.

That's the plan for a mathematical calculation of
turning number of paths in \C++. Details will