[metapost] Re: workaround for turningnumber bug

Taco Hoekwater taco at elvenkind.com
Sun Jan 30 15:47:56 CET 2005

Larry Siebenmann wrote:
> Taco writes:
>  > It looks like the inaccuracies introduced by calculating
>  > envelopes are the real culprits. That is to say:  JDH hints
>  > in his explanations that "turningnumber" is actaully using the
>  > envelope routines instead of the path itself.
> Mysterious. The winding number of the envellope of a penstroke
> along a cycle may in general differ from the winding number 
> of the cycle, and may depend on pencircle diameter.  
> Maybe for finite but small diameter a useful winding 
> number results??? 

It generally seems to operate well enough (and it has the
added advantage of using only a small bit of code).

Making the test_pen smaller would solve some of the reported
bugs, you think? The used pen is a triangle:


But if you (or anyone else) knows of a good algorithm to calculate
the turning number directly from the path nodes, I'd be more than
happy to implement that. It doesn't have to be fast, but it has
to cover all of the possible weird stuff like cusps and opposing
control points ...

Greetings, Taco

More information about the metapost mailing list