home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: window.tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Corel 10 Texture (image/corel10Texture)
| ext
| Unsupported |
1%
| dexvert
| Croteam texture file (image/croteamTextureFile)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document, ASCII text
| default
| |
100%
| TrID
| Delphi Project source (with rem)
| default (weak)
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| x-fmt/111 Plain Text File
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 7b 5c 6d 61 67 6f 6e 65 | 62 66 20 20 36 2e 37 20 |{\magone|bf 6.7 |
|00000010| 47 72 61 70 68 69 63 20 | 57 69 6e 64 6f 77 73 20 |Graphic |Windows |
|00000020| 28 77 69 6e 64 6f 77 29 | 7d 0a 0a 54 68 65 20 64 |(window)|}..The d|
|00000030| 61 74 61 20 74 79 70 65 | 20 24 77 69 6e 64 6f 77 |ata type| $window|
|00000040| 24 20 70 72 6f 76 69 64 | 65 73 20 61 6e 20 69 6e |$ provid|es an in|
|00000050| 74 65 72 66 61 63 65 20 | 66 6f 72 20 74 68 65 20 |terface |for the |
|00000060| 69 6e 70 75 74 20 61 6e | 64 20 0a 6f 75 74 70 75 |input an|d .outpu|
|00000070| 74 20 6f 66 20 62 61 73 | 69 63 20 74 77 6f 2d 64 |t of bas|ic two-d|
|00000080| 69 6d 65 6e 73 69 6f 6e | 61 6c 20 67 65 6f 6d 65 |imension|al geome|
|00000090| 74 72 69 63 20 6f 62 6a | 65 63 74 73 20 28 63 66 |tric obj|ects (cf|
|000000a0| 2e 20 73 65 63 74 69 6f | 6e 20 35 2e 31 29 20 75 |. sectio|n 5.1) u|
|000000b0| 73 69 6e 67 20 0a 74 68 | 65 20 58 31 31 20 6f 72 |sing .th|e X11 or|
|000000c0| 20 53 75 6e 56 69 65 77 | 20 77 69 6e 64 6f 77 20 | SunView| window |
|000000d0| 73 79 73 74 65 6d 2e 20 | 54 68 65 72 65 20 61 72 |system. |There ar|
|000000e0| 65 20 74 77 6f 20 6f 62 | 6a 65 63 74 20 63 6f 64 |e two ob|ject cod|
|000000f0| 65 20 6c 69 62 72 61 72 | 69 65 73 20 6c 69 62 57 |e librar|ies libW|
|00000100| 73 2e 61 2c 20 0a 61 6e | 64 20 6c 69 62 57 78 2e |s.a, .an|d libWx.|
|00000110| 61 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 69 6d 70 |a contai|ning imp|
|00000120| 6c 65 6d 65 6e 74 61 74 | 69 6f 6e 73 20 66 6f 72 |lementat|ions for|
|00000130| 20 62 6f 74 68 20 74 68 | 65 20 53 75 6e 56 69 65 | both th|e SunVie|
|00000140| 77 20 61 6e 64 20 58 31 | 31 20 28 78 76 69 65 77 |w and X1|1 (xview|
|00000150| 0a 74 6f 6f 6c 6b 69 74 | 29 20 65 6e 76 69 72 6f |.toolkit|) enviro|
|00000160| 6e 6d 65 6e 74 73 2e 20 | 41 70 70 6c 69 63 61 74 |nments. |Applicat|
|00000170| 69 6f 6e 20 70 72 6f 67 | 72 61 6d 73 20 75 73 69 |ion prog|rams usi|
|00000180| 6e 67 20 64 61 74 61 20 | 74 79 70 65 20 24 77 69 |ng data |type $wi|
|00000190| 6e 64 6f 77 24 20 68 61 | 76 65 20 74 6f 20 0a 62 |ndow$ ha|ve to .b|
|000001a0| 65 20 6c 69 6e 6b 65 64 | 20 77 69 74 68 20 6f 6e |e linked| with on|
|000001b0| 65 20 6f 66 20 74 68 65 | 73 65 20 6c 69 62 72 61 |e of the|se libra|
|000001c0| 72 69 65 73 20 28 63 66 | 2e 20 73 65 63 74 69 6f |ries (cf|. sectio|
|000001d0| 6e 7e 31 2e 36 29 3a 0a | 0a 5c 62 65 67 69 6e 69 |n~1.6):.|.\begini|
|000001e0| 74 65 6d 0a 5c 69 74 65 | 6d 7b 20 61 29 7d 20 0a |tem.\ite|m{ a)} .|
|000001f0| 46 6f 72 20 74 68 65 20 | 53 75 6e 56 69 65 77 20 |For the |SunView |
|00000200| 77 69 6e 64 6f 77 20 73 | 79 73 74 65 6d 3a 5c 6e |window s|ystem:\n|
|00000210| 6c 0a 43 43 20 24 70 72 | 6f 67 2e 63 24 20 2d 6c |l.CC $pr|og.c$ -l|
|00000220| 57 73 20 2d 6c 50 20 2d | 6c 47 20 2d 6c 4c 20 2d |Ws -lP -|lG -lL -|
|00000230| 6c 6d 20 20 2d 6c 73 75 | 6e 74 6f 6f 6c 20 2d 6c |lm -lsu|ntool -l|
|00000240| 73 75 6e 77 69 6e 64 6f | 77 20 2d 6c 70 69 78 72 |sunwindo|w -lpixr|
|00000250| 65 63 74 0a 0a 5c 69 74 | 65 6d 7b 20 62 29 7d 20 |ect..\it|em{ b)} |
|00000260| 0a 46 6f 72 20 74 68 65 | 20 58 31 31 20 28 78 76 |.For the| X11 (xv|
|00000270| 69 65 77 29 20 77 69 6e | 64 6f 77 20 73 79 73 74 |iew) win|dow syst|
|00000280| 65 6d 3a 5c 6e 6c 0a 43 | 43 20 24 70 72 6f 67 2e |em:\nl.C|C $prog.|
|00000290| 63 24 20 2d 6c 57 78 20 | 2d 6c 50 20 2d 6c 47 20 |c$ -lWx |-lP -lG |
|000002a0| 2d 6c 4c 20 2d 6c 6d 20 | 20 2d 6c 78 76 69 65 77 |-lL -lm | -lxview|
|000002b0| 20 2d 6c 6f 6c 67 78 20 | 2d 6c 58 31 31 20 0a 0a | -lolgx |-lX11 ..|
|000002c0| 5c 65 6e 64 69 74 65 6d | 0a 0a 0a 41 6e 20 69 6e |\enditem|...An in|
|000002d0| 73 74 61 6e 63 65 20 24 | 57 24 20 6f 66 20 74 68 |stance $|W$ of th|
|000002e0| 65 20 64 61 74 61 20 74 | 79 70 65 20 24 77 69 6e |e data t|ype $win|
|000002f0| 64 6f 77 24 20 69 73 20 | 61 6e 20 69 73 6f 2d 6f |dow$ is |an iso-o|
|00000300| 72 69 65 6e 74 65 64 20 | 0a 72 65 63 74 61 6e 67 |riented |.rectang|
|00000310| 75 6c 61 72 20 77 69 6e | 64 6f 77 20 69 6e 20 74 |ular win|dow in t|
|00000320| 68 65 20 74 77 6f 2d 64 | 69 6d 65 6e 73 69 6f 6e |he two-d|imension|
|00000330| 61 6c 20 70 6c 61 6e 65 | 2e 20 0a 54 68 65 20 64 |al plane|. .The d|
|00000340| 65 66 61 75 6c 74 20 72 | 65 70 72 65 73 65 6e 74 |efault r|epresent|
|00000350| 61 74 69 6f 6e 20 6f 66 | 20 24 57 24 20 6f 6e 20 |ation of| $W$ on |
|00000360| 74 68 65 20 73 63 72 65 | 65 6e 20 69 73 20 61 20 |the scre|en is a |
|00000370| 38 35 30 20 24 5c 74 69 | 6d 65 73 24 20 38 35 30 |850 $\ti|mes$ 850|
|00000380| 20 70 69 78 65 6c 0a 73 | 71 75 61 72 65 20 70 6f | pixel.s|quare po|
|00000390| 73 69 74 69 6f 6e 65 64 | 20 69 6e 20 74 68 65 20 |sitioned| in the |
|000003a0| 75 70 70 65 72 20 72 69 | 67 68 74 20 63 6f 72 6e |upper ri|ght corn|
|000003b0| 65 72 20 28 63 66 2e 20 | 63 72 65 61 74 69 6f 6e |er (cf. |creation|
|000003c0| 2c 20 76 61 72 69 61 6e | 74 20 63 29 29 2e 0a 54 |, varian|t c))..T|
|000003d0| 68 65 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 20 61 |he coord|inates a|
|000003e0| 6e 64 20 73 63 61 6c 69 | 6e 67 20 6f 66 20 24 57 |nd scali|ng of $W|
|000003f0| 24 20 75 73 65 64 20 66 | 6f 72 20 64 72 61 77 69 |$ used f|or drawi|
|00000400| 6e 67 20 6f 70 65 72 61 | 74 69 6f 6e 73 20 61 72 |ng opera|tions ar|
|00000410| 65 20 64 65 66 69 6e 65 | 64 20 0a 62 79 20 74 68 |e define|d .by th|
|00000420| 72 65 65 20 72 65 61 6c | 20 70 61 72 61 6d 65 74 |ree real| paramet|
|00000430| 65 72 73 3a 20 0a 24 78 | 5f 30 24 2c 20 74 68 65 |ers: .$x|_0$, the|
|00000440| 20 78 2d 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 | x-coord|inate of|
|00000450| 20 74 68 65 20 6c 65 66 | 74 20 73 69 64 65 2c 20 | the lef|t side, |
|00000460| 24 78 5f 31 24 2c 20 74 | 68 65 20 78 2d 63 6f 6f |$x_1$, t|he x-coo|
|00000470| 72 64 69 6e 61 74 65 20 | 6f 66 20 74 68 65 20 72 |rdinate |of the r|
|00000480| 69 67 68 74 20 0a 73 69 | 64 65 2c 20 61 6e 64 20 |ight .si|de, and |
|00000490| 24 79 5f 30 24 2c 20 74 | 68 65 20 79 2d 63 6f 6f |$y_0$, t|he y-coo|
|000004a0| 72 64 69 6e 61 74 65 20 | 6f 66 20 74 68 65 20 62 |rdinate |of the b|
|000004b0| 6f 74 74 6f 6d 20 73 69 | 64 65 2e 20 0a 54 68 65 |ottom si|de. .The|
|000004c0| 20 79 2d 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 | y-coord|inate of|
|000004d0| 20 74 68 65 20 74 6f 70 | 20 73 69 64 65 20 6f 66 | the top| side of|
|000004e0| 20 24 57 24 20 69 73 20 | 64 65 74 65 72 6d 69 6e | $W$ is |determin|
|000004f0| 65 64 20 62 79 20 74 68 | 65 20 63 75 72 72 65 6e |ed by th|e curren|
|00000500| 74 20 73 69 7a 65 20 61 | 6e 64 20 0a 73 68 61 70 |t size a|nd .shap|
|00000510| 65 20 6f 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |e of the| window |
|00000520| 6f 6e 20 74 68 65 20 73 | 63 72 65 65 6e 2c 20 77 |on the s|creen, w|
|00000530| 68 69 63 68 20 63 61 6e | 20 62 65 20 63 68 61 6e |hich can| be chan|
|00000540| 67 65 64 20 69 6e 74 65 | 72 61 63 74 69 76 65 6c |ged inte|ractivel|
|00000550| 79 2e 20 0a 41 20 67 72 | 61 70 68 69 63 20 77 69 |y. .A gr|aphic wi|
|00000560| 6e 64 6f 77 20 73 75 70 | 70 6f 72 74 73 20 6f 70 |ndow sup|ports op|
|00000570| 65 72 61 74 69 6f 6e 73 | 20 66 6f 72 20 64 72 61 |erations| for dra|
|00000580| 77 69 6e 67 20 70 6f 69 | 6e 74 73 2c 20 6c 69 6e |wing poi|nts, lin|
|00000590| 65 73 2c 20 73 65 67 6d | 65 6e 74 73 2c 20 0a 61 |es, segm|ents, .a|
|000005a0| 72 72 6f 77 73 2c 20 63 | 69 72 63 6c 65 73 2c 20 |rrows, c|ircles, |
|000005b0| 70 6f 6c 79 67 6f 6e 73 | 2c 20 67 72 61 70 68 73 |polygons|, graphs|
|000005c0| 2c 20 5c 64 6f 74 73 20 | 61 6e 64 20 66 6f 72 20 |, \dots |and for |
|000005d0| 67 72 61 70 68 69 63 61 | 6c 20 69 6e 70 75 74 20 |graphica|l input |
|000005e0| 6f 66 20 61 6c 6c 20 74 | 68 65 73 65 20 0a 6f 62 |of all t|hese .ob|
|000005f0| 6a 65 63 74 73 20 75 73 | 69 6e 67 20 74 68 65 20 |jects us|ing the |
|00000600| 6d 6f 75 73 65 20 69 6e | 70 75 74 20 64 65 76 69 |mouse in|put devi|
|00000610| 63 65 2e 20 4d 6f 73 74 | 20 6f 66 20 74 68 65 20 |ce. Most| of the |
|00000620| 64 72 61 77 69 6e 67 20 | 6f 70 65 72 61 74 69 6f |drawing |operatio|
|00000630| 6e 73 20 68 61 76 65 20 | 61 6e 20 0a 6f 70 74 69 |ns have |an .opti|
|00000640| 6f 6e 61 6c 20 63 6f 6c | 6f 72 20 61 72 67 75 6d |onal col|or argum|
|00000650| 65 6e 74 2e 20 50 6f 73 | 73 69 62 6c 65 20 63 6f |ent. Pos|sible co|
|00000660| 6c 6f 72 73 20 61 72 65 | 20 24 62 6c 61 63 6b 24 |lors are| $black$|
|00000670| 20 28 64 65 66 61 75 6c | 74 29 2c 20 24 77 68 69 | (defaul|t), $whi|
|00000680| 74 65 24 2c 0a 24 62 6c | 75 65 24 2c 20 24 67 72 |te$,.$bl|ue$, $gr|
|00000690| 65 65 6e 24 2c 20 24 72 | 65 64 24 2c 20 24 76 69 |een$, $r|ed$, $vi|
|000006a0| 6f 6c 65 74 24 2c 20 61 | 6e 64 20 24 6f 72 61 6e |olet$, a|nd $oran|
|000006b0| 67 65 24 2e 20 4f 6e 20 | 6d 6f 6e 6f 63 68 72 6f |ge$. On |monochro|
|000006c0| 6d 65 20 64 69 73 70 6c | 61 79 73 20 61 6c 6c 20 |me displ|ays all |
|000006d0| 0a 63 6f 6c 6f 72 73 20 | 64 69 66 66 65 72 65 6e |.colors |differen|
|000006e0| 74 20 66 72 6f 6d 20 24 | 77 68 69 74 65 24 20 61 |t from $|white$ a|
|000006f0| 72 65 20 74 75 72 6e 65 | 64 20 74 6f 20 24 62 6c |re turne|d to $bl|
|00000700| 61 63 6b 24 2e 20 54 68 | 65 72 65 20 61 72 65 20 |ack$. Th|ere are |
|00000710| 36 20 70 61 72 61 6d 65 | 74 65 72 73 20 0a 75 73 |6 parame|ters .us|
|00000720| 65 64 20 62 79 20 74 68 | 65 20 64 72 61 77 69 6e |ed by th|e drawin|
|00000730| 67 20 6f 70 65 72 61 74 | 69 6f 6e 73 3a 0a 5c 62 |g operat|ions:.\b|
|00000740| 65 67 69 6e 69 74 65 6d | 0a 5c 69 74 65 6d 20 7b |eginitem|.\item {|
|00000750| 31 2e 20 7d 20 0a 54 68 | 65 20 7b 5c 73 6c 20 6c |1. } .Th|e {\sl l|
|00000760| 69 6e 65 20 77 69 64 74 | 68 7d 20 70 61 72 61 6d |ine widt|h} param|
|00000770| 65 74 65 72 20 28 64 65 | 66 61 75 6c 74 20 76 61 |eter (de|fault va|
|00000780| 6c 75 65 20 31 20 70 69 | 78 65 6c 29 20 64 65 66 |lue 1 pi|xel) def|
|00000790| 69 6e 65 73 20 74 68 65 | 20 77 69 64 74 68 20 6f |ines the| width o|
|000007a0| 66 20 61 6c 6c 20 0a 6b | 69 6e 64 73 20 6f 66 20 |f all .k|inds of |
|000007b0| 6c 69 6e 65 73 20 28 73 | 65 67 6d 65 6e 74 73 2c |lines (s|egments,|
|000007c0| 20 61 72 72 6f 77 73 2c | 20 65 64 67 65 73 2c 20 | arrows,| edges, |
|000007d0| 63 69 72 63 6c 65 73 2c | 20 70 6f 6c 79 67 6f 6e |circles,| polygon|
|000007e0| 73 29 2e 20 0a 0a 5c 69 | 74 65 6d 20 7b 32 2e 20 |s). ..\i|tem {2. |
|000007f0| 7d 0a 54 68 65 20 7b 5c | 73 6c 20 6c 69 6e 65 20 |}.The {\|sl line |
|00000800| 73 74 79 6c 65 7d 20 70 | 61 72 61 6d 65 74 65 72 |style} p|arameter|
|00000810| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 73 74 79 | defines| the sty|
|00000820| 6c 65 20 6f 66 20 6c 69 | 6e 65 73 2e 20 50 6f 73 |le of li|nes. Pos|
|00000830| 73 69 62 6c 65 20 6c 69 | 6e 65 20 0a 73 74 79 6c |sible li|ne .styl|
|00000840| 65 73 20 61 72 65 20 24 | 73 6f 6c 69 64 24 20 28 |es are $|solid$ (|
|00000850| 64 65 66 61 75 6c 74 29 | 2c 20 24 64 61 73 68 65 |default)|, $dashe|
|00000860| 64 24 2c 20 61 6e 64 20 | 24 64 6f 74 74 65 64 24 |d$, and |$dotted$|
|00000870| 2e 20 0a 0a 5c 69 74 65 | 6d 20 7b 33 2e 20 7d 0a |. ..\ite|m {3. }.|
|00000880| 54 68 65 20 7b 5c 73 6c | 20 6e 6f 64 65 20 77 69 |The {\sl| node wi|
|00000890| 64 74 68 7d 20 70 61 72 | 61 6d 65 74 65 72 20 28 |dth} par|ameter (|
|000008a0| 64 65 66 61 75 6c 74 20 | 76 61 6c 75 65 20 31 30 |default |value 10|
|000008b0| 20 70 69 78 65 6c 73 29 | 20 64 65 66 69 6e 65 73 | pixels)| defines|
|000008c0| 20 74 68 65 20 64 69 61 | 6d 65 74 65 72 20 0a 6f | the dia|meter .o|
|000008d0| 66 20 6e 6f 64 65 73 20 | 63 72 65 61 74 65 64 20 |f nodes |created |
|000008e0| 62 79 20 74 68 65 20 64 | 72 61 77 5c 5f 6e 6f 64 |by the d|raw\_nod|
|000008f0| 65 20 61 6e 64 20 64 72 | 61 77 5c 5f 66 69 6c 6c |e and dr|aw\_fill|
|00000900| 65 64 5c 5f 6e 6f 64 65 | 20 6f 70 65 72 61 74 69 |ed\_node| operati|
|00000910| 6f 6e 73 2e 0a 0a 5c 69 | 74 65 6d 20 7b 34 2e 20 |ons...\i|tem {4. |
|00000920| 7d 0a 54 68 65 20 7b 5c | 73 6c 20 74 65 78 74 20 |}.The {\|sl text |
|00000930| 6d 6f 64 65 7d 20 70 61 | 72 61 6d 65 74 65 72 20 |mode} pa|rameter |
|00000940| 64 65 66 69 6e 65 73 20 | 68 6f 77 20 74 65 78 74 |defines |how text|
|00000950| 20 69 73 20 69 6e 73 65 | 72 74 65 64 20 69 6e 74 | is inse|rted int|
|00000960| 6f 20 74 68 65 20 77 69 | 6e 64 6f 77 2e 0a 50 6f |o the wi|ndow..Po|
|00000970| 73 73 69 62 6c 65 20 76 | 61 6c 75 65 73 20 61 72 |ssible v|alues ar|
|00000980| 65 20 24 74 72 61 6e 73 | 70 61 72 65 6e 74 24 20 |e $trans|parent$ |
|00000990| 28 64 65 66 61 75 6c 74 | 29 20 20 61 6e 64 20 24 |(default|) and $|
|000009a0| 6f 70 61 71 75 65 24 2e | 0a 0a 5c 69 74 65 6d 20 |opaque$.|..\item |
|000009b0| 7b 35 2e 20 7d 0a 54 68 | 65 20 7b 5c 73 6c 20 64 |{5. }.Th|e {\sl d|
|000009c0| 72 61 77 69 6e 67 20 6d | 6f 64 65 7d 20 70 61 72 |rawing m|ode} par|
|000009d0| 61 6d 65 74 65 72 20 64 | 65 66 69 6e 65 73 20 74 |ameter d|efines t|
|000009e0| 68 65 20 6c 6f 67 69 63 | 61 6c 20 6f 70 65 72 61 |he logic|al opera|
|000009f0| 74 69 6f 6e 20 74 68 61 | 74 20 69 73 20 75 73 65 |tion tha|t is use|
|00000a00| 64 0a 66 6f 72 20 73 65 | 74 74 69 6e 67 20 70 69 |d.for se|tting pi|
|00000a10| 78 65 6c 73 20 69 6e 20 | 61 6c 6c 20 64 72 61 77 |xels in |all draw|
|00000a20| 69 6e 67 20 6f 70 65 72 | 61 74 69 6f 6e 73 2e 20 |ing oper|ations. |
|00000a30| 50 6f 73 73 69 62 6c 65 | 20 76 61 6c 75 65 73 20 |Possible| values |
|00000a40| 61 72 65 0a 24 73 72 63 | 5c 5f 6d 6f 64 65 24 20 |are.$src|\_mode$ |
|00000a50| 28 64 65 66 61 75 6c 74 | 29 20 61 6e 64 20 24 78 |(default|) and $x|
|00000a60| 6f 72 5c 5f 6d 6f 64 65 | 24 2e 20 49 6e 20 24 73 |or\_mode|$. In $s|
|00000a70| 72 63 5c 5f 6d 6f 64 65 | 24 20 70 69 78 65 6c 73 |rc\_mode|$ pixels|
|00000a80| 20 61 72 65 20 73 65 74 | 20 74 6f 20 0a 74 68 65 | are set| to .the|
|00000a90| 20 72 65 73 70 65 63 74 | 69 76 65 20 63 6f 6c 6f | respect|ive colo|
|00000aa0| 72 20 76 61 6c 75 65 2c | 20 69 6e 20 24 78 6f 72 |r value,| in $xor|
|00000ab0| 5c 5f 6d 6f 64 65 24 20 | 74 68 65 20 76 61 6c 75 |\_mode$ |the valu|
|00000ac0| 65 20 69 73 20 62 69 74 | 77 69 73 65 20 61 64 64 |e is bit|wise add|
|00000ad0| 65 64 20 74 6f 20 74 68 | 65 20 0a 63 75 72 72 65 |ed to th|e .curre|
|00000ae0| 6e 74 20 70 69 78 65 6c | 20 76 61 6c 75 65 2e 0a |nt pixel| value..|
|00000af0| 0a 5c 69 74 65 6d 20 7b | 36 2e 20 7d 0a 54 68 65 |.\item {|6. }.The|
|00000b00| 20 7b 5c 73 6c 20 72 65 | 64 72 61 77 20 66 75 6e | {\sl re|draw fun|
|00000b10| 63 74 69 6f 6e 7d 20 70 | 61 72 61 6d 65 74 65 72 |ction} p|arameter|
|00000b20| 20 69 73 20 75 73 65 64 | 20 74 6f 20 72 65 64 72 | is used| to redr|
|00000b30| 61 77 20 74 68 65 20 65 | 6e 74 69 72 65 20 77 69 |aw the e|ntire wi|
|00000b40| 6e 64 6f 77 2c 20 0a 77 | 68 65 6e 65 76 65 72 20 |ndow, .w|henever |
|00000b50| 61 20 72 65 64 72 61 77 | 69 6e 67 20 69 73 20 6e |a redraw|ing is n|
|00000b60| 65 63 65 73 73 61 72 79 | 2c 20 65 2e 67 2e 2c 20 |ecessary|, e.g., |
|00000b70| 69 66 20 74 68 65 20 77 | 69 6e 64 6f 77 20 73 68 |if the w|indow sh|
|00000b80| 61 70 65 20 6f 6e 20 74 | 68 65 20 73 63 72 65 65 |ape on t|he scree|
|00000b90| 6e 20 0a 68 61 73 20 20 | 62 65 65 6e 20 63 68 61 |n .has |been cha|
|00000ba0| 6e 67 65 64 2e 20 49 74 | 73 20 74 79 70 65 20 69 |nged. It|s type i|
|00000bb0| 73 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 76 |s pointe|r to a v|
|00000bc0| 6f 69 64 2d 66 75 6e 63 | 74 69 6f 6e 20 74 61 6b |oid-func|tion tak|
|00000bd0| 69 6e 67 20 6e 6f 20 61 | 72 67 75 6d 65 6e 74 73 |ing no a|rguments|
|00000be0| 2c 0a 69 2e 65 2e 2c 20 | 76 6f 69 64 20 28 2a 46 |,.i.e., |void (*F|
|00000bf0| 29 28 29 3b 0a 5c 65 6e | 64 69 74 65 6d 0a 0a 5c |)();.\en|ditem..\|
|00000c00| 64 65 66 5c 76 61 72 20 | 7b 24 57 24 7d 0a 0a 5c |def\var |{$W$}..\|
|00000c10| 62 69 67 73 6b 69 70 0a | 7b 5c 62 66 20 31 2e 20 |bigskip.|{\bf 1. |
|00000c20| 43 72 65 61 74 69 6f 6e | 20 6f 66 20 61 20 67 72 |Creation| of a gr|
|00000c30| 61 70 68 69 63 20 77 69 | 6e 64 6f 77 20 7d 0a 5c |aphic wi|ndow }.\|
|00000c40| 62 69 67 73 6b 69 70 0a | 5c 63 6c 65 61 72 74 61 |bigskip.|\clearta|
|00000c50| 62 73 0a 5c 62 69 67 73 | 6b 69 70 0a 5c 2b 61 29 |bs.\bigs|kip.\+a)|
|00000c60| 20 26 24 77 69 6e 64 6f | 77 24 20 24 57 28 69 6e | &$windo|w$ $W(in|
|00000c70| 74 5c 20 78 70 69 78 2c | 5c 20 69 6e 74 5c 20 79 |t\ xpix,|\ int\ y|
|00000c80| 70 69 78 2c 5c 20 69 6e | 74 5c 20 78 70 6f 73 2c |pix,\ in|t\ xpos,|
|00000c90| 5c 20 69 6e 74 5c 20 79 | 70 6f 73 29 24 3b 5c 63 |\ int\ y|pos)$;\c|
|00000ca0| 72 0a 5c 62 69 67 73 6b | 69 70 0a 5c 2b 62 29 20 |r.\bigsk|ip.\+b) |
|00000cb0| 26 24 77 69 6e 64 6f 77 | 24 20 24 57 28 69 6e 74 |&$window|$ $W(int|
|00000cc0| 5c 20 78 70 69 78 2c 5c | 20 69 6e 74 5c 20 79 70 |\ xpix,\| int\ yp|
|00000cd0| 69 78 29 24 3b 5c 63 72 | 0a 5c 62 69 67 73 6b 69 |ix)$;\cr|.\bigski|
|00000ce0| 70 0a 5c 2b 63 29 20 26 | 24 77 69 6e 64 6f 77 24 |p.\+c) &|$window$|
|00000cf0| 20 24 57 24 3b 5c 63 72 | 0a 5c 62 69 67 73 6b 69 | $W$;\cr|.\bigski|
|00000d00| 70 0a 0a 56 61 72 69 61 | 6e 74 20 61 29 20 63 72 |p..Varia|nt a) cr|
|00000d10| 65 61 74 65 73 20 61 20 | 77 69 6e 64 6f 77 20 24 |eates a |window $|
|00000d20| 57 24 20 6f 66 20 70 68 | 79 73 69 63 61 6c 20 73 |W$ of ph|ysical s|
|00000d30| 69 7a 65 20 24 78 70 69 | 78 20 5c 74 69 6d 65 73 |ize $xpi|x \times|
|00000d40| 20 79 70 69 78 24 20 70 | 69 78 65 6c 73 20 0a 77 | ypix$ p|ixels .w|
|00000d50| 69 74 68 20 69 74 73 20 | 75 70 70 65 72 20 6c 65 |ith its |upper le|
|00000d60| 66 74 20 63 6f 72 6e 65 | 72 20 61 74 20 70 6f 73 |ft corne|r at pos|
|00000d70| 69 74 69 6f 6e 20 28 24 | 78 70 6f 73 2c 79 70 6f |ition ($|xpos,ypo|
|00000d80| 73 24 29 20 6f 6e 20 74 | 68 65 20 73 63 72 65 65 |s$) on t|he scree|
|00000d90| 6e 2c 0a 76 61 72 69 61 | 6e 74 20 62 29 20 70 6c |n,.varia|nt b) pl|
|00000da0| 61 63 65 73 20 24 57 24 | 20 69 6e 74 6f 20 74 68 |aces $W$| into th|
|00000db0| 65 20 75 70 70 65 72 20 | 72 69 67 68 74 20 63 6f |e upper |right co|
|00000dc0| 72 6e 65 72 20 6f 66 20 | 74 68 65 20 73 63 72 65 |rner of |the scre|
|00000dd0| 65 6e 2c 20 61 6e 64 0a | 76 61 72 69 61 6e 74 20 |en, and.|variant |
|00000de0| 63 29 20 63 72 65 61 74 | 65 73 20 61 20 24 38 35 |c) creat|es a $85|
|00000df0| 30 20 5c 74 69 6d 65 73 | 20 38 35 30 24 20 70 69 |0 \times| 850$ pi|
|00000e00| 78 65 6c 20 77 69 6e 64 | 6f 77 20 70 6f 73 69 74 |xel wind|ow posit|
|00000e10| 69 6f 6e 65 64 20 69 6e | 74 6f 20 74 68 65 0a 75 |ioned in|to the.u|
|00000e20| 70 70 65 72 20 72 69 67 | 68 74 20 63 6f 72 6e 65 |pper rig|ht corne|
|00000e30| 72 2e 0a 0a 41 6c 6c 20 | 74 68 72 65 65 20 76 61 |r...All |three va|
|00000e40| 72 69 61 6e 74 73 20 69 | 6e 69 74 69 61 6c 69 7a |riants i|nitializ|
|00000e50| 65 20 74 68 65 20 63 6f | 6f 72 64 69 6e 61 74 65 |e the co|ordinate|
|00000e60| 73 20 6f 66 20 24 57 24 | 20 74 6f 20 24 78 30 20 |s of $W$| to $x0 |
|00000e70| 3d 20 30 24 2c 0a 24 78 | 31 20 3d 20 31 30 30 24 |= 0$,.$x|1 = 100$|
|00000e80| 20 61 6e 64 20 24 79 30 | 20 3d 20 30 24 2e 20 54 | and $y0| = 0$. T|
|00000e90| 68 65 20 24 69 6e 69 74 | 24 20 6f 70 65 72 61 74 |he $init|$ operat|
|00000ea0| 69 6f 6e 20 28 73 65 65 | 20 20 62 65 6c 6f 77 29 |ion (see| below)|
|00000eb0| 20 63 61 6e 20 6c 61 74 | 65 72 20 0a 62 65 20 75 | can lat|er .be u|
|00000ec0| 73 65 64 20 74 6f 20 63 | 68 61 6e 67 65 20 74 68 |sed to c|hange th|
|00000ed0| 65 20 77 69 6e 64 6f 77 | 20 63 6f 6f 72 64 69 6e |e window| coordin|
|00000ee0| 61 74 65 73 20 61 6e 64 | 20 73 63 61 6c 69 6e 67 |ates and| scaling|
|00000ef0| 2e 0a 0a 5c 63 6c 65 61 | 72 74 61 62 73 0a 5c 2b |...\clea|rtabs.\+|
|00000f00| 26 5c 68 73 6b 69 70 20 | 32 2e 32 74 72 75 65 63 |&\hskip |2.2truec|
|00000f10| 6d 20 26 5c 68 73 6b 69 | 70 20 34 74 72 75 65 63 |m &\hski|p 4truec|
|00000f20| 6d 20 26 5c 63 72 0a 7b | 5c 62 66 20 32 2e 20 4f |m &\cr.{|\bf 2. O|
|00000f30| 70 65 72 61 74 69 6f 6e | 73 7d 0a 0a 5c 62 69 67 |peration|s}..\big|
|00000f40| 73 6b 69 70 0a 7b 5c 62 | 66 20 32 2e 31 20 49 6e |skip.{\b|f 2.1 In|
|00000f50| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 7d 0a 5c 6d |itializa|tion}.\m|
|00000f60| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |edskip.\|+\op voi|
|00000f70| 64 20 69 6e 69 74 20 7b | 72 65 61 6c 5c 20 78 5f |d init {|real\ x_|
|00000f80| 30 2c 5c 20 72 65 61 6c | 5c 20 78 5f 31 2c 5c 20 |0,\ real|\ x_1,\ |
|00000f90| 72 65 61 6c 5c 20 79 5f | 30 7d 20 7b 7d 0a 5c 2b |real\ y_|0} {}.\+|
|00000fa0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 7b 73 |\nop | {s|
|00000fb0| 65 74 73 20 74 68 65 20 | 63 6f 6f 72 64 69 6e 61 |ets the |coordina|
|00000fc0| 74 65 73 20 6f 66 20 24 | 57 24 20 74 6f 20 24 78 |tes of $|W$ to $x|
|00000fd0| 5f 30 24 2c 24 78 5f 31 | 24 2c 20 61 6e 64 20 24 |_0$,$x_1|$, and $|
|00000fe0| 79 5f 30 24 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |y_0$}.\m|edskip.\|
|00000ff0| 2b 5c 6f 70 20 76 6f 69 | 64 20 73 65 74 5c 5f 67 |+\op voi|d set\_g|
|00001000| 72 69 64 20 7b 69 6e 74 | 5c 20 64 7d 20 0a 20 20 |rid {int|\ d} . |
|00001010| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 41 | | {A|
|00001020| 64 64 73 20 61 20 72 65 | 63 74 61 6e 67 75 6c 61 |dds a re|ctangula|
|00001030| 72 20 67 72 69 64 20 77 | 69 74 68 20 69 6e 74 65 |r grid w|ith inte|
|00001040| 67 65 72 20 63 6f 6f 72 | 64 69 6e 61 74 65 73 20 |ger coor|dinates |
|00001050| 61 6e 64 20 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |and }.\+|\nop |
|00001060| 20 20 20 20 20 20 7b 67 | 72 69 64 20 64 69 73 74 | {g|rid dist|
|00001070| 61 6e 63 65 20 24 64 24 | 20 74 6f 20 24 57 24 2c |ance $d$| to $W$,|
|00001080| 20 69 66 20 24 64 20 3e | 20 30 24 2e 20 52 65 6d | if $d >| 0$. Rem|
|00001090| 6f 76 65 73 20 67 72 69 | 64 20 66 72 6f 6d 7d 20 |oves gri|d from} |
|000010a0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|000010b0| 20 7b 24 57 24 2c 20 69 | 66 20 24 64 5c 6c 65 20 | {$W$, i|f $d\le |
|000010c0| 30 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |0$.}.\me|dskip.\+|
|000010d0| 5c 6f 70 20 76 6f 69 64 | 20 69 6e 69 74 20 7b 72 |\op void| init {r|
|000010e0| 65 61 6c 5c 20 78 5f 30 | 2c 5c 20 72 65 61 6c 5c |eal\ x_0|,\ real\|
|000010f0| 20 78 5f 31 2c 5c 20 72 | 65 61 6c 5c 20 79 5f 30 | x_1,\ r|eal\ y_0|
|00001100| 2c 5c 20 69 6e 74 5c 20 | 64 7d 20 7b 7d 0a 5c 2b |,\ int\ |d} {}.\+|
|00001110| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 7b 6c |\nop | {l|
|00001120| 69 6b 65 20 69 6e 69 74 | 28 24 78 5f 30 2c 78 5f |ike init|($x_0,x_|
|00001130| 31 2c 79 5f 30 24 29 20 | 66 6f 6c 6c 6f 77 65 64 |1,y_0$) |followed|
|00001140| 20 62 79 20 73 65 74 5c | 5f 67 72 69 64 28 24 64 | by set\|_grid($d|
|00001150| 24 29 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |$)}.\med|skip.\+\|
|00001160| 6f 70 20 76 6f 69 64 20 | 63 6c 65 61 72 20 7b 7d |op void |clear {}|
|00001170| 20 20 20 7b 24 57 24 20 | 69 73 20 65 72 61 73 65 | {$W$ |is erase|
|00001180| 64 2e 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 0a 5c 76 |d.}.\med|skip..\v|
|00001190| 66 69 6c 6c 5c 65 6a 65 | 63 74 0a 0a 5c 62 69 67 |fill\eje|ct..\big|
|000011a0| 73 6b 69 70 0a 7b 5c 62 | 66 20 32 2e 32 20 53 65 |skip.{\b|f 2.2 Se|
|000011b0| 74 74 69 6e 67 20 70 61 | 72 61 6d 65 74 65 72 73 |tting pa|rameters|
|000011c0| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|000011d0| 20 69 6e 74 20 73 65 74 | 5c 5f 6c 69 6e 65 5c 5f | int set|\_line\_|
|000011e0| 77 69 64 74 68 20 7b 69 | 6e 74 5c 20 70 69 78 7d |width {i|nt\ pix}|
|000011f0| 20 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 | {}.\+\|nop |
|00001200| 20 20 20 20 7b 53 65 74 | 73 20 74 68 65 20 6c 69 | {Set|s the li|
|00001210| 6e 65 20 77 69 64 74 68 | 20 70 61 72 61 6d 65 74 |ne width| paramet|
|00001220| 65 72 20 74 6f 20 24 70 | 69 78 24 20 70 69 78 65 |er to $p|ix$ pixe|
|00001230| 6c 73 20 61 6e 64 20 7d | 0a 5c 2b 5c 6e 6f 70 20 |ls and }|.\+\nop |
|00001240| 20 20 20 20 20 20 20 20 | 7b 72 65 74 75 72 6e 73 | |{returns|
|00001250| 20 69 74 73 20 70 72 65 | 76 69 6f 75 73 20 76 61 | its pre|vious va|
|00001260| 6c 75 65 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |lue.}.\m|edskip.\|
|00001270| 2b 5c 6f 70 20 6c 69 6e | 65 5c 5f 73 74 79 6c 65 |+\op lin|e\_style|
|00001280| 20 73 65 74 5c 5f 6c 69 | 6e 65 5c 5f 73 74 79 6c | set\_li|ne\_styl|
|00001290| 65 20 7b 6c 69 6e 65 73 | 74 79 6c 65 5c 20 73 7d |e {lines|tyle\ s}|
|000012a0| 20 20 7b 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 | {}.\+\|nop |
|000012b0| 20 20 20 20 7b 53 65 74 | 73 20 74 68 65 20 6c 69 | {Set|s the li|
|000012c0| 6e 65 20 73 74 79 6c 65 | 20 70 61 72 61 6d 65 74 |ne style| paramet|
|000012d0| 65 72 20 74 6f 20 24 73 | 24 20 61 6e 64 20 72 65 |er to $s|$ and re|
|000012e0| 74 75 72 6e 73 20 69 74 | 73 20 7d 0a 5c 2b 5c 6e |turns it|s }.\+\n|
|000012f0| 6f 70 20 20 20 20 20 20 | 20 20 20 7b 70 72 65 76 |op | {prev|
|00001300| 69 6f 75 73 20 76 61 6c | 75 65 2e 7d 0a 5c 6d 65 |ious val|ue.}.\me|
|00001310| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 69 6e 74 20 |dskip.\+|\op int |
|00001320| 73 65 74 5c 5f 6e 6f 64 | 65 5c 5f 77 69 64 74 68 |set\_nod|e\_width|
|00001330| 20 7b 69 6e 74 5c 20 70 | 69 78 7d 20 20 20 7b 7d | {int\ p|ix} {}|
|00001340| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00001350| 7b 53 65 74 73 20 74 68 | 65 20 6e 6f 64 65 20 77 |{Sets th|e node w|
|00001360| 69 64 74 68 20 70 61 72 | 61 6d 65 74 65 72 20 74 |idth par|ameter t|
|00001370| 6f 20 24 70 69 78 24 20 | 70 69 78 65 6c 73 20 61 |o $pix$ |pixels a|
|00001380| 6e 64 20 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |nd }.\+\|nop |
|00001390| 20 20 20 20 7b 72 65 74 | 75 72 6e 73 20 69 74 73 | {ret|urns its|
|000013a0| 20 70 72 65 76 69 6f 75 | 73 20 76 61 6c 75 65 2e | previou|s value.|
|000013b0| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|000013c0| 20 74 65 78 74 5c 5f 6d | 6f 64 65 20 73 65 74 5c | text\_m|ode set\|
|000013d0| 5f 74 65 78 74 5c 5f 6d | 6f 64 65 20 7b 74 65 78 |_text\_m|ode {tex|
|000013e0| 74 5c 5f 6d 6f 64 65 5c | 20 6d 7d 20 20 20 7b 7d |t\_mode\| m} {}|
|000013f0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00001400| 7b 53 65 74 73 20 74 68 | 65 20 74 65 78 74 20 6d |{Sets th|e text m|
|00001410| 6f 64 65 20 70 61 72 61 | 6d 65 74 65 72 20 74 6f |ode para|meter to|
|00001420| 20 24 6d 24 20 61 6e 64 | 20 72 65 74 75 72 6e 73 | $m$ and| returns|
|00001430| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00001440| 20 7b 69 74 73 20 70 72 | 65 76 69 6f 75 73 20 76 | {its pr|evious v|
|00001450| 61 6c 75 65 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |alue.}.\|medskip.|
|00001460| 5c 2b 5c 6f 70 20 64 72 | 61 77 69 6e 67 5c 5f 6d |\+\op dr|awing\_m|
|00001470| 6f 64 65 20 73 65 74 5c | 5f 6d 6f 64 65 20 7b 64 |ode set\|_mode {d|
|00001480| 72 61 77 69 6e 67 5c 5f | 6d 6f 64 65 5c 20 6d 7d |rawing\_|mode\ m}|
|00001490| 20 20 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 | {}.\+|\nop |
|000014a0| 20 20 20 20 20 7b 53 65 | 74 73 20 74 68 65 20 64 | {Se|ts the d|
|000014b0| 72 61 77 69 6e 67 20 6d | 6f 64 65 20 70 61 72 61 |rawing m|ode para|
|000014c0| 6d 65 74 65 72 20 74 6f | 20 24 6d 24 20 61 6e 64 |meter to| $m$ and|
|000014d0| 20 72 65 74 75 72 6e 73 | 7d 0a 5c 2b 5c 6e 6f 70 | returns|}.\+\nop|
|000014e0| 20 20 20 20 20 20 20 20 | 20 7b 69 74 73 20 70 72 | | {its pr|
|000014f0| 65 76 69 6f 75 73 20 76 | 61 6c 75 65 2e 7d 0a 5c |evious v|alue.}.\|
|00001500| 6d 65 64 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 76 6f |medskip.|\+\op vo|
|00001510| 69 64 20 73 65 74 5c 5f | 72 65 64 72 61 77 20 7b |id set\_|redraw {|
|00001520| 76 6f 69 64 5c 20 28 2a | 46 29 28 29 7d 20 7b 7d |void\ (*|F)()} {}|
|00001530| 20 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 | .\+\nop| |
|00001540| 20 20 7b 53 65 74 73 20 | 74 68 65 20 72 65 64 72 | {Sets |the redr|
|00001550| 61 77 20 66 75 6e 63 74 | 69 6f 6e 20 70 61 72 61 |aw funct|ion para|
|00001560| 6d 65 74 65 72 20 74 6f | 20 24 46 24 2e 7d 20 0a |meter to| $F$.} .|
|00001570| 0a 5c 62 69 67 73 6b 69 | 70 0a 7b 5c 62 66 20 32 |.\bigski|p.{\bf 2|
|00001580| 2e 33 20 52 65 61 64 69 | 6e 67 20 70 61 72 61 6d |.3 Readi|ng param|
|00001590| 65 74 65 72 73 20 61 6e | 64 20 77 69 6e 64 6f 77 |eters an|d window|
|000015a0| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 7d 0a 5c 62 | coordin|ates}.\b|
|000015b0| 69 67 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 69 6e 74 |igskip.\|+\op int|
|000015c0| 20 20 20 20 20 20 20 20 | 20 67 65 74 5c 5f 6c 69 | | get\_li|
|000015d0| 6e 65 5c 5f 77 69 64 74 | 68 20 7b 7d 20 20 20 20 |ne\_widt|h {} |
|000015e0| 20 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|000015f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001600| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 72 | | {r|
|00001610| 65 74 75 72 6e 73 20 74 | 68 65 20 63 75 72 72 65 |eturns t|he curre|
|00001620| 6e 74 20 6c 69 6e 65 20 | 77 69 64 74 68 2e 7d 20 |nt line |width.} |
|00001630| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00001640| 6c 69 6e 65 5c 5f 73 74 | 79 6c 65 20 67 65 74 5c |line\_st|yle get\|
|00001650| 5f 6c 69 6e 65 5c 5f 73 | 74 79 6c 65 20 7b 7d 20 |_line\_s|tyle {} |
|00001660| 20 20 20 20 20 0a 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00001670| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001680| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001690| 20 7b 72 65 74 75 72 6e | 73 20 74 68 65 20 63 75 | {return|s the cu|
|000016a0| 72 72 65 6e 74 20 6c 69 | 6e 65 20 73 74 79 6c 65 |rrent li|ne style|
|000016b0| 2e 7d 20 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |.} .\med|skip.\+\|
|000016c0| 6f 70 20 69 6e 74 20 20 | 20 20 20 20 20 20 20 67 |op int | g|
|000016d0| 65 74 5c 5f 6e 6f 64 65 | 5c 5f 77 69 64 74 68 20 |et\_node|\_width |
|000016e0| 7b 7d 20 20 20 20 20 20 | 0a 20 20 20 20 20 20 20 |{} |. |
|000016f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001700| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001710| 20 20 20 20 7b 72 65 74 | 75 72 6e 73 20 74 68 65 | {ret|urns the|
|00001720| 20 63 75 72 72 65 6e 74 | 20 6e 6f 64 65 20 77 69 | current| node wi|
|00001730| 64 74 68 2e 7d 20 0a 5c | 6d 65 64 73 6b 69 70 0a |dth.} .\|medskip.|
|00001740| 5c 2b 5c 6f 70 20 74 65 | 78 74 5c 5f 6d 6f 64 65 |\+\op te|xt\_mode|
|00001750| 20 20 67 65 74 5c 5f 74 | 65 78 74 5c 5f 6d 6f 64 | get\_t|ext\_mod|
|00001760| 65 20 7b 7d 20 20 20 20 | 20 20 20 0a 20 20 20 20 |e {} | . |
|00001770| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001780| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001790| 20 20 20 20 20 20 20 7b | 72 65 74 75 72 6e 73 20 | {|returns |
|000017a0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 74 65 78 74 |the curr|ent text|
|000017b0| 20 6d 6f 64 65 2e 7d 20 | 0a 5c 6d 65 64 73 6b 69 | mode.} |.\medski|
|000017c0| 70 0a 5c 2b 5c 6f 70 20 | 64 72 61 77 69 6e 67 5c |p.\+\op |drawing\|
|000017d0| 5f 6d 6f 64 65 20 20 67 | 65 74 5c 5f 6d 6f 64 65 |_mode g|et\_mode|
|000017e0| 20 7b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 | {} {}.\|+\nop |
|000017f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001800| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001810| 20 20 7b 72 65 74 75 72 | 6e 73 20 74 68 65 20 63 | {retur|ns the c|
|00001820| 75 72 72 65 6e 74 20 64 | 72 61 77 69 6e 67 20 6d |urrent d|rawing m|
|00001830| 6f 64 65 2e 7d 20 0a 5c | 6d 65 64 73 6b 69 70 0a |ode.} .\|medskip.|
|00001840| 5c 2b 5c 6f 70 20 72 65 | 61 6c 20 20 20 20 20 20 |\+\op re|al |
|00001850| 20 20 78 6d 69 6e 20 7b | 7d 20 20 0a 20 20 20 20 | xmin {|} . |
|00001860| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001870| 20 20 20 20 20 20 20 7b | 72 65 74 75 72 6e 73 20 | {|returns |
|00001880| 24 78 5f 30 24 2c 20 74 | 68 65 20 6d 69 6e 69 6d |$x_0$, t|he minim|
|00001890| 61 6c 20 78 2d 63 6f 6f | 72 64 69 6e 61 74 65 20 |al x-coo|rdinate |
|000018a0| 6f 66 20 24 57 24 2e 7d | 20 0a 5c 6d 65 64 73 6b |of $W$.}| .\medsk|
|000018b0| 69 70 0a 5c 2b 5c 6f 70 | 20 72 65 61 6c 20 20 20 |ip.\+\op| real |
|000018c0| 20 20 20 20 20 79 6d 69 | 6e 20 7b 7d 20 20 0a 20 | ymi|n {} . |
|000018d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018e0| 20 20 20 20 20 20 20 20 | 20 20 7b 72 65 74 75 72 | | {retur|
|000018f0| 6e 73 20 24 79 5f 30 24 | 2c 20 74 68 65 20 6d 69 |ns $y_0$|, the mi|
|00001900| 6e 69 6d 61 6c 20 79 2d | 63 6f 6f 72 64 69 6e 61 |nimal y-|coordina|
|00001910| 74 65 20 6f 66 20 24 57 | 24 2e 7d 20 0a 5c 6d 65 |te of $W|$.} .\me|
|00001920| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 72 65 61 6c |dskip.\+|\op real|
|00001930| 20 20 20 20 20 20 20 20 | 78 6d 61 78 20 7b 7d 20 | |xmax {} |
|00001940| 20 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00001950| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 72 65 | | {re|
|00001960| 74 75 72 6e 73 20 24 78 | 5f 31 24 2c 20 74 68 65 |turns $x|_1$, the|
|00001970| 20 6d 61 78 69 6d 61 6c | 20 78 2d 63 6f 6f 72 64 | maximal| x-coord|
|00001980| 69 6e 61 74 65 20 6f 66 | 20 24 57 24 2e 7d 20 0a |inate of| $W$.} .|
|00001990| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 72 |\medskip|.\+\op r|
|000019a0| 65 61 6c 20 20 20 20 20 | 20 20 20 79 6d 61 78 20 |eal | ymax |
|000019b0| 7b 7d 20 20 0a 20 20 20 | 20 20 20 20 20 20 20 20 |{} . | |
|000019c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000019d0| 7b 72 65 74 75 72 6e 73 | 20 24 79 5f 31 24 2c 20 |{returns| $y_1$, |
|000019e0| 74 68 65 20 6d 61 78 69 | 6d 61 6c 20 79 2d 63 6f |the maxi|mal y-co|
|000019f0| 6f 72 64 69 6e 61 74 65 | 20 6f 66 20 24 57 24 2e |ordinate| of $W$.|
|00001a00| 7d 20 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |} .\meds|kip.\+\o|
|00001a10| 70 20 72 65 61 6c 20 20 | 20 20 20 20 20 20 73 63 |p real | sc|
|00001a20| 61 6c 65 20 7b 7d 20 0a | 20 20 20 20 20 20 20 20 |ale {} .| |
|00001a30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a40| 20 20 20 7b 72 65 74 75 | 72 6e 73 20 74 68 65 20 | {retu|rns the |
|00001a50| 6e 75 6d 62 65 72 20 6f | 66 20 70 69 78 65 6c 73 |number o|f pixels|
|00001a60| 20 6f 66 20 61 20 75 6e | 69 74 20 6c 65 6e 67 74 | of a un|it lengt|
|00001a70| 68 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |h}.\+\no|p |
|00001a80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 6c | | {l|
|00001a90| 69 6e 65 20 73 65 67 6d | 65 6e 74 2e 7d 0a 5c 6d |ine segm|ent.}.\m|
|00001aa0| 65 64 73 6b 69 70 0a 0a | 5c 76 66 69 6c 6c 5c 65 |edskip..|\vfill\e|
|00001ab0| 6a 65 63 74 0a 0a 5c 62 | 69 67 73 6b 69 70 0a 7b |ject..\b|igskip.{|
|00001ac0| 5c 62 66 20 32 2e 34 20 | 44 72 61 77 69 6e 67 20 |\bf 2.4 |Drawing |
|00001ad0| 70 6f 69 6e 74 73 7d 0a | 5c 62 69 67 73 6b 69 70 |points}.|\bigskip|
|00001ae0| 0a 5c 2b 5c 6f 70 20 76 | 6f 69 64 20 64 72 61 77 |.\+\op v|oid draw|
|00001af0| 5c 5f 70 6f 69 6e 74 20 | 7b 72 65 61 6c 5c 20 78 |\_point |{real\ x|
|00001b00| 2c 5c 20 72 65 61 6c 5c | 20 79 2c 5c 20 63 6f 6c |,\ real\| y,\ col|
|00001b10| 6f 72 5c 20 63 3d 62 6c | 61 63 6b 7d 20 7b 7d 0a |or\ c=bl|ack} {}.|
|00001b20| 5c 2b 5c 6e 6f 70 20 20 | 20 20 7b 64 72 61 77 73 |\+\nop | {draws|
|00001b30| 20 74 68 65 20 70 6f 69 | 6e 74 20 24 28 78 2c 79 | the poi|nt $(x,y|
|00001b40| 29 24 20 61 73 20 61 20 | 63 72 6f 73 73 20 6f 66 |)$ as a |cross of|
|00001b50| 20 61 20 76 65 72 74 69 | 63 61 6c 7d 0a 5c 2b 5c | a verti|cal}.\+\|
|00001b60| 6e 6f 70 20 20 20 20 7b | 61 6e 64 20 61 20 68 6f |nop {|and a ho|
|00001b70| 72 69 7a 6f 6e 74 61 6c | 20 73 65 67 6d 65 6e 74 |rizontal| segment|
|00001b80| 20 69 6e 74 65 72 73 65 | 63 74 69 6e 67 20 61 74 | interse|cting at|
|00001b90| 20 24 28 78 2c 79 29 24 | 2e 7d 0a 5c 6d 65 64 73 | $(x,y)$|.}.\meds|
|00001ba0| 6b 69 70 0a 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |kip.\+\o|p void d|
|00001bb0| 72 61 77 5c 5f 70 6f 69 | 6e 74 20 7b 70 6f 69 6e |raw\_poi|nt {poin|
|00001bc0| 74 5c 20 70 2c 5c 20 63 | 3d 62 6c 61 63 6b 7d 20 |t\ p,\ c|=black} |
|00001bd0| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 7b 64 | {}.\+\n|op {d|
|00001be0| 72 61 77 73 20 70 6f 69 | 6e 74 20 28 24 70 24 2e |raws poi|nt ($p$.|
|00001bf0| 78 63 6f 6f 72 64 28 29 | 2c 24 70 24 2e 79 63 6f |xcoord()|,$p$.yco|
|00001c00| 6f 72 64 28 29 29 2e 7d | 0a 25 5c 6d 65 64 73 6b |ord()).}|.%\medsk|
|00001c10| 69 70 0a 25 5c 2b 5c 6f | 70 20 76 6f 69 64 20 64 |ip.%\+\o|p void d|
|00001c20| 72 61 77 20 7b 70 6f 69 | 6e 74 5c 20 70 2c 5c 20 |raw {poi|nt\ p,\ |
|00001c30| 63 3d 62 6c 61 63 6b 7d | 20 20 7b 7d 0a 25 5c 2b |c=black}| {}.%\+|
|00001c40| 5c 6e 6f 70 20 20 20 20 | 7b 73 61 6d 65 20 61 73 |\nop |{same as|
|00001c50| 20 64 72 61 77 5c 5f 70 | 6f 69 6e 74 28 24 70 24 | draw\_p|oint($p$|
|00001c60| 2c 24 63 24 29 2e 7d 0a | 0a 5c 62 69 67 73 6b 69 |,$c$).}.|.\bigski|
|00001c70| 70 0a 7b 5c 62 66 20 32 | 2e 35 20 44 72 61 77 69 |p.{\bf 2|.5 Drawi|
|00001c80| 6e 67 20 6c 69 6e 65 20 | 73 65 67 6d 65 6e 74 73 |ng line |segments|
|00001c90| 7d 0a 5c 62 69 67 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\bigsk|ip.\+\op|
|00001ca0| 20 76 6f 69 64 20 64 72 | 61 77 5c 5f 73 65 67 6d | void dr|aw\_segm|
|00001cb0| 65 6e 74 20 7b 72 65 61 | 6c 5c 20 78 5f 31 2c 5c |ent {rea|l\ x_1,\|
|00001cc0| 20 72 65 61 6c 5c 20 79 | 5f 31 2c 5c 20 72 65 61 | real\ y|_1,\ rea|
|00001cd0| 6c 5c 20 78 5f 32 2c 5c | 20 72 65 61 6c 5c 20 79 |l\ x_2,\| real\ y|
|00001ce0| 5f 32 2c 5c 20 63 6f 6c | 6f 72 5c 20 63 3d 62 6c |_2,\ col|or\ c=bl|
|00001cf0| 61 63 6b 7d 20 7b 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |ack} {}.|\+\nop |
|00001d00| 20 20 7b 64 72 61 77 73 | 20 61 20 6c 69 6e 65 20 | {draws| a line |
|00001d10| 73 65 67 6d 65 6e 74 20 | 66 72 6f 6d 20 24 28 78 |segment |from $(x|
|00001d20| 5f 31 2c 79 5f 31 29 24 | 20 74 6f 20 24 28 78 5f |_1,y_1)$| to $(x_|
|00001d30| 32 2c 79 5f 32 29 24 2e | 7d 0a 5c 6d 65 64 73 6b |2,y_2)$.|}.\medsk|
|00001d40| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00001d50| 61 77 5c 5f 73 65 67 6d | 65 6e 74 20 7b 70 6f 69 |aw\_segm|ent {poi|
|00001d60| 6e 74 5c 20 70 2c 5c 20 | 70 6f 69 6e 74 5c 20 71 |nt\ p,\ |point\ q|
|00001d70| 2c 5c 20 63 6f 6c 6f 72 | 5c 20 63 3d 62 6c 61 63 |,\ color|\ c=blac|
|00001d80| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |k} {}.\+|\nop |
|00001d90| 7b 64 72 61 77 73 20 61 | 20 6c 69 6e 65 20 73 65 |{draws a| line se|
|00001da0| 67 6d 65 6e 74 20 66 72 | 6f 6d 20 70 6f 69 6e 74 |gment fr|om point|
|00001db0| 20 24 70 24 20 74 6f 20 | 70 6f 69 6e 74 20 24 71 | $p$ to |point $q|
|00001dc0| 24 2e 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |$.}.\med|skip.\+\|
|00001dd0| 6f 70 20 76 6f 69 64 20 | 64 72 61 77 5c 5f 73 65 |op void |draw\_se|
|00001de0| 67 6d 65 6e 74 20 7b 73 | 65 67 6d 65 6e 74 5c 20 |gment {s|egment\ |
|00001df0| 73 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 3d 62 6c 61 |s,\ colo|r\ c=bla|
|00001e00| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |ck} {}.\|+\nop |
|00001e10| 20 7b 64 72 61 77 73 20 | 6c 69 6e 65 20 73 65 67 | {draws |line seg|
|00001e20| 6d 65 6e 74 20 24 73 24 | 2e 7d 0a 25 5c 6d 65 64 |ment $s$|.}.%\med|
|00001e30| 73 6b 69 70 0a 25 5c 2b | 5c 6f 70 20 76 6f 69 64 |skip.%\+|\op void|
|00001e40| 20 64 72 61 77 20 7b 73 | 65 67 6d 65 6e 74 5c 20 | draw {s|egment\ |
|00001e50| 73 2c 5c 20 63 3d 62 6c | 61 63 6b 7d 20 20 7b 7d |s,\ c=bl|ack} {}|
|00001e60| 0a 25 5c 2b 5c 6e 6f 70 | 20 20 20 20 7b 73 61 6d |.%\+\nop| {sam|
|00001e70| 65 20 61 73 20 64 72 61 | 77 5c 5f 73 65 67 6d 65 |e as dra|w\_segme|
|00001e80| 6e 74 28 24 73 24 2c 24 | 63 24 29 2e 7d 0a 0a 5c |nt($s$,$|c$).}..\|
|00001e90| 62 69 67 73 6b 69 70 0a | 7b 5c 62 66 20 32 2e 36 |bigskip.|{\bf 2.6|
|00001ea0| 20 44 72 61 77 69 6e 67 | 20 6c 69 6e 65 73 7d 0a | Drawing| lines}.|
|00001eb0| 5c 62 69 67 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\bigskip|.\+\op v|
|00001ec0| 6f 69 64 20 64 72 61 77 | 5c 5f 6c 69 6e 65 20 7b |oid draw|\_line {|
|00001ed0| 72 65 61 6c 5c 20 78 5f | 31 2c 5c 20 72 65 61 6c |real\ x_|1,\ real|
|00001ee0| 5c 20 79 5f 31 2c 5c 20 | 72 65 61 6c 5c 20 78 5f |\ y_1,\ |real\ x_|
|00001ef0| 32 2c 5c 20 72 65 61 6c | 5c 20 79 5f 32 2c 5c 20 |2,\ real|\ y_2,\ |
|00001f00| 63 6f 6c 6f 72 5c 20 63 | 3d 62 6c 61 63 6b 7d 20 |color\ c|=black} |
|00001f10| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 7b 64 72 |{}.\+\no|p {dr|
|00001f20| 61 77 73 20 61 20 73 74 | 72 61 69 67 68 74 20 6c |aws a st|raight l|
|00001f30| 69 6e 65 20 70 61 73 73 | 69 6e 67 20 74 68 72 6f |ine pass|ing thro|
|00001f40| 75 67 68 20 70 6f 69 6e | 74 73 7d 0a 5c 2b 5c 6e |ugh poin|ts}.\+\n|
|00001f50| 6f 70 20 20 20 20 7b 24 | 28 78 5f 31 2c 79 5f 31 |op {$|(x_1,y_1|
|00001f60| 29 24 20 61 6e 64 20 24 | 28 78 5f 32 2c 79 5f 32 |)$ and $|(x_2,y_2|
|00001f70| 29 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |)$.}.\me|dskip.\+|
|00001f80| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 6c |\op void| draw\_l|
|00001f90| 69 6e 65 20 7b 70 6f 69 | 6e 74 5c 20 70 2c 5c 20 |ine {poi|nt\ p,\ |
|00001fa0| 70 6f 69 6e 74 5c 20 71 | 2c 5c 20 63 6f 6c 6f 72 |point\ q|,\ color|
|00001fb0| 5c 20 63 3d 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |\ c=blac|k} {}.\+|
|00001fc0| 5c 6e 6f 70 20 20 20 20 | 7b 64 72 61 77 73 20 61 |\nop |{draws a|
|00001fd0| 20 73 74 72 61 69 67 68 | 74 20 6c 69 6e 65 20 70 | straigh|t line p|
|00001fe0| 61 73 73 69 6e 67 20 74 | 68 72 6f 75 67 68 20 70 |assing t|hrough p|
|00001ff0| 6f 69 6e 74 73 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |oints}.\|+\nop |
|00002000| 20 7b 24 70 24 20 61 6e | 64 20 24 71 24 2e 7d 0a | {$p$ an|d $q$.}.|
|00002010| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00002020| 6f 69 64 20 64 72 61 77 | 5c 5f 6c 69 6e 65 20 7b |oid draw|\_line {|
|00002030| 6c 69 6e 65 5c 20 6c 2c | 5c 20 63 6f 6c 6f 72 5c |line\ l,|\ color\|
|00002040| 20 63 3d 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | c=black|} {}.\+\|
|00002050| 6e 6f 70 20 20 20 20 7b | 64 72 61 77 73 20 6c 69 |nop {|draws li|
|00002060| 6e 65 20 24 6c 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |ne $l$.}|.\medski|
|00002070| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|00002080| 77 5c 5f 68 6c 69 6e 65 | 20 7b 72 65 61 6c 5c 20 |w\_hline| {real\ |
|00002090| 79 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 3d 62 6c 61 |y,\ colo|r\ c=bla|
|000020a0| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |ck} {}.\|+\nop |
|000020b0| 20 7b 64 72 61 77 73 20 | 61 20 68 6f 72 69 7a 6f | {draws |a horizo|
|000020c0| 6e 74 61 6c 20 6c 69 6e | 65 20 77 69 74 68 20 79 |ntal lin|e with y|
|000020d0| 2d 63 6f 6f 72 64 69 6e | 61 74 65 20 24 79 24 2e |-coordin|ate $y$.|
|000020e0| 20 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f | }.\meds|kip.\+\o|
|000020f0| 70 20 76 6f 69 64 20 64 | 72 61 77 5c 5f 76 6c 69 |p void d|raw\_vli|
|00002100| 6e 65 20 7b 72 65 61 6c | 5c 20 78 2c 5c 20 63 6f |ne {real|\ x,\ co|
|00002110| 6c 6f 72 5c 20 63 3d 62 | 6c 61 63 6b 7d 20 7b 7d |lor\ c=b|lack} {}|
|00002120| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 7b 64 72 61 77 |.\+\nop | {draw|
|00002130| 73 20 61 20 76 65 72 74 | 69 63 61 6c 20 6c 69 6e |s a vert|ical lin|
|00002140| 65 20 77 69 74 68 20 78 | 2d 63 6f 6f 72 64 69 6e |e with x|-coordin|
|00002150| 61 74 65 20 24 78 24 2e | 20 7d 0a 25 5c 6d 65 64 |ate $x$.| }.%\med|
|00002160| 73 6b 69 70 0a 25 5c 2b | 5c 6f 70 20 76 6f 69 64 |skip.%\+|\op void|
|00002170| 20 64 72 61 77 20 7b 6c | 69 6e 65 5c 20 6c 2c 5c | draw {l|ine\ l,\|
|00002180| 20 63 3d 62 6c 61 63 6b | 7d 20 20 7b 7d 0a 25 5c | c=black|} {}.%\|
|00002190| 2b 5c 6e 6f 70 20 20 20 | 20 7b 73 61 6d 65 20 61 |+\nop | {same a|
|000021a0| 73 20 64 72 61 77 5c 5f | 6c 69 6e 65 28 24 6c 24 |s draw\_|line($l$|
|000021b0| 2c 24 63 24 29 2e 7d 0a | 0a 0a 5c 62 69 67 73 6b |,$c$).}.|..\bigsk|
|000021c0| 69 70 0a 7b 5c 62 66 20 | 32 2e 37 20 44 72 61 77 |ip.{\bf |2.7 Draw|
|000021d0| 69 6e 67 20 61 72 72 6f | 77 73 7d 0a 5c 62 69 67 |ing arro|ws}.\big|
|000021e0| 73 6b 69 70 0a 5c 2b 5c | 6f 70 20 76 6f 69 64 20 |skip.\+\|op void |
|000021f0| 64 72 61 77 5c 5f 61 72 | 72 6f 77 20 7b 72 65 61 |draw\_ar|row {rea|
|00002200| 6c 5c 20 78 5f 31 2c 5c | 20 72 65 61 6c 5c 20 79 |l\ x_1,\| real\ y|
|00002210| 5f 31 2c 5c 20 72 65 61 | 6c 5c 20 78 5f 32 2c 5c |_1,\ rea|l\ x_2,\|
|00002220| 20 72 65 61 6c 5c 20 79 | 5f 32 2c 5c 20 63 6f 6c | real\ y|_2,\ col|
|00002230| 6f 72 5c 20 63 3d 62 6c | 61 63 6b 7d 20 7b 7d 0a |or\ c=bl|ack} {}.|
|00002240| 5c 2b 5c 6e 6f 70 20 20 | 20 20 7b 64 72 61 77 73 |\+\nop | {draws|
|00002250| 20 61 6e 20 61 72 72 6f | 77 20 70 6f 69 6e 74 69 | an arro|w pointi|
|00002260| 6e 67 20 66 72 6f 6d 20 | 24 28 78 5f 31 2c 79 5f |ng from |$(x_1,y_|
|00002270| 31 29 24 20 74 6f 20 24 | 28 78 5f 32 2c 79 5f 32 |1)$ to $|(x_2,y_2|
|00002280| 29 24 2e 7d 0a 5c 76 66 | 69 6c 6c 5c 65 6a 65 63 |)$.}.\vf|ill\ejec|
|00002290| 74 0a 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |t..\+\op| void dr|
|000022a0| 61 77 5c 5f 61 72 72 6f | 77 20 7b 70 6f 69 6e 74 |aw\_arro|w {point|
|000022b0| 5c 20 70 2c 5c 20 70 6f | 69 6e 74 5c 20 71 2c 5c |\ p,\ po|int\ q,\|
|000022c0| 20 63 6f 6c 6f 72 5c 20 | 63 3d 62 6c 61 63 6b 7d | color\ |c=black}|
|000022d0| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 7b 64 | {}.\+\n|op {d|
|000022e0| 72 61 77 73 20 61 6e 20 | 61 72 72 6f 77 20 70 6f |raws an |arrow po|
|000022f0| 69 6e 74 69 6e 67 20 66 | 72 6f 6d 20 70 6f 69 6e |inting f|rom poin|
|00002300| 74 20 24 70 24 20 74 6f | 20 70 6f 69 6e 74 20 24 |t $p$ to| point $|
|00002310| 71 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |q$.}.\me|dskip.\+|
|00002320| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 61 |\op void| draw\_a|
|00002330| 72 72 6f 77 20 7b 73 65 | 67 6d 65 6e 74 5c 20 73 |rrow {se|gment\ s|
|00002340| 2c 5c 20 63 6f 6c 6f 72 | 5c 20 63 3d 62 6c 61 63 |,\ color|\ c=blac|
|00002350| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |k} {}.\+|\nop |
|00002360| 7b 64 72 61 77 73 20 61 | 6e 20 61 72 72 6f 77 20 |{draws a|n arrow |
|00002370| 70 6f 69 6e 74 69 6e 67 | 20 66 72 6f 6d 20 24 73 |pointing| from $s|
|00002380| 24 2e 73 74 61 72 74 28 | 29 20 74 6f 20 24 73 24 |$.start(|) to $s$|
|00002390| 2e 65 6e 64 28 29 2e 7d | 0a 0a 5c 62 69 67 73 6b |.end().}|..\bigsk|
|000023a0| 69 70 0a 7b 5c 62 66 20 | 32 2e 38 20 44 72 61 77 |ip.{\bf |2.8 Draw|
|000023b0| 69 6e 67 20 63 69 72 63 | 6c 65 73 7d 0a 5c 62 69 |ing circ|les}.\bi|
|000023c0| 67 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 76 6f 69 64 |gskip.\+|\op void|
|000023d0| 20 64 72 61 77 5c 5f 63 | 69 72 63 6c 65 20 7b 72 | draw\_c|ircle {r|
|000023e0| 65 61 6c 5c 20 78 2c 5c | 20 72 65 61 6c 5c 20 79 |eal\ x,\| real\ y|
|000023f0| 2c 5c 20 72 65 61 6c 5c | 20 72 2c 5c 20 63 6f 6c |,\ real\| r,\ col|
|00002400| 6f 72 5c 20 63 20 3d 20 | 62 6c 61 63 6b 7d 20 7b |or\ c = |black} {|
|00002410| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00002420| 20 20 20 7b 64 72 61 77 | 73 20 74 68 65 20 63 69 | {draw|s the ci|
|00002430| 72 63 6c 65 20 77 69 74 | 68 20 63 65 6e 74 65 72 |rcle wit|h center|
|00002440| 20 24 28 78 2c 79 29 24 | 20 61 6e 64 20 72 61 64 | $(x,y)$| and rad|
|00002450| 69 75 73 20 24 72 24 2e | 7d 0a 5c 6d 65 64 73 6b |ius $r$.|}.\medsk|
|00002460| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00002470| 61 77 5c 5f 63 69 72 63 | 6c 65 20 7b 70 6f 69 6e |aw\_circ|le {poin|
|00002480| 74 5c 20 70 2c 5c 20 72 | 65 61 6c 5c 20 72 2c 5c |t\ p,\ r|eal\ r,\|
|00002490| 20 63 6f 6c 6f 72 5c 20 | 63 20 3d 20 62 6c 61 63 | color\ |c = blac|
|000024a0| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 20 20 20 |k} {}.\+|\nop |
|000024b0| 20 20 20 20 20 20 20 7b | 64 72 61 77 73 20 74 68 | {|draws th|
|000024c0| 65 20 63 69 72 63 6c 65 | 20 77 69 74 68 20 63 65 |e circle| with ce|
|000024d0| 6e 74 65 72 20 24 70 24 | 20 61 6e 64 20 72 61 64 |nter $p$| and rad|
|000024e0| 69 75 73 20 24 72 24 2e | 7d 0a 5c 6d 65 64 73 6b |ius $r$.|}.\medsk|
|000024f0| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00002500| 61 77 5c 5f 63 69 72 63 | 6c 65 20 7b 63 69 72 63 |aw\_circ|le {circ|
|00002510| 6c 65 5c 20 43 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |le\ C,\ |color\ c|
|00002520| 20 3d 20 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | = black|} {}.\+\|
|00002530| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 7b 64 |nop | {d|
|00002540| 72 61 77 73 20 63 69 72 | 63 6c 65 20 24 43 24 2e |raws cir|cle $C$.|
|00002550| 7d 0a 25 5c 6d 65 64 73 | 6b 69 70 0a 25 5c 2b 5c |}.%\meds|kip.%\+\|
|00002560| 6f 70 20 76 6f 69 64 20 | 64 72 61 77 20 7b 63 69 |op void |draw {ci|
|00002570| 72 63 6c 65 5c 20 43 2c | 5c 20 63 3d 62 6c 61 63 |rcle\ C,|\ c=blac|
|00002580| 6b 7d 20 20 7b 7d 0a 25 | 5c 2b 5c 6e 6f 70 20 20 |k} {}.%|\+\nop |
|00002590| 20 20 7b 73 61 6d 65 20 | 61 73 20 64 72 61 77 5c | {same |as draw\|
|000025a0| 5f 63 69 72 63 6c 65 28 | 24 43 24 2c 24 63 24 29 |_circle(|$C$,$c$)|
|000025b0| 2e 7d 0a 0a 0a 5c 62 69 | 67 73 6b 69 70 0a 7b 5c |.}...\bi|gskip.{\|
|000025c0| 62 66 20 32 2e 39 20 44 | 72 61 77 69 6e 67 20 64 |bf 2.9 D|rawing d|
|000025d0| 69 73 63 73 7d 0a 5c 62 | 69 67 73 6b 69 70 0a 5c |iscs}.\b|igskip.\|
|000025e0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|000025f0| 64 69 73 63 20 7b 72 65 | 61 6c 5c 20 78 2c 5c 20 |disc {re|al\ x,\ |
|00002600| 72 65 61 6c 5c 20 79 2c | 5c 20 72 65 61 6c 5c 20 |real\ y,|\ real\ |
|00002610| 72 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 20 3d 20 62 |r,\ colo|r\ c = b|
|00002620| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|00002630| 20 20 20 20 20 20 20 20 | 20 20 7b 64 72 61 77 73 | | {draws|
|00002640| 20 61 20 66 69 6c 6c 65 | 64 20 63 69 72 63 6c 65 | a fille|d circle|
|00002650| 20 77 69 74 68 20 63 65 | 6e 74 65 72 20 24 28 78 | with ce|nter $(x|
|00002660| 2c 79 29 24 20 61 6e 64 | 20 72 61 64 69 75 73 20 |,y)$ and| radius |
|00002670| 24 72 24 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |$r$.}.\m|edskip.\|
|00002680| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00002690| 64 69 73 63 20 7b 70 6f | 69 6e 74 5c 20 70 2c 5c |disc {po|int\ p,\|
|000026a0| 20 72 65 61 6c 5c 20 72 | 2c 5c 20 63 6f 6c 6f 72 | real\ r|,\ color|
|000026b0| 5c 20 63 20 3d 20 62 6c | 61 63 6b 7d 20 7b 7d 0a |\ c = bl|ack} {}.|
|000026c0| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|000026d0| 20 7b 64 72 61 77 73 20 | 61 20 66 69 6c 6c 65 64 | {draws |a filled|
|000026e0| 20 63 69 72 63 6c 65 20 | 77 69 74 68 20 63 65 6e | circle |with cen|
|000026f0| 74 65 72 20 24 70 24 20 | 61 6e 64 20 72 61 64 69 |ter $p$ |and radi|
|00002700| 75 73 20 24 72 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |us $r$.}|.\medski|
|00002710| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|00002720| 77 5c 5f 64 69 73 63 20 | 7b 63 69 72 63 6c 65 5c |w\_disc |{circle\|
|00002730| 20 43 2c 5c 20 63 6f 6c | 6f 72 5c 20 63 20 3d 20 | C,\ col|or\ c = |
|00002740| 62 6c 61 63 6b 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |black} {|}.\+\nop|
|00002750| 20 20 20 20 20 20 20 20 | 20 20 20 7b 64 72 61 77 | | {draw|
|00002760| 73 20 66 69 6c 6c 65 64 | 20 63 69 72 63 6c 65 20 |s filled| circle |
|00002770| 24 43 24 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 0a |$C$.}.\m|edskip..|
|00002780| 5c 62 69 67 73 6b 69 70 | 0a 7b 5c 62 66 20 32 2e |\bigskip|.{\bf 2.|
|00002790| 31 30 20 44 72 61 77 69 | 6e 67 20 70 6f 6c 79 67 |10 Drawi|ng polyg|
|000027a0| 6f 6e 73 20 7d 0a 5c 62 | 69 67 73 6b 69 70 0a 5c |ons }.\b|igskip.\|
|000027b0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|000027c0| 70 6f 6c 79 67 6f 6e 20 | 7b 6c 69 73 74 28 70 6f |polygon |{list(po|
|000027d0| 69 6e 74 29 5c 20 6c 70 | 2c 5c 20 63 6f 6c 6f 72 |int)\ lp|,\ color|
|000027e0| 5c 20 63 3d 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |\ c=blac|k} {}.\+|
|000027f0| 5c 6e 6f 70 20 7b 64 72 | 61 77 73 20 74 68 65 20 |\nop {dr|aws the |
|00002800| 70 6f 6c 79 67 6f 6e 20 | 77 69 74 68 20 76 65 72 |polygon |with ver|
|00002810| 74 65 78 20 73 65 71 75 | 65 6e 63 65 20 24 6c 70 |tex sequ|ence $lp|
|00002820| 24 2e 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |$.}.\med|skip.\+\|
|00002830| 6f 70 20 76 6f 69 64 20 | 64 72 61 77 5c 5f 70 6f |op void |draw\_po|
|00002840| 6c 79 67 6f 6e 20 7b 70 | 6f 6c 79 67 6f 6e 5c 20 |lygon {p|olygon\ |
|00002850| 50 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 3d 62 6c 61 |P,\ colo|r\ c=bla|
|00002860| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 7b 64 |ck} {}.\|+\nop {d|
|00002870| 72 61 77 73 20 70 6f 6c | 79 67 6f 6e 20 24 50 24 |raws pol|ygon $P$|
|00002880| 2e 7d 0a 25 5c 6d 65 64 | 73 6b 69 70 0a 25 5c 2b |.}.%\med|skip.%\+|
|00002890| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 20 7b 70 |\op void| draw {p|
|000028a0| 6f 6c 79 67 6f 6e 5c 20 | 50 2c 5c 20 63 3d 62 6c |olygon\ |P,\ c=bl|
|000028b0| 61 63 6b 7d 20 20 7b 7d | 0a 25 5c 2b 5c 6e 6f 70 |ack} {}|.%\+\nop|
|000028c0| 20 20 20 20 7b 73 61 6d | 65 20 61 73 20 64 72 61 | {sam|e as dra|
|000028d0| 77 5c 5f 70 6f 6c 79 67 | 6f 6e 28 24 50 24 2c 24 |w\_polyg|on($P$,$|
|000028e0| 63 24 29 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |c$).}.\m|edskip.\|
|000028f0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00002900| 66 69 6c 6c 65 64 5c 5f | 70 6f 6c 79 67 6f 6e 20 |filled\_|polygon |
|00002910| 7b 6c 69 73 74 28 70 6f | 69 6e 74 29 5c 20 6c 70 |{list(po|int)\ lp|
|00002920| 2c 5c 20 63 6f 6c 6f 72 | 5c 20 63 3d 62 6c 61 63 |,\ color|\ c=blac|
|00002930| 6b 7d 20 7b 7d 0a 5c 2b | 5c 6e 6f 70 20 7b 64 72 |k} {}.\+|\nop {dr|
|00002940| 61 77 73 20 74 68 65 20 | 66 69 6c 6c 65 64 20 70 |aws the |filled p|
|00002950| 6f 6c 79 67 6f 6e 20 77 | 69 74 68 20 76 65 72 74 |olygon w|ith vert|
|00002960| 65 78 20 73 65 71 75 65 | 6e 63 65 20 24 6c 70 24 |ex seque|nce $lp$|
|00002970| 2e 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |.}.\meds|kip.\+\o|
|00002980| 70 20 76 6f 69 64 20 64 | 72 61 77 5c 5f 66 69 6c |p void d|raw\_fil|
|00002990| 6c 65 64 5c 5f 70 6f 6c | 79 67 6f 6e 20 7b 70 6f |led\_pol|ygon {po|
|000029a0| 6c 79 67 6f 6e 5c 20 50 | 2c 5c 20 63 6f 6c 6f 72 |lygon\ P|,\ color|
|000029b0| 5c 20 63 3d 62 6c 61 63 | 6b 7d 20 7b 7d 0a 5c 2b |\ c=blac|k} {}.\+|
|000029c0| 5c 6e 6f 70 20 7b 64 72 | 61 77 73 20 66 69 6c 6c |\nop {dr|aws fill|
|000029d0| 65 64 20 70 6f 6c 79 67 | 6f 6e 20 24 50 24 2e 7d |ed polyg|on $P$.}|
|000029e0| 0a 5c 6d 65 64 73 6b 69 | 70 0a 0a 5c 76 66 69 6c |.\medski|p..\vfil|
|000029f0| 6c 5c 65 6a 65 63 74 0a | 0a 5c 62 69 67 73 6b 69 |l\eject.|.\bigski|
|00002a00| 70 0a 7b 5c 62 66 20 32 | 2e 31 31 20 44 72 61 77 |p.{\bf 2|.11 Draw|
|00002a10| 69 6e 67 20 66 75 6e 63 | 74 69 6f 6e 73 7d 0a 5c |ing func|tions}.\|
|00002a20| 62 69 67 73 6b 69 70 0a | 5c 2b 5c 6f 70 20 76 6f |bigskip.|\+\op vo|
|00002a30| 69 64 20 70 6c 6f 74 5c | 5f 78 79 20 7b 72 65 61 |id plot\|_xy {rea|
|00002a40| 6c 5c 20 78 5f 30 2c 5c | 20 72 65 61 6c 5c 20 78 |l\ x_0,\| real\ x|
|00002a50| 5f 31 2c 5c 20 28 72 65 | 61 6c 29 28 2a 46 29 28 |_1,\ (re|al)(*F)(|
|00002a60| 72 65 61 6c 29 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 |real),\ |color\ c|
|00002a70| 20 3d 20 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | = black|} {}.\+\|
|00002a80| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nop | |
|00002a90| 20 20 7b 64 72 61 77 73 | 20 66 75 6e 63 74 69 6f | {draws| functio|
|00002aa0| 6e 20 24 46 24 20 69 6e | 20 72 61 6e 67 65 20 24 |n $F$ in| range $|
|00002ab0| 5b 78 5f 30 2c 78 5f 31 | 5d 24 2c 20 69 2e 65 2e |[x_0,x_1|]$, i.e.|
|00002ac0| 2c 20 61 6c 6c 20 70 6f | 69 6e 74 73 7d 0a 5c 2b |, all po|ints}.\+|
|00002ad0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 20 |\nop | |
|00002ae0| 20 20 20 7b 24 28 78 2c | 79 29 24 20 77 69 74 68 | {$(x,|y)$ with|
|00002af0| 20 24 79 20 3d 20 46 28 | 78 29 24 20 61 6e 64 20 | $y = F(|x)$ and |
|00002b00| 24 78 5f 30 5c 6c 65 20 | 78 5c 6c 65 20 78 5f 31 |$x_0\le |x\le x_1|
|00002b10| 24 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |$}.\meds|kip.\+\o|
|00002b20| 70 20 76 6f 69 64 20 70 | 6c 6f 74 5c 5f 79 78 20 |p void p|lot\_yx |
|00002b30| 7b 72 65 61 6c 5c 20 79 | 5f 30 2c 5c 20 72 65 61 |{real\ y|_0,\ rea|
|00002b40| 6c 5c 20 79 5f 31 2c 5c | 20 28 72 65 61 6c 29 28 |l\ y_1,\| (real)(|
|00002b50| 2a 46 29 28 72 65 61 6c | 29 2c 5c 20 63 6f 6c 6f |*F)(real|),\ colo|
|00002b60| 72 5c 20 63 20 3d 20 62 | 6c 61 63 6b 7d 20 7b 7d |r\ c = b|lack} {}|
|00002b70| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00002b80| 20 20 20 20 20 20 7b 64 | 72 61 77 73 20 66 75 6e | {d|raws fun|
|00002b90| 63 74 69 6f 6e 20 24 46 | 24 20 69 6e 20 72 61 6e |ction $F|$ in ran|
|00002ba0| 67 65 20 24 5b 79 5f 30 | 2c 79 5f 31 5d 24 2c 20 |ge $[y_0|,y_1]$, |
|00002bb0| 69 2e 65 2e 2c 20 61 6c | 6c 20 70 6f 69 6e 74 73 |i.e., al|l points|
|00002bc0| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00002bd0| 20 20 20 20 20 20 20 7b | 24 28 78 2c 79 29 24 20 | {|$(x,y)$ |
|00002be0| 77 69 74 68 20 24 78 20 | 3d 20 46 28 79 29 24 20 |with $x |= F(y)$ |
|00002bf0| 61 6e 64 20 24 79 5f 30 | 5c 6c 65 20 79 5c 6c 65 |and $y_0|\le y\le|
|00002c00| 20 79 5f 31 24 7d 0a 0a | 0a 5c 62 69 67 73 6b 69 | y_1$}..|.\bigski|
|00002c10| 70 0a 7b 5c 62 66 20 32 | 2e 31 32 20 44 72 61 77 |p.{\bf 2|.12 Draw|
|00002c20| 69 6e 67 20 74 65 78 74 | 7d 0a 5c 62 69 67 73 6b |ing text|}.\bigsk|
|00002c30| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00002c40| 61 77 5c 5f 74 65 78 74 | 20 7b 72 65 61 6c 5c 20 |aw\_text| {real\ |
|00002c50| 78 2c 5c 20 72 65 61 6c | 5c 20 79 2c 5c 20 73 74 |x,\ real|\ y,\ st|
|00002c60| 72 69 6e 67 5c 20 73 2c | 5c 20 63 6f 6c 6f 72 5c |ring\ s,|\ color\|
|00002c70| 20 63 20 3d 20 62 6c 61 | 63 6b 7d 20 7b 7d 0a 5c | c = bla|ck} {}.\|
|00002c80| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00002c90| 20 20 20 20 7b 77 72 69 | 74 65 73 20 73 74 72 69 | {wri|tes stri|
|00002ca0| 6e 67 20 24 73 24 20 73 | 74 61 72 74 69 6e 67 20 |ng $s$ s|tarting |
|00002cb0| 61 74 20 70 6f 73 69 74 | 69 6f 6e 20 24 28 78 2c |at posit|ion $(x,|
|00002cc0| 79 29 24 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |y)$.}.\m|edskip.\|
|00002cd0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00002ce0| 74 65 78 74 20 7b 70 6f | 69 6e 74 5c 20 70 2c 5c |text {po|int\ p,\|
|00002cf0| 20 73 74 72 69 6e 67 5c | 20 73 2c 5c 20 63 6f 6c | string\| s,\ col|
|00002d00| 6f 72 5c 20 63 20 3d 20 | 62 6c 61 63 6b 7d 20 7b |or\ c = |black} {|
|00002d10| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00002d20| 20 20 20 20 20 20 20 7b | 77 72 69 74 65 73 20 73 | {|writes s|
|00002d30| 74 72 69 6e 67 20 24 73 | 24 20 73 74 61 72 74 69 |tring $s|$ starti|
|00002d40| 6e 67 20 61 74 20 70 6f | 73 69 74 69 6f 6e 20 24 |ng at po|sition $|
|00002d50| 70 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |p$.}.\me|dskip.\+|
|00002d60| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 63 |\op void| draw\_c|
|00002d70| 74 65 78 74 20 7b 72 65 | 61 6c 5c 20 78 2c 5c 20 |text {re|al\ x,\ |
|00002d80| 72 65 61 6c 5c 20 79 2c | 5c 20 73 74 72 69 6e 67 |real\ y,|\ string|
|00002d90| 5c 20 73 2c 5c 20 63 6f | 6c 6f 72 5c 20 63 20 3d |\ s,\ co|lor\ c =|
|00002da0| 20 62 6c 61 63 6b 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f | black} |{}.\+\no|
|00002db0| 70 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |p | |
|00002dc0| 7b 77 72 69 74 65 73 20 | 73 74 72 69 6e 67 20 24 |{writes |string $|
|00002dd0| 73 24 20 63 65 6e 74 65 | 72 65 64 20 61 74 20 70 |s$ cente|red at p|
|00002de0| 6f 73 69 74 69 6f 6e 20 | 24 28 78 2c 79 29 24 2e |osition |$(x,y)$.|
|00002df0| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|00002e00| 20 76 6f 69 64 20 64 72 | 61 77 5c 5f 63 74 65 78 | void dr|aw\_ctex|
|00002e10| 74 20 7b 70 6f 69 6e 74 | 5c 20 70 2c 5c 20 73 74 |t {point|\ p,\ st|
|00002e20| 72 69 6e 67 5c 20 73 2c | 5c 20 63 6f 6c 6f 72 5c |ring\ s,|\ color\|
|00002e30| 20 63 20 3d 20 62 6c 61 | 63 6b 7d 20 7b 7d 0a 5c | c = bla|ck} {}.\|
|00002e40| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00002e50| 20 20 20 20 7b 77 72 69 | 74 65 73 20 73 74 72 69 | {wri|tes stri|
|00002e60| 6e 67 20 24 73 24 20 63 | 65 6e 74 65 72 65 64 20 |ng $s$ c|entered |
|00002e70| 61 74 20 70 6f 73 69 74 | 69 6f 6e 20 24 70 24 2e |at posit|ion $p$.|
|00002e80| 7d 0a 0a 0a 0a 0a 5c 62 | 69 67 73 6b 69 70 0a 7b |}.....\b|igskip.{|
|00002e90| 5c 62 66 20 32 2e 31 33 | 20 44 72 61 77 69 6e 67 |\bf 2.13| Drawing|
|00002ea0| 20 6e 6f 64 65 73 7d 0a | 0a 4e 6f 64 65 73 20 61 | nodes}.|.Nodes a|
|00002eb0| 72 65 20 63 69 72 63 6c | 65 73 20 6f 66 20 64 69 |re circl|es of di|
|00002ec0| 61 6d 65 74 65 72 20 24 | 6e 6f 64 65 5c 5f 77 69 |ameter $|node\_wi|
|00002ed0| 64 74 68 24 2e 0a 5c 62 | 69 67 73 6b 69 70 0a 5c |dth$..\b|igskip.\|
|00002ee0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00002ef0| 6e 6f 64 65 20 7b 72 65 | 61 6c 5c 20 20 78 5f 30 |node {re|al\ x_0|
|00002f00| 2c 5c 20 72 65 61 6c 5c | 20 79 5f 30 2c 5c 20 63 |,\ real\| y_0,\ c|
|00002f10| 6f 6c 6f 72 5c 20 63 20 | 3d 20 62 6c 61 63 6b 7d |olor\ c |= black}|
|00002f20| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00002f30| 20 20 20 20 20 20 20 20 | 20 7b 64 72 61 77 73 20 | | {draws |
|00002f40| 61 20 6e 6f 64 65 20 61 | 74 20 70 6f 73 69 74 69 |a node a|t positi|
|00002f50| 6f 6e 20 24 28 78 5f 30 | 2c 79 5f 30 29 24 2e 7d |on $(x_0|,y_0)$.}|
|00002f60| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00002f70| 76 6f 69 64 20 64 72 61 | 77 5c 5f 6e 6f 64 65 20 |void dra|w\_node |
|00002f80| 7b 70 6f 69 6e 74 5c 20 | 70 2c 5c 20 63 6f 6c 6f |{point\ |p,\ colo|
|00002f90| 72 5c 20 63 20 3d 20 62 | 6c 61 63 6b 7d 20 7b 7d |r\ c = b|lack} {}|
|00002fa0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00002fb0| 20 20 20 20 20 20 7b 64 | 72 61 77 73 20 61 20 6e | {d|raws a n|
|00002fc0| 6f 64 65 20 61 74 20 70 | 6f 73 69 74 69 6f 6e 20 |ode at p|osition |
|00002fd0| 24 70 24 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |$p$.}.\m|edskip.\|
|00002fe0| 2b 5c 6f 70 20 76 6f 69 | 64 20 64 72 61 77 5c 5f |+\op voi|d draw\_|
|00002ff0| 66 69 6c 6c 65 64 5c 5f | 6e 6f 64 65 20 7b 72 65 |filled\_|node {re|
|00003000| 61 6c 5c 20 20 78 5f 30 | 2c 5c 20 72 65 61 6c 5c |al\ x_0|,\ real\|
|00003010| 20 20 79 5f 30 2c 5c 20 | 63 6f 6c 6f 72 5c 20 63 | y_0,\ |color\ c|
|00003020| 20 3d 20 62 6c 61 63 6b | 7d 20 7b 7d 0a 5c 2b 5c | = black|} {}.\+\|
|00003030| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nop | |
|00003040| 20 20 7b 64 72 61 77 73 | 20 61 20 66 69 6c 6c 65 | {draws| a fille|
|00003050| 64 20 6e 6f 64 65 20 61 | 74 20 70 6f 73 69 74 69 |d node a|t positi|
|00003060| 6f 6e 20 24 28 78 5f 30 | 2c 79 5f 30 29 24 2e 7d |on $(x_0|,y_0)$.}|
|00003070| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00003080| 76 6f 69 64 20 64 72 61 | 77 5c 5f 66 69 6c 6c 65 |void dra|w\_fille|
|00003090| 64 5c 5f 6e 6f 64 65 20 | 7b 70 6f 69 6e 74 5c 20 |d\_node |{point\ |
|000030a0| 70 2c 5c 20 63 6f 6c 6f | 72 5c 20 63 20 3d 20 62 |p,\ colo|r\ c = b|
|000030b0| 6c 61 63 6b 7d 20 7b 7d | 0a 5c 2b 5c 6e 6f 70 20 |lack} {}|.\+\nop |
|000030c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 64 | | {d|
|000030d0| 72 61 77 73 20 61 20 66 | 69 6c 6c 65 64 20 6e 6f |raws a f|illed no|
|000030e0| 64 65 20 61 74 20 70 6f | 73 69 74 69 6f 6e 20 24 |de at po|sition $|
|000030f0| 70 24 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |p$.}.\me|dskip.\+|
|00003100| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 74 |\op void| draw\_t|
|00003110| 65 78 74 5c 5f 6e 6f 64 | 65 20 7b 72 65 61 6c 5c |ext\_nod|e {real\|
|00003120| 20 20 78 2c 5c 20 72 65 | 61 6c 5c 20 20 79 2c 5c | x,\ re|al\ y,\|
|00003130| 20 73 74 72 69 6e 67 5c | 20 73 2c 5c 20 63 6f 6c | string\| s,\ col|
|00003140| 6f 72 5c 20 63 20 3d 20 | 62 6c 61 63 6b 7d 20 7b |or\ c = |black} {|
|00003150| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00003160| 20 20 20 20 20 20 20 7b | 64 72 61 77 73 20 61 20 | {|draws a |
|00003170| 6e 6f 64 65 20 66 69 6c | 6c 65 64 20 77 69 74 68 |node fil|led with|
|00003180| 20 73 74 72 69 6e 67 20 | 24 73 24 20 61 74 20 70 | string |$s$ at p|
|00003190| 6f 73 69 74 69 6f 6e 7d | 0a 5c 2b 5c 6e 6f 70 20 |osition}|.\+\nop |
|000031a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 24 | | {$|
|000031b0| 28 78 5f 30 2c 79 5f 30 | 29 24 2e 20 7d 0a 5c 6d |(x_0,y_0|)$. }.\m|
|000031c0| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |edskip.\|+\op voi|
|000031d0| 64 20 64 72 61 77 5c 5f | 74 65 78 74 5c 5f 6e 6f |d draw\_|text\_no|
|000031e0| 64 65 20 7b 70 6f 69 6e | 74 5c 20 70 2c 5c 20 73 |de {poin|t\ p,\ s|
|000031f0| 74 72 69 6e 67 5c 20 73 | 2c 5c 20 63 6f 6c 6f 72 |tring\ s|,\ color|
|00003200| 5c 20 63 20 3d 20 62 6c | 61 63 6b 7d 20 7b 7d 0a |\ c = bl|ack} {}.|
|00003210| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003220| 20 20 20 20 20 7b 64 72 | 61 77 73 20 61 20 6e 6f | {dr|aws a no|
|00003230| 64 65 20 66 69 6c 6c 65 | 64 20 77 69 74 68 20 73 |de fille|d with s|
|00003240| 74 72 69 6e 67 20 24 73 | 24 20 61 74 20 70 6f 73 |tring $s|$ at pos|
|00003250| 69 74 69 6f 6e 20 24 70 | 24 2e 20 7d 0a 25 5c 2b |ition $p|$. }.%\+|
|00003260| 5c 6f 70 20 76 6f 69 64 | 20 64 72 61 77 5c 5f 69 |\op void| draw\_i|
|00003270| 6e 74 5c 5f 6e 6f 64 65 | 20 7b 72 65 61 6c 5c 20 |nt\_node| {real\ |
|00003280| 20 78 2c 5c 20 72 65 61 | 6c 5c 20 20 79 2c 5c 20 | x,\ rea|l\ y,\ |
|00003290| 69 6e 74 5c 20 69 2c 5c | 20 63 6f 6c 6f 72 5c 20 |int\ i,\| color\ |
|000032a0| 63 20 3d 20 62 6c 61 63 | 6b 7d 20 7b 7d 0a 25 5c |c = blac|k} {}.%\|
|000032b0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|000032c0| 20 20 20 20 7b 64 72 61 | 77 73 20 61 20 6e 6f 64 | {dra|ws a nod|
|000032d0| 65 20 66 69 6c 6c 65 64 | 20 77 69 74 68 20 69 6e |e filled| with in|
|000032e0| 74 65 67 65 72 20 24 69 | 24 20 61 74 20 70 6f 73 |teger $i|$ at pos|
|000032f0| 69 74 69 6f 6e 20 7d 0a | 25 5c 2b 5c 6e 6f 70 20 |ition }.|%\+\nop |
|00003300| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7b 24 | | {$|
|00003310| 28 78 5f 30 2c 79 5f 30 | 29 24 2e 20 7d 0a 25 5c |(x_0,y_0|)$. }.%\|
|00003320| 6d 65 64 73 6b 69 70 0a | 25 5c 2b 5c 6f 70 20 76 |medskip.|%\+\op v|
|00003330| 6f 69 64 20 64 72 61 77 | 5c 5f 69 6e 74 5c 5f 6e |oid draw|\_int\_n|
|00003340| 6f 64 65 20 7b 70 6f 69 | 6e 74 5c 20 70 2c 5c 20 |ode {poi|nt\ p,\ |
|00003350| 69 6e 74 5c 20 69 2c 5c | 20 63 6f 6c 6f 72 5c 20 |int\ i,\| color\ |
|00003360| 63 20 3d 20 62 6c 61 63 | 6b 7d 20 7b 7d 0a 25 5c |c = blac|k} {}.%\|
|00003370| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00003380| 20 20 20 20 7b 64 72 61 | 77 73 20 61 20 6e 6f 64 | {dra|ws a nod|
|00003390| 65 20 66 69 6c 6c 65 64 | 20 77 69 74 68 20 69 6e |e filled| with in|
|000033a0| 74 65 67 65 72 20 24 69 | 24 20 61 74 20 6e 6f 64 |teger $i|$ at nod|
|000033b0| 65 20 24 70 24 2e 20 7d | 0a 0a 5c 62 69 67 73 6b |e $p$. }|..\bigsk|
|000033c0| 69 70 0a 7b 5c 62 66 20 | 32 2e 31 34 20 44 72 61 |ip.{\bf |2.14 Dra|
|000033d0| 77 69 6e 67 20 65 64 67 | 65 73 7d 0a 0a 45 64 67 |wing edg|es}..Edg|
|000033e0| 65 73 20 61 72 65 20 73 | 74 72 61 69 67 74 68 20 |es are s|traigth |
|000033f0| 6c 69 6e 65 20 73 65 67 | 6d 65 6e 74 73 20 6f 72 |line seg|ments or|
|00003400| 20 61 72 72 6f 77 73 20 | 77 69 74 68 20 61 20 63 | arrows |with a c|
|00003410| 6c 65 61 72 61 6e 63 65 | 20 6f 66 20 0a 24 6e 6f |learance| of .$no|
|00003420| 64 65 5c 5f 77 69 64 74 | 68 2f 32 24 20 61 74 20 |de\_widt|h/2$ at |
|00003430| 65 61 63 68 20 65 6e 64 | 2e 0a 5c 62 69 67 73 6b |each end|..\bigsk|
|00003440| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00003450| 61 77 5c 5f 65 64 67 65 | 20 7b 72 65 61 6c 5c 20 |aw\_edge| {real\ |
|00003460| 20 78 5f 31 2c 20 5c 20 | 72 65 61 6c 5c 20 79 5f | x_1, \ |real\ y_|
|00003470| 31 2c 20 5c 20 72 65 61 | 6c 5c 20 78 5f 32 2c 20 |1, \ rea|l\ x_2, |
|00003480| 5c 20 72 65 61 6c 5c 20 | 79 5f 32 2c 5c 20 63 6f |\ real\ |y_2,\ co|
|00003490| 6c 6f 72 5c 20 63 20 3d | 20 62 6c 61 63 6b 7d 20 |lor\ c =| black} |
|000034a0| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |{}.\+\no|p |
|000034b0| 20 20 20 20 20 20 20 20 | 7b 64 72 61 77 73 20 61 | |{draws a|
|000034c0| 6e 20 65 64 67 65 20 66 | 72 6f 6d 20 24 28 78 5f |n edge f|rom $(x_|
|000034d0| 31 2c 79 5f 31 29 24 20 | 74 6f 20 24 28 78 5f 32 |1,y_1)$ |to $(x_2|
|000034e0| 2c 79 5f 32 29 24 2e 7d | 0a 5c 6d 65 64 73 6b 69 |,y_2)$.}|.\medski|
|000034f0| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 64 72 61 |p.\+\op |void dra|
|00003500| 77 5c 5f 65 64 67 65 20 | 7b 70 6f 69 6e 74 5c 20 |w\_edge |{point\ |
|00003510| 70 2c 5c 20 70 6f 69 6e | 74 5c 20 71 2c 5c 20 63 |p,\ poin|t\ q,\ c|
|00003520| 6f 6c 6f 72 5c 20 63 20 | 3d 20 62 6c 61 63 6b 7d |olor\ c |= black}|
|00003530| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00003540| 20 20 20 20 20 20 20 20 | 20 7b 64 72 61 77 73 20 | | {draws |
|00003550| 61 6e 20 65 64 67 65 20 | 66 72 6f 6d 20 24 70 24 |an edge |from $p$|
|00003560| 20 74 6f 20 24 71 24 2e | 7d 0a 5c 6d 65 64 73 6b | to $q$.|}.\medsk|
|00003570| 69 70 0a 5c 2b 5c 6f 70 | 20 76 6f 69 64 20 64 72 |ip.\+\op| void dr|
|00003580| 61 77 5c 5f 65 64 67 65 | 20 7b 73 65 67 6d 65 6e |aw\_edge| {segmen|
|00003590| 74 5c 20 73 2c 5c 20 63 | 6f 6c 6f 72 5c 20 63 20 |t\ s,\ c|olor\ c |
|000035a0| 3d 20 62 6c 61 63 6b 7d | 20 7b 7d 0a 5c 2b 5c 6e |= black}| {}.\+\n|
|000035b0| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|000035c0| 20 7b 64 72 61 77 73 20 | 61 6e 20 65 64 67 65 20 | {draws |an edge |
|000035d0| 66 72 6f 6d 20 24 73 24 | 2e 73 74 61 72 74 28 29 |from $s$|.start()|
|000035e0| 20 74 6f 20 24 73 24 2e | 65 6e 64 28 29 2e 7d 0a | to $s$.|end().}.|
|000035f0| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 20 76 |\medskip|.\+\op v|
|00003600| 6f 69 64 20 64 72 61 77 | 5c 5f 65 64 67 65 5c 5f |oid draw|\_edge\_|
|00003610| 61 72 72 6f 77 20 7b 72 | 65 61 6c 5c 20 20 78 5f |arrow {r|eal\ x_|
|00003620| 31 2c 20 5c 20 72 65 61 | 6c 5c 20 79 5f 31 2c 20 |1, \ rea|l\ y_1, |
|00003630| 5c 20 72 65 61 6c 5c 20 | 78 5f 32 2c 20 5c 20 72 |\ real\ |x_2, \ r|
|00003640| 65 61 6c 5c 20 79 5f 32 | 2c 5c 20 63 6f 6c 6f 72 |eal\ y_2|,\ color|
|00003650| 5c 20 63 20 3d 20 62 6c | 61 63 6b 7d 20 7b 7d 0a |\ c = bl|ack} {}.|
|00003660| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003670| 20 20 20 20 20 7b 64 72 | 61 77 73 20 61 20 64 69 | {dr|aws a di|
|00003680| 72 65 63 74 65 64 20 65 | 64 67 65 20 66 72 6f 6d |rected e|dge from|
|00003690| 20 24 28 78 5f 31 2c 79 | 5f 31 29 24 20 74 6f 20 | $(x_1,y|_1)$ to |
|000036a0| 24 28 78 5f 32 2c 79 5f | 32 29 24 2e 7d 0a 5c 6d |$(x_2,y_|2)$.}.\m|
|000036b0| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |edskip.\|+\op voi|
|000036c0| 64 20 64 72 61 77 5c 5f | 65 64 67 65 5c 5f 61 72 |d draw\_|edge\_ar|
|000036d0| 72 6f 77 20 7b 70 6f 69 | 6e 74 5c 20 70 2c 5c 20 |row {poi|nt\ p,\ |
|000036e0| 70 6f 69 6e 74 5c 20 71 | 2c 5c 20 63 6f 6c 6f 72 |point\ q|,\ color|
|000036f0| 5c 20 63 20 3d 20 62 6c | 61 63 6b 7d 20 7b 7d 0a |\ c = bl|ack} {}.|
|00003700| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003710| 20 20 20 20 20 7b 64 72 | 61 77 73 20 61 20 64 69 | {dr|aws a di|
|00003720| 72 65 63 74 65 64 20 65 | 64 67 65 20 66 72 6f 6d |rected e|dge from|
|00003730| 20 24 70 24 20 74 6f 20 | 24 71 24 2e 7d 0a 5c 6d | $p$ to |$q$.}.\m|
|00003740| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 76 6f 69 |edskip.\|+\op voi|
|00003750| 64 20 64 72 61 77 5c 5f | 65 64 67 65 5c 5f 61 72 |d draw\_|edge\_ar|
|00003760| 72 6f 77 20 7b 73 65 67 | 6d 65 6e 74 5c 20 73 2c |row {seg|ment\ s,|
|00003770| 5c 20 63 6f 6c 6f 72 5c | 20 63 20 3d 20 62 6c 61 |\ color\| c = bla|
|00003780| 63 6b 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |ck} {}.\|+\nop |
|00003790| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 64 72 61 | | {dra|
|000037a0| 77 73 20 61 20 64 69 72 | 65 63 74 65 64 20 65 64 |ws a dir|ected ed|
|000037b0| 67 65 20 66 72 6f 6d 20 | 24 73 24 2e 73 74 61 72 |ge from |$s$.star|
|000037c0| 74 28 29 20 74 6f 20 24 | 73 24 2e 65 6e 64 28 29 |t() to $|s$.end()|
|000037d0| 2e 7d 20 0a 0a 0a 0a 5c | 62 69 67 73 6b 69 70 0a |.} ....\|bigskip.|
|000037e0| 7b 5c 62 66 20 32 2e 31 | 35 20 4d 6f 75 73 65 20 |{\bf 2.1|5 Mouse |
|000037f0| 49 6e 70 75 74 7d 0a 5c | 62 69 67 73 6b 69 70 0a |Input}.\|bigskip.|
|00003800| 5c 2b 5c 6f 70 20 69 6e | 74 20 20 20 72 65 61 64 |\+\op in|t read|
|00003810| 5c 5f 6d 6f 75 73 65 20 | 7b 7d 0a 20 20 20 20 20 |\_mouse |{}. |
|00003820| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 64 69 73 | | {dis|
|00003830| 70 6c 61 79 73 20 74 68 | 65 20 6d 6f 75 73 65 20 |plays th|e mouse |
|00003840| 63 75 72 73 6f 72 20 75 | 6e 74 69 6c 20 61 20 62 |cursor u|ntil a b|
|00003850| 75 74 74 6f 6e 20 69 73 | 20 70 72 65 73 73 65 64 |utton is| pressed|
|00003860| 2e 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |.}.\+\no|p |
|00003870| 20 20 20 20 7b 52 65 74 | 75 72 6e 73 20 69 6e 74 | {Ret|urns int|
|00003880| 65 67 65 72 20 31 20 66 | 6f 72 20 74 68 65 20 6c |eger 1 f|or the l|
|00003890| 65 66 74 2c 20 32 20 66 | 6f 72 20 74 68 65 20 6d |eft, 2 f|or the m|
|000038a0| 69 64 64 6c 65 2c 20 61 | 6e 64 7d 0a 5c 2b 5c 6e |iddle, a|nd}.\+\n|
|000038b0| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 33 20 |op | {3 |
|000038c0| 66 6f 72 20 74 68 65 20 | 72 69 67 68 74 20 62 75 |for the |right bu|
|000038d0| 74 74 6f 6e 20 28 2d 31 | 2c 2d 32 2c 2d 33 2c 20 |tton (-1|,-2,-3, |
|000038e0| 69 66 20 74 68 65 20 73 | 68 69 66 74 20 6b 65 79 |if the s|hift key|
|000038f0| 20 69 73 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 | is}.\+\|nop |
|00003900| 20 20 20 20 20 20 7b 70 | 72 65 73 73 65 64 20 73 | {p|ressed s|
|00003910| 69 6d 75 6c 74 61 6e 65 | 6f 75 73 6c 79 29 2e 7d |imultane|ously).}|
|00003920| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00003930| 69 6e 74 20 20 20 72 65 | 61 64 5c 5f 6d 6f 75 73 |int re|ad\_mous|
|00003940| 65 20 7b 72 65 61 6c 5c | 26 5c 20 78 2c 5c 20 72 |e {real\|&\ x,\ r|
|00003950| 65 61 6c 5c 26 5c 20 79 | 7d 20 20 7b 7d 0a 5c 2b |eal\&\ y|} {}.\+|
|00003960| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 7b |\nop | {|
|00003970| 64 69 73 70 6c 61 79 73 | 20 74 68 65 20 6d 6f 75 |displays| the mou|
|00003980| 73 65 20 63 75 72 73 6f | 72 20 6f 6e 20 74 68 65 |se curso|r on the|
|00003990| 20 73 63 72 65 65 6e 20 | 75 6e 74 69 6c 20 61 7d | screen |until a}|
|000039a0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|000039b0| 20 20 7b 62 75 74 74 6f | 6e 20 69 73 20 70 72 65 | {butto|n is pre|
|000039c0| 73 73 65 64 2e 20 57 68 | 65 6e 20 61 20 62 75 74 |ssed. Wh|en a but|
|000039d0| 74 6f 6e 20 69 73 20 70 | 72 65 73 73 65 64 20 74 |ton is p|ressed t|
|000039e0| 68 65 20 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |he }.\+\|nop |
|000039f0| 20 20 20 20 20 20 7b 63 | 75 72 72 65 6e 74 20 70 | {c|urrent p|
|00003a00| 6f 73 69 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 63 |osition |of the c|
|00003a10| 75 72 73 6f 72 20 69 73 | 20 61 73 73 69 67 6e 65 |ursor is| assigne|
|00003a20| 64 20 74 6f 20 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |d to }.\|+\nop |
|00003a30| 20 20 20 20 20 20 20 20 | 7b 74 6f 20 24 28 78 2c | |{to $(x,|
|00003a40| 79 29 24 20 61 6e 64 20 | 74 68 65 20 70 72 65 73 |y)$ and |the pres|
|00003a50| 73 65 64 20 62 75 74 74 | 6f 6e 20 69 73 20 72 65 |sed butt|on is re|
|00003a60| 74 75 72 6e 65 64 2e 7d | 0a 5c 6d 65 64 73 6b 69 |turned.}|.\medski|
|00003a70| 70 0a 5c 2b 5c 6f 70 20 | 69 6e 74 20 20 20 72 65 |p.\+\op |int re|
|00003a80| 61 64 5c 5f 6d 6f 75 73 | 65 5c 5f 73 65 67 20 7b |ad\_mous|e\_seg {|
|00003a90| 72 65 61 6c 5c 20 78 5f | 30 2c 5c 20 72 65 61 6c |real\ x_|0,\ real|
|00003aa0| 5c 20 79 5f 30 2c 5c 20 | 72 65 61 6c 5c 26 5c 20 |\ y_0,\ |real\&\ |
|00003ab0| 78 2c 5c 20 72 65 61 6c | 5c 26 5c 20 79 7d 20 20 |x,\ real|\&\ y} |
|00003ac0| 7b 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |{}.\+\no|p |
|00003ad0| 20 20 20 20 7b 64 69 73 | 70 6c 61 79 73 20 61 20 | {dis|plays a |
|00003ae0| 6c 69 6e 65 20 73 65 67 | 6d 65 6e 74 20 66 72 6f |line seg|ment fro|
|00003af0| 6d 20 24 28 78 5f 30 2c | 79 5f 30 29 24 20 74 6f |m $(x_0,|y_0)$ to|
|00003b00| 20 74 68 65 20 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 | the }.\|+\nop |
|00003b10| 20 20 20 20 20 20 20 20 | 7b 63 75 72 72 65 6e 74 | |{current|
|00003b20| 20 63 75 72 73 6f 72 20 | 70 6f 73 69 74 69 6f 6e | cursor |position|
|00003b30| 20 75 6e 74 69 6c 20 61 | 20 6d 6f 75 73 65 20 62 | until a| mouse b|
|00003b40| 75 74 74 6f 6e 20 69 73 | 7d 0a 5c 2b 5c 6e 6f 70 |utton is|}.\+\nop|
|00003b50| 20 20 20 20 20 20 20 20 | 20 20 20 7b 70 72 65 73 | | {pres|
|00003b60| 73 65 64 2e 20 57 68 65 | 6e 20 61 20 62 75 74 74 |sed. Whe|n a butt|
|00003b70| 6f 6e 20 69 73 20 70 72 | 65 73 73 65 64 20 74 68 |on is pr|essed th|
|00003b80| 65 20 63 75 72 72 65 6e | 74 7d 0a 5c 2b 5c 6e 6f |e curren|t}.\+\no|
|00003b90| 70 20 20 20 20 20 20 20 | 20 20 20 20 7b 70 6f 73 |p | {pos|
|00003ba0| 69 74 69 6f 6e 20 69 73 | 20 61 73 73 69 67 6e 65 |ition is| assigne|
|00003bb0| 64 20 74 6f 20 24 28 78 | 2c 79 29 24 20 61 6e 64 |d to $(x|,y)$ and|
|00003bc0| 20 74 68 65 20 70 72 65 | 73 73 65 64 7d 0a 5c 2b | the pre|ssed}.\+|
|00003bd0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 7b |\nop | {|
|00003be0| 62 75 74 74 6f 6e 20 69 | 73 20 72 65 74 75 72 6e |button i|s return|
|00003bf0| 65 64 2e 7d 0a 5c 6d 65 | 64 73 6b 69 70 0a 5c 2b |ed.}.\me|dskip.\+|
|00003c00| 5c 6f 70 20 69 6e 74 20 | 20 20 72 65 61 64 5c 5f |\op int | read\_|
|00003c10| 6d 6f 75 73 65 5c 5f 72 | 65 63 74 20 7b 72 65 61 |mouse\_r|ect {rea|
|00003c20| 6c 5c 20 78 5f 30 2c 5c | 20 72 65 61 6c 5c 20 79 |l\ x_0,\| real\ y|
|00003c30| 5f 30 2c 5c 20 72 65 61 | 6c 5c 26 5c 20 78 2c 5c |_0,\ rea|l\&\ x,\|
|00003c40| 20 72 65 61 6c 5c 26 5c | 20 79 7d 20 20 7b 7d 0a | real\&\| y} {}.|
|00003c50| 5c 2b 5c 6e 6f 70 20 20 | 20 20 20 20 20 20 20 20 |\+\nop | |
|00003c60| 20 7b 64 69 73 70 6c 61 | 79 73 20 61 20 72 65 63 | {displa|ys a rec|
|00003c70| 74 61 6e 67 6c 65 20 77 | 69 74 68 20 64 69 61 67 |tangle w|ith diag|
|00003c80| 6f 6e 61 6c 20 66 72 6f | 6d 20 24 28 78 5f 30 2c |onal fro|m $(x_0,|
|00003c90| 79 5f 30 29 24 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |y_0)$}.\|+\nop |
|00003ca0| 20 20 20 20 20 20 20 20 | 7b 74 6f 20 74 68 65 20 | |{to the |
|00003cb0| 63 75 72 72 65 6e 74 20 | 63 75 72 73 6f 72 20 70 |current |cursor p|
|00003cc0| 6f 73 69 74 69 6f 6e 20 | 75 6e 74 69 6c 20 61 20 |osition |until a |
|00003cd0| 6d 6f 75 73 65 20 62 75 | 74 74 6f 6e 7d 0a 5c 2b |mouse bu|tton}.\+|
|00003ce0| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 7b |\nop | {|
|00003cf0| 69 73 20 70 72 65 73 73 | 65 64 2e 20 57 68 65 6e |is press|ed. When|
|00003d00| 20 61 20 62 75 74 74 6f | 6e 20 69 73 20 70 72 65 | a butto|n is pre|
|00003d10| 73 73 65 64 20 74 68 65 | 20 63 75 72 72 65 6e 74 |ssed the| current|
|00003d20| 7d 0a 5c 2b 5c 6e 6f 70 | 20 20 20 20 20 20 20 20 |}.\+\nop| |
|00003d30| 20 20 20 7b 70 6f 73 69 | 74 69 6f 6e 20 69 73 20 | {posi|tion is |
|00003d40| 61 73 73 69 67 6e 65 64 | 20 74 6f 20 24 28 78 2c |assigned| to $(x,|
|00003d50| 79 29 24 20 61 6e 64 20 | 74 68 65 20 70 72 65 73 |y)$ and |the pres|
|00003d60| 73 65 64 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |sed}.\+\|nop |
|00003d70| 20 20 20 20 20 20 7b 20 | 62 75 74 74 6f 6e 20 69 | { |button i|
|00003d80| 73 20 72 65 74 75 72 6e | 65 64 2e 7d 0a 5c 6d 65 |s return|ed.}.\me|
|00003d90| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 69 6e 74 20 |dskip.\+|\op int |
|00003da0| 20 20 72 65 61 64 5c 5f | 6d 6f 75 73 65 5c 5f 63 | read\_|mouse\_c|
|00003db0| 69 72 63 6c 65 20 7b 72 | 65 61 6c 5c 20 78 5f 30 |ircle {r|eal\ x_0|
|00003dc0| 2c 5c 20 72 65 61 6c 5c | 20 79 5f 30 2c 5c 20 72 |,\ real\| y_0,\ r|
|00003dd0| 65 61 6c 5c 26 5c 20 78 | 2c 5c 20 72 65 61 6c 5c |eal\&\ x|,\ real\|
|00003de0| 26 5c 20 79 7d 20 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 |&\ y} {|}.\+\nop|
|00003df0| 20 20 20 20 20 20 20 20 | 20 20 20 7b 64 69 73 70 | | {disp|
|00003e00| 6c 61 79 73 20 61 20 63 | 69 72 63 6c 65 20 77 69 |lays a c|ircle wi|
|00003e10| 74 68 20 63 65 6e 74 65 | 72 20 24 28 78 5f 30 2c |th cente|r $(x_0,|
|00003e20| 79 5f 30 29 24 20 70 61 | 73 73 69 6e 67 7d 0a 5c |y_0)$ pa|ssing}.\|
|00003e30| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|00003e40| 7b 74 68 72 6f 75 67 68 | 20 74 68 65 20 63 75 72 |{through| the cur|
|00003e50| 72 65 6e 74 20 63 75 72 | 73 6f 72 20 70 6f 73 69 |rent cur|sor posi|
|00003e60| 74 69 6f 6e 20 75 6e 74 | 69 6c 20 61 20 6d 6f 75 |tion unt|il a mou|
|00003e70| 73 65 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 |se}.\+\n|op |
|00003e80| 20 20 20 20 20 7b 62 75 | 74 74 6f 6e 20 69 73 20 | {bu|tton is |
|00003e90| 70 72 65 73 73 65 64 2e | 20 57 68 65 6e 20 61 20 |pressed.| When a |
|00003ea0| 62 75 74 74 6f 6e 20 69 | 73 20 70 72 65 73 73 65 |button i|s presse|
|00003eb0| 64 20 74 68 65 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |d the}.\|+\nop |
|00003ec0| 20 20 20 20 20 20 20 20 | 7b 63 75 72 72 65 6e 74 | |{current|
|00003ed0| 20 70 6f 73 69 74 69 6f | 6e 20 69 73 20 61 73 73 | positio|n is ass|
|00003ee0| 69 67 6e 65 64 20 74 6f | 20 24 28 78 2c 79 29 24 |igned to| $(x,y)$|
|00003ef0| 20 61 6e 64 20 74 68 65 | 7d 0a 5c 2b 5c 6e 6f 70 | and the|}.\+\nop|
|00003f00| 20 20 20 20 20 20 20 20 | 20 20 20 7b 70 72 65 73 | | {pres|
|00003f10| 73 65 64 20 62 75 74 74 | 6f 6e 20 69 73 20 72 65 |sed butt|on is re|
|00003f20| 74 75 72 6e 65 64 2e 7d | 0a 5c 6d 65 64 73 6b 69 |turned.}|.\medski|
|00003f30| 70 0a 5c 2b 5c 6f 70 20 | 62 6f 6f 6c 20 20 63 6f |p.\+\op |bool co|
|00003f40| 6e 66 69 72 6d 20 7b 73 | 74 72 69 6e 67 5c 20 73 |nfirm {s|tring\ s|
|00003f50| 7d 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |} . | |
|00003f60| 20 20 20 20 7b 64 69 73 | 70 6c 61 79 73 20 73 74 | {dis|plays st|
|00003f70| 72 69 6e 67 20 24 73 24 | 20 61 6e 64 20 61 73 6b |ring $s$| and ask|
|00003f80| 73 20 66 6f 72 20 63 6f | 6e 66 69 72 6d 61 74 69 |s for co|nfirmati|
|00003f90| 6f 6e 2e 7d 0a 5c 2b 5c | 6e 6f 70 20 20 20 20 20 |on.}.\+\|nop |
|00003fa0| 20 20 20 20 20 20 7b 52 | 65 74 75 72 6e 73 20 74 | {R|eturns t|
|00003fb0| 72 75 65 20 69 66 66 20 | 74 68 65 20 61 6e 73 77 |rue iff |the answ|
|00003fc0| 65 72 20 77 61 73 20 60 | 60 79 65 73 27 27 2e 7d |er was `|`yes''.}|
|00003fd0| 0a 5c 6d 65 64 73 6b 69 | 70 0a 5c 2b 5c 6f 70 20 |.\medski|p.\+\op |
|00003fe0| 62 6f 6f 6c 20 20 61 63 | 6b 6e 6f 77 6c 65 64 67 |bool ac|knowledg|
|00003ff0| 65 20 7b 73 74 72 69 6e | 67 5c 20 73 7d 20 7b 7d |e {strin|g\ s} {}|
|00004000| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00004010| 20 20 7b 64 69 73 70 6c | 61 79 73 20 73 74 72 69 | {displ|ays stri|
|00004020| 6e 67 20 24 73 24 20 61 | 6e 64 20 61 73 6b 73 20 |ng $s$ a|nd asks |
|00004030| 66 6f 72 20 61 63 6b 6e | 6f 77 6c 65 64 67 65 6d |for ackn|owledgem|
|00004040| 65 6e 74 2e 7d 0a 5c 6d | 65 64 73 6b 69 70 0a 5c |ent.}.\m|edskip.\|
|00004050| 2b 5c 6f 70 20 69 6e 74 | 20 20 72 65 61 64 5c 5f |+\op int| read\_|
|00004060| 70 61 6e 65 6c 20 7b 73 | 74 72 69 6e 67 5c 20 68 |panel {s|tring\ h|
|00004070| 2c 5c 20 69 6e 74 5c 20 | 6e 2c 5c 20 73 74 72 69 |,\ int\ |n,\ stri|
|00004080| 6e 67 2a 5c 20 53 7d 20 | 7b 7d 0a 5c 2b 5c 6e 6f |ng*\ S} |{}.\+\no|
|00004090| 70 20 20 20 20 20 20 20 | 20 20 20 20 7b 64 69 73 |p | {dis|
|000040a0| 70 6c 61 79 73 20 61 20 | 70 61 6e 65 6c 20 77 69 |plays a |panel wi|
|000040b0| 74 68 20 68 65 61 64 65 | 72 20 24 68 24 20 61 6e |th heade|r $h$ an|
|000040c0| 64 20 61 6e 20 61 72 72 | 61 79 20 24 53 5b 31 2e |d an arr|ay $S[1.|
|000040d0| 2e 6e 5d 24 20 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 |.n]$ }.\|+\nop |
|000040e0| 20 20 20 20 20 20 20 20 | 7b 6f 66 20 24 6e 24 20 | |{of $n$ |
|000040f0| 73 74 72 69 6e 67 20 62 | 75 74 74 6f 6e 73 2c 20 |string b|uttons, |
|00004100| 72 65 74 75 72 6e 73 20 | 74 68 65 20 69 6e 64 65 |returns |the inde|
|00004110| 78 20 6f 66 20 74 68 65 | 20 73 65 6c 65 63 74 65 |x of the| selecte|
|00004120| 64 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |d}.\+\no|p |
|00004130| 20 20 20 20 7b 62 75 74 | 74 6f 6e 2e 7d 0a 5c 6d | {but|ton.}.\m|
|00004140| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 20 69 6e 74 |edskip.\|+\op int|
|00004150| 20 20 72 65 61 64 5c 5f | 76 70 61 6e 65 6c 20 7b | read\_|vpanel {|
|00004160| 73 74 72 69 6e 67 5c 20 | 68 2c 5c 20 69 6e 74 5c |string\ |h,\ int\|
|00004170| 20 6e 2c 5c 20 73 74 72 | 69 6e 67 2a 5c 20 53 7d | n,\ str|ing*\ S}|
|00004180| 20 7b 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 | {}.\+\n|op |
|00004190| 20 20 20 20 20 7b 6c 69 | 6b 65 20 72 65 61 64 5c | {li|ke read\|
|000041a0| 5f 70 61 6e 65 6c 20 77 | 69 74 68 20 76 65 72 74 |_panel w|ith vert|
|000041b0| 69 63 61 6c 20 62 75 74 | 74 6f 6e 20 6c 61 79 6f |ical but|ton layo|
|000041c0| 75 74 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |ut}.\med|skip.\+\|
|000041d0| 6f 70 20 69 6e 74 20 20 | 72 65 61 64 5c 5f 69 6e |op int |read\_in|
|000041e0| 74 20 7b 73 74 72 69 6e | 67 5c 20 70 7d 20 7b 7d |t {strin|g\ p} {}|
|000041f0| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00004200| 20 20 7b 64 69 73 70 6c | 61 79 73 20 61 20 70 61 | {displ|ays a pa|
|00004210| 6e 65 6c 20 77 69 74 68 | 20 70 72 6f 6d 70 74 20 |nel with| prompt |
|00004220| 24 70 24 20 66 6f 72 20 | 69 6e 74 65 67 65 72 20 |$p$ for |integer |
|00004230| 69 6e 70 75 74 2c 7d 0a | 5c 2b 5c 6e 6f 70 20 20 |input,}.|\+\nop |
|00004240| 20 20 20 20 20 20 20 20 | 20 7b 72 65 74 75 72 6e | | {return|
|00004250| 73 20 74 68 65 20 69 6e | 70 75 74 7d 0a 5c 6d 65 |s the in|put}.\me|
|00004260| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 20 72 65 61 6c |dskip.\+|\op real|
|00004270| 20 20 72 65 61 64 5c 5f | 72 65 61 6c 20 7b 73 74 | read\_|real {st|
|00004280| 72 69 6e 67 5c 20 70 7d | 20 7b 7d 0a 5c 2b 5c 6e |ring\ p}| {}.\+\n|
|00004290| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 64 69 |op | {di|
|000042a0| 73 70 6c 61 79 73 20 61 | 20 70 61 6e 65 6c 20 77 |splays a| panel w|
|000042b0| 69 74 68 20 70 72 6f 6d | 70 74 20 24 70 24 20 66 |ith prom|pt $p$ f|
|000042c0| 6f 72 20 72 65 61 6c 20 | 69 6e 70 75 74 7d 0a 5c |or real |input}.\|
|000042d0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|000042e0| 7b 72 65 74 75 72 6e 73 | 20 74 68 65 20 69 6e 70 |{returns| the inp|
|000042f0| 75 74 7d 0a 5c 6d 65 64 | 73 6b 69 70 0a 5c 2b 5c |ut}.\med|skip.\+\|
|00004300| 6f 70 20 73 74 72 69 6e | 67 20 20 72 65 61 64 5c |op strin|g read\|
|00004310| 5f 73 74 72 69 6e 67 20 | 7b 73 74 72 69 6e 67 5c |_string |{string\|
|00004320| 20 70 7d 20 7b 7d 0a 5c | 2b 5c 6e 6f 70 20 20 20 | p} {}.\|+\nop |
|00004330| 20 20 20 20 20 20 20 20 | 7b 64 69 73 70 6c 61 79 | |{display|
|00004340| 73 20 61 20 70 61 6e 65 | 6c 20 77 69 74 68 20 70 |s a pane|l with p|
|00004350| 72 6f 6d 70 74 20 24 70 | 24 20 66 6f 72 20 73 74 |rompt $p|$ for st|
|00004360| 72 69 6e 67 20 69 6e 70 | 75 74 2c 7d 0a 5c 2b 5c |ring inp|ut,}.\+\|
|00004370| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 7b 72 |nop | {r|
|00004380| 65 74 75 72 6e 73 20 74 | 68 65 20 69 6e 70 75 74 |eturns t|he input|
|00004390| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|000043a0| 20 73 74 72 69 6e 67 20 | 20 72 65 61 64 5c 5f 73 | string | read\_s|
|000043b0| 74 72 69 6e 67 20 7b 73 | 74 72 69 6e 67 5c 20 70 |tring {s|tring\ p|
|000043c0| 2c 5c 20 6c 69 73 74 28 | 73 74 72 69 6e 67 29 5c |,\ list(|string)\|
|000043d0| 20 6d 65 6e 75 7d 20 7b | 7d 0a 5c 2b 5c 6e 6f 70 | menu} {|}.\+\nop|
|000043e0| 20 20 20 20 20 20 20 20 | 20 20 20 7b 61 73 20 61 | | {as a|
|000043f0| 62 6f 76 65 2c 20 61 64 | 64 73 20 61 6e 20 61 64 |bove, ad|ds an ad|
|00004400| 64 69 74 69 6f 6e 61 6c | 20 6d 65 6e 75 20 62 75 |ditional| menu bu|
|00004410| 74 74 6f 6e 20 77 68 69 | 63 68 7d 0a 5c 2b 5c 6e |tton whi|ch}.\+\n|
|00004420| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 7b 63 61 |op | {ca|
|00004430| 6e 20 62 65 20 75 73 65 | 64 20 74 6f 20 73 65 6c |n be use|d to sel|
|00004440| 65 63 74 20 61 20 73 74 | 72 69 6e 67 20 66 72 6f |ect a st|ring fro|
|00004450| 6d 20 24 6d 65 6e 75 24 | 2e 7d 0a 5c 6d 65 64 73 |m $menu$|.}.\meds|
|00004460| 6b 69 70 0a 5c 2b 5c 6f | 70 20 73 74 72 69 6e 67 |kip.\+\o|p string|
|00004470| 20 20 72 65 61 64 5c 5f | 73 74 72 69 6e 67 20 7b | read\_|string {|
|00004480| 73 74 72 69 6e 67 5c 20 | 70 2c 5c 20 73 74 72 69 |string\ |p,\ stri|
|00004490| 6e 67 5c 20 6c 2c 5c 20 | 6c 69 73 74 28 73 74 72 |ng\ l,\ |list(str|
|000044a0| 69 6e 67 29 5c 20 6d 65 | 6e 75 7d 20 7b 7d 0a 5c |ing)\ me|nu} {}.\|
|000044b0| 2b 5c 6e 6f 70 20 20 20 | 20 20 20 20 20 20 20 20 |+\nop | |
|000044c0| 7b 61 73 20 61 62 6f 76 | 65 2c 20 74 68 65 20 6d |{as abov|e, the m|
|000044d0| 65 6e 75 20 62 75 74 74 | 6f 6e 20 69 73 20 6c 61 |enu butt|on is la|
|000044e0| 62 65 6c 6c 65 64 20 77 | 69 74 68 20 24 6c 24 2e |belled w|ith $l$.|
|000044f0| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 5c 2b 5c 6f 70 |}.\medsk|ip.\+\op|
|00004500| 20 76 6f 69 64 20 20 6d | 65 73 73 61 67 65 20 7b | void m|essage {|
|00004510| 73 74 72 69 6e 67 5c 20 | 73 7d 20 0a 20 20 20 20 |string\ |s} . |
|00004520| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 64 69 | | {di|
|00004530| 73 70 6c 61 79 73 20 24 | 73 24 20 28 65 61 63 68 |splays $|s$ (each|
|00004540| 20 63 61 6c 6c 20 61 64 | 64 73 20 61 20 6e 65 77 | call ad|ds a new|
|00004550| 20 6c 69 6e 65 29 2e 7d | 0a 5c 6d 65 64 73 6b 69 | line).}|.\medski|
|00004560| 70 0a 5c 2b 5c 6f 70 20 | 76 6f 69 64 20 20 64 65 |p.\+\op |void de|
|00004570| 6c 5c 5f 6d 65 73 73 61 | 67 65 20 7b 7d 20 0a 20 |l\_messa|ge {} . |
|00004580| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004590| 7b 64 65 6c 65 74 65 73 | 20 74 68 65 20 74 65 78 |{deletes| the tex|
|000045a0| 74 20 77 72 69 74 74 65 | 6e 20 62 79 20 61 6c 6c |t writte|n by all|
|000045b0| 20 70 72 65 76 69 6f 75 | 73 20 6d 65 73 73 61 67 | previou|s messag|
|000045c0| 65 7d 0a 5c 2b 5c 6e 6f | 70 20 20 20 20 20 20 20 |e}.\+\no|p |
|000045d0| 20 20 20 20 7b 6f 70 65 | 72 61 74 69 6f 6e 73 2e | {ope|rations.|
|000045e0| 7d 0a 5c 6d 65 64 73 6b | 69 70 0a 0a 5c 76 66 69 |}.\medsk|ip..\vfi|
|000045f0| 6c 6c 5c 65 6a 65 63 74 | 0a 0a 5c 62 69 67 73 6b |ll\eject|..\bigsk|
|00004600| 69 70 0a 7b 5c 62 66 20 | 32 2e 31 36 20 49 6e 70 |ip.{\bf |2.16 Inp|
|00004610| 75 74 20 61 6e 64 20 6f | 75 74 70 75 74 20 6f 70 |ut and o|utput op|
|00004620| 65 72 61 74 6f 72 73 7d | 0a 0a 46 6f 72 20 69 6e |erators}|..For in|
|00004630| 70 75 74 20 61 6e 64 20 | 6f 75 74 70 75 74 20 6f |put and |output o|
|00004640| 66 20 62 61 73 69 63 20 | 67 65 6f 6d 65 74 72 69 |f basic |geometri|
|00004650| 63 20 6f 62 6a 65 63 74 | 73 20 69 6e 20 74 68 65 |c object|s in the|
|00004660| 20 70 6c 61 6e 65 20 73 | 75 63 68 20 61 73 20 70 | plane s|uch as p|
|00004670| 6f 69 6e 74 73 2c 20 0a | 6c 69 6e 65 73 2c 20 6c |oints, .|lines, l|
|00004680| 69 6e 65 20 73 65 67 6d | 65 6e 74 73 2c 20 63 69 |ine segm|ents, ci|
|00004690| 72 63 6c 65 73 2c 20 61 | 6e 64 20 70 6f 6c 79 67 |rcles, a|nd polyg|
|000046a0| 6f 6e 73 20 74 68 65 20 | 24 3c 3c 24 20 61 6e 64 |ons the |$<<$ and|
|000046b0| 20 24 3e 3e 24 20 6f 70 | 65 72 61 74 6f 72 73 20 | $>>$ op|erators |
|000046c0| 63 61 6e 20 0a 62 65 20 | 75 73 65 64 2e 20 53 69 |can .be |used. Si|
|000046d0| 6d 69 6c 61 72 20 74 6f | 20 5c 43 43 20 69 6e 70 |milar to| \CC inp|
|000046e0| 75 74 20 73 74 72 65 61 | 6d 73 20 77 69 6e 64 6f |ut strea|ms windo|
|000046f0| 77 73 20 68 61 76 65 20 | 61 6e 20 69 6e 74 65 72 |ws have |an inter|
|00004700| 6e 61 6c 20 66 6c 61 67 | 20 69 6e 64 69 63 61 74 |nal flag| indicat|
|00004710| 69 6e 67 0a 77 68 65 74 | 68 65 72 20 74 68 65 72 |ing.whet|her ther|
|00004720| 65 20 69 73 20 6d 6f 72 | 65 20 69 6e 70 75 74 20 |e is mor|e input |
|00004730| 74 6f 20 72 65 61 64 20 | 6f 72 20 6e 6f 74 2e 20 |to read |or not. |
|00004740| 49 74 73 20 69 6e 69 74 | 69 61 6c 20 76 61 6c 75 |Its init|ial valu|
|00004750| 65 20 69 73 20 74 72 75 | 65 20 61 6e 64 20 69 74 |e is tru|e and it|
|00004760| 20 0a 69 73 20 74 75 72 | 6e 65 64 20 74 6f 20 66 | .is tur|ned to f|
|00004770| 61 6c 73 65 20 69 66 20 | 61 6e 20 69 6e 70 75 74 |alse if |an input|
|00004780| 20 73 65 71 75 65 6e 63 | 65 20 69 73 20 74 65 72 | sequenc|e is ter|
|00004790| 6d 69 6e 61 74 65 64 20 | 20 62 79 20 63 6c 69 63 |minated | by clic|
|000047a0| 6b 69 6e 67 20 74 68 65 | 20 72 69 67 68 74 20 0a |king the| right .|
|000047b0| 6d 6f 75 73 65 20 62 75 | 74 74 6f 6e 20 28 73 69 |mouse bu|tton (si|
|000047c0| 6d 69 6c 61 72 20 74 6f | 20 65 6e 64 69 6e 67 20 |milar to| ending |
|000047d0| 69 73 74 72 65 61 6d 20 | 69 6e 70 75 74 20 62 79 |istream |input by|
|000047e0| 20 74 68 65 20 65 6f 66 | 2d 63 68 61 72 61 63 74 | the eof|-charact|
|000047f0| 65 72 20 63 74 72 6c 2d | 44 29 2e 0a 49 6e 20 63 |er ctrl-|D)..In c|
|00004800| 6f 6e 64 69 74 69 6f 6e | 61 6c 20 73 74 61 74 65 |ondition|al state|
|00004810| 6d 65 6e 74 73 20 6f 62 | 6a 65 63 74 73 20 6f 66 |ments ob|jects of|
|00004820| 20 74 79 70 65 20 24 77 | 69 6e 64 6f 77 24 20 61 | type $w|indow$ a|
|00004830| 72 65 20 61 75 74 6f 6d | 61 74 69 63 61 6c 6c 79 |re autom|atically|
|00004840| 20 0a 63 6f 6e 76 65 72 | 74 65 64 20 74 6f 20 62 | .conver|ted to b|
|00004850| 6f 6f 6c 65 61 6e 20 62 | 79 20 73 69 6d 70 6c 79 |oolean b|y simply|
|00004860| 20 72 65 74 75 72 6e 69 | 6e 67 20 74 68 69 73 20 | returni|ng this |
|00004870| 69 6e 74 65 72 6e 61 6c | 20 66 6c 61 67 2e 20 54 |internal| flag. T|
|00004880| 68 75 73 2c 20 74 68 65 | 79 20 63 61 6e 20 62 65 |hus, the|y can be|
|00004890| 20 0a 75 73 65 64 20 69 | 6e 20 63 6f 6e 64 69 74 | .used i|n condit|
|000048a0| 69 6f 6e 61 6c 20 73 74 | 61 74 65 6d 65 6e 74 73 |ional st|atements|
|000048b0| 20 65 78 61 63 74 6c 79 | 20 69 6e 20 74 68 65 20 | exactly| in the |
|000048c0| 73 61 6d 65 20 77 61 79 | 20 61 73 20 5c 43 43 20 |same way| as \CC |
|000048d0| 69 6e 70 75 74 20 73 74 | 72 65 61 6d 73 2e 20 0a |input st|reams. .|
|000048e0| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 20 74 6f 20 |For exam|ple, to |
|000048f0| 72 65 61 64 20 61 20 73 | 65 71 75 65 6e 63 65 20 |read a s|equence |
|00004900| 6f 66 20 70 6f 69 6e 74 | 73 20 74 65 72 6d 69 6e |of point|s termin|
|00004910| 61 74 65 64 20 62 79 20 | 61 20 72 69 67 68 74 20 |ated by |a right |
|00004920| 62 75 74 74 6f 6e 20 63 | 6c 69 63 6b 2c 20 20 0a |button c|lick, .|
|00004930| 75 73 65 20 60 60 20 7b | 5c 62 66 20 77 68 69 6c |use `` {|\bf whil|
|00004940| 65 7d 20 28 24 57 5c 20 | 3e 3e 5c 20 70 24 29 20 |e} ($W\ |>>\ p$) |
|00004950| 24 5c 7b 5c 20 20 5c 64 | 6f 74 73 5c 20 5c 7d 24 |$\{\ \d|ots\ \}$|
|00004960| 20 27 27 2e 20 0a 0a 0a | 7b 5c 62 66 20 32 2e 31 | ''. ...|{\bf 2.1|
|00004970| 36 2e 31 20 4f 75 74 70 | 75 74 7d 0a 5c 73 6d 61 |6.1 Outp|ut}.\sma|
|00004980| 6c 6c 73 6b 69 70 0a 5c | 63 6c 65 61 72 74 61 62 |llskip.\|cleartab|
|00004990| 73 0a 5c 2b 26 5c 68 73 | 6b 69 70 20 33 74 72 75 |s.\+&\hs|kip 3tru|
|000049a0| 65 63 6d 20 20 20 20 20 | 20 26 5c 68 73 6b 69 70 |ecm | &\hskip|
|000049b0| 20 34 74 72 75 65 63 6d | 20 26 5c 63 72 0a 5c 2b | 4truecm| &\cr.\+|
|000049c0| 5c 6f 70 62 20 77 69 6e | 64 6f 77 5c 26 20 3c 3c |\opb win|dow\& <<|
|000049d0| 20 7b 70 6f 69 6e 74 5c | 20 70 7d 20 20 20 20 20 | {point\| p} |
|000049e0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000049f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a00| 20 20 20 20 7b 6c 69 6b | 65 20 24 57 24 2e 64 72 | {lik|e $W$.dr|
|00004a10| 61 77 5c 5f 70 6f 69 6e | 74 28 24 70 24 29 7d 0a |aw\_poin|t($p$)}.|
|00004a20| 5c 6d 65 64 73 6b 69 70 | 0a 5c 2b 5c 6f 70 62 20 |\medskip|.\+\opb |
|00004a30| 77 69 6e 64 6f 77 5c 26 | 20 3c 3c 20 7b 73 65 67 |window\&| << {seg|
|00004a40| 6d 65 6e 74 5c 20 73 7d | 20 20 20 0a 20 20 20 20 |ment\ s}| . |
|00004a50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7b | | {|
|00004a70| 6c 69 6b 65 20 24 57 24 | 2e 64 72 61 77 5c 5f 73 |like $W$|.draw\_s|
|00004a80| 65 67 6d 65 6e 74 28 24 | 73 24 29 7d 0a 5c 6d 65 |egment($|s$)}.\me|
|00004a90| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 62 20 77 69 6e |dskip.\+|\opb win|
|00004aa0| 64 6f 77 5c 26 20 3c 3c | 20 7b 6c 69 6e 65 5c 20 |dow\& <<| {line\ |
|00004ab0| 6c 7d 20 20 20 20 20 20 | 0a 20 20 20 20 20 20 20 |l} |. |
|00004ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004ad0| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 6c 69 6b | | {lik|
|00004ae0| 65 20 24 57 24 2e 64 72 | 61 77 5c 5f 6c 69 6e 65 |e $W$.dr|aw\_line|
|00004af0| 28 24 6c 24 29 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |($l$)}.\|medskip.|
|00004b00| 5c 2b 5c 6f 70 62 20 77 | 69 6e 64 6f 77 5c 26 20 |\+\opb w|indow\& |
|00004b10| 3c 3c 20 7b 63 69 72 63 | 6c 65 5c 20 43 7d 20 20 |<< {circ|le\ C} |
|00004b20| 20 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | . | |
|00004b30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004b40| 20 20 20 20 20 20 7b 6c | 69 6b 65 20 24 57 24 2e | {l|ike $W$.|
|00004b50| 64 72 61 77 5c 5f 63 69 | 72 63 6c 65 28 24 43 24 |draw\_ci|rcle($C$|
|00004b60| 29 7d 0a 5c 6d 65 64 73 | 6b 69 70 0a 5c 2b 5c 6f |)}.\meds|kip.\+\o|
|00004b70| 70 62 20 77 69 6e 64 6f | 77 5c 26 20 3c 3c 20 7b |pb windo|w\& << {|
|00004b80| 70 6f 6c 79 67 6f 6e 5c | 20 50 7d 20 20 20 0a 20 |polygon\| P} . |
|00004b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004ba0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004bb0| 20 20 7b 6c 69 6b 65 20 | 24 57 24 2e 64 72 61 77 | {like |$W$.draw|
|00004bc0| 5c 5f 70 6f 6c 79 67 6f | 6e 28 24 50 24 29 7d 0a |\_polygo|n($P$)}.|
|00004bd0| 5c 6d 65 64 73 6b 69 70 | 0a 0a 0a 5c 62 69 67 73 |\medskip|...\bigs|
|00004be0| 6b 69 70 0a 7b 5c 62 66 | 20 32 2e 31 36 2e 32 20 |kip.{\bf| 2.16.2 |
|00004bf0| 49 6e 70 75 74 7d 0a 5c | 6d 65 64 73 6b 69 70 0a |Input}.\|medskip.|
|00004c00| 5c 2b 5c 6f 70 62 20 77 | 69 6e 64 6f 77 5c 26 20 |\+\opb w|indow\& |
|00004c10| 3e 3e 20 70 20 20 20 0a | 20 20 20 20 20 20 20 20 |>> p .| |
|00004c20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004c30| 20 20 20 7b 72 65 61 64 | 73 20 61 20 70 6f 69 6e | {read|s a poin|
|00004c40| 74 20 24 70 24 3a 20 63 | 6c 69 63 6b 69 6e 67 20 |t $p$: c|licking |
|00004c50| 74 68 65 20 6c 65 66 74 | 20 62 75 74 74 6f 6e 7d |the left| button}|
|00004c60| 0a 5c 2b 5c 6e 6f 70 20 | 20 20 20 20 20 20 20 20 |.\+\nop | |
|00004c70| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 61 73 73 | | {ass|
|00004c80| 69 67 6e 73 20 74 68 65 | 20 63 75 72 72 65 6e 74 |igns the| current|
|00004c90| 20 63 75 72 73 6f 72 20 | 70 6f 73 69 74 69 6f 6e | cursor |position|
|00004ca0| 20 74 6f 20 24 70 24 2e | 7d 0a 5c 6d 65 64 73 6b | to $p$.|}.\medsk|
|00004cb0| 69 70 0a 5c 2b 5c 6f 70 | 62 20 77 69 6e 64 6f 77 |ip.\+\op|b window|
|00004cc0| 5c 26 20 3e 3e 20 73 20 | 20 20 0a 20 20 20 20 20 |\& >> s | . |
|00004cd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004ce0| 20 20 20 20 20 20 7b 72 | 65 61 64 73 20 61 20 73 | {r|eads a s|
|00004cf0| 65 67 6d 65 6e 74 20 24 | 73 24 3a 20 75 73 65 20 |egment $|s$: use |
|00004d00| 74 68 65 20 6c 65 66 74 | 20 62 75 74 74 6f 6e 20 |the left| button |
|00004d10| 74 6f 20 69 6e 70 75 74 | 7d 0a 5c 2b 5c 6e 6f 70 |to input|}.\+\nop|
|00004d20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004d30| 20 20 20 20 20 7b 74 68 | 65 20 73 74 61 72 74 20 | {th|e start |
|00004d40| 61 6e 64 20 65 6e 64 20 | 70 6f 69 6e 74 20 6f 66 |and end |point of|
|00004d50| 20 24 73 24 2e 7d 0a 5c | 6d 65 64 73 6b 69 70 0a | $s$.}.\|medskip.|
|00004d60| 5c 2b 5c 6f 70 62 20 77 | 69 6e 64 6f 77 5c 26 20 |\+\opb w|indow\& |
|00004d70| 3e 3e 20 6c 20 20 20 0a | 20 20 20 20 20 20 20 20 |>> l .| |
|00004d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004d90| 20 20 20 7b 72 65 61 64 | 73 20 61 20 6c 69 6e 65 | {read|s a line|
|00004da0| 20 24 6c 24 3a 20 75 73 | 65 20 74 68 65 20 6c 65 | $l$: us|e the le|
|00004db0| 66 74 20 62 75 74 74 6f | 6e 20 74 6f 20 69 6e 70 |ft butto|n to inp|
|00004dc0| 75 74 7d 0a 5c 2b 5c 6e | 6f 70 20 20 20 20 20 20 |ut}.\+\n|op |
|00004dd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7b | | {|
|00004de0| 74 77 6f 20 64 69 66 66 | 65 72 65 6e 74 20 70 6f |two diff|erent po|
|00004df0| 69 6e 74 73 20 6f 6e 20 | 24 6c 24 7d 0a 5c 6d 65 |ints on |$l$}.\me|
|00004e00| 64 73 6b 69 70 0a 5c 2b | 5c 6f 70 62 20 77 69 6e |dskip.\+|\opb win|
|00004e10| 64 6f 77 5c 26 20 3e 3e | 20 43 20 20 20 0a 20 20 |dow\& >>| C . |
|00004e20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004e30| 20 20 20 20 20 20 20 20 | 20 7b 72 65 61 64 73 20 | | {reads |
|00004e40| 61 20 63 69 72 63 6c 65 | 20 24 43 24 3a 20 75 73 |a circle| $C$: us|
|00004e50| 65 20 74 68 65 20 6c 65 | 66 74 20 62 75 74 74 6f |e the le|ft butto|
|00004e60| 6e 20 74 6f 20 69 6e 70 | 75 74 7d 0a 5c 2b 5c 6e |n to inp|ut}.\+\n|
|00004e70| 6f 70 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |op | |
|00004e80| 20 20 20 20 20 20 20 7b | 74 68 65 20 63 65 6e 74 | {|the cent|
|00004e90| 65 72 20 6f 66 20 24 43 | 24 20 61 6e 64 20 61 20 |er of $C|$ and a |
|00004ea0| 70 6f 69 6e 74 20 6f 6e | 20 24 43 24 7d 0a 5c 6d |point on| $C$}.\m|
|00004eb0| 65 64 73 6b 69 70 0a 5c | 2b 5c 6f 70 62 20 77 69 |edskip.\|+\opb wi|
|00004ec0| 6e 64 6f 77 5c 26 20 3e | 3e 20 50 20 20 20 0a 20 |ndow\& >|> P . |
|00004ed0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004ee0| 20 20 20 20 20 20 20 20 | 20 20 7b 72 65 61 64 73 | | {reads|
|00004ef0| 20 61 20 70 6f 6c 79 67 | 6f 6e 20 24 50 24 3a 20 | a polyg|on $P$: |
|00004f00| 75 73 65 20 74 68 65 20 | 6c 65 66 74 20 62 75 74 |use the |left but|
|00004f10| 74 6f 6e 20 74 6f 20 69 | 6e 70 75 74 7d 0a 5c 2b |ton to i|nput}.\+|
|00004f20| 5c 6e 6f 70 20 20 20 20 | 20 20 20 20 20 20 20 20 |\nop | |
|00004f30| 20 20 20 20 20 20 20 20 | 20 7b 74 68 65 20 73 65 | | {the se|
|00004f40| 71 75 65 6e 63 65 20 6f | 66 20 76 65 72 74 69 63 |quence o|f vertic|
|00004f50| 65 73 20 6f 66 20 24 50 | 24 2c 20 65 6e 64 20 74 |es of $P|$, end t|
|00004f60| 68 65 20 73 65 71 75 65 | 6e 63 65 7d 0a 5c 2b 5c |he seque|nce}.\+\|
|00004f70| 6e 6f 70 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |nop | |
|00004f80| 20 20 20 20 20 20 20 20 | 7b 62 79 20 63 6c 69 63 | |{by clic|
|00004f90| 6b 69 6e 67 20 74 68 65 | 20 6d 69 64 64 6c 65 20 |king the| middle |
|00004fa0| 62 75 74 74 6f 6e 2e 7d | 0a 5c 6d 65 64 73 6b 69 |button.}|.\medski|
|00004fb0| 70 0a 0a 41 73 20 6c 6f | 6e 67 20 61 73 20 61 6e |p..As lo|ng as an|
|00004fc0| 20 69 6e 70 75 74 20 6f | 70 65 72 61 74 69 6f 6e | input o|peration|
|00004fd0| 20 68 61 73 20 6e 6f 74 | 20 62 65 65 6e 20 63 6f | has not| been co|
|00004fe0| 6d 70 6c 65 74 65 64 20 | 74 68 65 20 6c 61 73 74 |mpleted |the last|
|00004ff0| 20 72 65 61 64 20 70 6f | 69 6e 74 20 63 61 6e 20 | read po|int can |
|00005000| 0a 62 65 20 65 72 61 73 | 65 64 20 62 79 20 73 69 |.be eras|ed by si|
|00005010| 6d 75 6c 74 61 6e 65 6f | 75 73 6c 79 20 70 72 65 |multaneo|usly pre|
|00005020| 73 73 69 6e 67 20 74 68 | 65 20 73 68 69 66 74 20 |ssing th|e shift |
|00005030| 6b 65 79 20 61 6e 64 20 | 74 68 65 20 6c 65 66 74 |key and |the left|
|00005040| 20 6d 6f 75 73 65 20 62 | 75 74 74 6f 6e 2e 0a 0a | mouse b|utton...|
+--------+-------------------------+-------------------------+--------+--------+