diff --git a/Notebooks/imgs_chap5/img_exo_2spirales (copie 1).py b/Notebooks/imgs_chap5/img_exo_2spirales (copie 1).py new file mode 100644 index 0000000000000000000000000000000000000000..a7470e62ca46a6cf40000f107a17ac8f5d932058 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_2spirales (copie 1).py @@ -0,0 +1,52 @@ +from turtle import * + +speed(0) +WIDTH, HEIGHT = 500, 500 + +screen = Screen() +screen.setup(WIDTH + 4, HEIGHT + 8) # fudge factors due to window borders & title bar + + +penup() +for k in range(21): + goto(-500+k*50,-500) + pendown() + goto(-500+k*50,500) + penup() +for k in range(20): + goto(-500,-500+k*50) + pendown() + goto(500,-500+k*50) + penup() + +goto(0, -100) +pendown() +width(5) + + +color("blue") +right(90) + +x = 50 +for _ in range(3): + forward(x) + right(90) + x = x + 100 + +color("red") +x = x - 100 +for _ in range(5): + forward(x) + right(90) + x = x - 50 + +shape('turtle') +color("black") +left(90) +penup() +goto(0, -100) + +ts = getscreen() +ts.getcanvas().postscript(file="img_exo_2spirales.eps") + +done() \ No newline at end of file diff --git a/Notebooks/imgs_chap5/img_exo_2spirales.eps b/Notebooks/imgs_chap5/img_exo_2spirales.eps new file mode 100644 index 0000000000000000000000000000000000000000..dfa5670fdf4c64955da3544ef33861af0164e329 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_2spirales.eps @@ -0,0 +1,399 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Tk Canvas Widget +%%For: mathieu +%%Title: Window .!canvas +%%CreationDate: Wed Jan 15 22:25:01 2025 +%%BoundingBox: 117 206 495 586 +%%Pages: 1 +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%EndComments + +%%BeginProlog +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +/CurrentEncoding [ +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle +/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash +/zero/one/two/three/four/five/six/seven +/eight/nine/colon/semicolon/less/equal/greater/question +/at/A/B/C/D/E/F/G +/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W +/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore +/grave/a/b/c/d/e/f/g +/h/i/j/k/l/m/n/o +/p/q/r/s/t/u/v/w +/x/y/z/braceleft/bar/braceright/asciitilde/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclamdown/cent/sterling/currency/yen/brokenbar/section +/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron +/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered +/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown +/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla +/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis +/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply +/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide +/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis +] def +50 dict begin +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def +/baselineSampler ( TXygqPZ) def +baselineSampler 0 196 put +/cstringshow {{ dup type /stringtype eq { show } { glyphshow } ifelse } forall } bind def +/cstringwidth {0 exch 0 exch { dup type /stringtype eq { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) stringwidth } ifelse exch 3 1 roll add 3 1 roll add exch } forall } bind def +/ISOEncode {dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding CurrentEncoding def currentdict end /Temporary exch definefont } bind def +/StrokeClip {{strokepath} stopped { (This Postscript printer gets limitcheck overflows when) = (stippling dashed lines; lines will be printed solid instead.) = [] 0 setdash strokepath} if clip } bind def +/EvenPixels {dup 0 matrix currentmatrix dtransform dup mul exch dup mul add sqrt dup round dup 1 lt {pop 1} if exch div mul } bind def +/StippleFill {/tmpstip 1 index def 1 EvenPixels dup scale pathbbox 4 2 roll 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll 6 index exch { 2 index 5 index 3 index { gsave 1 index exch translate 5 index 5 index true matrix tmpstip imagemask grestore } for pop } for pop pop pop pop pop } bind def +/AdjustColor {CL 2 lt { currentgray CL 0 eq { .5 lt {0} {1} ifelse } if setgray } if } bind def +/DrawText {/stipple exch def /justify exch def /yoffset exch def /xoffset exch def /spacing exch def /strings exch def /lineLength 0 def strings { cstringwidth pop dup lineLength gt {/lineLength exch def} {pop} ifelse newpath } forall 0 0 moveto baselineSampler false charpath pathbbox dup /baseline exch def exch pop exch sub /height exch def pop newpath translate rotate lineLength xoffset mul strings length 1 sub spacing mul height add yoffset mul translate justify lineLength mul baseline neg translate strings { dup cstringwidth pop justify neg mul 0 moveto stipple { gsave /char (X) def { dup type /stringtype eq { { char 0 3 -1 roll put currentpoint gsave char true charpath clip StippleText grestore char stringwidth translate moveto } forall } { currentfont /Encoding get exch 1 exch put currentpoint gsave (\001) true charpath clip StippleText grestore (\001) stringwidth translate moveto } ifelse } forall grestore } {cstringshow} ifelse 0 spacing neg translate } forall } bind def +/TkPhotoColor {gsave 32 dict begin /tinteger exch def /transparent 1 string def transparent 0 tinteger put /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /crpp newdict /Decode get length 2 idiv def /str w string def /pix w crpp mul string def /substrlen 2 w log 2 log div floor exp cvi def /substrs [ { substrlen string 0 1 substrlen 1 sub { 1 index exch tinteger put } for /substrlen substrlen 2 idiv def substrlen 0 eq {exit} if } loop ] def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put olddict /DataSource get str readstring pop pop /tail str def /x 0 def olddict /DataSource get pix readstring pop pop { tail transparent search dup /done exch not def {exch pop exch pop} if /w1 exch length def w1 0 ne { newdict /DataSource pix x crpp mul w1 crpp mul getinterval put newdict /Width w1 put mat 4 x neg put /x x w1 add def newdict image /tail tail w1 tail length w1 sub getinterval def } if done {exit} if tail substrs { anchorsearch {pop} if } forall /tail exch def tail length 0 eq {exit} if /x w tail length sub def } loop } for end grestore } bind def +/TkPhotoMono {gsave 32 dict begin /dummyInteger exch def /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /pix w 7 add 8 idiv string def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put 0.000 0.000 0.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask 1.000 1.000 1.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask } for end grestore } bind def +%%EndProlog +%%BeginSetup +/CL 2 def +%%EndSetup + +%%Page: 1 1 +save +306.0 396.0 translate +0.75 0.75 scale +2 -253 translate +-253 506 moveto 249 506 lineto 249 0 lineto -253 0 lineto closepath clip newpath +gsave +grestore +gsave +grestore +gsave +-250 -249 moveto +-250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 -249 moveto +-200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-150 -249 moveto +-150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-100 -249 moveto +-100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-50 -249 moveto +-50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 -249 moveto +0 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +50 -249 moveto +50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +100 -249 moveto +100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +150 -249 moveto +150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +200 -249 moveto +200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +250 -249 moveto +250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 1 moveto +500 1 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 51 moveto +500 51 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 101 moveto +500 101 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 151 moveto +500 151 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 201 moveto +500 201 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 251 moveto +500 251 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 301 moveto +500 301 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 351 moveto +500 351 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 401 moveto +500 401 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 451 moveto +500 451 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 501 moveto +500 501 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 151 moveto +3.06161699786838e-15 101 lineto +-150 101 lineto +-150 351 lineto +1 setlinecap +1 setlinejoin +5 setlinewidth +[] 0 setdash +0.000 0.000 1.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-150 351 moveto +99.9999999999999 351 lineto +100 151 lineto +-50 151 lineto +-50 251 lineto +-4.2632564145606e-14 251 lineto +1 setlinecap +1 setlinejoin +5 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +grestore +gsave +16 151 moveto +14 153 lineto +10 152 lineto +7 155 lineto +9 158 lineto +8 160 lineto +5 157 lineto +0.999999999999997 158 lineto +-3 156 lineto +-6 159 lineto +-8 157 lineto +-5 155 lineto +-7 151 lineto +-5 147 lineto +-8 145 lineto +-6 143 lineto +-3 146 lineto +1 144 lineto +5 145 lineto +8 142 lineto +9 144 lineto +7 147 lineto +10 150 lineto +14 149 lineto +16 151 lineto +0.000 0.000 0.000 setrgbcolor AdjustColor +eofill +16 151 moveto +14 153 lineto +10 152 lineto +7 155 lineto +9 158 lineto +8 160 lineto +5 157 lineto +0.999999999999997 158 lineto +-3 156 lineto +-6 159 lineto +-8 157 lineto +-5 155 lineto +-7 151 lineto +-5 147 lineto +-8 145 lineto +-6 143 lineto +-3 146 lineto +1 144 lineto +5 145 lineto +8 142 lineto +9 144 lineto +7 147 lineto +10 150 lineto +14 149 lineto +16 151 lineto +1 setlinejoin 1 setlinecap +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +restore showpage + +%%Trailer +end +%%EOF diff --git a/Notebooks/imgs_chap5/img_exo_2spirales.png b/Notebooks/imgs_chap5/img_exo_2spirales.png index dfa5670fdf4c64955da3544ef33861af0164e329..cc7ff525152e5463d3486e0fe766d7a3df171254 100644 Binary files a/Notebooks/imgs_chap5/img_exo_2spirales.png and b/Notebooks/imgs_chap5/img_exo_2spirales.png differ diff --git a/Notebooks/imgs_chap5/img_exo_carres (copie 1).py b/Notebooks/imgs_chap5/img_exo_carres (copie 1).py new file mode 100644 index 0000000000000000000000000000000000000000..4c8828b91e44c63dba244248d04af066b7016294 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_carres (copie 1).py @@ -0,0 +1,44 @@ +from turtle import * + +speed(0) +WIDTH, HEIGHT = 500, 500 + +screen = Screen() +screen.setup(WIDTH + 4, HEIGHT + 8) # fudge factors due to window borders & title bar + + +penup() +for k in range(21): + goto(-500+k*50,-500) + pendown() + goto(-500+k*50,500) + penup() +for k in range(20): + goto(-500,-500+k*50) + pendown() + goto(500,-500+k*50) + penup() + +# pour positionner le curseur en bas à gauche +penup() +goto(-200, -200) +pendown() + +# mettre le bon style de trait +width(5) +color("red") + +def carre(longueur): + for _ in range(4): + forward(longueur) + left(90) +# à compléter avec maximum 5 lignes +x = 50 +for _ in range(8): + carre(x) + x = 50 + x + +ts = getscreen() +ts.getcanvas().postscript(file="img_exo_carres.eps") + +done() \ No newline at end of file diff --git a/Notebooks/imgs_chap5/img_exo_carres.eps b/Notebooks/imgs_chap5/img_exo_carres.eps new file mode 100644 index 0000000000000000000000000000000000000000..1e0fedbdfdc8edc27568fbb7a40e41c88a114824 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_carres.eps @@ -0,0 +1,372 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Tk Canvas Widget +%%For: mathieu +%%Title: Window .!canvas +%%CreationDate: Wed Jan 15 23:09:17 2025 +%%BoundingBox: 117 206 495 586 +%%Pages: 1 +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%EndComments + +%%BeginProlog +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +/CurrentEncoding [ +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle +/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash +/zero/one/two/three/four/five/six/seven +/eight/nine/colon/semicolon/less/equal/greater/question +/at/A/B/C/D/E/F/G +/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W +/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore +/grave/a/b/c/d/e/f/g +/h/i/j/k/l/m/n/o +/p/q/r/s/t/u/v/w +/x/y/z/braceleft/bar/braceright/asciitilde/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclamdown/cent/sterling/currency/yen/brokenbar/section +/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron +/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered +/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown +/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla +/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis +/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply +/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide +/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis +] def +50 dict begin +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def +/baselineSampler ( TXygqPZ) def +baselineSampler 0 196 put +/cstringshow {{ dup type /stringtype eq { show } { glyphshow } ifelse } forall } bind def +/cstringwidth {0 exch 0 exch { dup type /stringtype eq { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) stringwidth } ifelse exch 3 1 roll add 3 1 roll add exch } forall } bind def +/ISOEncode {dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding CurrentEncoding def currentdict end /Temporary exch definefont } bind def +/StrokeClip {{strokepath} stopped { (This Postscript printer gets limitcheck overflows when) = (stippling dashed lines; lines will be printed solid instead.) = [] 0 setdash strokepath} if clip } bind def +/EvenPixels {dup 0 matrix currentmatrix dtransform dup mul exch dup mul add sqrt dup round dup 1 lt {pop 1} if exch div mul } bind def +/StippleFill {/tmpstip 1 index def 1 EvenPixels dup scale pathbbox 4 2 roll 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll 6 index exch { 2 index 5 index 3 index { gsave 1 index exch translate 5 index 5 index true matrix tmpstip imagemask grestore } for pop } for pop pop pop pop pop } bind def +/AdjustColor {CL 2 lt { currentgray CL 0 eq { .5 lt {0} {1} ifelse } if setgray } if } bind def +/DrawText {/stipple exch def /justify exch def /yoffset exch def /xoffset exch def /spacing exch def /strings exch def /lineLength 0 def strings { cstringwidth pop dup lineLength gt {/lineLength exch def} {pop} ifelse newpath } forall 0 0 moveto baselineSampler false charpath pathbbox dup /baseline exch def exch pop exch sub /height exch def pop newpath translate rotate lineLength xoffset mul strings length 1 sub spacing mul height add yoffset mul translate justify lineLength mul baseline neg translate strings { dup cstringwidth pop justify neg mul 0 moveto stipple { gsave /char (X) def { dup type /stringtype eq { { char 0 3 -1 roll put currentpoint gsave char true charpath clip StippleText grestore char stringwidth translate moveto } forall } { currentfont /Encoding get exch 1 exch put currentpoint gsave (\001) true charpath clip StippleText grestore (\001) stringwidth translate moveto } ifelse } forall grestore } {cstringshow} ifelse 0 spacing neg translate } forall } bind def +/TkPhotoColor {gsave 32 dict begin /tinteger exch def /transparent 1 string def transparent 0 tinteger put /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /crpp newdict /Decode get length 2 idiv def /str w string def /pix w crpp mul string def /substrlen 2 w log 2 log div floor exp cvi def /substrs [ { substrlen string 0 1 substrlen 1 sub { 1 index exch tinteger put } for /substrlen substrlen 2 idiv def substrlen 0 eq {exit} if } loop ] def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put olddict /DataSource get str readstring pop pop /tail str def /x 0 def olddict /DataSource get pix readstring pop pop { tail transparent search dup /done exch not def {exch pop exch pop} if /w1 exch length def w1 0 ne { newdict /DataSource pix x crpp mul w1 crpp mul getinterval put newdict /Width w1 put mat 4 x neg put /x x w1 add def newdict image /tail tail w1 tail length w1 sub getinterval def } if done {exit} if tail substrs { anchorsearch {pop} if } forall /tail exch def tail length 0 eq {exit} if /x w tail length sub def } loop } for end grestore } bind def +/TkPhotoMono {gsave 32 dict begin /dummyInteger exch def /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /pix w 7 add 8 idiv string def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put 0.000 0.000 0.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask 1.000 1.000 1.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask } for end grestore } bind def +%%EndProlog +%%BeginSetup +/CL 2 def +%%EndSetup + +%%Page: 1 1 +save +306.0 396.0 translate +0.75 0.75 scale +2 -253 translate +-253 506 moveto 249 506 lineto 249 0 lineto -253 0 lineto closepath clip newpath +gsave +grestore +gsave +grestore +gsave +-250 -249 moveto +-250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 -249 moveto +-200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-150 -249 moveto +-150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-100 -249 moveto +-100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-50 -249 moveto +-50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 -249 moveto +0 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +50 -249 moveto +50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +100 -249 moveto +100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +150 -249 moveto +150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +200 -249 moveto +200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +250 -249 moveto +250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 1 moveto +500 1 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 51 moveto +500 51 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 101 moveto +500 101 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 151 moveto +500 151 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 201 moveto +500 201 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 251 moveto +500 251 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 301 moveto +500 301 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 351 moveto +500 351 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 401 moveto +500 401 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 451 moveto +500 451 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 501 moveto +500 501 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 51 moveto +-150 51 lineto +-150 101 lineto +-200 101 lineto +-200 51 lineto +-100 51 lineto +-100 151 lineto +-200 151 lineto +-200 51 lineto +-50 50.9999999999999 lineto +-49.9999999999999 201 lineto +-200 201 lineto +-200 51 lineto +-5.6843418860808e-14 50.9999999999999 lineto +1.02360665028348e-13 251 lineto +-200 251 lineto +-200 51 lineto +49.9999999999999 50.9999999999998 lineto +50.0000000000002 301 lineto +-200 301 lineto +-200 51.0000000000001 lineto +99.9999999999999 50.9999999999997 lineto +100 351 lineto +-200 351 lineto +-200 51.0000000000001 lineto +150 50.9999999999996 lineto +150 401 lineto +-200 401 lineto +-200 51.0000000000001 lineto +200 50.9999999999995 lineto +200.000000000001 450.999999999999 lineto +-199.999999999999 451 lineto +-200 51.0000000000002 lineto +1 setlinecap +1 setlinejoin +5 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 51.0000000000002 moveto +-209 56.0000000000002 lineto +-207 51.0000000000002 lineto +-209 46.0000000000002 lineto +-200 51.0000000000002 lineto +1.000 0.000 0.000 setrgbcolor AdjustColor +eofill +-200 51.0000000000002 moveto +-209 56.0000000000002 lineto +-207 51.0000000000002 lineto +-209 46.0000000000002 lineto +-200 51.0000000000002 lineto +1 setlinejoin 1 setlinecap +1 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +restore showpage + +%%Trailer +end +%%EOF diff --git a/Notebooks/imgs_chap5/img_exo_carres.png b/Notebooks/imgs_chap5/img_exo_carres.png index 1e0fedbdfdc8edc27568fbb7a40e41c88a114824..ac886413a2ff24a885922d57c43662ebbc927045 100644 Binary files a/Notebooks/imgs_chap5/img_exo_carres.png and b/Notebooks/imgs_chap5/img_exo_carres.png differ diff --git a/Notebooks/imgs_chap5/img_exo_spirale (copie 1).py b/Notebooks/imgs_chap5/img_exo_spirale (copie 1).py new file mode 100644 index 0000000000000000000000000000000000000000..74703db12f8e51c9a9afa6c2efa052856e324a82 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_spirale (copie 1).py @@ -0,0 +1,41 @@ +from turtle import * + +speed(0) +WIDTH, HEIGHT = 500, 500 + +screen = Screen() +screen.setup(WIDTH + 4, HEIGHT + 8) # fudge factors due to window borders & title bar + + +penup() +for k in range(21): + goto(-500+k*50,-500) + pendown() + goto(-500+k*50,500) + penup() +for k in range(20): + goto(-500,-500+k*50) + pendown() + goto(500,-500+k*50) + penup() + +goto(-200, -200) +pendown() +width(5) + +color("red") + +x = 400 +for _ in range(8): + forward(x) + left(90) + x = x - 50 + +shape('turtle') +penup() +goto(-200, -200) + +ts = getscreen() +ts.getcanvas().postscript(file="img_exo_spirale.eps") + +done() \ No newline at end of file diff --git a/Notebooks/imgs_chap5/img_exo_spirale.eps b/Notebooks/imgs_chap5/img_exo_spirale.eps new file mode 100644 index 0000000000000000000000000000000000000000..a7e2a622fd0ebcfed79f958abd77eae1cfae515e --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_spirale.eps @@ -0,0 +1,390 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Tk Canvas Widget +%%For: mathieu +%%Title: Window .!canvas +%%CreationDate: Wed Jan 15 22:14:23 2025 +%%BoundingBox: 117 206 495 586 +%%Pages: 1 +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%EndComments + +%%BeginProlog +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +/CurrentEncoding [ +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle +/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash +/zero/one/two/three/four/five/six/seven +/eight/nine/colon/semicolon/less/equal/greater/question +/at/A/B/C/D/E/F/G +/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W +/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore +/grave/a/b/c/d/e/f/g +/h/i/j/k/l/m/n/o +/p/q/r/s/t/u/v/w +/x/y/z/braceleft/bar/braceright/asciitilde/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclamdown/cent/sterling/currency/yen/brokenbar/section +/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron +/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered +/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown +/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla +/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis +/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply +/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide +/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis +] def +50 dict begin +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def +/baselineSampler ( TXygqPZ) def +baselineSampler 0 196 put +/cstringshow {{ dup type /stringtype eq { show } { glyphshow } ifelse } forall } bind def +/cstringwidth {0 exch 0 exch { dup type /stringtype eq { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) stringwidth } ifelse exch 3 1 roll add 3 1 roll add exch } forall } bind def +/ISOEncode {dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding CurrentEncoding def currentdict end /Temporary exch definefont } bind def +/StrokeClip {{strokepath} stopped { (This Postscript printer gets limitcheck overflows when) = (stippling dashed lines; lines will be printed solid instead.) = [] 0 setdash strokepath} if clip } bind def +/EvenPixels {dup 0 matrix currentmatrix dtransform dup mul exch dup mul add sqrt dup round dup 1 lt {pop 1} if exch div mul } bind def +/StippleFill {/tmpstip 1 index def 1 EvenPixels dup scale pathbbox 4 2 roll 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll 6 index exch { 2 index 5 index 3 index { gsave 1 index exch translate 5 index 5 index true matrix tmpstip imagemask grestore } for pop } for pop pop pop pop pop } bind def +/AdjustColor {CL 2 lt { currentgray CL 0 eq { .5 lt {0} {1} ifelse } if setgray } if } bind def +/DrawText {/stipple exch def /justify exch def /yoffset exch def /xoffset exch def /spacing exch def /strings exch def /lineLength 0 def strings { cstringwidth pop dup lineLength gt {/lineLength exch def} {pop} ifelse newpath } forall 0 0 moveto baselineSampler false charpath pathbbox dup /baseline exch def exch pop exch sub /height exch def pop newpath translate rotate lineLength xoffset mul strings length 1 sub spacing mul height add yoffset mul translate justify lineLength mul baseline neg translate strings { dup cstringwidth pop justify neg mul 0 moveto stipple { gsave /char (X) def { dup type /stringtype eq { { char 0 3 -1 roll put currentpoint gsave char true charpath clip StippleText grestore char stringwidth translate moveto } forall } { currentfont /Encoding get exch 1 exch put currentpoint gsave (\001) true charpath clip StippleText grestore (\001) stringwidth translate moveto } ifelse } forall grestore } {cstringshow} ifelse 0 spacing neg translate } forall } bind def +/TkPhotoColor {gsave 32 dict begin /tinteger exch def /transparent 1 string def transparent 0 tinteger put /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /crpp newdict /Decode get length 2 idiv def /str w string def /pix w crpp mul string def /substrlen 2 w log 2 log div floor exp cvi def /substrs [ { substrlen string 0 1 substrlen 1 sub { 1 index exch tinteger put } for /substrlen substrlen 2 idiv def substrlen 0 eq {exit} if } loop ] def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put olddict /DataSource get str readstring pop pop /tail str def /x 0 def olddict /DataSource get pix readstring pop pop { tail transparent search dup /done exch not def {exch pop exch pop} if /w1 exch length def w1 0 ne { newdict /DataSource pix x crpp mul w1 crpp mul getinterval put newdict /Width w1 put mat 4 x neg put /x x w1 add def newdict image /tail tail w1 tail length w1 sub getinterval def } if done {exit} if tail substrs { anchorsearch {pop} if } forall /tail exch def tail length 0 eq {exit} if /x w tail length sub def } loop } for end grestore } bind def +/TkPhotoMono {gsave 32 dict begin /dummyInteger exch def /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /pix w 7 add 8 idiv string def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put 0.000 0.000 0.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask 1.000 1.000 1.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask } for end grestore } bind def +%%EndProlog +%%BeginSetup +/CL 2 def +%%EndSetup + +%%Page: 1 1 +save +306.0 396.0 translate +0.75 0.75 scale +2 -253 translate +-253 506 moveto 249 506 lineto 249 0 lineto -253 0 lineto closepath clip newpath +gsave +grestore +gsave +grestore +gsave +-250 -249 moveto +-250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 -249 moveto +-200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-150 -249 moveto +-150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-100 -249 moveto +-100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-50 -249 moveto +-50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 -249 moveto +0 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +50 -249 moveto +50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +100 -249 moveto +100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +150 -249 moveto +150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +200 -249 moveto +200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +250 -249 moveto +250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 1 moveto +500 1 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 51 moveto +500 51 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 101 moveto +500 101 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 151 moveto +500 151 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 201 moveto +500 201 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 251 moveto +500 251 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 301 moveto +500 301 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 351 moveto +500 351 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 401 moveto +500 401 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 451 moveto +500 451 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 501 moveto +500 501 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 51 moveto +200 51 lineto +200 401 lineto +-100 401 lineto +-100 151 lineto +100 151 lineto +100 301 lineto +2.8421709430404e-14 301 lineto +6.99039044532532e-15 251 lineto +1 setlinecap +1 setlinejoin +5 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +grestore +gsave +-184 51 moveto +-186 53 lineto +-190 52 lineto +-193 55 lineto +-191 58 lineto +-192 60 lineto +-195 57 lineto +-199 58 lineto +-203 56 lineto +-206 59 lineto +-208 57 lineto +-205 55 lineto +-207 51 lineto +-205 47 lineto +-208 45 lineto +-206 43 lineto +-203 46 lineto +-199 44 lineto +-195 45 lineto +-192 42 lineto +-191 44 lineto +-193 47 lineto +-190 50 lineto +-186 49 lineto +-184 51 lineto +1.000 0.000 0.000 setrgbcolor AdjustColor +eofill +-184 51 moveto +-186 53 lineto +-190 52 lineto +-193 55 lineto +-191 58 lineto +-192 60 lineto +-195 57 lineto +-199 58 lineto +-203 56 lineto +-206 59 lineto +-208 57 lineto +-205 55 lineto +-207 51 lineto +-205 47 lineto +-208 45 lineto +-206 43 lineto +-203 46 lineto +-199 44 lineto +-195 45 lineto +-192 42 lineto +-191 44 lineto +-193 47 lineto +-190 50 lineto +-186 49 lineto +-184 51 lineto +1 setlinejoin 1 setlinecap +1 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +restore showpage + +%%Trailer +end +%%EOF diff --git a/Notebooks/imgs_chap5/img_exo_spirale.png b/Notebooks/imgs_chap5/img_exo_spirale.png index a7e2a622fd0ebcfed79f958abd77eae1cfae515e..53f0a70a7d96cf9997679b6b26c995fd0e2a2775 100644 Binary files a/Notebooks/imgs_chap5/img_exo_spirale.png and b/Notebooks/imgs_chap5/img_exo_spirale.png differ diff --git a/Notebooks/imgs_chap5/img_exo_triangles (copie 1).py b/Notebooks/imgs_chap5/img_exo_triangles (copie 1).py new file mode 100644 index 0000000000000000000000000000000000000000..423556f4997cd9a1159fafbbba05b431e2839055 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_triangles (copie 1).py @@ -0,0 +1,46 @@ +from turtle import * + +speed(0) +WIDTH, HEIGHT = 500, 500 +L_carre = 25 + +screen = Screen() +screen.setup(WIDTH + 4, HEIGHT + 8) # fudge factors due to window borders & title bar + + +penup() +for k in range(2*WIDTH//L_carre + 1): + goto(-WIDTH+k*L_carre,-HEIGHT) + pendown() + goto(-WIDTH+k*L_carre,HEIGHT) + penup() +for k in range(2*HEIGHT//L_carre): + goto(-WIDTH,-HEIGHT+k*L_carre) + pendown() + goto(WIDTH,-HEIGHT+k*L_carre) + penup() + +# pour positionner le curseur en bas à gauche +penup() +goto(0, 0) +pendown() + +# mettre le bon style de trait +width(3) +color("red") + +def triangle(longueur): + for _ in range(3): + forward(longueur) + left(120) +# à compléter avec maximum 5 lignes +x = 200 +for _ in range(6): + triangle(x) + left(60) + x = x - 25 + +ts = getscreen() +ts.getcanvas().postscript(file="img_exo_triangles.eps") + +done() \ No newline at end of file diff --git a/Notebooks/imgs_chap5/img_exo_triangles.eps b/Notebooks/imgs_chap5/img_exo_triangles.eps new file mode 100644 index 0000000000000000000000000000000000000000..8b94342e4b83598e74b6ad61576ae4322a95b4e8 --- /dev/null +++ b/Notebooks/imgs_chap5/img_exo_triangles.eps @@ -0,0 +1,558 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Tk Canvas Widget +%%For: mathieu +%%Title: Window .!canvas +%%CreationDate: Wed Jan 15 23:19:34 2025 +%%BoundingBox: 117 206 495 586 +%%Pages: 1 +%%DocumentData: Clean7Bit +%%Orientation: Portrait +%%EndComments + +%%BeginProlog +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +/CurrentEncoding [ +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quotesingle +/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash +/zero/one/two/three/four/five/six/seven +/eight/nine/colon/semicolon/less/equal/greater/question +/at/A/B/C/D/E/F/G +/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W +/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore +/grave/a/b/c/d/e/f/g +/h/i/j/k/l/m/n/o +/p/q/r/s/t/u/v/w +/x/y/z/braceleft/bar/braceright/asciitilde/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/space/space/space/space/space/space/space +/space/exclamdown/cent/sterling/currency/yen/brokenbar/section +/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron +/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered +/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown +/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla +/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis +/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply +/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide +/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis +] def +50 dict begin +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def +/baselineSampler ( TXygqPZ) def +baselineSampler 0 196 put +/cstringshow {{ dup type /stringtype eq { show } { glyphshow } ifelse } forall } bind def +/cstringwidth {0 exch 0 exch { dup type /stringtype eq { stringwidth } { currentfont /Encoding get exch 1 exch put (\001) stringwidth } ifelse exch 3 1 roll add 3 1 roll add exch } forall } bind def +/ISOEncode {dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding CurrentEncoding def currentdict end /Temporary exch definefont } bind def +/StrokeClip {{strokepath} stopped { (This Postscript printer gets limitcheck overflows when) = (stippling dashed lines; lines will be printed solid instead.) = [] 0 setdash strokepath} if clip } bind def +/EvenPixels {dup 0 matrix currentmatrix dtransform dup mul exch dup mul add sqrt dup round dup 1 lt {pop 1} if exch div mul } bind def +/StippleFill {/tmpstip 1 index def 1 EvenPixels dup scale pathbbox 4 2 roll 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll 6 index exch { 2 index 5 index 3 index { gsave 1 index exch translate 5 index 5 index true matrix tmpstip imagemask grestore } for pop } for pop pop pop pop pop } bind def +/AdjustColor {CL 2 lt { currentgray CL 0 eq { .5 lt {0} {1} ifelse } if setgray } if } bind def +/DrawText {/stipple exch def /justify exch def /yoffset exch def /xoffset exch def /spacing exch def /strings exch def /lineLength 0 def strings { cstringwidth pop dup lineLength gt {/lineLength exch def} {pop} ifelse newpath } forall 0 0 moveto baselineSampler false charpath pathbbox dup /baseline exch def exch pop exch sub /height exch def pop newpath translate rotate lineLength xoffset mul strings length 1 sub spacing mul height add yoffset mul translate justify lineLength mul baseline neg translate strings { dup cstringwidth pop justify neg mul 0 moveto stipple { gsave /char (X) def { dup type /stringtype eq { { char 0 3 -1 roll put currentpoint gsave char true charpath clip StippleText grestore char stringwidth translate moveto } forall } { currentfont /Encoding get exch 1 exch put currentpoint gsave (\001) true charpath clip StippleText grestore (\001) stringwidth translate moveto } ifelse } forall grestore } {cstringshow} ifelse 0 spacing neg translate } forall } bind def +/TkPhotoColor {gsave 32 dict begin /tinteger exch def /transparent 1 string def transparent 0 tinteger put /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /crpp newdict /Decode get length 2 idiv def /str w string def /pix w crpp mul string def /substrlen 2 w log 2 log div floor exp cvi def /substrs [ { substrlen string 0 1 substrlen 1 sub { 1 index exch tinteger put } for /substrlen substrlen 2 idiv def substrlen 0 eq {exit} if } loop ] def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put olddict /DataSource get str readstring pop pop /tail str def /x 0 def olddict /DataSource get pix readstring pop pop { tail transparent search dup /done exch not def {exch pop exch pop} if /w1 exch length def w1 0 ne { newdict /DataSource pix x crpp mul w1 crpp mul getinterval put newdict /Width w1 put mat 4 x neg put /x x w1 add def newdict image /tail tail w1 tail length w1 sub getinterval def } if done {exit} if tail substrs { anchorsearch {pop} if } forall /tail exch def tail length 0 eq {exit} if /x w tail length sub def } loop } for end grestore } bind def +/TkPhotoMono {gsave 32 dict begin /dummyInteger exch def /olddict exch def olddict /DataSource get dup type /filetype ne { olddict /DataSource 3 -1 roll 0 () /SubFileDecode filter put } { pop } ifelse /newdict olddict maxlength dict def olddict newdict copy pop /w newdict /Width get def /pix w 7 add 8 idiv string def /h newdict /Height get def 1 w div 1 h div matrix scale olddict /ImageMatrix get exch matrix concatmatrix matrix invertmatrix concat newdict /Height 1 put newdict /DataSource pix put /mat [w 0 0 h 0 0] def newdict /ImageMatrix mat put 0 1 h 1 sub { mat 5 3 -1 roll neg put 0.000 0.000 0.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask 1.000 1.000 1.000 setrgbcolor olddict /DataSource get pix readstring pop pop newdict /DataSource pix put newdict imagemask } for end grestore } bind def +%%EndProlog +%%BeginSetup +/CL 2 def +%%EndSetup + +%%Page: 1 1 +save +306.0 396.0 translate +0.75 0.75 scale +2 -253 translate +-253 506 moveto 249 506 lineto 249 0 lineto -253 0 lineto closepath clip newpath +gsave +grestore +gsave +grestore +gsave +-250 -249 moveto +-250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-225 -249 moveto +-225 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-200 -249 moveto +-200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-175 -249 moveto +-175 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-150 -249 moveto +-150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-125 -249 moveto +-125 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-100 -249 moveto +-100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-75 -249 moveto +-75 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-50 -249 moveto +-50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-25 -249 moveto +-25 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 -249 moveto +0 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +25 -249 moveto +25 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +50 -249 moveto +50 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +75 -249 moveto +75 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +100 -249 moveto +100 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +125 -249 moveto +125 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +150 -249 moveto +150 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +175 -249 moveto +175 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +200 -249 moveto +200 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +225 -249 moveto +225 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +250 -249 moveto +250 751 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 1 moveto +500 1 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 26 moveto +500 26 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 51 moveto +500 51 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 76 moveto +500 76 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 101 moveto +500 101 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 126 moveto +500 126 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 151 moveto +500 151 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 176 moveto +500 176 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 201 moveto +500 201 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 226 moveto +500 226 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 251 moveto +500 251 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 276 moveto +500 276 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 301 moveto +500 301 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 326 moveto +500 326 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 351 moveto +500 351 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 376 moveto +500 376 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 401 moveto +500 401 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 426 moveto +500 426 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 451 moveto +500 451 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 476 moveto +500 476 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-500 501 moveto +500 501 lineto +1 setlinecap +1 setlinejoin +1 setlinewidth +[] 0 setdash +0.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +0 251 moveto +200 251 lineto +100 424.205080756888 lineto +-2.8421709430404e-14 251 lineto +87.5000000000001 402.554445662277 lineto +-87.4999999999999 402.554445662277 lineto +-1.13686837721616e-13 251 lineto +-74.9999999999999 380.903810567666 lineto +-150 251 lineto +-1.13686837721616e-13 251 lineto +-125 251 lineto +-62.5000000000004 142.746824526945 lineto +-9.2370555648813e-14 251 lineto +-50.0000000000003 164.397459621556 lineto +49.9999999999996 164.397459621556 lineto +-6.3948846218409e-14 251 lineto +37.4999999999997 186.048094716167 lineto +74.9999999999999 251 lineto +-4.2632564145606e-14 251 lineto +1 setlinecap +1 setlinejoin +3 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +gsave +-4.2632564145606e-14 251 moveto +-9.00000000000002 256 lineto +-7.00000000000004 251 lineto +-9.00000000000007 246 lineto +-4.2632564145606e-14 251 lineto +1.000 0.000 0.000 setrgbcolor AdjustColor +eofill +-4.2632564145606e-14 251 moveto +-9.00000000000002 256 lineto +-7.00000000000004 251 lineto +-9.00000000000007 246 lineto +-4.2632564145606e-14 251 lineto +1 setlinejoin 1 setlinecap +1 setlinewidth +[] 0 setdash +1.000 0.000 0.000 setrgbcolor AdjustColor +stroke +grestore +restore showpage + +%%Trailer +end +%%EOF diff --git a/Notebooks/imgs_chap5/img_exo_triangles.png b/Notebooks/imgs_chap5/img_exo_triangles.png index 8b94342e4b83598e74b6ad61576ae4322a95b4e8..55d249b355c0554f21cfe9d978ed895a9329c3e7 100644 Binary files a/Notebooks/imgs_chap5/img_exo_triangles.png and b/Notebooks/imgs_chap5/img_exo_triangles.png differ