Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/ex09DPV.m4

raw
1 .PS
2 # ex09.m4
3 # Illustrating the arguments of the `dimension_' and `arcdimension_' macros.
4 gen_init(svg_font(sans-serif,10bp__,3bp__))
5 scale = 25
6
7 define(`spacer',`
8 [
9 linethick_(1.0)
10
11 WC: circle diameter 4.22 at 0,0
12 EC: circle same at 30.15,0
13 NC: circle diameter 2.36 at 13.28, 10.92/2
14 SC: circle same at 13.28,-10.92/2
15
16 C: 0.5<WC,EC> # spacer centre
17 h = 27.26 # spacer height
18 s = 4.22/2 # small arc radius
19 r = h/2*0.80 # large arc radius
20 Cr: C+(0,h/2-r) # upper arc centre
21 e = s # small arc centre offset from small circle
22 Cs: EC+(e,0) # right arc centre
23
24 # Tangent points Tr and Ts to circles at Cr and Cs
25 dx = Cr.x-Cs.x; dy = Cr.y-Cs.y; dsq = dx*dx+dy*dy
26 Tr: (r*(r-s)/dsq)<Cr,Cs> + (vscal_(r*sqrt(dsq-(r-s)^2)/dsq,dy,-dx))
27 Ts: (s/r)<Cr,Tr>-(dx,dy)
28
29 line from Tr to Ts
30 arc cw to (Ts.x,-Ts.y) with .c at Cs
31 E: last arc.e
32 line to (Tr.x,-Tr.y)
33 arc cw to (C.x-(Here.x-C.x),Here.y) with .c at (Cr.x,-Cr.y)
34 S: last arc.s
35 line to (Cs.x-Ts.x-s,Cs.y-Ts.y)
36 arc cw to (Here.x,-Here.y) with .c at (-e,0)
37 W: last arc.w
38 line to (C.x-(Tr.x-C.x),Tr.y)
39 arc cw to Tr with .c at Cr
40 N: last arc.n
41
42 thinlines_
43 dimension_(from S+(2,0) to N+(2,0),-(E.x-C.x+4),27.76, 5)
44 dimension_(from SC.n+(0,2) left SC.x-WC.x, (SC.n.y-S.y+3), 13.28, 10)
45 dimension_(from WC.n+(0,2) right EC.x-WC.x,-(WC.n.y-S.y+7), 30.15, 10)
46 dimension_(from W+(0,-1.5) to E+(0,-1.5), -(C.y-S.y+8), 41.28, 10)
47 dimension_(from SC.e+(2,0) up NC.y-SC.y, (SC.e.x-W.x+8),"10.92" wid 10, 5)
48
49 arrow <- from EC left 6 up 16 chop EC.rad chop 0
50 line left 4 "4.22 (2) PL" above
51 arrow <- from NC up last line.y-NC.y+7/8 left 8 chop NC.rad chop 0
52 {"2.36" above}
53 arrow to SC chop 0 chop SC.rad
54
55 ] ')
56
57 define(`sk',`scale*0.7')
58
59 define(`bdot',
60 `dot(`$1',,0.5)
61 "svg_it($2)" $1 $3 ')
62
63 thinlines_
64
65 move right 0.8
66
67 # Upper left diagram
68 spacer
69
70 # Lower left diagram
71 [ define(`lwid',`29bp__')
72 A: bdot(at (0,0),A,below)
73 B: bdot(at (2*sk,0),B,below)
74 Ctr: 0.5 between A and B
75 move up 1*sk from A
76 L: move left 0.85*sk from A
77
78 linethick_(1)
79 dimension_(from A to B,0.5*sk,svg_it(label),lwid,0.1*sk)
80 "`dimension_(from A to B,0.5,label,29bp__,0.1)'" wid 70 \
81 with .w at (L.end.x+2,A.y-10)
82 move down_ 4 from last ""
83
84 thinlines_
85 arrow from A to B chop 0.05*sk "svg_it(linespec)" below
86 dimension_(up_ 0.5*sk from A,0.2*sk,"svg_it(offset)" rjust,,,->)
87 dimension_(up_ 0.1*sk from B,-0.2*sk," svg_it(tic offset)" ljust)
88 dimension_(up_ 0.1*sk from B+(0,0.5*sk),-0.2*sk,
89 " svg_it(tic offset)" ljust)
90 dimension_(from Ctr+(-lwid/2,0.5*sk) right lwid,0.2*sk,
91 "svg_it(blank width)" above)
92 ] with .nw at last [].sw+(0,-0.4*sk)
93 #showbox_
94
95 # Upper right diagram
96 [ A: bdot(at (0,0),A, above rjust)
97 B: bdot(at (2*sk,0),B, above ljust)
98 C: bdot(at (0,-1.5*sk),C, above rjust)
99 D: bdot(at (2*sk,-1.5*sk),D, above ljust)
100
101 T: C+(-1*sk,-0.5*sk)
102 T: C+(-0.45*sk,-0.5*sk)
103 dimension_(from A to B,0.3*sk,svg_it(AB),20bp__)
104 dimension_(from C to B chop dotrad_,,svg_it(X),16bp__)
105 dimension_(from C to A,0.3*sk,svg_it(CA),14bp__,,->)
106 dimension_(from D to B,-0.3*sk,"svg_it(DB)" ljust)
107 dimension_(from C to D chop dotrad_,,svg_it(T`'svg_sub(15)),15bp__)
108 arcdimension_(from C to D with .c at 0.5 between A and B,12bp__,
109 svg_it(C) to svg_it(D),34bp__)
110 Q: C+(-9,-15)
111
112 `define' leftparagraph { [ baselineskip = textht*1.5; { move right $1 }
113 for i = 2 to $+ do {
114 move to Here+(0,-baselineskip)
115 exec sprintf("{ `\"$%g \"' wid 4.5*scale ljust }; ",i) } ] }
116
117 leftparagraph(1.7*scale; baselineskip = 1.5*textht,
118 `dimension_(from A to B,0.3,AB,20bp__)',
119 `dimension_(from C to B,,X,16bp__)',
120 `dimension_(from C to A,0.3,CA,14bp__,,->)',
121 `dimension_(from D to B,-0.3,"DB" ljust)',
122 `dimension_(from C to D chop dotrad_,,T`'svg_sub(15),15bp__)',
123 `arcdimension_'svg_symbol(&`#'40;)`from C to D with .c at 0.5 \
124 between A and B'svg_comma`12bp__'svg_comma,
125 svg_ensp `C to D'svg_comma`34bp__'svg_symbol(&`#'41;)
126 ) with .nw at Q
127
128 ] with .nw at 1st [].ne+(1.7*sk,0)
129
130 command "</g>" # end font
131 .PE