From: Hans Hagen <j.hagen@xs4all.nl>
To: Otared Kavian <otared@gmail.com>, ntg-context@ntg.nl
Subject: Re: Colors in lmt_surface and luametafun
Date: Fri, 17 Apr 2020 15:59:44 +0200 [thread overview]
Message-ID: <efe5bc2f-53aa-2d3e-3bab-b5bf332385a0@xs4all.nl> (raw)
In-Reply-To: <AD831264-03BB-4D3D-8DAC-3A6879ACDBC8@gmail.com>
On 4/17/2020 3:33 PM, Otared Kavian wrote:
> Hi Hans,
>
> On page 36 of luametafun.pdf there is the following example of using lmt_surface:
>
> \startMPcode{doublefun}
> draw lmt_surface [
> preamble = "local sin, cos = math.sin, math.cos",
> code = "sin(x*x) - cos(y*y)",
> color = "f, f/2, 1-f",
> color = "f, f, 0",
> xstep = .02,
> ystep = .02,
> xvector = {-0.4, -0.4},
> height = 10cm,
> lines = true,
> ] xsized .TextWidth ;
> \stopMPcode
>
> What is the meaning of « f » in « color = "f, f/5, 1-f" »?
> Is it possible to specify other colors and how can it be done?
f = fraction
you can write some function yourself
\starttext
\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color = "f, f, 0",
xstep = .02,
ystep = .02,
xvector = {-0.4, -0.4},
height = 5cm,
lines = true,
] ysized (TextHeight/4) ;
\stopMPcode
\startluacode
function MyColor(f) return f/2, f/3, .5 end
\stopluacode
\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color = "MyColor(f)",
xstep = .02,
ystep = .02,
xvector = {-0.4, -0.4},
height = 5cm,
lines = true,
] ysized (TextHeight/4) ;
\stopMPcode
\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos " &
"function MyColor(f) return 0, f/3, .5 end",
code = "sin(x*x) - cos(y*y)",
color = "MyColor(f)",
xstep = .02,
ystep = .02,
xvector = {-0.4, -0.4},
height = 5cm,
lines = true,
] ysized (TextHeight/4) ;
\stopMPcode
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
prev parent reply other threads:[~2020-04-17 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 13:33 Otared Kavian
2020-04-17 13:59 ` Hans Hagen [this message]
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=efe5bc2f-53aa-2d3e-3bab-b5bf332385a0@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
--cc=otared@gmail.com \
/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).