[metapost] turningnumber revisited
Boguslaw Jackowski
jacko at bop.com.pl
Mon Jun 27 13:03:11 CEST 2011
Luigi:
> Do you have some explicit examples of paths with strange turning numbers ?
This seems to be ever-recurring problem. :)
If anybody is able to predict the result of the following MF/MP code
run on MF and MP
path p;
if known mitered: beginfig(100); fi
p:=(0,0)..{up}(1,1) & (1,1){down} .. (2,0) -- cycle; show turningnumber p;
if known mitered: draw p scaled 100; fi
p:=(0,0)..{up}(1,1) & (1,1){down} .. (0,1/2) -- cycle; show turningnumber p;
if known mitered: draw p scaled 100 shifted (250,0); endfig; fi
end.
I will be astonished -- for the second time. For the first time, I was
astonished by the result. :)
If you check in METAFONT the turningnumber for the first path from the
example rotated by 1, 2, ... 90 degree you'll see the different values.
MP is "stable" here.
In general, I would expect troubles at cusps. Imagine that you march
and suddenly turn back: after the turn one cannot say whether your
turn axis was left or right arm.
In other words, if the curve "turns back" at a given point, the turning
angle is NOT A LOCAL property -- locally one cannot tell whether it is 180
or -180 -- the analysis of the path in the neibourhood of this point is
needed. [intuitively, in the example above, the first path turns to the
right at the top cusp, hence the angle should be -180, the second one --
turns to the left hence the angle should be +180].
And assuming that we always compute the angle modulo 180 seems
arbitrary and inadequate -- it foretells troubles, of the kind that
shows the above example.
So, I support Larry's point -- turningnumber is a discontinuous operation
on the path -- an infinitesimal (i.e., arbitrarily small) change of a path
(nodes position) may cause the change of a turningnumber.
The windingnumber for a given point yields the constant value. More
precisely, the countinuous change of a path does not change
the winding number as long as the path does not touch the given
point. I this case the result is undefined. [Note that an infinitesimal
transformation of the path cannot cause that the point lying initially
ouside a path would touch it after the transformation.]
Cheers -- Jacko
Ps. I proposed to Taco including the winding number as a basic operation
to MP and Taco kindly agreed.
--
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
More information about the metapost
mailing list