2 USING: kernel namespaces math math.constants math.functions math.order
4 opengl opengl.gl opengl.glu ui ui.render ui.gadgets ui.gadgets.theme
5 ui.gadgets.cartesian colors accessors combinators.cleave
10 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12 ! omega(i) = 2*pi*i*(phi-1)
14 ! x(i) = 0.5*i*cos(omega(i))
15 ! y(i) = 0.5*i*sin(omega(i))
17 ! radius(i) = 10*sin((pi*i)/720)
19 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21 : omega ( i -- omega ) phi 1- * 2 * pi * ;
23 : x ( i -- x ) [ omega cos ] [ 0.5 * ] bi * ;
24 : y ( i -- y ) [ omega sin ] [ 0.5 * ] bi * ;
26 : center ( i -- point ) { x y } 1arr ;
28 : radius ( i -- radius ) pi * 720 / sin 10 * ;
30 : color ( i -- i ) dup 360.0 / dup 0.25 1 rgba boa >fill-color ;
32 : line-width ( i -- i ) dup radius 0.5 * 1 max glLineWidth ;
34 : draw ( i -- ) [ center ] [ radius 1.5 * 2 * ] bi circle ;
36 : dot ( i -- ) color line-width draw ;
38 : golden-section ( -- ) 720 [ dot ] each ;
40 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42 : <golden-section> ( -- gadget )
47 [ golden-section ] >>action ;
49 : golden-section-window ( -- )
50 [ <golden-section> "Golden Section" open-window ] with-ui ;
52 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
54 MAIN: golden-section-window