Am Freitag, den 21.10.2011, 01:14 +0200 schrieb Paul Menzel:
Dear ConTeXt/MetaFun folks,
looking at the example for grid and functions in the MetaFun manual [1] section 9.3
drawoptions(withpen pencircle scaled .25pt withcolor .5white) ; draw hlingrid(0, 20, .2, 20cm, 10cm) ; draw vloggrid(0, 10, .5, 10cm, 20cm) ; drawoptions(withpen pencircle scaled .50pt) ; draw hlingrid(0, 20, 1, 20cm, 10cm) ; draw vloggrid(0, 10, 1, 10cm, 20cm) ;
fmt_pictures := false ; % use TeX as formatting engine textextoffset := ExHeight ; % a variable set by ConTeXt draw hlintext.lft(0, 20, 5, 20cm, "@3e") ; draw vlogtext.bot(0, 10, 9, 10cm, "@3e") ;
draw function(1,"log(x)","x",1,10,1) xyscaled (10cm,2cm) withpen pencircle scaled 5mm withcolor transparent(1,.5,yellow) ;
I am confused how the resulting function is scaled correctly. The resulting dimensions seem to be 10cm and 18 cm. So I guess the 2 cm mean to shift it up some how.
Could someone please explain to me how `xyscaled` works in this case please. I though `xyscaled (αcm, ζcm)` would set the object/path to a width of α cm and a height of ζ cm.
Looking up the definition of the macro `xyscaled` it is indeed just a short version of `xscaled αcm yscaled ζcm`. $ more mp-tool.mp […] %D More robust: % let normalscaled = scaled ; % let normalxscaled = xscaled ; % let normalyscaled = yscaled ; % % def scaled expr s = normalscaled (s) enddef ; % def xscaled expr s = normalxscaled (s) enddef ; % def yscaled expr s = normalyscaled (s) enddef ; %D Shorter primarydef p xyscaled q = begingroup ; save qq ; pair qq ; qq = paired(q) ; ( p if xpart qq<>0 : xscaled (xpart qq) fi if ypart qq<>0 : yscaled (ypart qq) fi ) endgroup enddef ; […] I am still confused though what happens in the above example scaling the path of the function. Trying \starttext \startMPcode draw fullsquare xscaled 10cm yscaled 2cm; \stopMPcode \stoptext the resulting rectangle has the dimensions of 10 cm width and 2 cm height but the path of the function above does not. Thanks, Paul