
同心円上の弧(半円)が次第に大きくなる図形を描きます。
次の周の同心円、弧の半径は次の図のように計算します。
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 %!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 720 720
%%HiResBoundingBox: 0 0 720 720
%%CropBox: 0 0 720 720
%%Title:同心円上の半円が次第に大きくなる図形
%%Creator:Studio Fruit Jam / Toyokazu Nishi
%%Copyright:Studio Fruit Jam / Toyokazu Nishi
%%CreationDate:2018年7月31日 火曜日午前11:23:55
% 参考:特選グラフィックスデザイン P37 畠中兼司・北尾和真 共著
% 昭和60年5月1日初版発行 発行所:株式会社 学習研究社
% ================ 座標変換 ================
360 360 translate % 座標の原点を中央に移動
% ================ 背景 =================
/DeviceRGB setcolorspace % カラースペース設定
.917 .917 .863 setrgbcolor
-360 360 720 -720 rectfill
% ====================== 初期値
/r0 30 def % 同心円の最初の半径
/r1 10 def % 最初の弧(半円)の半径
/a 5 def % 同心円、弧の大きさの変化量
1 setlinewidth
0 0 0 setrgbcolor
% ================================================
% メイン
% ================================================
newpath % パスの初期化
1 1 8 { % 同心円
/j exch def % 偶数回の時に弧の方向を変える
0 5 355 { % 弧を置く
/th exch def % 制御変数をthに代入(角度)
/x r0 th cos mul def % 円の公式
/y r0 th sin mul neg def % 円の公式
% jを2で割った余りが1の場合(開始角360-th、終了角180-th)の半円を引く
% 余りがそれ以外(0)の場合(開始角180-th、終了角360-th)の半円を引く
j 2 mod 1 eq { x y r1 360 th sub 180 th sub arc }
{ x y r1 180 th sub 360 th sub arc } ifelse
stroke % 弧を描画
} for
% 最初の弧の半径 r1 、次の週の半径r1=r1+a/2とすると
% 次の週の同心円の半径 r0 = r0+r1+(r1+a/2)
% 次の同心円の大きさを計算する
/r0 r0 r1 add r1 add a 2 div add def % r0 = r0+r1+(r1+a/2)
% 次の弧の大きさを計算する
/r1 r1 a 2 div add def % r1 = r1+a/2
% 変化量を増加
/a a 6 add def % a = a+6
} for
応用例
弧の方向は同じにしています。

コメント