[NTG-context] metafun 2

Otared Kavian otared at gmail.com
Wed Aug 14 16:22:41 CEST 2019


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?

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: draw-2.pdf
Type: application/pdf
Size: 6106 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190814/5e45a775/attachment-0001.pdf>
-------------- next part --------------


> On 14 Aug 2019, at 11:54, Hans Hagen <j.hagen at xs4all.nl> wrote:
> 
> Hi,
> 
> In the process of providing an additional (more abstract) interface to some of the old and also new MetaFun code we wonder what kind of features users would like to see.
> 
> http://www.pragma-ade.com/general/magazines/mag-1104-mkiv.pdf
> 
> As a teaser I uploaded a MyWay document that shows some of what is coming. All is experimental but it shows the direction. We're talking ConTeXt LMTX here. For instance,
> 
>    draw lmt_outline [
>        content       = "hello",
>        kind          = "reverse",
>        fillcolor     = "darkred",
>        drawcolor     = "darkblue",
>        rulethickness = 1/2,
>    ] ysized h shifted (3.75h,-1.25h) ;
> 
> Wraps all the outline drawing in one macro with a set of options (there will be xml interface definitions for that). Or take:
> 
>    draw lmt_followtext [
>        content = "How well does it work {\bf 1}! ",
>        path    = (fullcircle scaled 4cm),
>        trace   = true,
>        spread  = true,
>    ] ysized 5cm ;
> 
> which is an easier interface to text along a curve. Arrows can be drawn with
> 
>    draw lmt_arrow [
>        kind        = "draw",
>        location    = "middle",
>        alternative = "curved",
>        path        = fullcircle
>            scaled  3cm
>            shifted (3.5cm,0cm),
>    ] withcolor "darkblue" ;
> 
> but of course the low level interface with its many variables for tweaking stays around. Other examples are shown in the mentioned document.
> 
> So the question is: What do you miss in metapost support? Of course it should fit within the concept, so 'artistic freehand drawings' is not something that is likely to get interfaced. We are particularly interested in educational applications, if only because ConTeXt started out that way.
> 
> 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
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at 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
> ___________________________________________________________________________________



More information about the ntg-context mailing list