summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpxl/mp-tool.mpxl
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context/base/mpxl/mp-tool.mpxl')
-rw-r--r--metapost/context/base/mpxl/mp-tool.mpxl31
1 files changed, 31 insertions, 0 deletions
diff --git a/metapost/context/base/mpxl/mp-tool.mpxl b/metapost/context/base/mpxl/mp-tool.mpxl
index 28d1bbf3e..d99439c5b 100644
--- a/metapost/context/base/mpxl/mp-tool.mpxl
+++ b/metapost/context/base/mpxl/mp-tool.mpxl
@@ -3946,3 +3946,34 @@ primarydef p withdashes len =
enddef ;
permanent withdashes ;
+
+%D For Mikael:
+
+path mfun_b ;
+pair mfun_k ;
+
+tertiarydef p intersectionpath q =
+ begingroup ;
+ save mfun_b ; path mfun_b ; mfun_b := sortedpath (p intersectiontimeslist q) ;
+ save mfun_k ; pair mfun_k ; mfun_k := point 0 of mfun_b;
+ .5[point xpart mfun_k of p, point ypart mfun_k of q]
+ for i = 1 upto length(mfun_b) :
+ hide(mfun_k := point i of mfun_b;)
+ -- .5[point xpart mfun_k of p, point ypart mfun_k of q]
+ endfor
+ endgroup
+enddef ;
+
+tertiarydef p firstintersectionpath q =
+ begingroup ;
+ save mfun_b ; path mfun_b ; mfun_b := sortedpath (p intersectiontimeslist q) ;
+ point xpart (point 0 of mfun_b) of p
+ for i = 1 upto length(mfun_b) :
+ -- point xpart (point i of mfun_b) of p
+ endfor
+ endgroup
+enddef ;
+
+tertiarydef p secondintersectionpath q =
+ q firstintersectionpath p
+enddef;