ヒルベルト

0

カメ太が描いたヒルベルト曲線を図形にして、別の次元のヒルベルト曲線と重ねてみた。

ヒルベルト曲線
http://bitarrow.eplang.jp/bitarrow/fs/pub/f4e9c680/Hilbert_2.html

処理に少し時間がかかります。

// hilbert curve
w=screen!width?. h=screen!height?.

hilbert=[|depth angle|
[depth>0]! then [
t! (angle) rightturn.
! (depth-1)(-1*angle) hilbert.
t! (step) forward.
t! (angle) leftturn.
! (depth-1)(angle) hilbert.
t! (step) forward.
! (depth-1)(angle) hilbert.
t! (angle) leftturn.
t! (step) forward.
! (depth-1)(-1*angle) hilbert.
t! (angle) rightturn.
] execute.
].

screen! (black) paint.

t=turtle! create.
depth=4. step=33. lw=4.
t! penup (-16*16)((h/2)-25) position pendown (lw) linewidth (yellow) linecolor.
! (depth)(90) hilbert.
f=t! makefigure (red! settransparency) paint.
t! penup (-16*16)((h/2)-25) position pendown (lw) linewidth (blue) linecolor.
! (depth)(90) hilbert.

Default