% Sheila Shah % MAKE PROOF %! % 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.15 scalefont setfont /point 0.03 def %-------------------PAGE 2 gsave 100 dup scale 2 5.5 translate 1 72 div setlinewidth 0.8 setgray /A [0 0] def /B [1 2] def /C [3 0] def A B C mktriangle stroke -0.15 0 moveto (A) show 1 2 moveto (B) show 3 0 moveto (C) show 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 1 0 0 setrgbcolor %the midpoints of the sides /L A B findmidpoint def L 0 get L 1 get point mkcircle fill L 0 get 0.1 sub L 1 get moveto (L) show /M B C findmidpoint def M 0 get M 1 get point mkcircle fill M 0 get M 1 get moveto (M) show 0.8 setgray /N A C findmidpoint def N 0 get N 1 get point mkcircle fill N 0 get 0.1 sub N 1 get 0.1 sub moveto (N) show % the feets of the altitudes /D [1.5625 1.4375] def /E [1 0] def /F [0.5625 1.125] def 0.8 setgray 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 0.8 setgray 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 D 0 get D 1 get moveto (D)show E 0 get E 1 get 0.1 sub moveto (E) show F 0 get 0.1 sub F 1 get moveto (F) show /H [1 0.9275] def 0.8 setgray H 0 get H 1 get point mkcircle fill H 0 get 0.05 sub H 1 get 0.1 add moveto (H) show % verticies to orthocentre /P A H findmidpoint def /Q B H findmidpoint def /R C H findmidpoint def 0 0 1 setrgbcolor P 0 get P 1 get point mkcircle fill R 0 get R 1 get point mkcircle fill 0.8 setgray Q 0 get Q 1 get point mkcircle fill 0 0 1 setrgbcolor P 0 get 0.15 sub P 1 get moveto (P) show R 0 get 0.05 add R 1 get moveto (R) show 0.8 setgray Q 0 get Q 1 get 0.05 add moveto (Q) show 0 setgray L 0 get L 1 get moveto M 0 get M 1 get lineto R 0 get R 1 get lineto P 0 get P 1 get lineto closepath stroke showpage grestore