From: Taco Hoekwater via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Taco Hoekwater <taco@bittext.nl>
Subject: Re: update old MP code
Date: Thu, 1 Sep 2022 15:40:32 +0200 [thread overview]
Message-ID: <43EF1253-41CC-418F-A6F9-40764B7D05C3@bittext.nl> (raw)
In-Reply-To: <48e6855a-0888-d823-43a3-5d3a4757bf86@fiee.net>
Hi Hraban,
Adding grouping makes sense:
>
> def Moire(expr size)(text densities)=
begingroup
> save dn,a,b,k,labit,n,p,q,s,xs;
> n := 32;
> dn := 0;
> for i := densities:
> d[incr dn] := abs(i);
> if i>1: labit[dn]:=1; fi
> endfor
> a := min(d[1],d[dn]);
> b := max(d[1],d[dn]);
> image(
> for i=-n upto n:
> draw (0,i*in/a)--(size,i*in/b);
> %withpen pencircle scaled 3/5defaultthickness;
> endfor
> for i=1 upto dn:
> k:=(a/d[i]-1)/(a/b-1);
> if known labit[i]:
> string s; s:=decimal(d[i]); xs:=0;
> picture p,q; q := p := depthless(s);
> if i=dn:
> q := depthless(s & " lpi");
> xs := width(q)-width(p);
> fi
> label.top(q, (k*size+1/2xs, n*in/a+1.5mm));
> fi
> draw (k*size, n*in/a+1.5mm)--(k*size, k[n*in/a,n*in/b]+.5mm);
> draw (k*size, -n*in/a-1.5mm)--(k*size, -k[n*in/a,n*in/b]-.5mm);
> endfor
> )
endgroup
> enddef;
> draw Moire(57.5mm)(200, 175, 150, 125, 100, 75);
> % ulshiftedto (142mm, 38.5mm);
> \stopreusableMPgraphic
As that at least makes it an expression instead of a statement list.
But also depthless() is never defined?
—
Taco Hoekwater E: taco@bittext.nl
genderfluid (all pronouns)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2022-09-01 13:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 7:29 Henning Hraban Ramm via ntg-context
2022-09-01 13:40 ` Taco Hoekwater via ntg-context [this message]
2022-09-01 16:28 ` Henning Hraban Ramm via ntg-context
2022-09-01 16:45 ` Taco Hoekwater via ntg-context
2022-09-01 16:48 ` Henning Hraban Ramm via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43EF1253-41CC-418F-A6F9-40764B7D05C3@bittext.nl \
--to=ntg-context@ntg.nl \
--cc=taco@bittext.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).