% Sheila Shah % MAKE CONSTRUCTION %! % takes in 2 points in vector form and finds the midpoint /findmidpoint { 10 dict begin /B exch def /A exch def [A 0 get B 0 get add 2 div A 1 get B 1 get add 2 div] end} def %takes in stack of 3 2D vectors, 3 points /mktriangle { 16 dict begin /C exch def /B exch def /A exch def A 0 get A 1 get moveto B 0 get B 1 get lineto C 0 get C 1 get lineto closepath end } def % takes in x, y, and size /mkcircle {16 dict begin /size exch def /y exch def /x exch def /N 64 def /a 0 def a cos size mul x add a sin size mul y add moveto N { /a a 360 N div add def a cos size mul x add a sin size mul y add lineto } repeat end } def %takes in a stack of 3 2D vectors, 3 points % and makes an inscribed circle in the triangle outputs centre[x y] /mkinscribedcircle { 20 dict begin /C exch def /B exch def /A exch def /aa [B 0 get C 0 get sub B 1 get C 1 get sub] def /bb [C 0 get A 0 get sub C 1 get A 1 get sub] def /cc [B 0 get A 0 get sub B 1 get A 1 get sub] def /a aa 0 get 2 exp aa 1 get 2 exp add 0.5 exp def /b bb 0 get 2 exp bb 1 get 2 exp add 0.5 exp def /c cc 0 get 2 exp cc 1 get 2 exp add 0.5 exp def /s a b add c add 2 div def /k s a sub s b sub mul s c sub mul s mul 0.5 exp def /r k s div def %finding the centre of the circle /sinA B 1 get A 1 get sub c div def /angle sinA dup 2 exp 1 sub neg sqrt atan def /d 1 angle 2 div sin angle 2 div cos div div r mul def [A 0 get d add A 1 get r add] end} def % takes in 3 vector, points and outputs a vector [xcentre, ycentre,R radius] /mkcircumcircle { 20 dict begin /C exch def /B exch def /A exch def /aa [B 0 get C 0 get sub B 1 get C 1 get sub] def /bb [C 0 get A 0 get sub C 1 get A 1 get sub] def /cc [B 0 get A 0 get sub B 1 get A 1 get sub] def /a aa 0 get 2 exp aa 1 get 2 exp add 0.5 exp def /b bb 0 get 2 exp bb 1 get 2 exp add 0.5 exp def /c cc 0 get 2 exp cc 1 get 2 exp add 0.5 exp def /k 0.5 b mul B 1 get A 1 get sub mul def /R a b mul c mul 4 k mul div def % coordinates of circumcircle /x A 0 get b 2 div add def /y R 2 exp b 2 div 2 exp sub 0.5 exp A 1 get add def [x y R] end} def /Times-Roman findfont 0.1 scalefont setfont /point 0.03 def %---------------------------PAGE 5 gsave 100 dup scale 2 5.5 translate 1 72 div setlinewidth /A [0 0] def /B [0.5 1.375] def /C [1 0] def 0.8 setgray A B C mktriangle stroke A 0 get A 1 get point mkcircle fill B 0 get B 1 get point mkcircle fill C 0 get C 1 get point mkcircle fill -0.33 0 moveto ( A(0,0) ) show 0.3 1.43 moveto ( B(0.5, 1.375) ) show 1.01 0 moveto ( C(1, 0) ) show /D [0.883136 0.3213774] def /E [0.5 0] def /F [0.11686 0.3213774] def D 0 get D 1 get point mkcircle fill E 0 get E 1 get point mkcircle fill F 0 get F 1 get point mkcircle fill A 0 get A 1 get moveto D 0 get D 1 get lineto stroke B 0 get B 1 get moveto E 0 get E 1 get lineto stroke C 0 get C 1 get moveto F 0 get F 1 get lineto stroke /H [0.5 0.18195] def H 0 get H 1 get point mkcircle fill H 0 get 0.3 sub H 1 get 0.1 add moveto ( H(0.5, 0.1820) ) show 0 0 1 setrgbcolor /midAH A H findmidpoint def midAH 0 get midAH 1 get point mkcircle fill /midBH B H findmidpoint def midBH 0 get midBH 1 get point mkcircle fill /midCH C H findmidpoint def midCH 0 get midCH 1 get point mkcircle fill midAH 0 get 0.7 sub midAH 1 get 0.05 add moveto ( P(0.25, 0.0910) ) show midBH 0 get 0.3 sub midBH 1 get 0.1 add moveto ( Q(0.5, 0.7785) ) show midCH 0 get midCH 1 get 0.05 add moveto ( R(0.75, 0.0910) ) show showpage grestore