Hi, On Sun, May 12, 2024 at 6:24 PM Fabrice Couvreur < fabrice1.couvr...@gmail.com> wrote: > > With Okular, it works !
Very good. You can still try the thing below: \startluacode local exp = math.exp local N = 1000 local xstep = 1.6/N local ystep = 1.8/N local xmin = 0.3 local ymin = 0.4 local function f(x,y) local x = xstep*x - xmin local y = ystep*y - ymin local z = x + exp(-60*x) - y if z > 0 then return '1' else return '0' end end potrace.setbitmap("mybitmap", potrace.contourplot(N,N,f)) \stopluacode \startMPpage[offset=1dk] path p ; p := lmt_potraced [ stringname = "mybitmap", value = "1", tolerance = 0.1, threshold = 0.2, optimize = true, ] ; p := p xsized 10cm ; draw p withpen pencircle scaled 5 withcolor "darkblue" ; drawpoints p withcolor "orange" ; drawpointlabels p ; p := subpath(6,19) of p ; draw p withpen pencircle scaled 3 withcolor "yellow" ; \stopMPpage Another thing, Hans added nocycle, so you can write your loop if you want to use it as something like def compute_curve(suffix f)(expr xmin, xmax, xinc) = for x=xmin step xinc until xmax: (x,f(x)) .. endfor nocycle ; enddef; Then you do not need to think about the first and/or last point separately.
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________