summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpiv/mp-mlib.mpiv26
-rw-r--r--metapost/context/base/mpiv/mp-tres.mpiv63
2 files changed, 63 insertions, 26 deletions
diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv
index be061a71f..48fcbd8c9 100644
--- a/metapost/context/base/mpiv/mp-mlib.mpiv
+++ b/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -1159,11 +1159,7 @@ vardef mfun_do_outline_text_f (expr n, x, y) (text t) =
mfun_do_outline_n := 0 ;
for i=t :
mfun_do_outline_n := mfun_do_outline_n + 1 ;
- if mfun_do_outline_n = n :
- fill i shifted(x,y) mfun_do_outline_options_f withpen pencircle scaled 0
- else :
- nofill i shifted(x,y)
- fi ;
+ if mfun_do_outline_n = n : fill else : nofill fi (i shifted(x,y)) mfun_do_outline_options_f withpen pencircle scaled 0 ;
endfor ;
enddef ;
@@ -1171,11 +1167,7 @@ vardef mfun_do_outline_text_u (expr n, x, y) (text t) =
mfun_do_outline_n := 0 ;
for i=t :
mfun_do_outline_n := mfun_do_outline_n + 1 ;
- if mfun_do_outline_n = n :
- fillup i shifted(x,y) mfun_do_outline_options_f
- else :
- nofill i shifted(x,y)
- fi ;
+ if mfun_do_outline_n = n : fillup else : nofill fi (i shifted(x,y)) mfun_do_outline_options_f ;
endfor ;
enddef ;
@@ -1195,11 +1187,7 @@ vardef mfun_do_outline_text_b (expr n, x, y) (text t) =
mfun_do_outline_n := 0 ;
for i=t :
mfun_do_outline_n := mfun_do_outline_n + 1 ;
- if mfun_do_outline_n = n :
- fill i shifted(x,y) mfun_do_outline_options_f
- else :
- nofill i shifted(x,y)
- fi ;
+ if mfun_do_outline_n = n : fill else : nofill fi (i shifted(x,y)) mfun_do_outline_options_f ;
endfor ;
for i=t :
draw i shifted(x,y) mfun_do_outline_options_d ;
@@ -1213,11 +1201,7 @@ vardef mfun_do_outline_text_r (expr n, x, y) (text t) =
endfor ;
for i=t :
mfun_do_outline_n := mfun_do_outline_n + 1 ;
- if mfun_do_outline_n = n :
- fill i shifted(x,y) mfun_do_outline_options_f
- else :
- nofill i shifted(x,y)
- fi ;
+ if mfun_do_outline_n = n : fill else : nofill fi (i shifted(x,y)) mfun_do_outline_options_f ;
endfor ;
enddef ;
@@ -1225,7 +1209,7 @@ vardef mfun_do_outline_text_n (expr n, x, y) (text t) =
mfun_do_outline_n := 0 ;
for i=t :
mfun_do_outline_n := mfun_do_outline_n + 1 ;
- if mfun_do_outline_n = n : fill else : nofill fi i shifted(x,y) ;
+ if mfun_do_outline_n = n : fill else : nofill fi (i shifted(x,y)) ;
endfor ;
enddef ;
diff --git a/metapost/context/base/mpiv/mp-tres.mpiv b/metapost/context/base/mpiv/mp-tres.mpiv
index 335670a98..c331d71af 100644
--- a/metapost/context/base/mpiv/mp-tres.mpiv
+++ b/metapost/context/base/mpiv/mp-tres.mpiv
@@ -96,14 +96,14 @@ primarydef p XYZscaled q =
(q*Xpart p,q*Ypart p,q*Zpart p)
enddef ;
-vardef projection expr t =
- if triplet t :
+vardef projection primary t =
+ (if triplet t :
(Xpart t, Ypart t) transformed Txy shifted (0,Zpart t)
- elseif pair t :
+ elseif pair t :
t transformed Txy
- else :
+ else :
origin transformed Txy
- fi
+ fi)
enddef ;
%D This overloads the plain macro \type {abs} (being \type {length}):
@@ -166,6 +166,59 @@ vardef draw_vector@# (expr v, s) text t =
fi
enddef ;
+%D Transform a (2D) path to a 3D plane
+
+def XYpath primary p =
+ (for i=0 upto (length p) if cycle p: -1 fi :
+ if i>0 : .. fi
+ projection (xpart point i of p,
+ ypart point i of p,
+ 0)
+ ..controls
+ projection (xpart postcontrol i of p,
+ ypart postcontrol i of p,
+ 0)
+ and
+ projection (xpart precontrol (i+1) of p,
+ ypart precontrol (i+1) of p,
+ 0)
+ endfor if cycle p: ..cycle fi)
+enddef ;
+
+def XZpath primary p =
+ (for i=0 upto (length p) if cycle p: -1 fi :
+ if i>0 : .. fi
+ projection (xpart point i of p,
+ 0,
+ ypart point i of p)
+ ..controls
+ projection (xpart postcontrol i of p,
+ 0,
+ ypart postcontrol i of p)
+ and
+ projection (xpart precontrol (i+1) of p,
+ 0,
+ ypart precontrol (i+1) of p)
+ endfor if cycle p: ..cycle fi)
+enddef ;
+
+def YZpath primary p =
+ (for i=0 upto (length p) if cycle p: -1 fi :
+ if i>0 : .. fi
+ projection (0,
+ xpart point i of p,
+ ypart point i of p)
+ ..controls
+ projection (0,
+ xpart postcontrol i of p,
+ ypart postcontrol i of p)
+ and
+ projection (0,
+ xpart precontrol (i+1) of p,
+ ypart precontrol (i+1) of p)
+ endfor if cycle p: ..cycle fi)
+enddef ;
+
%D Some constants...
triplet Origin, Xunitvector, Yunitvector, Zunitvector ;