2 USING: kernel namespaces arrays sequences math.vectors
3 mortar slot-accessors geom.pos geom.dim ;
7 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 : v+y ( pos y -- pos ) 0 swap 2array v+ ;
13 : v-y ( pos y -- pos ) 0 swap 2array v- ;
15 : v+x ( pos x -- pos ) 0 2array v+ ;
17 : v-x ( pos x -- pos ) 0 2array v- ;
19 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24 <pos> class-slots <dim> class-slots append
25 <pos> class-methods <dim> class-methods append { H{ } } append
27 4array <rect> set-global
29 ! { 0 0 } { 0 0 } <rect> new
33 "top-left" !( rect -- point ) [ $pos ]
35 "top-right" !( rect -- point ) [ dup $pos swap <- width 1- v+x ]
37 "bottom-left" !( rect -- point ) [ dup $pos swap <- height 1- v+y ]
39 "bottom-right" !( rect -- point ) [ dup $pos swap $dim { 1 1 } v- v+ ]