これは等角螺旋または対数螺旋またはベルヌーイの螺旋と言って自然界の中に見られるそうです。
b=1/6
r=a(b*th)またはa^(b*th)
x=r*cos(th)
y=r*sin(th)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[cc lang="postscript" tab_size=“4” lines="40" highlight=“0”] %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 240 240 %%Title:equiangular spiral(等角螺旋)を描く /a 1.009 def % 図形の大きさに影響 /b .17 def % 図形の大きさに影響 /sw 0 def % 始点を置くスイッチ 0 0 240 240 rectfill % 黒の背景 120 120 translate % 座標の原点を中央に移動 newpath % パスの初期化 0 1 3400 { % 0から1づつ増分し3400になるまで{ }内を繰り返す /th exch def % 制御変数をth(角度)に入れる % 等角螺旋の数式 /r a b th mul exp def /x r th cos mul def /y r th sin mul def % swが0なら始点を置き、さもなくば線を引く sw 0 eq { x y moveto /sw 1 def }{ x y lineto }ifelse } for .936 .517 1 sethsbcolor % 色設定 2 setlinewidth % 線幅2ポイント stroke % 線を描画する[/cc] |
コメント