# [metapost] Re: workaround for turningnumber bug

Giuseppe Bilotta gip.bilotta at iol.it
Thu Feb 3 02:18:50 CET 2005

```Wednesday, February 2, 2005 Taco Hoekwater wrote:

> Giuseppe Bilotta wrote:
>> Sunday, January 30, 2005 Taco Hoekwater wrote:
>>
>> What exactly is the turning number of a path? If you tell me,
>> I might try to work something out.

> Straight from the MF-book:

>   "The turning number of a [cyclic] path is defined to be \$t\$
>    if the compass heading [of a car driving along the path]
>    changes by exactly \$t\$ times 360 degrees when the path is
>    traversed [once]"

> Hope it helps,

Hm. If there are no inflections (i.e. if all the beziers in the
cubic have the same clockwise/counterclockwise orientation)
this should be equal to the number of points where the
direction of the curve is parallel (and with the same verse) as
the direction at the first point of the first curve, right?

This should be easy. Iterate over all the path components,
solving for

postcontrol(g[i](t))-precontrol(g[i](t)) == direction(p0)

(second-degree, easy to solve, could probably give explicit
formula at different hour), count the solutions, subtract one
(for the solution p0) and that's it?

How do we cope with inflections, though?

--
Giuseppe "Oblomov" Bilotta

```