diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-04-15 20:34:40 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-04-15 20:34:40 +0200 |
commit | b155eafa1e2d73692eed08ecabeb5ad589ac11dc (patch) | |
tree | ec352f240efa570d5e06db368ce3dd99e792545a /metapost/context/base/mpxl/mp-tool.mpxl | |
parent | 1e69816bbbeebedafd52684fc4182ce977d92a8a (diff) | |
download | context-b155eafa1e2d73692eed08ecabeb5ad589ac11dc.tar.gz |
2022-04-15 20:15:00
Diffstat (limited to 'metapost/context/base/mpxl/mp-tool.mpxl')
-rw-r--r-- | metapost/context/base/mpxl/mp-tool.mpxl | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/metapost/context/base/mpxl/mp-tool.mpxl b/metapost/context/base/mpxl/mp-tool.mpxl index d99439c5b..749f3d657 100644 --- a/metapost/context/base/mpxl/mp-tool.mpxl +++ b/metapost/context/base/mpxl/mp-tool.mpxl @@ -3932,15 +3932,30 @@ permanent hatched ; numeric mfun_dash_on, mfun_dash_off ; +% primarydef p withdashes len = +% hide ( +% save l, t, n, m ; pair t ; +% l := arclength p ; +% t := paired(len) ; +% m := xpart t + ypart t ; +% n := l / (l div m) / m ; +% mfun_dash_on := n * xpart t ; +% mfun_dash_off := n * ypart t ; +% ) +% p dashed dashpattern (on mfun_dash_on off mfun_dash_off) +% enddef ; + primarydef p withdashes len = hide ( - save l, t, n, m ; pair t ; + save l, t, n, m, don, doff; pair t ; l := arclength p ; - t := paired(len) ; + t := paired (len) ; m := xpart t + ypart t ; - n := l / (l div m) / m ; - mfun_dash_on := n * xpart t ; - mfun_dash_off := n * ypart t ; + n := (l if not cycle p : - xpart t fi) div m ; + (n if not cycle p : + 1 fi) * don + n * doff = l ; + don*(ypart t) = doff*(xpart t) ; + mfun_dash_on := don ; + mfun_dash_off := doff ; ) p dashed dashpattern (on mfun_dash_on off mfun_dash_off) enddef ; @@ -3952,6 +3967,10 @@ permanent withdashes ; path mfun_b ; pair mfun_k ; +tertiarydef p sortedintersectiontimes q = + sortedpath (p intersectiontimeslist q) +enddef ; + tertiarydef p intersectionpath q = begingroup ; save mfun_b ; path mfun_b ; mfun_b := sortedpath (p intersectiontimeslist q) ; |