From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/111348 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: Fwd: Fuzzy lines Date: Wed, 12 May 2021 16:21:12 -0500 Message-ID: References: <5CD0C6B2-D23C-45A4-A04F-B0809EBBF501@fiee.net> <092986D0-2072-4907-9B86-B54D0FC3D690@fiee.net> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3194525800627422108==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3308"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed May 12 23:22:01 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgwIp-0000f5-JQ for gctc-ntg-context-518@m.gmane-mx.org; Wed, 12 May 2021 23:21:59 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7DE9F28377B; Wed, 12 May 2021 23:21:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gE7v6HBtdt29; Wed, 12 May 2021 23:21:30 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CA30028376C; Wed, 12 May 2021 23:21:30 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3C741283768 for ; Wed, 12 May 2021 23:21:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hXRzFgTxntah for ; Wed, 12 May 2021 23:21:25 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.52; helo=mail-wm1-f52.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 8AF8028370B for ; Wed, 12 May 2021 23:21:25 +0200 (CEST) Original-Received: by mail-wm1-f52.google.com with SMTP id s5-20020a7bc0c50000b0290147d0c21c51so3720019wmh.4 for ; Wed, 12 May 2021 14:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6EBEGOXS2N7wjgBdZ6HY3wpRSpk9b4cnt9D5XrlQ8Ks=; b=AIsqiMKs8rhCGdDvjQGN89RQiWJb8iwP7jEYaOfVU+BUA6n2gFriXC7SeHNH3LZn07 O/U9ETUIh1CRyu2KplPYjkz7O4QcKrtnUYWzWGsVxQn30sJgmGqbTChe1dDxFTDIOYED KmMrK9hiQjl7TS9D1lIUMnUegCzHgRtarukC/9twqDGAn3/W09/brFx3+VLMuwIyPoai nJ4SZ0UN5hi2XDKL6oLuUXMyZEOebl1ml/KtNUZslFbaXvE3FvUGvdc8ROnrQwLQgeAq fX9bwMF0+Dffwf7h7c0nWqIjiNXu4/v9hVOzwNc1nn/0c2HNM+D+wiZf5UXHBp5XlcpR s6LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6EBEGOXS2N7wjgBdZ6HY3wpRSpk9b4cnt9D5XrlQ8Ks=; b=Pv3gb8aby10R9b3icObmaGPMHlwAJdc/SsgOXb4cpyXFAtdM1keBy1ZWQtEB22XJqu Q7BlTziB3VuavDDZGVCgRDyQyq8hhM4wbxRjCjCLgleC6zWw3w8N5nmaBD2yENRIFiSj 2D47ia1PlaJ1NMW2KQuNDOkIIJv466g2C1/cN1zSGXrSwMpSYFWX0vQ8l4XzVlnIs5oW oRc6VnwBeRz4Hjo5XZCIyYFhqWUuUy5v1N2jEA9LTcF0K6Tr/QDk+ca1rVnt3Akz7AQT IXz8TlW6sowH7ifITKgZNrt7zDOMHK0MEX/1bEtLPdZ/clYEXOYcYzlIjQmV40o+wZOE 7JQQ== X-Gm-Message-State: AOAM533a3pf4rHQaXgUizz4RAX3zIq32q+SaoOlKFSZFEsAP7WlgEabT UgFxJbPo3s1Lhmp94Majh+ZM867UTWmWmP3Us/uP+lvC1Dc= X-Google-Smtp-Source: ABdhPJywBE01jXRBB1hjTGHCxc63/Fg2RovPHeGruVXGOcGEMj5guU4IPpiCkYAByjon/HF774APyVaXvQ7hPBjxP6E= X-Received: by 2002:a1c:c206:: with SMTP id s6mr445437wmf.47.1620854484827; Wed, 12 May 2021 14:21:24 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:111348 Archived-At: --===============3194525800627422108== Content-Type: multipart/alternative; boundary="000000000000cd020905c22897c2" --000000000000cd020905c22897c2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ---------- Forwarded message --------- De: Jairo A. del Rio Date: mi=C3=A9, 12 de may. de 2021 a la(s) 14:08 Subject: Re: [NTG-context] Fuzzy lines To: mailing list for ConTeXt users El mi=C3=A9, 12 de may. de 2021 a la(s) 13:03, Henning Hraban Ramm ( texml@fiee.net) escribi=C3=B3: > Hi Jairo, > > thank you for the suggestion. > > > Am 11.05.2021 um 14:56 schrieb Jairo A. del Rio >: > > > > For simple pens, you may define your own (section 9.7 of MetaPost > manual). > > Unfortunately, pens don=E2=80=99t work as patterns but only as outlines. > > > For complicated strokes, something along these lines could be useful as > a starting point (I'm not taking cyclic paths in consideration, btw). I d= id > something similar with duck footprints some weeks ago: > > > > %Sorry for the ugly code... > > \starttext > > \startMPpage > > %Unit size > > numeric u; u :=3D 1mm; > > > > %In a picture you are able to include everything, kinda > > picture Pluma; > > Pluma :=3D image( > > for i =3D 1 upto 5: > > for j =3D 1 upto 5: > > draw (i,j) randomized 1; > > endfor > > endfor > > ); > > Unfortunately, that=E2=80=99s the same pattern over and over. > The randomization is only applied once. > Good for footprints, bad for fuzzy patterns. > You only need to move "randomized" at the drawing stage: \starttext \startMPpage numeric u; u :=3D 1mm; picture Pluma; Pluma :=3D image( for i =3D 1 upto 5: for j =3D 1 upto 5: draw (i,j); endfor endfor ); path Camino; Camino :=3D origin for i =3D 1 upto 30: .. (u*i, u*sind (12i mod 360)) endf= or; for i =3D 0 step 1/2 until length Camino: draw Pluma randomized 1 rotated (90 + angle direction i of Camino) shifted point i of Camino; endfor \stopMPpage \stoptext But "randomized" will deform paths. Maybe you want something like this? \starttext \startMPpage[align=3D] begingroup; save Rnd; let Rnd =3D uniformdeviate; numeric u; u :=3D 3mm; picture Pluma; Pluma :=3D image( for i =3D 1 upto 5: for j =3D 1 upto 5: fill fullcircle shifted (i,j); %try fulltriangle or another shape endfor endfor ); path Camino; Camino :=3D origin for i =3D 1 upto 30: .. u*i*left endfor; for i =3D 0 step 1/2 until length Camino: draw image( for x within Pluma: fill pathpart x %Assuming our image only contains cyclic paths scaled (1+Rnd 1) shifted (1/2dir Rnd 360) withcolor hsvtorgb(6round(Rnd 60),9/10,1); %Colors just because they look cute endfor ) rotated (90 + angle direction i of Camino) shifted point i of Camino; endfor endgroup; \stopMPpage \stoptext > %Simple curve > > path Camino; > > Camino :=3D origin for i =3D 1 upto 30: .. (u*i, u*sind (12i mod 360)) > endfor; > > > > %Strokes > > for i =3D 0 step 1/2 until length Camino: > > draw Pluma rotated (90 + angle direction i of Camino) > > shifted point i of Camino; > > endfor > > Since I have more or less straight lines but of different length, the "on= e > pattern per 1/n path segment" doesn=E2=80=99t work for me. I could try to= construct > my paths differently. > You only need to use fractions, i.e., "for 0 step 1/n until 1: ... endfor" if you work with straight lines defined using only two points. In the example above I made one from more than two points just for ease of manipulation. With examples and feedback from the mailing list, you might define your own function using the new Metafun interface for LMTX. > > Hraban > > > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ > > Jairo --000000000000cd020905c22897c2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


---------- Forwarded message ---------
De: Jairo A. del Rio <<= a href=3D"mailto:jairoadelrio6@gmail.com">jairoadelrio6@gmail.com>
Date: mi=C3=A9, 12 de may. de 2021 a la(s) 14:08
Subject: Re: [= NTG-context] Fuzzy lines
To: mailing list for ConTeXt users <ntg-context@ntg.nl>


=


=
El mi=C3=A9, 12 de may. de 2021 a la(= s) 13:03, Henning Hraban Ramm (texml@fiee.net) escribi=C3=B3:
Hi Jairo,

thank you for the suggestion.

> Am 11.05.2021 um 14:56 schrieb Jairo A. del Rio <jairoadelrio6@gmail.com>:=
>
> For simple pens, you may define your own (section 9.7 of MetaPost manu= al).

Unfortunately, pens don=E2=80=99t work as patterns but only as outlines.
> For complicated strokes, something along these lines could be useful a= s a starting point (I'm not taking cyclic paths in consideration, btw).= I did something similar with duck footprints some weeks ago:
>
> %Sorry for the ugly code...
> \starttext
> \startMPpage
> %Unit size
> numeric u; u :=3D 1mm;
>
> %In a picture you are able to include everything, kinda
> picture Pluma;
> Pluma :=3D image(
>=C2=A0 =C2=A0 =C2=A0 =C2=A0for i =3D 1 upto 5:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for j =3D 1 upto= 5:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0draw (i,j) randomized 1;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0endfor
>=C2=A0 =C2=A0 =C2=A0 =C2=A0endfor
> );

Unfortunately, that=E2=80=99s the same pattern over and over.
The randomization is only applied once.
Good for footprints, bad for fuzzy patterns.

You only need to move "randomized" at the drawing stage:

\starttext

\startMPpage

numeric u; u := =3D 1mm;

picture Pluma;=

Pluma :=3D ima= ge(

for i =3D 1 u= pto 5:

for j =3D 1 = upto 5:

draw (i,j);=

endfor

endfor

);

path Camino;

Camino :=3D or= igin for i =3D 1 upto 30: .. (u*i, u*sind (12i mod 360)) endfor;

for i =3D 0 st= ep 1/2 until length Camino:

draw Pluma ra= ndomized 1 rotated (90 + angle direction i of Camino)

shifted poin= t i of Camino;

endfor

\stopMPpage

\stoptext

<= br>
But "randomized" will deform paths. Maybe you want = something like this?

\starttext

\startMPpage[a= lign=3D]

begingroup;

save Rnd; let = Rnd =3D uniformdeviate;


numeric u; u := =3D 3mm;

picture Pluma;=

Pluma :=3D ima= ge(

for i =3D 1 u= pto 5:

for j =3D 1 = upto 5:

fill fullci= rcle shifted (i,j); %try fulltriangle or another shape

endfor

endfor

);

path Camino;

Camino :=3D or= igin for i =3D 1 upto 30: .. u*i*left endfor;

for i =3D 0 st= ep 1/2 until length Camino:

draw image(

for x within = Pluma:

fill pathpar= t x %Assuming our image only contains cyclic paths

scaled (1+Rn= d 1)

shifted (1/2= dir Rnd 360)

withcolor hs= vtorgb(6round(Rnd 60),9/10,1); %Colors just because they look cute

endfor

) rotated (90= + angle direction i of Camino)

shifted point= i of Camino;

endfor

endgroup;

\stopMPpage

\stoptext

<= /div>

> %Simple curve
> path Camino;
> Camino :=3D origin for i =3D 1 upto 30: .. (u*i, u*sind (12i mod 360))= endfor;
>
> %Strokes
> for i =3D 0 step 1/2 until length Camino:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0draw Pluma rotated (90 + angle direction i o= f Camino)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0shifted point i = of Camino;
> endfor

Since I have more or less straight lines but of different length, the "= ;one pattern per 1/n path segment" doesn=E2=80=99t work for me. I coul= d try to construct my paths differently.

You only need to use fractions, i.e., "for 0 step 1/n until 1: ... e= ndfor" if you work with straight lines defined using only two points. = In the example above I made one from more than two points just for ease of = manipulation. With examples and feedback from the mailing list, you might d= efine your own function using the new Metafun interface for LMTX.
=
=C2=A0

Hraban

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________

Jairo
--000000000000cd020905c22897c2-- --===============3194525800627422108== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3194525800627422108==--