lilypond-user
[Top][All Lists]

## Re: Graphic lines create

 From: karl Subject: Re: Graphic lines create Date: Tue, 5 Nov 2019 23:02:17 +0100 (CET)

```Karl:
> Reggie:
> > Karl Hammar wrote
...
> > > zz = \markup\postscript "0 1 360 5 mul { cos 0.01 mul 0.002 add .01 exch
> > > rlineto } for stroke"
> > >
> > > \relative c'' {
> > >   c4^\zz c c c |
> > >   c c c c |
> > > }
...
> > Karl this looks outstanding but I don't understand how the code works. Is
> > there a manual page for curves postscript code? Can you tell how you arrived
> > at the code? I'm totally unable to see anything.
...
>  Introduction to postscript:
> https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
>
>  Reference:
> (https://www-cdf.fnal.gov/offline/PostScript/PLRM2.pdf)
> https://www-cdf.fnal.gov/offline/PostScript/PLRM3.pdf
...

I you have downloaded theese, you can get an intro in the blue book,
and look up the operators in the ref.manual, ch.8.

This:
0 1 360 5 mul { cos 0.01 mul 0.002 add .01 exch rlineto } for stroke

draws the function:
y = 0.01 * sin(t) + 0.002 * t
x = 0.01 * t
for t = 0 to 360*5, in steps of 1 (i.e. t = 0, 1, 2, ... 1800)

360 5 mul
give us 360*5 = 1800

cos(t)
is the cosinus of the angle t in degrees, so t = 0 to 360*5
means from 0Â° to five whole turns
but since "rlineto" adds incrementally, the curve looks like the
integral of cos (i.e. sin)

a b c { ... } for
do the ... for the values a, a+b, a+2*b, ..., as long as the value <= c

Regards,
/Karl Hammar

```