]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix order problem in lindenmayer
authorwayo.cavazos <wayo.cavazos@gmail.com>
Thu, 5 Oct 2006 00:03:43 +0000 (00:03 +0000)
committerwayo.cavazos <wayo.cavazos@gmail.com>
Thu, 5 Oct 2006 00:03:43 +0000 (00:03 +0000)
contrib/lindenmayer/lindenmayer.factor

index 7aa1b2a7d96cd4135def954f2f229684db42f570..03418446bb09313e9eb94877ba839aa9bb39a62f 100644 (file)
@@ -258,8 +258,6 @@ H{ { "+" [ angle get     turn-left ] }
 
 } command-table set ;
 
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-! Examples
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 VAR: axiom
@@ -273,6 +271,95 @@ VAR: result
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+VAR: model
+
+: init-model ( -- ) 1 glGenLists >model ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: display ( -- )
+
+black gl-clear-color
+
+GL_FLAT glShadeModel
+
+GL_PROJECTION glMatrixMode
+glLoadIdentity
+-1 1 -1 1 1.5 200 glFrustum
+
+GL_MODELVIEW glMatrixMode
+
+glLoadIdentity
+
+[ do-look-at ] camera> with-turtle
+
+GL_COLOR_BUFFER_BIT glClear
+
+GL_FRONT_AND_BACK GL_LINE glPolygonMode
+
+white gl-color
+GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
+
+color-index> set-color-index
+
+model> glCallList ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-turtle ( -- ) <turtle> >turtle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-camera ( -- ) <turtle> >camera ;
+
+: reset-camera ( -- ) [
+reset-turtle
+45 turn-left
+45 pitch-up
+5 step-turtle
+180 turn-left
+] camera> with-turtle ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init-slate ( -- )
+<camera-slate> >slate
+namespace slate> set-slate-ns
+slate> "L-system" open-titled-window
+[ display ] >action ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: init ( -- )
+init-turtle
+init-turtle-stack
+init-camera reset-camera
+init-model
+
+2 >color-index
+init-color-table
+
+init-slate ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: result>model ( -- )
+[ model> GL_COMPILE glNewList result> interpret glEndList ] >action .slate ;
+
+: build-model ( -- )
+reset-state-stack
+reset-vertices
+reset-turtle
+default-values> call
+model-values> call
+result>model
+3000 sleep
+[ display ] >action .slate ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! Examples
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
 : koch ( -- ) lparser-dialect   [ 90 >angle ] >model-values
 
 H{ { "K" "[[a|b] '(0.41)f'(2.439) |<(60) [a|b]]" }
@@ -473,93 +560,6 @@ H{ { "C" "LBW" }
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-VAR: model
-
-: init-model ( -- ) 1 glGenLists >model ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: display ( -- )
-
-black gl-clear-color
-
-GL_FLAT glShadeModel
-
-GL_PROJECTION glMatrixMode
-glLoadIdentity
--1 1 -1 1 1.5 200 glFrustum
-
-GL_MODELVIEW glMatrixMode
-
-glLoadIdentity
-
-[ do-look-at ] camera> with-turtle
-
-GL_COLOR_BUFFER_BIT glClear
-
-GL_FRONT_AND_BACK GL_LINE glPolygonMode
-
-white gl-color
-GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
-
-color-index> set-color-index
-
-model> glCallList ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-turtle ( -- ) <turtle> >turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-camera ( -- ) <turtle> >camera ;
-
-: reset-camera ( -- ) [
-reset-turtle
-45 turn-left
-45 pitch-up
-5 step-turtle
-180 turn-left
-] camera> with-turtle ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init-slate ( -- )
-<camera-slate> >slate
-namespace slate> set-slate-ns
-slate> "L-system" open-titled-window
-[ display ] >action ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: init ( -- )
-init-turtle
-init-turtle-stack
-init-camera reset-camera
-init-model
-
-2 >color-index
-init-color-table
-
-init-slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: result>model ( -- )
-[ model> GL_COMPILE glNewList result> interpret glEndList ] >action .slate ;
-
-: build-model ( -- )
-reset-state-stack
-reset-vertices
-reset-turtle
-default-values> call
-model-values> call
-result>model
-3000 sleep
-[ display ] >action .slate ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 ! These should be moved into a separate file. They are used to pretty
 ! print matricies and vectors.