PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/unmaintained/cartesian/cartesian.factor

http://github.com/abeaumont/factor
Unknown | 42 lines | 30 code | 12 blank | 0 comment | 0 complexity | 4f66f14099a51ae8849a93211f19a94c MD5 | raw file
 1
 2USING: kernel combinators sequences opengl.gl
 3       ui.render ui.gadgets ui.gadgets.slate
 4       accessors ;
 5
 6IN: ui.gadgets.cartesian
 7
 8! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 9
10TUPLE: cartesian < slate x-min x-max y-min y-max z-min z-max perspective ;
11
12: init-cartesian ( cartesian -- cartesian )
13  init-slate
14  -10 >>x-min
15   10 >>x-max
16  -10 >>y-min
17   10 >>y-max
18   -1 >>z-min
19    1 >>z-max ;
20
21: <cartesian> ( -- cartesian ) cartesian new init-cartesian ;
22
23! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
25M: cartesian establish-coordinate-system ( cartesian -- cartesian )
26   dup
27   {
28     [ x-min>> ] [ x-max>> ]
29     [ y-min>> ] [ y-max>> ]
30     [ z-min>> ] [ z-max>> ]
31   }
32   cleave
33   glOrtho ;
34
35! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
36
37: x-range ( cartesian range -- cartesian ) first2 [ >>x-min ] [ >>x-max ] bi* ;
38: y-range ( cartesian range -- cartesian ) first2 [ >>y-min ] [ >>y-max ] bi* ;
39: z-range ( cartesian range -- cartesian ) first2 [ >>z-min ] [ >>z-max ] bi* ;
40
41! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42