]> gitweb.factorcode.org Git - factor.git/blob - contrib/lindenmayer/lindenmayer.factor
9acf45f61144c5b5615921818256ce2b9e513b4a
[factor.git] / contrib / lindenmayer / lindenmayer.factor
1 ! Eduardo Cavazos - wayo.cavazos@gmail.com
2
3 REQUIRES: contrib/math
4           contrib/vars
5           contrib/slate/slate
6           contrib/lindenmayer/opengl
7           contrib/lindenmayer/turtle
8           contrib/lindenmayer/camera
9           contrib/lindenmayer/camera-slate ;
10
11 USING: kernel alien namespaces arrays vectors math opengl sequences threads
12        hashtables strings gadgets
13        math-contrib vars slate turtle turtle-camera camera-slate
14        opengl-contrib ;
15
16 IN: lindenmayer 
17
18 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
19
20 : record-vertex ( -- ) position> gl-vertex ;
21
22 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
23
24 DEFER: polygon-vertex
25
26 : draw-forward ( length -- )
27 GL_LINES glBegin record-vertex step-turtle record-vertex glEnd ;
28
29 : move-forward ( length -- ) step-turtle polygon-vertex ;
30
31 : sneak-forward ( length -- ) step-turtle ;
32
33 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34
35 ! (v0 - v1) x (v1 - v2)
36
37 : polygon-normal ( {_v0_v1_v2_} -- normal )
38 0 over nth over 1 swap nth v- swap
39 1 over nth swap 2 swap nth v- cross ;
40
41 ! Test and replace with:
42
43 ! : v0-v1 ( { v0 v1 v2 } -- vec ) first2 v- ;
44
45 ! : v1-v2 ( { v0 v1 v2 } -- vec ) first3 v- nip ;
46
47 ! : polygon-normal ( { v0 v1 v2 } -- normal ) dup v0-v1 swap v1-v2 cross ;
48
49 : (polygon) ( vertices -- )
50 GL_POLYGON glBegin dup polygon-normal gl-normal [ gl-vertex ] each glEnd ;
51
52 : polygon ( vertices -- ) dup length 3 >= [ (polygon) ] [ drop ] if ;
53
54 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
55
56 ! Maybe use an array instead of a vector
57
58 VAR: vertices
59
60 : start-polygon ( -- ) 0 <vector> >vertices ;
61
62 : finish-polygon ( -- ) vertices> polygon ;
63
64 : polygon-vertex ( -- ) position> vertices> push ;
65
66 : reset-vertices start-polygon ;
67
68 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
69 ! Lindenmayer string rewriting
70 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
71
72 ! Maybe use an array instead of a quot in the work of segment
73
74 VAR: rules
75
76 : segment ( str -- seq )
77 { { [ dup "" = ] [ drop [ ] ] }
78   { [ dup length 1 = ] [ unit ] }
79   { [ 1 over nth CHAR: ( = ]
80     [ CHAR: ) over index 1 +            ! str i
81       2dup head                         ! str i head
82       -rot tail                         ! head tail
83       segment swap add* ] }
84   { [ t ] [ dup 1 head swap 1 tail segment swap add* ] } }
85 cond ;
86
87 : lookup ( str -- str ) dup 1 head rules get hash dup [ nip ] [ drop ] if ;
88
89 : rewrite ( str -- str ) segment [ lookup ] map concat ;
90
91 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
92 ! Lindenmayer string interpretation
93 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
94
95 SYMBOL: command-table
96
97 : segment-command ( seg -- command ) 1 head ;
98
99 ! : segment-parameter ( seg -- parameter )
100 ! dup length 1 - 2 swap rot subseq parse call ;
101
102 : segment-parameter ( seg -- parameter )
103 dup length 1 - 2 swap rot subseq string>number ;
104
105 : segment-parts ( seg -- param command )
106 dup segment-parameter swap segment-command ;
107
108 : exec-command ( str -- ) command-table get hash dup [ call ] [ drop ] if ;
109
110 : exec-command-with-param ( param command -- )
111 command-table get hash dup [ peek unit call ] [ 2drop ] if ;
112
113 : (interpret) ( seg -- )
114 dup length 1 =
115 [ exec-command ] [ segment-parts exec-command-with-param ] if ;
116
117 : interpret ( str -- ) segment [ (interpret) ] each ;
118
119 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
120 ! Lparser dialect
121 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
122
123 VAR: angle
124 VAR: len
125 VAR: thickness
126 VAR: color-index
127
128 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
129
130 DEFER: set-thickness
131 DEFER: set-color-index
132
133 TUPLE: state position orientation angle len thickness color-index ;
134
135 VAR: states
136
137 : reset-state-stack ( -- ) V{ } clone >states ;
138
139 : save-state ( -- )
140 position> orientation> angle> len> thickness> color-index> <state>
141 states> push ;
142
143 : restore-state ( -- )
144 states> pop
145 dup state-position    >position
146 dup state-orientation >orientation
147 dup state-len         >len
148 dup state-angle       >angle
149 dup state-color-index set-color-index
150 dup state-thickness   set-thickness
151 drop ;
152
153 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
154
155 : scale-len ( m -- ) len> * >len ;
156
157 : scale-angle ( m -- ) angle> * >angle ;
158
159 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
160
161 VAR: color-table
162
163 : init-color-table ( -- )
164 { { 0    0    0 }    ! black
165   { 0.5  0.5  0.5 }  ! grey
166   { 1    0    0 }    ! red
167   { 1    1    0 }    ! yellow
168   { 0    1    0 }    ! green
169   { 0.25 0.88 0.82 } ! turquoise
170   { 0    0    1 }    ! blue
171   { 0.63 0.13 0.94 } ! purple
172   { 0.00 0.50 0.00 } ! dark green
173   { 0.00 0.82 0.82 } ! dark turquoise
174   { 0.00 0.00 0.50 } ! dark blue
175   { 0.58 0.00 0.82 } ! dark purple
176   { 0.50 0.00 0.00 } ! dark red
177   { 0.25 0.25 0.25 } ! dark grey
178   { 0.75 0.75 0.75 } ! medium grey
179   { 1    1    1 }    ! white
180 } [ 1 set-color-alpha ] map color-table set ;
181
182 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
183
184 : material-color ( color -- )
185 GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE rot gl-material-fv ;
186
187 : set-color-index ( i -- )
188 dup >color-index color-table> nth dup gl-color material-color ;
189
190 : inc-color-index ( -- ) color-index> 1 + set-color-index ;
191
192 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
193
194 : set-thickness ( i -- ) dup >thickness glLineWidth ;
195
196 : scale-thickness ( m -- ) thickness> * 0.5 max set-thickness ;
197
198 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
199
200 VAR: default-values
201 VAR: model-values
202
203 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
204
205 : lparser-dialect ( -- )
206
207 [ 1 >len   45 >angle   1 >thickness   2 >color-index ] >default-values
208
209 H{ { "+" [ angle get     turn-left ] }
210    { "-" [ angle get     turn-right ] }
211    { "&" [ angle get     pitch-down ] }
212    { "^" [ angle get     pitch-up ] }
213    { "<" [ angle get     roll-left ] }
214    { ">" [ angle get     roll-right ] }
215
216    { "|" [ 180.0         rotate-y ] }
217    { "%" [ 180.0         rotate-z ] }
218    { "$" [ roll-until-horizontal ]  }
219
220    { "F" [ len get     draw-forward ] }
221    { "Z" [ len get 2 / draw-forward ] }
222    { "f" [ len get     move-forward ] }
223    { "z" [ len get 2 / move-forward ] }
224    { "g" [ len get     sneak-forward ] }
225    { "." [ polygon-vertex ] }
226
227    { "[" [ save-state ] }
228    { "]" [ restore-state ] }
229    { "{" [ start-polygon ] }
230    { "}" [ finish-polygon ] }
231
232    { "/" [ 1.1 scale-len ] } ! double quote command in lparser
233    { "'" [ 0.9 scale-len ] }
234    { ";" [ 1.1 scale-angle ] }
235    { ":" [ 0.9 scale-angle ] }
236    { "?" [ 1.4 scale-thickness ] }
237    { "!" [ 0.7 scale-thickness ] }
238
239    { "c" [ color-index> 1 + color-table get length mod set-color-index ] }
240
241 } command-table set ;
242
243 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
244
245 VAR: axiom
246 VAR: result
247
248 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
249
250 : iterate ( -- ) result> rewrite >result ;
251
252 : iterations ( n -- ) [ iterate ] times ;
253
254 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
255
256 VAR: model
257
258 : init-model ( -- ) 1 glGenLists >model ;
259
260 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
261
262 : display ( -- )
263
264 black gl-clear-color
265
266 GL_FLAT glShadeModel
267
268 GL_PROJECTION glMatrixMode
269 glLoadIdentity
270 -1 1 -1 1 1.5 200 glFrustum
271
272 GL_MODELVIEW glMatrixMode
273
274 glLoadIdentity
275
276 [ do-look-at ] camera> with-turtle
277
278 GL_COLOR_BUFFER_BIT glClear
279
280 GL_FRONT_AND_BACK GL_LINE glPolygonMode
281
282 white gl-color
283 GL_LINES glBegin { 0 0 0 } gl-vertex { 0 0 1 } gl-vertex glEnd
284
285 color-index> set-color-index
286
287 model> glCallList ;
288
289 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
290
291 : init-turtle ( -- ) <turtle> >turtle ;
292
293 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
294
295 : init-camera ( -- ) <turtle> >camera ;
296
297 : reset-camera ( -- ) [
298 reset-turtle
299 45 turn-left
300 45 pitch-up
301 5 step-turtle
302 180 turn-left
303 ] camera> with-turtle ;
304
305 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
306
307 : init-slate ( -- )
308 <camera-slate> >slate
309 namespace slate> set-slate-ns
310 slate> "L-system" open-titled-window
311 [ display ] >action ;
312
313 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
314
315 : init ( -- )
316 init-turtle
317 init-turtle-stack
318 init-camera reset-camera
319 init-model
320
321 2 >color-index
322 init-color-table
323
324 init-slate ;
325
326 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
327
328 : result>model ( -- )
329 [ model> GL_COMPILE glNewList result> interpret glEndList ] >action .slate ;
330
331 : build-model ( -- )
332 reset-state-stack
333 reset-vertices
334 reset-turtle
335 default-values> call
336 model-values> call
337 result>model
338 3000 sleep
339 [ display ] >action .slate ;
340
341 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
342 ! Examples
343 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
344
345 : koch ( -- ) lparser-dialect   [ 90 >angle ] >model-values
346
347 H{ { "K" "[[a|b] '(0.41)f'(2.439) |<(60) [a|b]]" }
348    { "k" "[ c'(0.5) K]" }
349    { "a" "[d <(120) d <(120) d ]" }
350    { "b" "e" }
351    { "e" "[^ '(.2887)f'(3.4758) &(180)      +z{.-(120)f-(120)f}]" }
352    { "d" "[^ '(.2887)f'(3.4758) &(109.5111) +zk{.-(120)f-(120)f}]" }
353 } >rules
354
355 "K" >axiom   axiom> >result ;
356
357 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
358
359 : spiral-0 ( -- ) lparser-dialect   [ 10 >angle 5 >thickness ] >model-values
360
361 "[P]|[P]" >axiom
362
363 H{ { "P" "[A]>>>>>>>>>[cB]>>>>>>>>>[ccC]>>>>>>>>>[cccD]" }
364    { "A" "F+;'A" }
365    { "B" "F!+F+;'B" }
366    { "C" "F!^+F^+;'C" }
367    { "D" "F!>^+F>^+;'D" }
368 } >rules
369
370 axiom> >result ;
371
372 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
373
374 : tree-5 ( -- ) lparser-dialect   [ 5 >angle   1 >thickness ] >model-values
375
376 "c(4)FFS" >result
377
378 H{ { "S" "FFR>(60)R>(60)R>(60)R>(60)R>(60)R>(30)S" }
379    { "R" "[Ba]" }
380    { "a" "$tF[Cx]Fb" }
381    { "b" "$tF[Dy]Fa" }
382    { "B" "&B" }
383    { "C" "+C" }
384    { "D" "-D" }
385
386    { "x" "a" }
387    { "y" "b" }
388
389    { "F" "'(1.25)F'(.8)" }
390 } >rules ;
391
392 : tree-5-scene ( -- )
393 tree-5
394 9 iterations
395 build-model
396 [ reset-turtle 90 pitch-down -70 step-turtle 50 strafe-up ] camera> with-turtle
397 .slate ;
398
399 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
400
401 : abop-1 ( -- ) lparser-dialect   [ 45 >angle   5 >thickness ] >model-values
402
403 H{ { "A" "F[&'(.8)!BL]>(137)'!(.9)A" }
404    { "B" "F[-'(.8)!(.9)$CL]'!(.9)C" }
405    { "C" "F[+'(.8)!(.9)$BL]'!(.9)B" }
406
407    { "L" "~c(8){+(30)f-(120)f-(120)f}" }
408 } >rules
409
410 "c(12)FFAL" >result ;
411
412 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
413
414 : abop-2 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
415
416 H{ { "A" "F[&'(.7)!BL]>(137)[&'(.6)!BL]>(137)'(.9)!(.9)A" }
417    { "B" "F[-'(.7)!(.9)$CL]'(.9)!(.9)C" }
418    { "C" "F[+'(.7)!(.9)$BL]'(.9)!(.9)B" }
419
420    { "L" "~c(8){+(45)f(.1)-(45)f(.1)-(45)f(.1)+(45)|+(45)f(.1)-(45)f(.1)-(45)f(.1)}" }
421
422 } >rules
423
424 "c(12)FAL" >result ;
425
426 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
427
428 : abop-3 ( -- ) lparser-dialect   [ 30 >angle   5 >thickness ] >model-values
429
430 H{ { "A" "!(.9)t(.4)FB>(94)B>(132)B" }
431    { "B" "[&t(.4)F$A]" }
432    { "F" "'(1.25)F'(.8)" }
433 } >rules
434
435 "c(12)FA" >result ;
436
437 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
438
439 : abop-4 ( -- ) lparser-dialect   [ 18 >angle   5 >thickness ] >model-values
440
441 H{ { "N" "FII[&(60)rY]>(90)[&(45)'(0.8)rA]>(90)[&(60)rY]>(90)[&(45)'(0.8)rD]!FIK" }
442    { "Y" "[c(4){++l.--l.--l.++|++l.--l.--l.}]" }
443    { "l" "g(.2)l" }
444    { "K" "[!c(2)FF>w>(72)w>(72)w>(72)w>(72)w]" }
445    { "w" "[c(2)^!F][c(5)&(72){-(54)f(3)+(54)f(3)|-(54)f(3)+(54)f(3)}]" }
446    { "f" "_" }
447
448    { "A" "B" }
449    { "B" "C" }
450    { "C" "D" }
451    { "D" "E" }
452    { "E" "G" }
453    { "G" "H" }
454    { "H" "N" }
455
456    { "I" "FoO" }
457    { "O" "FoP" }
458    { "P" "FoQ" }
459    { "Q" "FoR" }
460    { "R" "FoS" }
461    { "S" "FoT" }
462    { "T" "FoU" }
463    { "U" "FoV" }
464    { "V" "FoW" }
465    { "W" "FoX" }
466    { "X" "_" }
467
468    { "o" "$t(-0.03)" }
469    { "r" "~(30)" }
470 } >rules
471
472 "c(12)&(20)N" >result ;
473
474 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
475
476 : abop-5 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
477
478 H{ { "a" "F[+(45)l][-(45)l]^;ca" }
479
480    { "l" "j" }
481    { "j" "h" }
482    { "h" "s" }
483    { "s" "d" }
484    { "d" "x" }
485    { "x" "a" }
486
487    { "F" "'(1.17)F'(.855)" }
488 } >rules
489
490 "&(90)+(90)a" >result ;
491
492 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
493
494 : abop-6 ( -- ) lparser-dialect   [ 5 >angle   5 >thickness ] >model-values
495
496 "&(90)+(90)FFF[-(120)'(.6)x][-(60)'(.8)x][+(120)'(.6)x][+(60)'(.8)x]x" >result
497
498 H{ { "a" "F[cdx][cex]F!(.9)a" }
499    { "x" "a" }
500
501    { "d" "+d" }
502    { "e" "-e" }
503
504    { "F" "'(1.25)F'(.8)" }
505 } >rules ;
506
507 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
508
509 : airhorse ( -- ) lparser-dialect [ 10 >angle 5 >thickness ] >model-values
510
511 "C" >result
512
513 H{ { "C" "LBW" }
514
515    { "B" "[[''aH]|[g]]" }
516    { "a" "Fs+;'a" }
517    { "g" "Ft+;'g" }
518    { "s" "[::cc!!!!&&[FFcccZ]^^^^FFcccZ]" }
519    { "t" "[c!!!!&[FF]^^FF]" }
520
521    { "L" "O" }
522    { "O" "P" }
523    { "P" "Q" }
524    { "Q" "R" }
525    { "R" "U" }
526    { "U" "X" }
527    { "X" "Y" }
528    { "Y" "V" }
529    { "V" "[cc!!!&(90)[Zp]|[Zp]]" }
530    { "p" "h>(120)h>(120)h" }
531    { "h" "[+(40)!F'''p]" }
532
533    { "H" "[cccci[>(50)dcFFF][<(50)ecFFF]]" }
534    { "d" "Z!&Z!&:'d" }
535    { "e" "Z!^Z!^:'e" }
536    { "i" "-:/i" }
537
538    { "W" "[%[!!cb][<<<!!cb][>>>!!cb]]" }
539    { "b" "Fl!+Fl+;'b" }
540    { "l" "[-cc{--z++z++z--|--z++z++z}]" }
541 } >rules ;
542
543 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
544
545 ! These should be moved into a separate file. They are used to pretty
546 ! print matricies and vectors.
547
548 USING: styles prettyprint io ;
549
550 : decimal-places ( n d -- n )
551 10 swap ^ tuck * >fixnum swap /f ;
552
553 ! : .mat ( matrix -- ) [ [ 2 decimal-places ] map ] map . ;
554
555 : .mat ( matrix -- )
556 H{ { table-gap 4 } { table-border 4 } }
557 [ 2 decimal-places pprint ]
558 tabular-output ;
559
560 : .vec ( vector -- ) [ 2 decimal-places ] map . ;
561
562 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
563
564 PROVIDE: lindenmayer ;
565
566 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!