% - This is geometry.inc -------------------------------------------- % scale2d % rotate2d % translate2d % line-through % line-intersect % ------------------------------------------------------------------- % P sx sy /scale2d { 4 dict begin /sy exch def /sx exch def /P exch def [ P 0 get sx mul P 1 get sy mul ] end } def % P A /rotate2d { 4 dict begin /A exch def /P exch def [ A cos P 0 get mul A sin P 1 get mul sub A sin P 0 get mul A cos P 1 get mul add ] end } def % P x y /translate2d { 4 dict begin /y exch def /x exch def /P exch def [ P 0 get x add P 1 get y add ] end } def % P Q => line oriented right-hand rule /line-through { 5 dict begin /Q exch def /P exch def /A Q 1 get P 1 get sub neg def /B Q 0 get P 0 get sub def /C A P 0 get mul B P 1 get mul add neg def [ A B C ] end } def % m n /line-intersect { 4 dict begin aload pop /C exch def /B exch def /A exch def aload pop /c exch def /b exch def /a exch def /D A b mul a B mul sub def [ b C mul B c mul sub D div neg A c mul a C mul sub D div ] end } def