2 USING: kernel arrays sequences random math accessors multi-methods
3 processing processing.shapes
5 bubble-chamber.particle ;
7 IN: bubble-chamber.particle.quark
9 TUPLE: quark < particle ;
11 : <quark> ( -- quark ) quark new initialize-particle ;
13 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
15 METHOD: collide { quark }
18 collision-theta> -0.11 0.11 2random + >>theta
19 0.5 3.0 2random >>speed
21 0.996 1.001 2random >>speed-d
25 [ 0.00001 theta-dd-small? ] [ -0.001 0.001 random-theta-dd ] [ ] while
29 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 METHOD: move { quark }
33 dup myc>> 0.13 >>alpha stroke
36 dup pos>> first2 >r dim swap - r> 2array point
38 [ ] [ vel>> ] bi move-by
48 dup speed>> neg >>speed
49 2 over speed-d>> - >>speed-d
53 out-of-bounds? [ collide ] [ drop ] if ;