summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-10-17 21:24:04 +0000
committerKarl Berry <karl@freefriends.org>2016-10-17 21:24:04 +0000
commit194bd35605c2da5ae9f60db1eae3c76992a4d92b (patch)
tree05a7a8272a0ac61fcf3873b93143e9c14e74f871 /Master/texmf-dist/metapost
parented5e43ddff288abda4c9a13ab8727e0783260667 (diff)
repere (17oct16)
git-svn-id: svn://tug.org/texlive/trunk@42293 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/repere/repere.mp46
1 files changed, 43 insertions, 3 deletions
diff --git a/Master/texmf-dist/metapost/repere/repere.mp b/Master/texmf-dist/metapost/repere/repere.mp
index 2b6d86e5b8b..3027bdac026 100644
--- a/Master/texmf-dist/metapost/repere/repere.mp
+++ b/Master/texmf-dist/metapost/repere/repere.mp
@@ -2,7 +2,7 @@
%% repere.mp %%
%% Macros pour la construction de figures dans un repère %%
%% o.peault@openmailbox.org %%
-%% Version 16.06 (Juin 2016) %%
+%% Version 16.10 (Octobre 2016) %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This work may be distributed and/or modified under the conditions of
@@ -169,6 +169,37 @@ def init_traces =
enddef;
enddef;
+def traces_orig =
+ def fill expr c = addto currentpicture contour c _op_ enddef;
+ def draw expr p =
+ addto currentpicture
+ if picture p:
+ also p
+ else:
+ doublepath p withpen currentpen
+ fi
+ _op_
+ enddef;
+ vardef thelabel@#(expr s,z) = % Position s near z
+ save p; picture p;
+ if picture s: p=s
+ else: p = s infont defaultfont scaled defaultscale
+ fi;
+ p shifted (z + labeloffset*laboff@# -
+ (labxf@#*lrcorner p + labyf@#*ulcorner p
+ + (1-labxf@#-labyf@#)*llcorner p
+ )
+ )
+ enddef;
+ vardef bbox primary p =
+ llcorner p-(bboxmargin,bboxmargin) -- lrcorner p+(bboxmargin,-bboxmargin)
+ -- urcorner p+(bboxmargin,bboxmargin) -- ulcorner p+(-bboxmargin,bboxmargin)-- cycle
+ enddef;
+ def drawarrow expr p = _apth:=p; _finarr enddef;
+ def drawdblarrow expr p = _apth:=p; _findarr enddef;
+
+enddef;
+
def _finarr text t =
olddraw _apth t;
filldraw arrowhead _apth t
@@ -211,6 +242,7 @@ def fin =
if _nbaxes=1: olddraw _axorlab fi;
if coupe: clip currentpicture to (cadre transformed _T) fi;
if bf: oldendfig; bf:=false;_nfig:=_nfig+1 fi;
+ traces_orig;
enddef;
def _defcadre=
@@ -806,7 +838,7 @@ vardef axexpart@#(text t)=
if numeric _i:
if var: if str @#="": draw _etiqx_.bot(tmp,taillegrad,tmp) else: draw _etiqx_@#(tmp,taillegrad,tmp) fi fi;
if boolgradxpart:
- draw graduationx(_i) withpen pencircle scaled 0.8bp
+ olddraw graduationx(_i) withpen pencircle scaled 0.8bp
fi;
tmp:=_i;
var:=true
@@ -829,7 +861,7 @@ vardef axeypart@#(text t)=
for _i=t:
if numeric _i:
if var: if str @#="": draw _etiqy_.lft(tmp,taillegrad,tmp) else: draw _etiqy_@#(tmp,taillegrad,tmp) fi fi;
- draw ((taillegrad,0)--(-taillegrad,0)) shifted _cart(xO,_i) withpen pencircle scaled 0.8bp;
+ olddraw ((taillegrad,0)--(-taillegrad,0)) shifted _cart(xO,_i) withpen pencircle scaled 0.8bp;
tmp:=_i;
var:=true
else:
@@ -1820,6 +1852,14 @@ vardef polygoneregulier(expr A,B,n)=
poly transformed inverse _T
enddef;
+vardef sommetpolygoneregulier(expr A,B,n,i)=
+ save $,centre;
+ pair $,centre;
+ _cart(B)-centre = (_cart(A)-centre) rotated (360/n);
+ $= _cart(A) rotatedaround(centre,((i-1)*360)/n);
+ $ transformed inverse _T
+enddef;
+
vardef equilateral(expr A,B)=
polygoneregulier(A,B,3)
enddef;