summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-07-02 16:09:16 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-07-02 16:09:16 +0200
commit847821faaecf92833f1e1564e1ef9377758d4d45 (patch)
tree7a033668d823e231478c055daeb47c4582883059 /metapost
parent052a096e160508ddbbbfcbf1522eb8ddbfc3b1cd (diff)
downloadcontext-847821faaecf92833f1e1564e1ef9377758d4d45.tar.gz
2018-07-02 14:46:00
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv24
1 files changed, 23 insertions, 1 deletions
diff --git a/metapost/context/base/mpiv/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index d025848ca..bebe4c0ad 100644
--- a/metapost/context/base/mpiv/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -171,6 +171,28 @@ vardef positionatanchor(expr name) =
currentpicture := currentpicture shifted - positionxy(name) ;
enddef ;
-
vardef texvar(expr name) = lua.mp.texvar(name) enddef ;
vardef texstr(expr name) = lua.mp.texstr(name) enddef ;
+
+%D New experimental feature for Alan-The-Number-Cruncher:
+
+% \startMPcode{doublefun}
+% path p ; p := (
+% for i=1 upto 20000 :
+% origin randomized 10000 ..
+% endfor cycle
+% ) xysized (TextWidth,TextHeight) ;
+% draw for i inpath p:
+% pointof i .. controls (leftof i) and (rightof i) ..
+% endfor cycle ;
+% \stopMPcode
+
+def inpath suffix p =
+ = 1 step 1 until lua.mp.mfun_path_length(str p)
+enddef ;
+
+vardef pointof primary i = lua.mp.mfun_path_point(i) enddef ;
+vardef leftof primary i = lua.mp.mfun_path_left (i) enddef ;
+vardef rightof primary i = lua.mp.mfun_path_right(i) enddef ;
+
+extra_endfig := extra_endfig & " lua.mp.mfun_path_reset() ; " ;