diff options
author | Norbert Preining <norbert@preining.info> | 2020-05-02 03:03:34 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-05-02 03:03:34 +0000 |
commit | 8626a9c3cb5dc8d02d779d5b5b1e3933d5626f43 (patch) | |
tree | 3cf05fd2ad850b994dafdcf497738d48a29634ca /graphics/circuit_macros/libcct.m4 | |
parent | 7039906aa6676b98933cd099d1cb038f1644c18f (diff) |
CTAN sync 202005020303
Diffstat (limited to 'graphics/circuit_macros/libcct.m4')
-rw-r--r-- | graphics/circuit_macros/libcct.m4 | 283 |
1 files changed, 221 insertions, 62 deletions
diff --git a/graphics/circuit_macros/libcct.m4 b/graphics/circuit_macros/libcct.m4 index b213af9e91..0ae189ad17 100644 --- a/graphics/circuit_macros/libcct.m4 +++ b/graphics/circuit_macros/libcct.m4 @@ -1,7 +1,7 @@ divert(-1) libcct.m4 -* Circuit_macros Version 9.2, copyright (c) 2020 J. D. Aplevich under * +* Circuit_macros Version 9.3, copyright (c) 2020 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -551,15 +551,15 @@ define(`xtal',`eleminit_(`$1') `source( linespec, V|v|I|i|AC|B|F|G|H|Q|L|N|P|R|S[C[r]|E[r]]]|T|X|U|other, diameter, R, fill) - V = voltage source; v=alternate voltage source; + V = voltage source; v = alternate voltage source; I = current source; i = alternate current source; - AC = AC source, B = bulb, F = fluorescent, G = generator, - Q = charge, L = lamp, N = neon, P = pulse, R = ramp, - SC = quarter arc, SE = arc; r = right orientation, - S = sinusoid, - T = triangle, X = interior X, U = square-wave, - other = custom interior label or waveform, - R = reversed polarity + AC = AC source; B = bulb; F = fluorescent; G = + generator; H = step function; L = lamp; + N = neon; P = pulse; Q = charge; R = ramp; r = right + orientation; S = sinusoid; SC = quarter arc; SE = + arc; T = triangle; U = square-wave; X = interior X; + other = custom interior label or waveform; + arg 4: R = reversed polarity; arg 5 modifies the circle with e.g., color or fill' define(`source',`ifelse(`$4',R, `reversed(`source',`$1',`$2',`$3',,shift(shift(shift(shift($@)))))', @@ -621,10 +621,7 @@ define(`source',`ifelse(`$4',R, at rvec_( m4h/2,0) ifsvg(+(0,textht/10))}', `$2',v,`{line from rvec_(-m4h,0) \ to rvec_(m4h,0)}', - `$2',AC,`{ - arc rad m4h/3 cw from Here-(m4h*2/3,0) \ - to Here with .c at Here-(m4h/3,0) - arc rad m4h/3 ccw from Here to Here+(m4h*2/3,0) with .c at Here+(m4h/3,0)}', + `$2',AC,`{ACsymbol(,,,AR)}', `$2',P,`{ line from Here+(-m4h/2,-m4h/4) \ to Here+(-m4h/4,-m4h/4) \ then to Here+(-m4h/4,m4h/4) \ @@ -652,13 +649,7 @@ define(`source',`ifelse(`$4',R, `$2',SE,`{ arc from Cintersect(Here,m4h,rvec_(0,2*m4h),1.8*m4h) \ to Cintersect(Here,m4h,rvec_(0,2*m4h),1.8*m4h,R) \ with .c at rvec_(0,2*m4h) }', - `$2',S,`{ ifgpic( - `arc rad m4h/3 cw from Here-(m4h*2/3,0) \ - to Here with .c at Here-(m4h/3,0) - arc rad m4h/3 ccw from Here to Here+(m4h*2/3,0) with .c at Here+(m4h/3,0)', - `savem4dir(`m4srcstack') right_ - sinusoid(m4h/2,twopi_/(m4h),pi_/2,-m4h/2,m4h/2) with .Origin at Here - restorem4dir(`m4srcstack') ') }', + `$2',S,`{ACsymbol(,,,R)}', `$2',T,`{ line from Here+(-m4h*3/4,-m4h/4) \ to Here+(-m4h/4,m4h/4) \ then to Here+(m4h/4,-m4h/4) \ @@ -706,34 +697,75 @@ define(`ttmotor',`eleminit_(`$1') { [box invis ht_ m4r*2 wid_ (m4r+m4w)*2] at last circle.c } line to rvec_(rp_len,0) invis ') - `Controlled source - consource( linespec ,V|I|v|i, R ) + `consource( linespec ,V|I|v|i|P, R ) + Controlled source + Arg3: + V= voltage + I= current + v= voltage type 2 + i= current type 2 + P= proximity sensor arg 4 can be used to modify the body with e.g. color or fill' define(`consource',`ifelse(`$3',R, `reversed(`consource',`$1',`$2',,shift(shift(shift($@))))', `eleminit_(`$1') {line to rvec_(rp_len/2-csdim_,0) - {line to rvec_(csdim_,csdim_) \ - then to rvec_(2*csdim_,0)\ - then to rvec_(csdim_,-csdim_) \ - then to Here `$4' } + M4CSN: rvec_(csdim_,csdim_) + M4CSS: rvec_(csdim_,-csdim_) + M4CSE: rvec_(2*csdim_,0) + M4CSW: Here + {line to M4CSN then to M4CSE then to M4CSS then to Here `$4'} ifelse(`$2',I, `{arrow from rvec_(csdim_/4,0) \ to rvec_(csdim_*7/4,0)}', `$2',i, - `{line from rvec_(csdim_,csdim_) \ - to rvec_(csdim_,-csdim_)}', + `{line from M4CSN to M4CSS}', `$2',V, - `{"ifsvg(-,`$-$')" at rvec_(csdim_*0.5,0) ifsvg(+(0,textht/10))} - {"ifsvg(+,`$+$')" at rvec_(csdim_*1.5,0) ifsvg(+(0,textht/10))}', + `{"iflatex(`$-$',-)" at rvec_(csdim_*0.5,0) ifsvg(+(0,textht/10))} + {"iflatex(`$+$',+)" at rvec_(csdim_*1.5,0) ifsvg(+(0,textht/10))}', `$2',v, - `{line to rvec_(2*csdim_,0)} ') - line from rvec_(2*csdim_,0) \ - to rvec_(rp_len/2+csdim_,0) } + `{line to M4CSE} ', + `$2',P, + `{ Proxim(2*csdim_) at rvec_(csdim_,0) }') + line from M4CSE to rvec_(rp_len/2+csdim_,0) } {[box invis ht_ 2*csdim_ wid_ 2*csdim_] at rvec_(rp_len/2,0)} line to rvec_(rp_len,0) invis ')') + `Proxim(size, U|D|L|R|degrees) + Proximity symbol + Arg2 default: current direction' +define(`Proxim',`[ + define(`m4prwid',`ifelse(`$1',,(dimen_/2),`($1)')')dnl + setdir_(ifelse(`$2',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$2')) + M4PRN: rvec_(0, m4prwid/2) + M4PRE: rvec_(m4prwid/2,0) + M4PRS: rvec_(0,-m4prwid/2) + M4PRW: rvec_(-m4prwid/2,0) + { line from 1/2 between M4PRN and M4PRE to M4PRE then to M4PRS \ + then to M4PRW then to M4PRN then to 1/2 between M4PRN and M4PRE } + { line from 1/4 between M4PRW and M4PRN to 1/4 between M4PRE and M4PRN } + { line from 1/4 between M4PRW and M4PRS to 1/4 between M4PRE and M4PRS } + `$3'; resetdir_ ]') + + `Magn(len, ht, U|D|L|R|degrees) + Magnetic relay action symbol' +define(`Magn',`[ + define(`m4mawi2',`ifelse(`$1',,(dimen_/4),`(($1)/2)')')dnl + define(`m4mah2',`ifelse(`$2',,(dimen_/8),`(($2)/2)')')dnl + setdir_(ifelse(`$3',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$3')) + m4fshade(0, line from vec_( 0, m4mah2) \ + to vec_( m4mawi2, m4mah2) \ + then to vec_( m4mawi2,-m4mah2) \ + then to vec_( m4mawi2/2,-m4mah2) \ + then to vec_( m4mawi2/2,0) \ + then to vec_(-m4mawi2/2,0) \ + then to vec_(-m4mawi2/2,-m4mah2) \ + then to vec_(-m4mawi2,-m4mah2) \ + then to vec_(-m4mawi2, m4mah2) \ + then to vec_( 0, m4mah2)) + `$4'; resetdir_ ]') + `battery( linespec, n, R ) Arg 3: reversed polarity' define(`battery',`ifelse(`$3',R, @@ -765,7 +797,7 @@ define(`ebox',`eleminit_(`$1') line to rvec_(rp_len,0) invis ') `fuse( linespec, chars, wid, ht ) - chars A|B|C|D|S|HB|HC or dA (=D)' + chars dA|B|C|D|S|SB|HB|HC or dA (=D)' define(`fuse',`eleminit_(`$1') define(`m4fusetype',`ifelse(`$2',,A,`$2',D,dA,`$2')')dnl define(`m4ht',ifelse(`$4',,`dimen_/5'ifinstr(`$2',H,*5/3),`($4)'))dnl @@ -775,7 +807,7 @@ define(`fuse',`eleminit_(`$1') sc_draw(`m4fusetype',HB, `{move to rvec_(m4d,0); lbox(m4wd-2*m4d,m4ht-2*m4d)} {lbox(m4wd,m4ht)} - line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)}') + line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)') sc_draw(`m4fusetype',HC, `{move to rvec_(m4d,0); {lbox(m4wd-2*m4d,m4ht-2*m4d)} {line from rvec_((m4wd-2*m4d)/5,m4ht/2-m4d) \ @@ -783,30 +815,87 @@ define(`fuse',`eleminit_(`$1') line from rvec_((m4wd-2*m4d)*4/5,m4ht/2-m4d) \ to rvec_((m4wd-2*m4d)*4/5,-m4ht/2+m4d) } {lbox(m4wd,m4ht)} - move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}') + move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)') sc_draw(`m4fusetype',A, `arc cw to rvec_(m4ht,0) rad m4ht/2 with .c at rvec_(m4ht/2,0)dnl ifelse(m4a,d,`; {dot(at last arc.start,,1)}') arc ccw to rvec_(m4ht,0) rad m4ht/2 with .c at rvec_(m4ht/2,0) line to rvec_(max(0,rp_len/2-m4wd/2),0)dnl - ifelse(m4a,d,`; dot(at last line.start,,1)') }') + ifelse(m4a,d,`; dot(at last line.start,,1)')') + sc_draw(`m4fusetype',SB, + `{lbox(m4wd,m4ht)} + {line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)} + {m4fshade(m4fill,lbox(m4wd/5,m4ht))} + move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)') sc_draw(`m4fusetype',B, `{lbox(m4wd,m4ht)} - line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)}') + line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)') sc_draw(`m4fusetype',C, `{lbox(m4wd,m4ht)} {line from rvec_(m4wd/5,-m4ht/2) \ to rvec_(m4wd/5,m4ht/2)} {line from rvec_(m4wd*4/5,-m4ht/2) \ to rvec_(m4wd*4/5,m4ht/2)} - move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}') + move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)') sc_draw(`m4fusetype',S, `{lbox(m4wd,m4ht)} {m4fshade(m4fill,lbox(m4wd/5,m4ht))} - move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}') + move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)') + } {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)} line to rvec_(rp_len,0) invis ') + `arrester( linespec, [G|E|S][D[L]], len, ht ) + G= spark gap (default) + E= gas discharge + S= surge + D= double (creates 3-terminal element) + DL= double, left orientation' +define(`arrester', + `define(`m4wd',ifelse(`$3',,`dimen_/2',`($3)'))dnl + define(`m4ht',ifelse(`$4',,`dimen_/5',`($4)'))dnl + define(`m4arm',ifinstr(`$2',L,,-))dnl + define(`m4ardna',`patsubst(patsubst(`$2',L),D)')dnl + define(`m4awd',arrowwid*4/3)define(`m4aht',arrowht*2/3)dnl + define(`m4len',`ifinstr(`$2',D,`ifelse(`$1',,dimen_)',`$1')')dnl + ifinstr(`$2',D,[)eleminit_(m4len)ifinstr(`$2',D,,`;{')dnl + ifinstr( m4ardna,S, + `line to rvec_(max(0,rp_len/2-m4wd/2),0) + {lbox(m4wd,m4ht)} + {arrow to rvec_(m4wd*0.4,0) wid m4awd ht m4aht} + ifinstr(`$2',D, + `A: 3rd last line.start; B: last line.end; C: 1/2 between A and B + move to rvec_(m4wd/2,m4arm`'(-m4ht/2)) + Gb: line to rvec_(0,m4arm`'(m4ht*2)) + G: Here]', + `line from rvec_(m4wd,0) to rvec_(max(0,rp_len/2+m4wd/2),0)} + {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)} + line to rvec_(rp_len,0) invis ') ', + m4ardna,E, + `arrow to rvec_(max(0,rp_len/2-m4wd/8),0) wid m4awd ht m4aht + {dot(at rvec_(-m4aht/4,-m4wd/4),dotrad_*2/3)} + {move to rvec_(m4wd/4,0) + arrow <- to rvec_(max(0,rp_len/2-m4wd/8),0) wid m4awd ht m4aht } + {circle diam m4wd at rvec_(m4wd/8,0)} + ifinstr(`$2',D, + `A: 2nd last arrow.start; B: last arrow.end; C: last circle.c + move to rvec_(m4wd/8,m4arm`'(-m4ht/2)) + Gb: line to rvec_(0,m4arm`'ifelse(`$3',,`dimen_/2',`($3)')) + G: Here]', + `}; {[box invis ht_ m4wd wid_ m4wd] at rvec_(rp_len/2,0)} + line to rvec_(rp_len,0) invis ')', + `define(`m4wd',ifelse(`$3',,`dimen_/8',`($3)'))dnl + arrow to rvec_(max(0,rp_len/2-m4wd/2),0) wid m4awd ht m4aht + { move to rvec_(m4wd,0) + arrow <- to rvec_(max(0,rp_len/2-m4wd/2),0) wid m4awd ht m4aht } + ifinstr(`$2',D, + `A: 2nd last arrow.start; B: last arrow.end; C: 1/2 between A and B + move to rvec_(m4wd/2,m4arm`'(-m4awd)) + Gb: line to rvec_(0,m4arm`'ifelse(`$3',,`dimen_/2',`($3)')) + G: Here]', + `}; {[box invis ht_ m4ht wid_ m4wd+2*m4aht] at rvec_(rp_len/2,0)} + line to rvec_(rp_len,0) invis ')')') + `memristor( linespec, wid, ht )' define(`memristor',`eleminit_(`$1') define(`m4ht',ifelse(`$3',,`dimen_/5',`($3)'))define(`m4htx',`m4ht/4')dnl @@ -949,10 +1038,11 @@ define(`arrowline',`line ifelse(`$1',,`to rvec_(elen_,0)',`$1') chop lin_leng(last line)/2-arrowht/2 [box invis ht_ arrowwid wid_ arrowht] at last line.c }') - `ground( at position, T, N|F|S|L|P|E, D|U|L|R|degrees) + `ground( at position, T, N|F|S|L|P[A]|E, + D|U|L|R|degrees) T=truncated stem; N=normal ground, F=frame, S=signal, L=low-noise, P=protective, - E=European; + E=European; PA=protective alternate down (default), up, left, right, angle (deg)' define(`ground',`box invis ht 0 wid 0 with .c ifelse(`$1',,`at Here',`$1') define(`m4v',`dimen_/6')define(`m4h',`dimen_/16')dnl @@ -979,6 +1069,12 @@ define(`ground',`box invis ht 0 wid 0 with .c ifelse(`$1',,`at Here',`$1') arc cw rad m4v*3/2 from rvec_(Rect_(m4v*3/2,-60)) \ to rvec_(Rect_(m4v*3/2,60)) with .c at Here} ground(,T,,`$4')', + `$3',PA, + `{Grnd_T: line to rvec_(0,m4v*1.6) \ + then to rvec_(5.5*m4h,0) \ + then to rvec_(0,-m4v*1.6) \ + then to Here} + ground(at rvec_(m4h,0),T,,`$4')', `$3',P, `{Grnd_C: circle rad m4v*3/2 at rvec_(m4h,0)} ground(,T,,`$4')', @@ -1146,7 +1242,6 @@ define(`lswitch',`eleminit_(`$1') dnl arrowht = m4t1 ; arrowwid = m4t2; ifelse(`$4',,,`{`$4'}') line to rvec_(rp_len,0) invis ') - `dswitch(linespec,R,W[ud]B[K] chars) Comprehensive IEEE-IEC single-pole switch: arg2=R: orient to the right of drawing dir @@ -1180,6 +1275,8 @@ define(`lswitch',`eleminit_(`$1') dnl MMR = momentary contact on make and release O = hand operation button P = pushbutton + Pr[T|M] = proximity [touch-sensitive or + magnetically controlled] R = time-delay operating arm Sd = Switch-disconnector Th = thermal control linkage @@ -1281,6 +1378,10 @@ define(`m4R',`ifelse(`$2',R,-)')define(`m4sc',`dimen_/24')dnl move to M4dT1+vec_(0,m4c`'m4dTr/2) m4fshade(0,lbox(m4dTr,m4dTr)) point_(m4angtmp) ') + sc_draw(`dna_',PrM, + `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 + Magn(dimen_/3,dimen_/6) at M4T+vec_(0,ifelse(m4a,d,-)dimen_/4)') sc_draw(`dna_',M, `define(`m4t',ifelse(m4a,d,-))dnl M4T: M4B.c+ta_xy(0,m4t`'12) @@ -1294,6 +1395,13 @@ define(`m4R',`ifelse(`$2',R,-)')define(`m4sc',`dimen_/24')dnl sc_draw(`dna_',O, `line from M4T + ta_xy(-2.5,0) \ to M4T + ta_xy(2.5,0) ') + sc_draw(`dna_',PrT, + `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 + line to rvec_(dimen_/4,0) with .c at M4T+vec_(0,ifelse(m4a,d,-)dimen_/6)') + sc_draw(`dna_',Pr, + `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 ') sc_draw(`dna_',P, `line from M4T + ta_xy(-2.5,-2.5) \ to M4T + ta_xy(-2.5,0) \ @@ -2118,6 +2226,7 @@ define(`c_fet',`mosfet(`$1',`$2',`ZSDF'ifelse(`$3',P,d)T,,`$4')') udM: G pin to channel center or u: pin at drain end, d: pin at source end udMn: gates G0 to Gn as above + Py: parallel diode Pz: parallel zener diode Q: connect B pin to S pin R: thick channel @@ -2200,15 +2309,18 @@ define(`mosfet', Gl: line from tr_xy(2,(m4s+1)) \ to tr_xy(-2,(m4s+1)) \ then to G')') - sc_draw(`dna_',Pz, + sc_draw(`dna_',Py,`pushdef(`m4pdd_mosfet')') + sc_draw(`dna_',Pz,`pushdef(`m4pdd_mosfet',Z)') + ifdef(`m4pdd_mosfet', `define(`m4q',m4a)dnl Diode: diode(ifelse(m4q,d,to,from) tr_xy(-2,-2) \ - ifelse(m4q,d,from,to) tr_xy( 2,-2),Z) + ifelse(m4q,d,from,to) tr_xy( 2,-2),m4pdd_mosfet) ifelse(m4q,d,rp_ang = rp_ang + pi_) line from tr_xy(-2,0) \ to tr_xy(-2,-2) \ then to tr_xy(2,-2) \ - then to tr_xy(2,0)') + then to tr_xy(2,0) + popdef(`m4pdd_mosfet')') sc_draw(`dna_',Q, `Ql: line from tr_xy(0,0)+vec_(0,m4R`'linethick pt__) \ to tr_xy(0,0) \ @@ -2464,8 +2576,10 @@ define(`resized',`define(`m4resiztmp',dimen_)define(`dimen_',(dimen_)*(`$1'))dnl `variable(`element', type, angle, length) overlaid arrow or line on two-terminal element - to show variablility: type = [A|P|L|[u]N][C|S] + to show variablility: + type = [A|P|L|[u]N|[u]NN][C|S] A=arrow, P=preset, L=linear, N=nonlinear, + NN=symmetric nonlinear, u changes direction, C=continuous, S=setpwise' define(`variable',`$1 {[ define(`dna_',`ifelse($2,,A,$2)') ang = ifelse(`$3',,45,`$3') @@ -2473,6 +2587,11 @@ define(`variable',`$1 sc_draw(`dna_',P,`Line: line to M4_T [line to (Rect_(dimen_/6,ang-90))] at Line.end') sc_draw(`dna_',L,`Line: line to M4_T') + sc_draw(`dna_',NN,`Line: ifelse(m4a,u, + `line from Here-(dimen_/6,0) to Here \ + then to M4_T then to M4_T+(dimen_/6,0)', + `line from Here-(0,dimen_/6) to Here \ + then to M4_T then to M4_T+(0,dimen_/6)') ') sc_draw(`dna_',N,`Line: line to M4_T ifelse(m4a,u,`line up dimen_/6 from Line.end', `line left dimen_/6 from Line.start')') @@ -2669,7 +2788,6 @@ define(`contact',`[ dnl ') `$3'] ') - `relaycoil( chars, wid, ht, U|D|L|R|degrees ) chars: X or default: external lines from A2 and B2 @@ -2679,8 +2797,8 @@ define(`contact',`[ dnl SO slow operating SOR slow operating and release SR slow release - HS hight speed - HS hight speed + HS high speed + HS high speed NAC unaffected by AC current AC AC current ML mechanically latched @@ -2951,7 +3069,7 @@ define(`m4pcrpin',`[ifinstr(`$2',F,`circle diam `$1'', `Header(1|2,rows,wid,ht,type) arg1: number of columns arg2: pins per column - arg3,4: custom sizes + arg3,4: custom wid, ht arg5: eg fill_(0.9)' define(`Header', `[define(`m4Hm',`ifelse(`$2',,2,`$2')')define(`m4Hn',`ifelse(`$1',,1,`$1')')dnl @@ -3041,7 +3159,8 @@ define(`gyrator', down Box.ht/4 then right N1b.x-N1a.x then up Box.ht/4 arcd(Box+(0,Box.ht/4),(N1b.x-N1a.x)/3,90+90,90+270) `$5')') ') - + `proximity(linespec)' +define(`proximity',`consource(`$1',P)') `nullator(linespec, wid, ht)' define(`nullator',`eleminit_(`$1') define(`m4wd',ifelse(`$2',,`dimen_/2',`($2)'))dnl @@ -3080,6 +3199,25 @@ define(`norator',`eleminit_(`$1') {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)} line to rvec_(rp_len,0) invis ') + `ACsymbol(at position, len, ht, [A]U|D|L|R|degrees) + Arg4: drawing direction (default: current direction) + Arg4 contains A: use arcs instead of sinusoid + A convenience for drawing a 1-cycle sinusoid, + e.g. source; ACsymbol(at last [])' +define(`ACsymbol',`[ Origin: Here + define(`m4range',`ifelse(`$2',,(dimen_/3),`($2)')')dnl + define(`m4ACd',patsubst(`$4',A))dnl + setdir_(ifelse(m4ACd,,`ifdef(`m4a_',rp_ang*rtod_,0)',m4ACd)) + Start: rvec_(-m4range/2,0) + End: rvec_( m4range/2,0) + define(`m4amp',`ifelse(`$3',,`m4range/3',`($3)/2')') + ifinstr(ifgpic(A)`$4',A, + `{ arc ccw to Start with .c at rvec_(-m4range/4,-max(m4range/4-m4amp,0)) } + { arc ccw to End with .c at rvec_( m4range/4, max(m4range/4-m4amp,0)) }', + `{ sinusoid(m4amp,twopi_/m4range,pi_/2,-m4range/2,m4range/2) \ + with .Origin at Origin } ') + `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') + `n-terminal box nterm(box specs; other commands, nw,nn,ne,ns, @@ -3156,16 +3294,37 @@ define(`bell',`[setdir_($1,R) In2: Here In3: rvec_(0,-m4h/4) `$3'; resetdir_ ]') - `microphone(U|D|L|R|degrees, vert size)' -define(`microphone',`[setdir_($1,R) - define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl - {L1: line from rvec_(m4h,-m4h/2) \ - to rvec_(m4h,m4h/2)} - {Circle: circle diameter m4h at rvec_(m4h/2,0)} - In1: rvec_(m4h*(2-sqrt(3))/4,m4h/4) - In2: Here - In3: rvec_(m4h*(2-sqrt(3))/4,-m4h/4) - `$3'; resetdir_ ]') + `microphone(A|U|D|L|R|degrees, vert size) + Arg1= A, upright mic + Thanks to Arnold Knott' +define(`microphone',`ifinstr(`$1',A, + `[ define(`m4sfact',`(ifelse(`$2',,dimen_,(`$2'))*8/5)') + circlerad = m4sfact/1000 + cspace = m4sfact/100 + bwd = m4sfact/10 + bht = m4sfact/4+bwd + Stand: line up m4sfact/5 + { arc from Here+(-bwd,bwd) to Here+(bwd,bwd) with .c at Here+(0,bwd) + line up m4sfact/4-bwd from last arc.start + line up m4sfact/4-bwd from last arc.end } + Head: box rad bwd/2 ht bht wid bwd with .s at Here+(0,bwd/2) + Inner: box rad bwd/2 ht bht/2+bwd/2 wid bwd with .n at Head.n + move to Inner.s+(0,bwd/2) + for i=1 to 4 do { + for j=-1 to 1 do { + { circle at Here+(3*j*cspace,(abs(j)-3)*cspace) } + if j != 0 then {{ circle at Here+(j*3/2*cspace,0) }} } + move up 5*cspace } ]', + `[setdir_($1,R) + define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl + {L1: line from rvec_(m4h,-m4h/2) \ + to rvec_(m4h,m4h/2)} + {Circle: circle diameter m4h at rvec_(m4h/2,0)} + In1: rvec_(m4h*(2-sqrt(3))/4,m4h/4) + In2: Here + In3: rvec_(m4h*(2-sqrt(3))/4,-m4h/4) + `$3'; resetdir_ ]')') + `buzzer(U|D|L|R|degrees, vert size,[C])' define(`buzzer',`[setdir_($1,R) ifelse(`$3',, |