Re: metapost spiral

Taco Hoekwater <[email protected]>
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Hi Hraban,

> On 30 Mar 2026, at 12:52, Hraban Ramm <[email protected]> wrote:
> 
> Hi,
> in https://tug.ctan.org/info/drawing-with-metapost/Drawing-with-Metapost.pdf
> I found this code to draw a spiral:
> path S;
> S = origin
> for t=1 upto 90:
> .. 1/12 t * dir 16t
> endfor;
> draw S;
> I understand it starts at origin and adds a number of points – but where are the points (pairs)?

Paths are built using pairs, not “points". And directions happen to be pairs (a unit vector). That is all there is to it.

> There’s a number (distance?) and a direction (angle?). Could you explain this in layman’s terms?
> If I try a different starting point than origin, the spiral still is drawn around origin. I'd like to add it to another path and also randomize the points a bit to make it look hand-drawn.

You can treat the “1/12 t * dir 16t” as a computed point, so just shift and/or modify it in place, e.g.

> .. (1/12 t * dir 16t) shifted (100,0)


Best wishes,
Taco


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.