Colors in lmt_surface and luametafun
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? Thanks for your attention: Otared
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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Otared Kavian