
【曲線-29】で描いた弦巻線は円柱に線を巻き付けたような形でしたが、今回は円錐に巻きつけたような螺旋です。
マセマティカでおなじみのmathworldを参考にしました。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 720 720 %%HiResBoundingBox: 0 0 720 720 %%CropBox: 0 0 720 720 %%Title: conical spiral 円錐形の螺旋 %%Creator:Studio Fruit Jam / Toyokazu Nishi %%Copyright:Studio Fruit Jam / Toyokazu Nishi %%CreationDate:2018年11月5日 月曜日午後1:52:22 % conical spiralの式 % x=th*r*cos(a*th) % y=th*r*sin(a*th) % z=b*th % ================ 座標変換 ================ 360 360 translate 1 dup scale % ================ 背景 ================= 0 0 0 setrgbcolor -360 360 720 -720 rectfill % ================ 定義 ================ 1 1 1 setrgbcolor 1 setlinewidth % 線幅を1ポイントにする /xa 10 def % 弦巻きのX軸角度 a:angle /ya 0 def % 弦巻きのY軸角度 /za 0 def % 弦巻きのZ軸角度 /r 1 def % 弦巻きの径サイズ /L 300 def % 弦巻きの長さ /a 20 def % 振幅の係数 /b 2 def % 高さの係数 /sw 0 def 0 -300 translate % 下に移動 % ================ プロシージャ================ % 図形の回転 /rotation { /x1 x def /y1 y xa cos mul z xa sin mul sub def /z1 y xa sin mul z xa cos mul add def /x2 x1 ya cos mul z1 ya sin mul add def /y2 y1 def /z2 z1 ya cos mul x1 ya sin mul sub def /x3 x2 za cos mul y2 za sin mul sub def /y3 x2 za sin mul y2 za cos mul add def /z3 z2 def } def % ================ メイン================ newpath % パスの初期化 0 .1 L { /th exch def /x th r mul a th mul cos mul def /y b th mul def /z th r mul a th mul sin mul def rotation sw 0 eq { x3 y3 moveto /sw 1 def } { x3 y3 lineto } ifelse } for stroke |
コメント