

左下1/4円と右上1/4円を繋げたパターンを作成します。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 240 240 %%Title: 1/4円を連続した図形 % ========= 定義 ========= /r 40 def % 円の半径 /xs r 2 mul def % 円の移動量(x方向) /ys r 5 idiv def % 円の移動量(y方向) 0 0 240 240 rectstroke % 黒枠 120 120 translate % 座標の原点を中央に移動 % ======= メイン ========= newpath % パスの初期化 -120 xs 120 { % x方向 -120から120までxsづつ増分し{ }内を繰り返す /x exch def % 制御変数をxに入れる -200 ys 120 { % y方向 /y exch def /y1 y xs add def % 左下1/4円を直径分上に移動 x y1 r 180 270 arc % 左下1/4円 x y r 90 0 arcn % 右上1/4円 stroke % 線を描画 } for } for |
レインボーカラーで色を付けました。

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 | %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 240 240 %%Title: 1/4円を連続した図形 % ========= 定義 ========= /r 40 def /xs r 2 mul def /ys r 20 idiv def /hc 0 def % 色相初期値 1 setlinewidth % 線幅1ポイント 0 0 240 240 rectfill 120 120 translate % ======= メイン ========= newpath % -120 xs 120 { /x exch def -200 ys 120 { /y exch def /y1 y xs add def x y1 r 180 270 arc x y r 90 0 arcn hc 1 1 sethsbcolor % カラー設定 stroke /hc hc .0055 add def % 色相に0.0055を足す } for /hc 0 def % 色相を初期値にリセットする } for |
コメント