1 Jul 2011 05:57

### Re: turning number revisited

At 06:54 AM 6/30/2011, you wrote:

>I believe I'm blind or silly or I completely mistunderstand you both
>(Dan and Larry) -- I cannot see the (simple) relation between cubic
>and its derivative quadratic ... Assume, for example, that we have
>a square ABCD, and that its sides are approximated by "canonical"
>cubic splines (represented in MF/MP by the "--" operator), which,
>in this case, are just linear functions:
>   A + (B-A)*t     for t in [0,1]
>   B + (C-B)*(t-1) for t in [1,2]
>   C + (D-C)*(t-2) for t in [2,3]
>   D + (A-D)*(t-3) for t in [3,4]
>Therefore, its derivative is:
>   B-A  for t in (0,1) (observe that the intervals now are open)
>   C-B  for t in (1,2)
>   D-C  for t in (2,3)
>   A-D  for t in (3,4)
>so, the derivative of the original curve is constant
>over the interior of the intervals and undefined at
>their ends...

But 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> & ...


1 Jul 2011 08:18

### Re: turningnumber revisited


Hi Jacko, and others

Supoporting Dan, Jacko has presented the following
example where "subpath" and "intersectiontimes"
together conspire to overlook a genuine intersection
point of two bezier paths.

>... Thu, 30 Jun 2011 08:00:32 +0200
>...
> path p,q,r;
> p:=(0,0){up}..{down}(100,0); % just an arc
> q:=subpath (2/5,3/5) of p;
> r:=subpath (3/5,4/5) of p;
> show q intersectiontimes r;
> show point 1 of q;
> show point 0 of r;
> end.
>

>> This is METAFONT, Version 2.718281
>>  [...]
>> (-1,-1)
>> (64.8003,47.99994)
>> (64.80087,47.99976) )

I am duly alarmed. Same result for MP in versions < 1!

Is it not a MF/MP bug for MF/MP to accept two rather


1 Jul 2011 11:12

### Re: turning number revisited


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


1 Jul 2011 11:24

### Re: turning number revisited


Jacko:
> This shows that Knuth handles weird cases consistently.

So, why the MF algorithm was not compatibly transferred
(by John D. Hobby, I guess) to MP? Does anybody know?
What's so difficult in transferring MF turningnumber
procedure to MP? (I don't suggest that it must be easy,
just curious; as I mentioned, I've never understood
the sources in detail.)

Cheers -- Jacko

--

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Bogus\l{}aw Jackowski: B_Jackowski <at> GUST.ORG.PL
----------------------------------------------------------------
Hofstadter's Law: It always takes longer than you expect, even
when you take into account Hofstadter's Law.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

--
http://tug.org/metapost/


2 Jul 2011 04:26

### Re: turningnumber revisited


Hi all,

Jacko writes <Date: Fri, 1 Jul 2011 11:24:03 +0200 (CEST)>

> So, why the MF algorithm was not compatibly transferred
> (by John D. Hobby, I guess) to MP? Does anybody know?
> What's so difficult in transferring MF turningnumber
> procedure to MP? (I don't suggest that it must be easy,
> just curious; as I mentioned, I've never understood
> the sources in detail.)

My hasty reading in Knuth's "The Metafont Book" makes
me think that for turning number and quite a few
other things Knuth makes essential use of bitmaps.
If so, there was no plausible vectorial algorithm

<< The whole story is here in case you're curious. >>

Well, perhaps if one includes the Metafont program's
source and the book "Metafont the Program".

And, in any case, Knuth describes the MF book as a tissue of
lies designed to convey truth and understanding :)

Another important quote from the MF book's introduction:



7 Jul 2011 07:17

### Re: turningnumber revisited


Hi All,

From the conceptial viewpoint of pure
mathematics, the calculation of the turning number of
a cyclic piecewise bezier path p : [0,n] ---> R^2
that happens to be locally topologically immersive
seems now to me to be a fairly simple matter.  This
very roughly means that if MP had instant and
infinite precision floating point calculation
abilities I would be ready to program a turning
number calculation.  Today I'll make just a tiny step
towards justifying this optimism.

Practical calculation of turning number in
today's MF/MP etc will be much more complex because
of instabilities and inaccuracies in MP practice
(that I probably do not yet fully understand!).
SO I WILL NOT PROGRESS ON PRACTICAL CALCULATION UNTIL
THE SIMPLER MATHEMATICAL DISCUSSION IS COMPLETE.

Recall the class \C of cyclic bezier paths of 05
June, namely those p : [0,n] --> R^2, p(0) = p(n),
such that for i = 1, ..., n the restricted path:

p_i := p|_{[i-1,i]} : [i-1,i] --> R^2

is a bezier path enjoying the properties:

(a) p_i is nondegenerate in the sense that the


7 Jul 2011 19:44

### CMYK colours in SVG output

Hi,

the following code uses a CMYK colour while generating SVG output.
MetaPost seems to be nice and silently convert that into an RGB colour.

outputformat := "svg";
beginfig(1);
draw fullcircle withcmykcolor (.1,.2,.3,.4);
endfig;
end

To be honest, I'd expect MetaPost to error out on colouring objects with
colours from a colour model that isn't supported by the output format.
Isn't such use-case better be dealt with at the macro level than on the
engine level, i.e., by providing a macro that does the conversion?
Implicit conversion seems wrong to me.  Are the conversion rules
documented somewhere?  Can they be configured by the user?

Best regards,
Stephan Hennig
--
http://tug.org/metapost/


7 Jul 2011 20:53

### mpost 1.504?

Hi, Taco and all metaposters,

using mp 1.504 I got the following strange announcement:

This is MetaPost, version 1.504 (kpathsea version 6.0.0)  7 JUL
2011 09:22
**\nonstopmode; input pum2
(mpost.mp (d:/TeXlive/texmf-dist/metapost/base/plain.mp
(./pum2.mp
(d:/TeXlive/texmf-local/metapost/osy.mp){pdftex.map}{curr.map
! Emergency stop.
l.26 fontmapfile "+curr.map";

buffer overflow: (1025,1024) at file
../../../source/texk/web2c/mplibdir/psout.
w, line 1194

Do not understand at all, but mp 1.212 compiles the file without
any objection.

Karel Horak
--
http://tug.org/metapost/


7 Jul 2011 23:21

### Re: turningnumber revisited

On Thu, 7 Jul 2011, laurent <at> math.toronto.edu wrote:

>      A key example of bezier path that may appear as
> segment of  a  p \in \C+ and not in \C is:
>
>  \b(A,B,C,D) with Casteljau polygon
>
>             A=B --- C
>                      \
>                       \
>                        D
>
> The derivative vector at the point A=B is zero but
> the direction vector there is the non-null direction
>  (C-A) / |C-A|  .
>
>      The good news of today is that the turning
> number calculation algorithm I gave for \C on Tue, 28
> Jun 2011 02:40:50 -0400 (EDT) obviously applies to
> \C+.
>
>      Unfortunately, instabilities of turning number
> occur in \C+.  For example, the point A=B of the above
> example is a cusp of its maximally extended cubic
> path, and that path can devellop a loop under
> perturbation. Thus *practical* problems for winding
> number calculations remain for paths in \C+.

Can't one be happy that points A=B are _identical_ as any kind of
transform will give at least the same new A'=B' position also


8 Jul 2011 00:01

### defaultcolormodel

Hi,

I'm wondering what the meaning of variable defaultcolormodel is.  The
manual is rather terse (p.28):

The â€˜current defaultâ€™ color model can be set up using the internal
variable defaultcolormodel.  Table 2 lists the valid values.

Well, variable defaultcolormodel determines the colour space of the
black ink that is used for drawing and filling strokes, i.e., whether 0,
(0,0,0) or (0,0,0,1) is written into the output.  Is there anything else
that is affected by defaultcolormodel?

Best regards,
Stephan Hennig
--
http://tug.org/metapost/



Gmane