summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/svg/ex15SVG.m4
blob: ca15109fa98858f77f964e629b0fe0dd826590ca (plain)
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
.PS
# ex15.m4
gen_init

[
n = 10; r = 1
for i = 1 to n-1 do {
   for j = i+1 to n do {
      line from rect_(r,i*twopi_/n) to rect_(r,j*twopi_/n)
      }
   }
  ]
[
  linethick = 2.5
  lt = linethick bp__
  crad = 1.0
  C: circle rad crad
  g = 0.65
  D: C+(Rect_(crad*g,110))
  rm = crad+distance(C,D)
  for r=lt to rm by 2*lt do {
    if r < (1-g)*crad then { circle rad r at D thick r/rm*linethick } \
      else { arc cw from Cintersect(D,r,C,crad) \
       to Cintersect(D,r,C,crad,R) with .c at D thick r/rm*linethick }
    }
  linethick = 1.5
  lt = linethick bp__
  C: circle invis rad crad with .w at C.e+(0.1,0)
  D: C+(Rect_(crad*g,110))
  rm = crad+distance(C,D)
  for r=lt to rm by lt do {
    u = (1-r/rm)
    if r < (1-g)*crad then { rgbdraw(u,u,u,circle rad r at D) } \
    else { rgbdraw(u,u,u,arc cw from Cintersect(D,r,C,crad) \
      to Cintersect(D,r,C,crad,R) with .c at D) }
    }
  circle rad C.rad at C
  ] with .w at last [].e+(0.1,0)

.PE