10 def Repere(expr l,h,ox,oy,ux,uy) =
11 repLargeur := l; repHauteur := h;
12 repOX := ox ; repOY := oy;
13 repXmin := - ox / ux; repXmax := repXmin + l / ux;
14 repYmin := - oy / uy; repYmax := repYmin + h / uy;
15 repUX := ux; repUY := uy;
17 gddW := "xscaled repUX yscaled repUY shifted (repOX,repOY) scaled gddU";
21 repSavePict := currentpicture; currentpicture := nullpicture;
25 clip currentpicture to
26 ((0,0)--(repLargeur,0)--(repLargeur,repHauteur)--(0,repHauteur)--cycle)
30 def repStroke (expr c) =
31 draw ((0,0)--(repLargeur,0)--(repLargeur,repHauteur)--(0,repHauteur)--cycle)
32 scaled gddU withcolor c;
36 repClip; addto repSavePict also currentpicture; currentpicture := repSavePict;
41 drawarrow ((repXmin,0)--(repXmax,0)) gddEnPlace;
42 drawarrow ((0,repYmin)--(0,repYmax)) gddEnPlace;
43 label.lrt(TEX(gddXlabel),(repXmax,0) gddEnPlace);
44 label.ulft(TEX(gddYlabel),(0,repYmax) gddEnPlace);
48 save xmin, xmax, ymin, ymax;
49 xmin = floor(repXmin); xmax = floor(repXmax) + 1;
50 ymin = floor(repYmin); ymax = floor(repYmax) + 1;
51 SequenceTirets((xmin,0),(1,0),(0,-4),xmax-xmin+1);
52 SequenceTirets((xmin+0.5,0),(1,0),(0,-2),xmax-xmin);
53 SequenceTirets((0,ymin),(0,1),(-4,0),ymax-ymin+1);
54 SequenceTirets((0,ymin+0.5),(0,1),(-2,0),ymax-ymin);
58 extra_endfig := extra_endfig & "repClip;";
63 % ------------------------------------------------------------------------------
64 vardef SequenceTirets(expr o,p,t,n) text a=
65 save ot; pair ot; ot := o gddEnPlace;
68 draw ot -- (ot shifted t) a;
70 ot := (o + i*p) gddEnPlace;
74 vardef Unites(expr t) =
76 label.bot(TEX("$+1$"),(1,-(3/gddU/repUY)) gddEnPlace);
77 label.ulft(TEX("$+1$"),(-(3/gddU/repUX),1) gddEnPlace);
81 %%% ----------------------------------------------------------------------------
83 %%% ----------------------------------------------------------------------------
86 save xmin, xmax, ymin, ymax;
87 xmin = floor(repXmin); xmax = floor(repXmax) + 1;
88 ymin = floor(repYmin); ymax = floor(repYmax) + 1;
89 for i:=xmin upto xmax:
90 draw ((i,ymin)--(i,ymax)) gddEnPlace;
92 for i:=ymin upto ymax:
93 draw ((xmin,i)--(xmax,i)) gddEnPlace;
97 %%% ----------------------------------------------------------------------------
99 %%% ----------------------------------------------------------------------------
101 (repXmin,repYmin)--(repXmin,repYmax)--(repXmax,repYmax)--(repXmax,repYmin)--cycle