[NTG-context] metafun 2

Hans Hagen j.hagen at xs4all.nl
Wed Aug 14 16:49:05 CEST 2019


On 8/14/2019 4:22 PM, Otared Kavian wrote:
> Hi Hans,
> 
> Thank you very much for the new features! I haven't yet read all the mag-1104-mkiv.pdf where you explain some of them, but after modifying one of your examples, I noticed that some funtions get a strange graph, which is probably due to the fact that metafun2 is interpolating between points in a way which is not correct.
> For instance, in the following example (which is a slight modification of yours), the curve drawn is not a graph, in the sense that for some values of x it seems to be two or more values of y.
> 
> How does metafun 2 traces the curve between two discretization points?

it doesn't, it just connects the dots, so, just use a smaller step, like

xstep = .01

(The upcoming luagraph module will provide some interpolators so at some 
point we can hook these in.)

(btw, there are a lot of extra math functions, also or complex numbers)

> Best regards: OK
> 
> %%% begin draw-2.tex
> 
> \starttext
> \startMPcode{doublefun}
> draw lmt_function [
> 	xmin =  1.0, xmax = 2.5066283, xstep = .1,
> 	ymin = -2, ymax =  2,
> %	xticks = "bottom", xsmall = 80, xlarge = 20,
> %	yticks = "left", ysmall = 40, ylarge = 4,
> 	code = "1.5 * math.sin(2*x^2)",
> 	xlabels = "yes",
> 	ylabels = "yes",
> 	ycaption = "\strut\tfd \rotate[rotation=90]{vertical}",
> 	xcaption = "\strut\tfd horizontal",
> 	pointsymbol = "dot", pointsize = 4, pointcolor = "orange",
> 	sx = 2mm, sy = 4mm, linewidth = .025mm, offset = .1mm,
> 	]
> 	xsized 8cm ;
> \stopMPcode
> 
> \stoptext
> 
> %%% end draw-2.tex

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list