]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/math/splines/viewer/viewer.factor
factor: trim using lists
[factor.git] / extra / math / splines / viewer / viewer.factor
index f1ec1a2445bed61a6265ea02b8e4798e71c3ebae..ad0269c01a8434a32787ad24f9ce99cd0b2edf81 100644 (file)
@@ -1,14 +1,14 @@
 ! Copyright (C) 2010 Erik Charlebois.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel locals math math.order math.polynomials
-math.splines opengl.gl sequences ui.gadgets ui.gadgets.panes ui.render
-arrays ;
+USING: accessors kernel math math.order math.polynomials
+opengl.demo-support opengl.gl sequences ui.gadgets
+ui.gadgets.panes ui.render arrays ;
 IN: math.splines.viewer
 
 <PRIVATE
 : eval-polynomials ( polynomials-seq n -- xy-sequence )
     [
-        [ 1 + iota ] keep [
+        [ 1 + <iota> ] keep [
             /f swap [ polyval ] with map
         ] curry with map
     ] curry map concat ;
@@ -32,18 +32,18 @@ M:: spline-gadget draw-gadget* ( gadget -- )
         [ first x-min - x-max x-min - / gadget spline-dim>> first * ]
         [ second y-min - y-max y-min - / gadget spline-dim>> second * ] bi 2array
     ] map :> pts
-    
-    GL_LINE_STRIP glBegin
-    pts [
-        first2 neg gadget spline-dim>> second + glVertex2f
-    ] each
-    glEnd ;
+
+    GL_LINE_STRIP [
+        pts [
+            first2 neg gadget spline-dim>> second + glVertex2f
+        ] each ]
+    do-state ;
 
 :: <spline-gadget> ( polynomials dim steps -- gadget )
     spline-gadget new
     dim >>spline-dim
-    polynomials >>polynomials 
+    polynomials >>polynomials
     steps >>steps ;
 
 : spline. ( curve dim steps -- )
-    <spline-gadget> gadget. ; 
+    <spline-gadget> gadget. ;