]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/golden-section/golden-section.factor
ui: some cleanup of old factor code
[factor.git] / extra / golden-section / golden-section.factor
index 32f454f07689d09ab2aa8b07b4110525096e510e..f8992f8ff02398c4518da778fc05c807652fe92f 100644 (file)
@@ -1,23 +1,10 @@
 
-USING: kernel namespaces math math.constants math.functions math.order
-       arrays sequences
-       opengl opengl.gl opengl.glu ui ui.render ui.gadgets
-       ui.gadgets.cartesian colors accessors
-       processing.shapes ;
+USING: accessors arrays colors kernel math math.constants
+math.functions math.order namespaces opengl.gl processing.shapes
+sequences ui ui.gadgets.cartesian ;
 
 IN: golden-section
 
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-! omega(i) = 2*pi*i*(phi-1)
-
-! x(i) = 0.5*i*cos(omega(i))
-! y(i) = 0.5*i*sin(omega(i))
-
-! radius(i) = 10*sin((pi*i)/720)
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 : omega ( i -- omega ) phi 1 - * 2 * pi * ;
 
 : x ( i -- x ) [ omega cos ] [ 0.5 * ] bi * ;
@@ -37,18 +24,13 @@ IN: golden-section
 
 : golden-section ( -- ) 720 <iota> [ dot ] each ;
 
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 : <golden-section> ( -- gadget )
-  <cartesian>
-    {  600 600 }       >>pdim
-    { -400 400 }       x-range
-    { -400 400 }       y-range
-    [ golden-section ] >>action ;
-
-: golden-section-window ( -- )
-  [ <golden-section> "Golden Section" open-window ] with-ui ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-MAIN: golden-section-window
+    <cartesian>
+        {  600 600 }       >>pdim
+        { -400 400 }       x-range
+        { -400 400 }       y-range
+        [ golden-section ] >>action ;
+
+MAIN-WINDOW: golden-section-window
+    { { title "Golden Section" } }
+    <golden-section> >>gadgets ;