4 def Repere(expr l,h,ox,oy,ux,uy) =
5 repLargeur := l; repHauteur := h;
6 repOX := ox ; repOY := oy;
7 repXmin := - ox / ux; repXmax := repXmin + l / ux;
8 repYmin := - oy / uy; repYmax := repYmin + h / uy;
9 repUX := ux; repUY := uy;
11 gddW := "xscaled repUX yscaled repUY shifted (repOX,repOY) scaled gddU";
15 repSavePict := currentpicture; currentpicture := nullpicture;
19 clip currentpicture to
20 ((0,0)--(repLargeur,0)--(repLargeur,repHauteur)--(0,repHauteur)--cycle)
24 def repStroke (expr c) =
25 draw ((0,0)--(repLargeur,0)--(repLargeur,repHauteur)--(0,repHauteur)--cycle)
26 scaled gddU withcolor c;
30 repClip; addto repSavePict also currentpicture; currentpicture := repSavePict;
35 drawarrow ((repXmin,0)--(repXmax,0)) gddEnPlace;
36 drawarrow ((0,repYmin)--(0,repYmax)) gddEnPlace;
37 label.lrt(TEX("$x$"),(repXmax,0) gddEnPlace);
38 label.ulft(TEX("$y$"),(0,repYmax) gddEnPlace);
42 save xmin, xmax, ymin, ymax;
43 xmin = floor(repXmin); xmax = floor(repXmax) + 1;
44 ymin = floor(repYmin); ymax = floor(repYmax) + 1;
45 SequenceTirets((xmin,0),(1,0),(0,-4),xmax-xmin+1);
46 SequenceTirets((xmin+0.5,0),(1,0),(0,-2),xmax-xmin);
47 SequenceTirets((0,ymin),(0,1),(-4,0),ymax-ymin+1);
48 SequenceTirets((0,ymin+0.5),(0,1),(-2,0),ymax-ymin);
52 extra_endfig := extra_endfig & "repClip;";
57 % ------------------------------------------------------------------------------
58 vardef SequenceTirets(expr o,p,t,n) text a=
59 save ot; pair ot; ot := o gddEnPlace;
62 draw ot -- (ot shifted t) a;
64 ot := (o + i*p) gddEnPlace;
68 vardef Unites(expr t) =
70 label.bot(TEX("$+1$"),(1,-(3/gddU/repUY)) gddEnPlace);
71 label.ulft(TEX("$+1$"),(-(3/gddU/repUX),1) gddEnPlace);
75 %%% ----------------------------------------------------------------------------
77 %%% ----------------------------------------------------------------------------
80 save xmin, xmax, ymin, ymax;
81 xmin = floor(repXmin); xmax = floor(repXmax) + 1;
82 ymin = floor(repYmin); ymax = floor(repYmax) + 1;
83 for i:=xmin upto xmax:
84 draw ((i,ymin)--(i,ymax)) gddEnPlace;
86 for i:=ymin upto ymax:
87 draw ((xmin,i)--(xmax,i)) gddEnPlace;
91 %%% ----------------------------------------------------------------------------
93 %%% ----------------------------------------------------------------------------
95 (repXmin,repYmin)--(repXmin,repYmax)--(repXmax,repYmax)--(repXmax,repYmin)--cycle