This code look trivial and the image rather simple. Trust me, it isn't :-) Also take a look at: http://www.math.uwaterloo.ca/~wgilbert/Research/HilbertCurve/HilbertCurve.html to aaa ; ; Hilbert Cube Filling Curve using MSWLogo 3D ; ; Just as 2D Hilbert space filling curves map eleganly to 2D Logo ; 3D Hilbert volume filling curves map just as elegantly in 3D Logo ; ; The string language used to describe these curves maps directly ; to MSWLogo 3D Primitives. ; ; Compare with mathamatica solution done at: ; ; http://forum.swarthmore.edu/advanced/robertd/lsys3d.html ; cs perspective ; Get A Good View setturtle -1 setxyz 300 300 300 setturtle 0 ; Position HilbertCube such that it's center ends up at origin pu setxyz -150 -150 150 pd HilbertCube 20 4 end to HilbertCube :siz :lev ; ; X -> "DLXFDLXFXMFDRRXFXUFPRRXFXMFRXMR" ; ; In the expression above ; ; X = Hilbert ; ; D = Down Pitch 90 ; U = Up Pitch 90 ; M = Left Turn 90 ; P = Right Turn 90 ; L = Left Roll 90 ; R = Right Roll 90 ; F = Forward Size if :lev > 0 ~ [D L X F D L X F X M F D R R X F X U F P R R X F X M F R X M R] end to D down 90 end to L lr 90 end to M lt 90 end to P rt 90 end to R rr 90 end to U up 90 end to F ; This simply maps the forward move to a single letter ; :lev and :siz are being implicity passed setpc :lev fd :siz end to X ; This simply maps the Hiblert Recursive call to a single letter ; :lev and :siz are being implicity passed HilbertCube :siz :lev-1 end -- =============================================================== George Mills email: mills@softronix.com http://www.softronix.com The www page contains some very powerful educational software. Our single most important investment is our kids.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home