# [metapost] turning number revisited

Boguslaw Jackowski jacko at bop.com.pl
Fri Jul 1 11:12:00 CEST 2011

```Hi,

Dan:
> Larry's construction of the differentiated path added
> line segments corresponding to those places where the derivative
> is discontinuous. For this example the differentiated path becomes
>
>   (B-A)--(C-B)--(D-C)--(A-D)--cycle.
>
> For a general
>
>   p = <cubic> & <cubic> & ...
>
> one would get (in general)
>
>
> And the winding number of p' around (0,0)
> is the turningnumber of p.

Thank you for your patience in explaining --
I was right, I must have been "blind or silly". :)
Now I re-read Larry's proposal and everything
seems (mathematically) clear to me.

Two questions:

1. Is anybody able to say for certain that Larry's
approach is not essentially different from Knuth's
approach implemented in MF, as Dan suggests and I'm
inclined to share his opinion?

2. Larry, how do you want to handle the cases
Here, I believe, one cannot just ignore them as you did
(and I followed your idea) in the algorithm for computing
winding number. Since you aim at the _replacement_
(or a compatible alternative) of the turning number
implementation, more subtle approach is needed.

[Let's recall an important Dan's remark: "In complex analysis, a curve
can usefully be defined to have a winding number around any point through
which it passes smoothly: the average of the values on either side. Of
course, if this definition is chosen, then winding number is also
discontinuous (and now undefined at a cusp--or at least ambiguous)."]

As Dan pointed out, the examples (given by me) of "whimsically
behaving" curves
(0,0)..{up}(1,1) & (1,1){down} .. (2,0) -- cycle
(0,0)..{up}(1,1) & (1,1){down} .. (0,1/2) -- cycle
are invalid. The curves are nasty, indeed, but in MF (with
autorounding set to 0) their turning number is stably 2 and 1,
respectively (not so, however, in MP).

This shows that Knuth handles weird cases consistently.
And, as was emphasized many times in this thread, this
is crucial if one thinks about a replacement/alternative
for the turning number implementation.

Cheers -- Jacko

--
BOP s. c.
ul. Bora-Komorowskiego 24, 80-377 Gdansk, Poland
tel. (+48 58) 553 46 59,  fax (+48 58) 511 03 81
bop at bop.com.pl, http://www.bop.com.pl
```