summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/csc.m4
blob: 6fc3be88ba871dcbf73f2977a728daa4b9aa2251 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
ifelse(ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpgf(T),,
 `PSTricks, MetaPost, PGF, or Postscript required for this diagram',`dnl
.PS 3.5
# csc.m4
gen_init

circlerad=1.91
hubrad=0.10
s=0.5

define(`midnight',`0.1, 0.1, 0.44')
define(`white',`1, 1, 1')
define(`spokewidth',0.1)
define(`spoke',`dnl
  {line from rvec_(0,hubrad-spokewidth/2) to rvec_(circlerad-0.05,0)}
  {line from rvec_(0,-(hubrad-spokewidth/2)) to rvec_(circlerad-0.05,0)}')
define(`lwid',1)
define(`coord',`(s*(`$1'),s*(`$2'))')

#                               Circle and spokes
# [
rgbdraw(midnight,
  linethick=`0.'eval(lwid*15)/(1pt__)
  {circle with .c at Here
   circle invis diam last circle.diam + linethick pt__ at last circle }
  linethick=spokewidth/(1pt__)
  for angle = 0 to 330 by 30 do {
    Point_(angle)
    {spoke}
    }
  )

#                               Whiten where the hull will be
  linethick=`0.'eval(lwid*20)/(1pt__)
  rgbdraw(white,
    Point_(-60){line to rvec_(circlerad*0.72,0)} 
    Point_(-90){line to rvec_(circlerad*0.72,0)} 
    Point_(-120){line to rvec_(circlerad*0.72,0)} 
  
    linethick=`0.'eval(lwid*15)/(1pt__)
    {move to coord(1.8,-2.3)+(0,0.025)
    spline to Here+coord(-0.8,-0.3) then to Here+coord(-1.8,-0.3) \
      then to Here+coord(-2.18,-0.27) \
      then to Here+coord(-3.93,-0.1)}
    )

#                               Sail
  thinlines_
  setrgb(midnight)
  rgbfill(midnight,
    line from coord(0.44,3.38) to coord(0.44,2.6) \
      then to coord(2.1,-1.75) \
      then to coord(1.22,-1.53) \
      then to coord(0.62,-1.4) \
      then to coord(0.55,-1.6) \
      then to coord(-2.2,-1.6) \
      then to coord(-2.35,-1.5)
    spline to coord(-2.14,-0.78) \
      then to coord(-1.74,0.22) \
      then to coord(-1.42,0.89) \
      then to coord(-0.92,1.73) \
      then to coord(0,2.9) \
      then to coord(0.44,3.38)
    )

#                               Hull
   rgbfill(midnight,
     spline from coord(2.1,-1.75) to coord(1.9,-2.2) \
       then to coord(1.85,-2.3) then to coord(1.8,-2.33) \
       then to coord(1,-2.5) then to coord(0,-2.6) then to coord(-0.38,-2.57) \
       then to coord(-2.13,-2.4)
     line to coord(-2.2,-2.05) then to coord(2.1,-1.75)
     spline to coord(-1,-2.08) then to coord(0.55,-1.77)
     )
# ] with .sw at 1,1
.PE')