Debian Codegraph @

texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.0.tex

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12
13 \def\pgfcircversion{1.0}
14 \def\pgfcircversiondate{2020/02/04}
15 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
16
17 \usemodule[tikz]
18
19 \startmodule[circuitikz-1.0]
20 \usetikzlibrary[calc]
21 \usetikzlibrary[arrows.meta, bending]
22
23 \unprotect
24
25 \edef\tikzatcode{\the\catcode`\@}
26 \edef\tikzbarcode{\the\catcode`\|}
27 \edef\tikzexclaimcode{\the\catcode`\!}
28 \catcode`\@=11
29 \catcode`\|=12
30 \catcode`\!=12
31
32 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
33 %%%---------- open: tex/pgfcirc.defines.tex
34 % Copyright 2018-2026 by Romano Giannetti
35 % Copyright 2015-2026 by Stefan Lindner
36 % Copyright 2013-2026 by Stefan Erhardt
37 % Copyright 2007-2026 by Massimo Redaelli
38 %
39 % This file may be distributed and/or modified
40 %
41 % 1. under the LaTeX Project Public License and/or
42 % 2. under the GNU Public License.
43 %
44 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
45
46 %
47 %% Key managements
48
49 \long\def\pgf@circ@comment#1{}
50
51 \def\circuitikzbasekey{/tikz/circuitikz}
52
53 \pgfkeys{\circuitikzbasekey/.is family}
54
55 \def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
56 \let\ctikzset\circuitikzset
57 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
58 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
59
60 %% Temporary Counters
61
62 \newcount\pgf@circ@count@a
63 \newcount\pgf@circ@count@b
64 \newcount\pgf@circ@count@c
65 %%%%%%%%%%%%
66 %% Dimensions
67
68 % coordinates
69 \newdimen\pgf@circ@res@up
70 \newdimen\pgf@circ@res@down
71 \newdimen\pgf@circ@res@zero
72 \newdimen\pgf@circ@res@left
73 \newdimen\pgf@circ@res@right
74 \newdimen\pgf@circ@res@other
75 \newdimen\pgf@circ@res@step
76 \newdimen\pgf@circ@res@temp
77 % inital thickness
78 \newdimen \pgfstartlinewidth
79
80 % arrow tips, ported over old arrows library (deprecated)
81 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
82 % this was the original definition of latex' tips, renamed to avoid clashes
83 %
84 \pgfarrowsdeclare{latexslim}{latexslim}
85 {
86 \pgfutil@tempdima=0.28pt%
87 \advance\pgfutil@tempdima by.3\pgflinewidth%
88 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
89 \pgfarrowsrightextend{+6\pgfutil@tempdima}
90 }
91 {
92 \pgfutil@tempdima=0.28pt%
93 \advance\pgfutil@tempdima by.3\pgflinewidth%
94 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
95 \pgfpathcurveto
96 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
97 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
98 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
99 \pgfpathcurveto
100 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
101 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
102 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
103 \pgfpathcurveto
104 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
105 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
106 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
107 \pgfpathclose
108 \pgfusepathqfill
109 }
110
111 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
112
113 \def\pgf@circ@setifdefinedfill#1#2{%
114 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
115 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
116 \ifdefined\ctikzclass
117 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
118 {% yes, it's defined
119 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
120 \ifx\@@tmp\@@none % but it's none
121 \pgfusepath{#2}%
122 \else
123 \pgfsetfillcolor{\@@tmp}%
124 \pgfusepath{#1}%
125 \fi
126 }{% the class is defined but the fill key not; use #2
127 \pgfusepath{#2}%
128 }
129 \else
130 \pgfusepath{#2}%
131 \fi
132 }
133
134 %% Macro to fill or draw
135
136 \def\pgf@circ@draworfill{%
137 \ifx\tikz@fillcolor\pgfutil@empty
138 \pgf@circ@setifdefinedfill{draw,fill}{draw}
139 \else
140 \pgfsetfillcolor{\tikz@fillcolor}
141 \pgfusepath{draw, fill}
142 \fi
143 }
144
145 \def\pgf@circ@draworfillandclip{%
146 \ifx\tikz@fillcolor\pgfutil@empty
147 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
148 \pgfusepath{draw, clip}
149 \else
150 \pgfsetfillcolor{\tikz@fillcolor}
151 \pgfusepath{draw, clip, fill}
152 \fi
153 }
154
155 \def\pgf@circ@maybefill{%
156 \ifx\tikz@fillcolor\pgfutil@empty
157 \pgf@circ@setifdefinedfill{fill}{discard}
158 \else
159 \pgfsetfillcolor{\tikz@fillcolor}
160 \pgfusepath{fill}
161 \fi
162 }
163
164 %% Macros for setting linewidth
165 % #1 is the legacy class (bipoles, tripoles) etc
166 % #2 is the reference linewidth
167 \def\pgf@circ@setlinewidth#1#2{%
168 \ifdefined\ctikzclass
169 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
170 {% yes, it's defined
171 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
172 \ifx\@@tmp\@@none % but it's none
173 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
174 \else
175 \pgfsetlinewidth{\@@tmp #2}%
176 \fi
177 }{ % key not defined, do the legacy thing
178 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
179 }% Ok, do nothing
180 \else % no class
181 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
182 \fi
183 }
184 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
185 \ctikzset{none/thickness/.initial=1.0} % do not touch
186
187 %% font changes compatible with plain/LaTeX/ConTeXt
188 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
189
190 \ifpgfutil@format@is@latex
191 \long\def\pgf@circ@font@tiny{\tiny}
192 \long\def\pgf@circ@font@small{\small}
193 \long\def\pgf@circ@font@bold{\textbf}
194 \long\def\pgf@circ@font@boldmath{\boldmath}
195 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
196 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
197 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
198 \else\ifpgfutil@format@is@plain
199 \long\def\pgf@circ@font@tiny{\fiverm}
200 \long\def\pgf@circ@font@small{\sevenrm}
201 \long\def\pgf@circ@font@bold#1{{\bf#1}}
202 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
203 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
204 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
205 \long\def\pgf@circ@font@twelve{\twelverm} %
206 \else\ifpgfutil@format@is@context
207 \long\def\pgf@circ@font@tiny{\tfxx}
208 \long\def\pgf@circ@font@small{\tfx}
209 \long\def\pgf@circ@font@bold{\bold}
210 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
211 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
212 \long\def\pgf@circ@font@tenbm{\normal\bold}%
213 \long\def\pgf@circ@font@twelve{\tfa} %
214 \fi\fi\fi
215
216
217 %
218 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
219 %
220 % this is needed to avoid problems with \ConTeXt
221 \ifcsname normalunexpanded\endcsname
222 \let\pgfcircutil@unexpanded\normalunexpanded
223 \else
224 \let\pgfcircutil@unexpanded\unexpanded
225 \fi
226 % minimally expand a pgfkey to check if it's {}/undefined or filled.
227 \def\unexpandedvalueof#1{%
228 \pgfcircutil@unexpanded\expandafter\expandafter
229 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
230 \def\pgf@circ@valueof@chk#1{%
231 \ifx\relax#1%
232 \expandafter\pgfutil@firstoftwo
233 \else
234 \expandafter\pgfutil@secondoftwo
235 \fi
236 {{}}% #1 is \relax, so consider empty
237 {\expandafter{#1}}% otherwise, leave the key after one more expansion
238 }%
239
240 % voltage options
241
242 \newif\ifpgf@circ@siunitx
243 \newif\ifpgf@circuit@compat
244 \newif\ifpgf@circ@oldvoltagedirection % default false
245 \newif\ifpgf@circ@explicitvdir
246 \newif\ifpgf@circ@fixbatteries
247
248 \ctikzset{voltage dir/.is choice}
249 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
250 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
251 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
252 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
253 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
254
255 % Option ">" for twoports
256 \newif\ifpgf@circuit@inputarrow
257 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
258 \ctikzset{inputarrow/.is choice}
259 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
260 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
261
262 % Option "boxed" for nodes and twoports
263 \newif\ifpgf@circuit@boxed
264 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
265 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
266 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
267 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
268
269 % Option "dashed" for nodes and twoports
270 \newif\ifpgf@circuit@dashed
271 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
272 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}
273
274 % Option "t=*" for nodes
275 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
276
277 \ctikzset{current arrow scale/.initial=16}
278
279 \ctikzset{bipoles/.is family}
280 \ctikzset{bipoles/border margin/.initial=1.1}
281 \ctikzset{bipoles/thickness/.initial=2}
282 \ctikzset{tripoles/thickness/.initial=2}
283 \ctikzset{quadpoles/thickness/.initial=2}
284 \ctikzset{nodes width/.initial=.04}
285
286 % Base len for all circuitikz
287 \newdimen\pgf@circ@Rlen
288 % scaled length for internal use in scalable shapes
289 \newdimen\pgf@circ@scaled@Rlen
290 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
291 \pgf@circ@Rlen = 1.4cm
292 % by default scale is 1.0
293 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
294
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 %% main style definitions
297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
298
299
300
301 % load a style file: search ctikzstyle-NAME.tex in path
302 \def\ctikzloadstyle#1{%
303 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
304 \tikzerror{I did not find the circuitikz style #1}}%
305 }
306
307 % load and enact a style
308 \def\ctikzsetstyle#1{%
309 \ctikzloadstyle{#1}%
310 \tikzset{#1 circuit style}%
311 }
312
313 % global style parameters
314 \ctikzset{default/scale/.initial=1.0} % do not touch
315 \ctikzset{default/fill/.initial=none} % do not touch
316 \ctikzset{default/thickness/.initial=none} % do not touch
317 % default is use as the generic default style for bipoles
318
319 % mostly bipoles:
320
321 \ctikzset{resistors/scale/.initial=1.0}
322 \ctikzset{resistors/fill/.initial=none}
323 \ctikzset{resistors/thickness/.initial=none}
324
325 \ctikzset{capacitors/scale/.initial=1.0}
326 \ctikzset{capacitors/fill/.initial=none}
327 \ctikzset{capacitors/thickness/.initial=none}
328
329 \ctikzset{inductors/scale/.initial=1.0}
330 \ctikzset{inductors/fill/.initial=none}
331 \ctikzset{inductors/thickness/.initial=none}
332
333 \ctikzset{diodes/scale/.initial=1.0}
334 \ctikzset{diodes/fill/.initial=none}
335 \ctikzset{diodes/thickness/.initial=none}
336
337 \ctikzset{batteries/scale/.initial=1.0}
338 \ctikzset{batteries/fill/.initial=none}
339 \ctikzset{batteries/thickness/.initial=none}
340
341 \ctikzset{sources/scale/.initial=1.0}
342 \ctikzset{sources/fill/.initial=none}
343 \ctikzset{sources/thickness/.initial=none}
344
345 \ctikzset{csources/scale/.initial=1.0}
346 \ctikzset{csources/fill/.initial=none}
347 \ctikzset{csources/thickness/.initial=none}
348
349 \ctikzset{instruments/scale/.initial=1.0}
350 \ctikzset{instruments/fill/.initial=none}
351 \ctikzset{instruments/thickness/.initial=none}
352
353 \ctikzset{mechanicals/scale/.initial=1.0}
354 \ctikzset{mechanicals/fill/.initial=none}
355 \ctikzset{mechanicals/thickness/.initial=none}
356
357 \ctikzset{misc/scale/.initial=1.0}
358 \ctikzset{misc/fill/.initial=none}
359 \ctikzset{misc/thickness/.initial=none}
360
361 \ctikzset{blocks/scale/.initial=1.0}
362 \ctikzset{blocks/fill/.initial=none}
363 \ctikzset{blocks/thickness/.initial=none}
364
365 % mostly nodes
366
367 \ctikzset{grounds/scale/.initial=1.0}
368 \ctikzset{grounds/fill/.initial=none}
369 \ctikzset{grounds/thickness/.initial=none}
370
371 \ctikzset{power supplies/scale/.initial=1.0}
372 \ctikzset{power supplies/fill/.initial=none}
373 \ctikzset{power supplies/thickness/.initial=none}
374
375 \ctikzset{transistors/scale/.initial=1.0}
376 \ctikzset{transistors/fill/.initial=none}
377 \ctikzset{transistors/thickness/.initial=none}
378
379 \ctikzset{tubes/scale/.initial=1.0}
380 \ctikzset{tubes/fill/.initial=none}
381 \ctikzset{tubes/thickness/.initial=none}
382
383 \ctikzset{RF/scale/.initial=1.0}
384 \ctikzset{RF/fill/.initial=none}
385 \ctikzset{RF/thickness/.initial=none}
386
387 \ctikzset{electromechanicals/scale/.initial=1.0}
388 \ctikzset{electromechanicals/fill/.initial=none}
389 \ctikzset{electromechanicals/thickness/.initial=none}
390
391 % transformers go with inductors
392 \ctikzset{amplifiers/scale/.initial=1.0}
393 \ctikzset{amplifiers/fill/.initial=none}
394 \ctikzset{amplifiers/thickness/.initial=none}
395
396 \ctikzset{switches/scale/.initial=1.0}
397 \ctikzset{switches/fill/.initial=none}
398 \ctikzset{switches/thickness/.initial=none}
399
400 \ctikzset{logic ports/scale/.initial=1.0}
401 \ctikzset{logic ports/fill/.initial=none}
402 \ctikzset{logic ports/thickness/.initial=none}
403
404 \ctikzset{flipflops/scale/.initial=1.0}
405 \ctikzset{flipflops/fill/.initial=none}
406 \ctikzset{flipflops/thickness/.initial=none}
407
408 \ctikzset{muxdemuxes/scale/.initial=1.0}
409 \ctikzset{muxdemuxes/fill/.initial=none}
410 \ctikzset{muxdemuxes/thickness/.initial=none}
411
412 \ctikzset{chips/scale/.initial=1.0}
413 \ctikzset{chips/fill/.initial=none}
414 \ctikzset{chips/thickness/.initial=none}
415
416 \ctikzset{displays/scale/.initial=1.0}
417 \ctikzset{displays/fill/.initial=none}
418 \ctikzset{displays/thickness/.initial=none}
419
420 % grounds and power supplies
421
422 \ctikzset{monopoles/.is family}
423 \ctikzset{monopoles/ground/width/.initial=.25}
424 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
425 \ctikzset{monopoles/ground/thickness/.initial=2}
426 \ctikzset{monopoles/rground/thickness/.initial=2}
427 \ctikzset{monopoles/tground/thickness/.initial=3}
428 \ctikzset{monopoles/vcc/width/.initial=.2}
429 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
430 \ctikzset{monopoles/vee/arrow/.initial=legacy}
431 \ctikzset{monopoles/match/width/.initial=.4}
432 \ctikzset{monopoles/chassis/width/.initial=.25}
433 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
434 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
435 \ctikzset{monopoles/antenna/width/.initial=.25}
436 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
437 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
438 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
439 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
440 \ctikzset{monopoles/txantenna/width/.initial=.25}
441 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
442 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
443 \ctikzset{monopoles/rxantenna/width/.initial=.25}
444 \ctikzset{monopoles/bareantenna/width/.initial=.25}
445 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
446 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
447 \ctikzset{monopoles/waves/width/.initial=0.5}
448
449 % microstrips
450 \ctikzset{bipoles/mstline/height/.initial=0.3}
451 \ctikzset{bipoles/mstline/width/.initial=1.2}
452 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
453 \ctikzset{monopoles/msport/width/.initial=.5}
454 \ctikzset{monopoles/msrstub/height/.initial=1.0}
455 \ctikzset{monopoles/msrstub/width/.initial=0.6}
456
457 % microphone and loudspeaker
458 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
459 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
460 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
461 \ctikzset{bipoles/mic/height/.initial=1.2}
462 \ctikzset{bipoles/mic/depth/.initial=.0}
463 \ctikzset{bipoles/mic/width/.initial=.8}
464
465 % Zig Zag resistors
466 \ctikzset{resistors/zigs/.initial=3}
467 \ctikzset{resistors/width/.code={%
468 \ctikzset{bipoles/resistor/width=#1}%
469 \ctikzset{bipoles/vresistor/width=#1}%
470 \ctikzset{bipoles/potentiometer/width=#1}%
471 \ctikzset{bipoles/resistivesens/width=#1}%
472 \ctikzset{bipoles/photoresistor/width=#1}%
473 \ctikzset{bipoles/thermistor/width=#1}%
474 \ctikzset{bipoles/thermistorntc/width=#1}%
475 \ctikzset{bipoles/thermistorptc/width=#1}%
476 \ctikzset{bipoles/varistor/width=#1}%
477 \ctikzset{bipoles/generic/width=#1}%
478 \ctikzset{bipoles/generic potentiometer/width=#1}%
479 \ctikzset{bipoles/ageneric/width=#1}%
480 \ctikzset{bipoles/tgeneric/width=#1}%
481 }}
482 \ctikzset{wiper pos/.code={%
483 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
484 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
485 }}
486 % zigzag resistor
487 \ctikzset{bipoles/resistor/height/.initial=.3}
488 \ctikzset{bipoles/resistor/width/.initial=.8}
489 \ctikzset{bipoles/potentiometer/height/.initial=.8}
490 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
491 \ctikzset{bipoles/potentiometer/width/.initial=.8}
492 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
493 \ctikzset{bipoles/vresistor/height/.initial=.6}
494 \ctikzset{bipoles/vresistor/width/.initial=.8}
495 \ctikzset{bipoles/resistivesens/height/.initial=.6}
496 \ctikzset{bipoles/resistivesens/width/.initial=.8}
497 % square resistors
498 \ctikzset{bipoles/photoresistor/height/.initial=.6}
499 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
500 \ctikzset{bipoles/photoresistor/width/.initial=.8}
501 \ctikzset{bipoles/thermistor/main/.initial=.7}
502 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
503 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
504 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
505 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
506 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
507 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
508 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
509 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
510 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
511 \ctikzset{bipoles/thermistor/width/.initial=.8}
512 \ctikzset{bipoles/varistor/main/.initial=.7}
513 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
514 \ctikzset{bipoles/varistor/width/.initial=.8}
515 \ctikzset{bipoles/generic/height/.initial=.30}
516 \ctikzset{bipoles/generic/width/.initial=.80}
517 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
518 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
519 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
520 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
521 \ctikzset{bipoles/ageneric/height/.initial=.30}
522 \ctikzset{bipoles/tgeneric/height/.initial=.70}
523 \ctikzset{bipoles/tgeneric/width/.initial=.80}
524 \ctikzset{bipoles/ageneric/width/.initial=.80}
525
526 %% Capacitors
527 \ctikzset{bipoles/capacitor/height/.initial=.6}
528 \ctikzset{bipoles/capacitor/width/.initial=.2}
529 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
530 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
531 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
532 %%% pcapacitor is deprecated
533 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
534 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
535 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
536 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
537 \ctikzset{bipoles/ccapacitor/width/.initial=.12}
538 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
539 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
540 \ctikzset{bipoles/vcapacitor/width/.initial=.5}
541 \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
542 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
543 \ctikzset{bipoles/piezoelectric/width/.initial=.5}
544
545 % Inductors
546 \ctikzset{inductors/coils/.code={%
547 \ctikzset{bipoles/cuteinductor/coils=#1}%
548 \ctikzset{bipoles/cutechoke/coils=#1}%
549 \ctikzset{bipoles/americaninductor/coils=#1}%
550 \ctikzset{bipoles/vcuteinductor/coils=#1}%
551 \ctikzset{bipoles/vamericaninductor/coils=#1}%
552 }}
553 \ctikzset{inductors/width/.code={%
554 \ctikzset{bipoles/cuteinductor/width=#1}%
555 \ctikzset{bipoles/cutechoke/width=#1}%
556 \ctikzset{bipoles/americaninductor/width=#1}%
557 \ctikzset{bipoles/vcuteinductor/width=#1}%
558 \ctikzset{bipoles/vamericaninductor/width=#1}%
559 \ctikzset{bipoles/fullgeneric/width=#1}%
560 \ctikzset{bipoles/tfullgeneric/width=#1}%
561 }}
562 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
563 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
564 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
565 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
566 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
567 %% Cute choke settings
568 \ctikzset{bipoles/cutechoke/height/.initial=.3}
569 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
570 \ctikzset{bipoles/cutechoke/width/.initial=.6}
571 \ctikzset{bipoles/cutechoke/coils/.initial=5}
572 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
573 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
574 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
575 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
576 \newif\ifpgf@circuit@bipole@twolineschoke
577 \pgf@circuit@bipole@twolineschokefalse
578 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
579 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
580 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
581 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
582 %
583 \ctikzset{bipoles/americaninductor/height/.initial=.3}
584 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
585 \ctikzset{bipoles/americaninductor/width/.initial=.8}
586 \ctikzset{bipoles/americaninductor/coils/.initial=4}
587 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
588 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
589 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
590 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
591 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
592 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
593 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
594 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
595 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
596 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
597 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
598 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
599 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
600 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
601 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
602
603 % Sources
604
605 \ctikzset{bipoles/esource/height/.initial=.60}
606 \ctikzset{bipoles/esource/width/.initial=.60}
607 \ctikzset{bipoles/pvsource/height/.initial=.60}
608 \ctikzset{bipoles/pvsource/width/.initial=.60}
609 \ctikzset{bipoles/isource/height/.initial=.60}
610 \ctikzset{bipoles/isource/width/.initial=.60}
611 \ctikzset{bipoles/oosource/height/.initial=.60}
612 \ctikzset{bipoles/oosource/width/.initial=.60}
613 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
614 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
615 \ctikzset{bipoles/dcisource/angle/.initial=80}
616 \ctikzset{bipoles/dcisource/height/.initial=.60}
617 \ctikzset{bipoles/dcisource/width/.initial=.60}
618 \ctikzset{bipoles/dcvsource/height/.initial=.60}
619 \ctikzset{bipoles/dcvsource/width/.initial=.60}
620 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
621 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
622 \ctikzset{bipoles/isourceam/height/.initial=.60}
623 \ctikzset{bipoles/isourceam/width/.initial=.60}
624 \ctikzset{bipoles/vsource/height/.initial=.60}
625 \ctikzset{bipoles/vsource/width/.initial=.60}
626 \ctikzset{bipoles/vsourceam/height/.initial=.60}
627 \ctikzset{bipoles/vsourceam/width/.initial=.60}
628 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
629 \ctikzset{bipoles/isourcesin/height/.initial=.60}
630 \ctikzset{bipoles/isourcesin/width/.initial=.60}
631 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
632 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
633 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
634 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
635 \ctikzset{bipoles/cisource/height/.initial=.7}
636 \ctikzset{bipoles/cisource/width/.initial=.7}
637 \ctikzset{bipoles/cisourceam/height/.initial=.7}
638 \ctikzset{bipoles/cisourceam/width/.initial=.7}
639 \ctikzset{bipoles/ecsource/height/.initial=.7}
640 \ctikzset{bipoles/ecsource/width/.initial=.7}
641 \ctikzset{bipoles/cvsource/height/.initial=.7}
642 \ctikzset{bipoles/cvsource/width/.initial=.7}
643 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
644 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
645 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
646 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
647 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
648 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
649 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
650 \ctikzset{bipoles/battery/height/.initial=.6}
651 \ctikzset{bipoles/battery/width/.initial=.3}
652 \ctikzset{bipoles/battery1/height/.initial=.6}
653 \ctikzset{bipoles/battery1/width/.initial=.3}
654 \ctikzset{bipoles/battery2/height/.initial=.6}
655 \ctikzset{bipoles/battery2/width/.initial=.3}
656
657 % diodes
658
659 \ctikzset{bipoles/diode/height/.initial=.50}
660 \ctikzset{bipoles/diode/width/.initial=.40}
661 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
662 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
663 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
664 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
665 \ctikzset{bipoles/varcap/height/.initial=.50}
666 \ctikzset{bipoles/varcap/width/.initial=.45}
667
668 % switches
669
670 \ctikzset{bipoles/spst/height/.initial=.35}
671 \ctikzset{bipoles/spst/width/.initial=.35}
672 \ctikzset{bipoles/spst/depth/.initial=.2}
673 \ctikzset{bipoles/nos/height/.initial=.3}
674 \ctikzset{bipoles/nos/width/.initial=.35}
675 \ctikzset{bipoles/nos/depth/.initial=.2}
676 \ctikzset{bipoles/ncs/height/.initial=.35}
677 \ctikzset{bipoles/ncs/width/.initial=.35}
678 \ctikzset{bipoles/ncs/depth/.initial=.2}
679 %%% reed switch
680 \ctikzset{bipoles/reed/height/.initial=.4}
681 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
682 \ctikzset{bipoles/reed/depth/.initial=.4}
683
684 % misc
685
686 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
687 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
688 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
689 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
690 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
691 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
692 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
693 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
694 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
695 \ctikzset{bipoles/fuse/height/.initial=.20}
696 \ctikzset{bipoles/fuse/width/.initial=.50}
697 \ctikzset{bipoles/afuse/height/.initial=.20}
698 \ctikzset{bipoles/afuse/width/.initial=.50}
699 \ctikzset{bipoles/memristor/height/.initial=.30}
700 \ctikzset{bipoles/memristor/wave height/.initial=.5}
701 \ctikzset{bipoles/memristor/width/.initial=.80}
702 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
703 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
704 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
705 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
706 \ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
707 \ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
708 %\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
709 %\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
710 % multiwire
711 \ctikzset{bipoles/multiwire/height/.initial=0.4}
712 \ctikzset{bipoles/multiwire/width/.initial=0.2}
713 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
714
715 \ctikzset{bipoles/ammeter/height/.initial=.60}
716 \ctikzset{bipoles/ammeter/width/.initial=.60}
717 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
718 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
719 \ctikzset{bipoles/voltmeter/height/.initial=.60}
720 \ctikzset{bipoles/voltmeter/width/.initial=.60}
721 \ctikzset{bipoles/smeter/height/.initial=.60}
722 \ctikzset{bipoles/smeter/width/.initial=.60}
723 \ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
724 \ctikzset{bipoles/qmeter/depth/.initial=.40}
725 \ctikzset{bipoles/qmeter/height/.initial=.80}
726 \ctikzset{bipoles/qmeter/width/.initial=.60}
727 % this must be specified for each one
728 \ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
729 \ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
730 \ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
731 \ctikzset{bipoles/iloop/width/.initial=.40}
732 \ctikzset{bipoles/iloop/height/.initial=.60}
733
734 \ctikzset{bipoles/oscope/height/.initial=.60}
735 \ctikzset{bipoles/oscope/width/.initial=.60}
736 \ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
737
738
739 % option to not rotate the new (Romano's) instruments
740 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
741 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
742 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
743 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
744 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
745
746
747 \ctikzset{bipoles/buffer/height/.initial=1}
748 \ctikzset{bipoles/buffer/width/.initial=1}
749 \ctikzset{bipoles/not port/width/.initial=1}
750 \ctikzset{bipoles/not port/height/.initial=.8}
751 \ctikzset{bipoles/not port/circle width/.initial=.15}
752 \ctikzset{bipoles/lamp/height/.initial=.60}
753 \ctikzset{bipoles/lamp/width/.initial=.60}
754 \ctikzset{bipoles/bulb/height/.initial=.8}
755 \ctikzset{bipoles/bulb/width/.initial=.8}
756 \ctikzset{bipoles/tline/height/.initial=.3}
757 \ctikzset{bipoles/tline/width/.initial=.8}
758 \ctikzset{bipoles/squid/height/.initial=.60}
759 \ctikzset{bipoles/squid/width/.initial=.60}
760 \ctikzset{bipoles/barrier/height/.initial=.60}
761 \ctikzset{bipoles/barrier/width/.initial=.60}
762 \ctikzset{bipoles/thermocouple/height/.initial=.250}
763 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
764 \ctikzset{bipoles/thermocouple/width/.initial=.140}
765 \ctikzset{bipoles/pushbutton/height/.initial=.5}
766 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
767 \ctikzset{bipoles/pushbutton/width/.initial=.50}
768
769 \ctikzset{bipoles/twoport/width/.initial=.7}
770 \ctikzset{bipoles/twoport/height/.initial=.7}
771 \ctikzset{bipoles/twoport/text/.initial=}
772 \ctikzset{bipoles/vco/width/.initial=.7}
773 \ctikzset{bipoles/bandpass/width/.initial=.7}
774 \ctikzset{bipoles/bandstop/width/.initial=.7}
775 \ctikzset{bipoles/highpass/width/.initial=.7}
776 \ctikzset{bipoles/lowpass/width/.initial=.7}
777 \ctikzset{bipoles/adc/width/.initial=.7}
778 \ctikzset{bipoles/dac/width/.initial=.7}
779 \ctikzset{bipoles/dsp/width/.initial=.7}
780 \ctikzset{bipoles/fft/width/.initial=.7}
781 \ctikzset{bipoles/amp/width/.initial=.7}
782 \ctikzset{bipoles/vamp/width/.initial=.7}
783 \ctikzset{bipoles/piattenuator/width/.initial=.7}
784 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
785 \ctikzset{bipoles/tattenuator/width/.initial=.7}
786 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
787 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
788 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
789 \ctikzset{bipoles/detector/width/.initial=.7}
790
791 % crossing wires
792 \ctikzset{bipoles/crossing/size/.initial=.2}
793
794 % Transistors starts here
795
796 \newif\ifpgf@circuit@trans@depletiontype
797 \pgf@circuit@trans@depletiontypefalse
798
799 \newif\ifpgf@circuit@mos@arrows
800 \ctikzset{tripoles/mos style/.is choice}
801 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
802 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
803 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
804 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
805
806 % Fixed label positions
807 \newif\ifpgf@circuit@transisors@fixlabels
808 \pgf@circuit@transisors@fixlabelstrue
809 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
810 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
811 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
812 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
813
814 % Option solderdot for fet
815 \newif\ifpgf@circuit@fet@solderdot
816 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
817 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
818 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
819 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
820
821 % Option bodydiode for fet
822 \newif\ifpgf@circuit@fet@bodydiode
823 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
824 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
825 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
826 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
827
828 % Option draw fet without gate connection
829 \newif\ifpgf@circuit@bpt@drawgate
830 \pgf@circuit@bpt@drawgatetrue
831 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
832 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
833 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
834 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
835
836 % Option draw bpt without base connection
837 \newif\ifpgf@circuit@bpt@drawbase
838 \pgf@circuit@bpt@drawbasetrue
839 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
840 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
841 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
842 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
843
844 % Option draw bpt with optical input
845 \newif\ifpgf@circuit@bpt@drawphoto
846 \pgf@circuit@bpt@drawphotofalse
847 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
848 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
849 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
850 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
851
852 % Option draw fet without bulk connection -- Added by Burak Kelleci
853 \newif\ifpgf@circuit@bpt@drawbulk
854 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
855 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
856 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
857 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
858
859 % Option draw pmos with empty circle
860 \newif\ifpgf@circuit@pmos@emptycircle
861 \pgf@circuit@pmos@emptycirclefalse
862 \ctikzset{tripoles/pmos style/.is choice}
863 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
864 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
865 % Option draw pmos with no circle
866 \newif\ifpgf@circuit@pmos@nocircle
867 \pgf@circuit@pmos@nocirclefalse
868 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
869 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
870 % back to normal
871 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
872 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
873 % arrows at the end, the correct way
874 \newif\ifpgf@circuit@trans@arrowatend
875 \pgf@circuit@trans@arrowatendfalse
876 \ctikzset{transistors/arrow pos/.is choice}
877 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
878 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
879
880 \newif\ifpgf@circuit@trans@ntype
881 \pgf@circuit@trans@ntypetrue %default true
882 %\newif\ifpgf@circuit@trans@ptype
883 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
884 \ctikzset{tripoles/nmos/width/.initial=.7}
885 \ctikzset{tripoles/nmos/gate height/.initial=.35}
886 \ctikzset{tripoles/nmos/base height/.initial=.5}
887 \ctikzset{tripoles/nmos/conn height/.initial=0}
888 \ctikzset{tripoles/nmos/height/.initial=1.1}
889 \ctikzset{tripoles/nmos/base width/.initial=.5}
890 \ctikzset{tripoles/nmos/gate width/.initial=.62}
891 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
892 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
893 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
894 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
895 \ctikzset{tripoles/nmos/curr direction/.initial=1}
896
897 \ctikzset{tripoles/pmos/width/.initial=.7}
898 \ctikzset{tripoles/pmos/gate height/.initial=.35}
899 \ctikzset{tripoles/pmos/base height/.initial=.5}
900 \ctikzset{tripoles/pmos/conn height/.initial=0}
901 \ctikzset{tripoles/pmos/height/.initial=1.1}
902 \ctikzset{tripoles/pmos/base width/.initial=.5}
903 \ctikzset{tripoles/pmos/gate width/.initial=.62}
904 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
905 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
906 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
907 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
908 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
909
910 \ctikzset{tripoles/hemt/width/.initial=.7}
911 \ctikzset{tripoles/hemt/gate height/.initial=.35}
912 \ctikzset{tripoles/hemt/base height/.initial=.5}
913 \ctikzset{tripoles/hemt/conn height/.initial=0}
914 \ctikzset{tripoles/hemt/height/.initial=1.1}
915 \ctikzset{tripoles/hemt/base width/.initial=.5}
916 \ctikzset{tripoles/hemt/gate width/.initial=.62}
917 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
918 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
919 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
920 \ctikzset{tripoles/hemt/curr direction/.initial=1}
921
922 \ctikzset{tripoles/nfet/width/.initial=.7}
923 \ctikzset{tripoles/nfet/gate height/.initial=.35}
924 \ctikzset{tripoles/nfet/base height/.initial=.5}
925 \ctikzset{tripoles/nfet/conn height/.initial=0}
926 \ctikzset{tripoles/nfet/height/.initial=1.1}
927 \ctikzset{tripoles/nfet/base width/.initial=.5}
928 \ctikzset{tripoles/nfet/gate width/.initial=.62}
929 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
930 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
931 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
932 \ctikzset{tripoles/nfet/curr direction/.initial=1}
933
934 \ctikzset{tripoles/pfet/width/.initial=.7}
935 \ctikzset{tripoles/pfet/gate height/.initial=.35}
936 \ctikzset{tripoles/pfet/base height/.initial=.5}
937 \ctikzset{tripoles/pfet/conn height/.initial=0}
938 \ctikzset{tripoles/pfet/height/.initial=1.1}
939 \ctikzset{tripoles/pfet/base width/.initial=.5}
940 \ctikzset{tripoles/pfet/gate width/.initial=.62}
941 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
942 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
943 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
944 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
945
946 \ctikzset{tripoles/nigfete/width/.initial=.7}
947 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
948 \ctikzset{tripoles/nigfete/base height/.initial=.5}
949 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
950 \ctikzset{tripoles/nigfete/height/.initial=1.1}
951 \ctikzset{tripoles/nigfete/base width/.initial=.5}
952 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
953 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
954 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
955 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
956 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
957
958 \ctikzset{tripoles/nigfetd/width/.initial=.7}
959 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
960 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
961 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
962 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
963 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
964 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
965 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
966 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
967 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
968 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
969
970 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
971 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
972 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
973 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
974 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
975 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
976 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
977 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
978 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
979 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
980 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
981
982 \ctikzset{tripoles/pigfete/width/.initial=.7}
983 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
984 \ctikzset{tripoles/pigfete/base height/.initial=.5}
985 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
986 \ctikzset{tripoles/pigfete/height/.initial=1.1}
987 \ctikzset{tripoles/pigfete/base width/.initial=.5}
988 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
989 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
990 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
991 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
992 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
993
994 \ctikzset{tripoles/pigfetd/width/.initial=.7}
995 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
996 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
997 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
998 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
999 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
1000 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
1001 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
1002 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
1003 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
1004 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
1005
1006 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
1007 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
1008 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
1009 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
1010 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
1011 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
1012 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
1013 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
1014 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
1015 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
1016 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
1017
1018 \ctikzset{tripoles/npn/width/.initial=.6}
1019 \ctikzset{tripoles/npn/base height/.initial=.45}
1020 \ctikzset{tripoles/npn/base height 2/.initial=.15}
1021 \ctikzset{tripoles/npn/base height/.initial=.4}
1022 \ctikzset{tripoles/npn/conn height/.initial=0}
1023 \ctikzset{tripoles/npn/height/.initial=1.1}
1024 \ctikzset{tripoles/npn/base width/.initial=.5}
1025 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
1026 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
1027 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
1028 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
1029 \ctikzset{tripoles/npn/curr direction/.initial=1}
1030
1031 \ctikzset{tripoles/pnp/width/.initial=.6}
1032 \ctikzset{tripoles/pnp/base height/.initial=.45}
1033 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
1034 \ctikzset{tripoles/pnp/base height/.initial=.4}
1035 \ctikzset{tripoles/pnp/conn height/.initial=0}
1036 \ctikzset{tripoles/pnp/height/.initial=1.1}
1037 \ctikzset{tripoles/pnp/base width/.initial=.5}
1038 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
1039 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
1040 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
1041 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
1042 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
1043
1044 \ctikzset{tripoles/pigbt/width/.initial=.6}
1045 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
1046 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
1047 \ctikzset{tripoles/pigbt/base height/.initial=.4}
1048 \ctikzset{tripoles/pigbt/conn height/.initial=0}
1049 \ctikzset{tripoles/pigbt/height/.initial=1.1}
1050 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
1051 \ctikzset{tripoles/pigbt/base width/.initial=.5}
1052 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
1053 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
1054 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
1055 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
1056
1057 \ctikzset{tripoles/nigbt/width/.initial=.6}
1058 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
1059 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
1060 \ctikzset{tripoles/nigbt/base height/.initial=.4}
1061 \ctikzset{tripoles/nigbt/conn height/.initial=0}
1062 \ctikzset{tripoles/nigbt/height/.initial=1.1}
1063 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
1064 \ctikzset{tripoles/nigbt/base width/.initial=.5}
1065 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
1066 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
1067 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
1068 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
1069
1070 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
1071 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
1072 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
1073 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
1074 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
1075 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
1076 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
1077 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
1078 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
1079 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
1080 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
1081 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
1082
1083 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
1084 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
1085 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
1086 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
1087 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
1088 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
1089 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
1090 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
1091 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
1092 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
1093 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
1094 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
1095
1096 \ctikzset{tripoles/njfet/width/.initial=.7}
1097 \ctikzset{tripoles/njfet/gate height/.initial=.5}
1098 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
1099 \ctikzset{tripoles/njfet/gate width/.initial=.5}
1100 \ctikzset{tripoles/njfet/conn height/.initial=.35}
1101 \ctikzset{tripoles/njfet/height/.initial=1.1}
1102 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
1103 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
1104 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
1105 \ctikzset{tripoles/njfet/curr direction/.initial=1}
1106
1107 \ctikzset{tripoles/pjfet/width/.initial=.7}
1108 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
1109 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
1110 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
1111 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
1112 \ctikzset{tripoles/pjfet/height/.initial=1.1}
1113 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
1114 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
1115 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
1116 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
1117
1118 \ctikzset{tripoles/isfet/width/.initial=1}
1119 \ctikzset{tripoles/isfet/gate height/.initial=.35}
1120 \ctikzset{tripoles/isfet/base height/.initial=.5}
1121 \ctikzset{tripoles/isfet/height/.initial=1.1}
1122 \ctikzset{tripoles/isfet/base width/.initial=.3}
1123 \ctikzset{tripoles/isfet/gate width/.initial=.5}
1124 \ctikzset{tripoles/isfet/conn height/.initial=0}
1125 \ctikzset{tripoles/isfet/wave width/.initial=.16}
1126 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
1127 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
1128 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
1129 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
1130 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
1131 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
1132 \ctikzset{tripoles/isfet/curr direction/.initial=1}
1133 %
1134 % multi-emitter and multi-collector BJTs by Romano Giannetti
1135 %
1136 \ctikzset{tripoles/bjt/emitters/.initial=1}
1137 \ctikzset{tripoles/bjt/collectors/.initial=1}
1138 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
1139 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
1140 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
1141 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
1142 \ctikzset{tripoles/bjt/multi height/.initial=.5}
1143 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
1144 %
1145 \ctikzset{tripoles/bjt/width/.initial=.3}
1146 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
1147 \ctikzset{tripoles/bjt/base height/.initial=1.1}
1148 \ctikzset{tripoles/bjt/height/.initial=.4}
1149 \ctikzset{tripoles/bjt/base width/.initial=1}
1150 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
1151 % do NOT touch these two!
1152 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
1153 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
1154
1155 %% transistors stop here
1156
1157 %% Logic ports
1158
1159 \newif\ifpgf@circuit@europeanlogicport
1160 \ctikzset{logic ports/.is choice}
1161 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
1162 \tikzset{and port/.style={shape=european and port}}%
1163 \tikzset{or port/.style={shape=european or port}}%
1164 \tikzset{xor port/.style={shape=european xor port}}%
1165 \tikzset{buffer port/.style={shape=european buffer port}}%
1166 \tikzset{not port/.style={shape=european not port}}%
1167 \tikzset{nand port/.style={shape=european nand port}}%
1168 \tikzset{nor port/.style={shape=european nor port}}%
1169 \tikzset{xnor port/.style={shape=european xnor port}}%
1170 }}
1171 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
1172 \tikzset{and port/.style={shape=american and port}}%
1173 \tikzset{or port/.style={shape=american or port}}%
1174 \tikzset{xor port/.style={shape=american xor port}}%
1175 \tikzset{buffer port/.style={shape=american buffer port}}%
1176 \tikzset{not port/.style={shape=american not port}}%
1177 \tikzset{nand port/.style={shape=american nand port}}%
1178 \tikzset{nor port/.style={shape=american nor port}}%
1179 \tikzset{xnor port/.style={shape=american xnor port}}%
1180 }}
1181
1182 \ctikzset{logic ports origin/.is choice}
1183 \ctikzset{logic ports origin/legacy/.code={
1184 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
1185 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
1186 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
1187 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
1188 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
1189 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
1190 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
1191 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
1192 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
1193 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
1194 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
1195 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
1196 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
1197 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
1198 }%
1199 }
1200 \ctikzset{logic ports origin/center/.code={%
1201 \ctikzset{tripoles/american and port/origin/.initial=0}%
1202 \ctikzset{tripoles/american nand port/origin/.initial=0}%
1203 \ctikzset{tripoles/american nor port/origin/.initial=0}%
1204 \ctikzset{tripoles/american or port/origin/.initial=0}%
1205 \ctikzset{tripoles/american xor port/origin/.initial=0}%
1206 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
1207 \ctikzset{tripoles/european and port/origin/.initial=0}%
1208 \ctikzset{tripoles/european nand port/origin/.initial=0}%
1209 \ctikzset{tripoles/european or port/origin/.initial=0}%
1210 \ctikzset{tripoles/european nor port/origin/.initial=0}%
1211 \ctikzset{tripoles/european xor port/origin/.initial=0}%
1212 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
1213 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
1214 \ctikzset{tripoles/european not port/origin/.initial=0}%
1215 }%
1216 }
1217
1218 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
1219 \ctikzset{american or shape/.is choice}
1220 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
1221 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
1222
1223 \newif\ifpgfcirc@draw@leads\pgfcirc@draw@leadstrue
1224 \ctikzset{logic ports draw input leads/.is choice}
1225 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@leadstrue}}
1226 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@leadsfalse}}
1227 \tikzset{input leads/.code={\pgfcirc@draw@leadstrue}}
1228 \tikzset{no input leads/.code={\pgfcirc@draw@leadsfalse}}
1229
1230 \ctikzset{tripoles/american and port/width/.initial=1.1}
1231 \ctikzset{tripoles/american and port/height/.initial=.8}
1232 \ctikzset{tripoles/american and port/port width/.initial=.7}
1233 \ctikzset{tripoles/american and port/input height/.initial=.5}
1234 \ctikzset{tripoles/american nand port/width/.initial=1.1}
1235 \ctikzset{tripoles/american nand port/height/.initial=.8}
1236 \ctikzset{tripoles/american nand port/port width/.initial=.7}
1237 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
1238 \ctikzset{tripoles/american nand port/input height/.initial=.5}
1239 \ctikzset{tripoles/american or port/width/.initial=1.1}
1240 \ctikzset{tripoles/american or port/height/.initial=.8}
1241 \ctikzset{tripoles/american or port/port width/.initial=.7}
1242 \ctikzset{tripoles/american or port/input height/.initial=.5}
1243 \ctikzset{tripoles/american or port/input skip/.initial=.25}
1244 \ctikzset{tripoles/american or port/aaa/.initial=.6}
1245 \ctikzset{tripoles/american or port/bbb/.initial=.4}
1246 \ctikzset{tripoles/american or port/ccc/.initial=.5}
1247 \ctikzset{tripoles/american or port/ddd/.initial=.0}
1248 \ctikzset{tripoles/american nor port/width/.initial=1.1}
1249 \ctikzset{tripoles/american nor port/height/.initial=.8}
1250 \ctikzset{tripoles/american nor port/port width/.initial=.7}
1251 \ctikzset{tripoles/american nor port/input height/.initial=.5}
1252 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
1253 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
1254 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
1255 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
1256 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
1257 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
1258 \ctikzset{tripoles/american xor port/width/.initial=1.1}
1259 \ctikzset{tripoles/american xor port/height/.initial=.8}
1260 \ctikzset{tripoles/american xor port/port width/.initial=.7}
1261 \ctikzset{tripoles/american xor port/input height/.initial=.5}
1262 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
1263 \ctikzset{tripoles/american xor port/distance/.initial=.1}
1264 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
1265 \ctikzset{tripoles/american xnor port/height/.initial=.8}
1266 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
1267 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
1268 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
1269 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
1270 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
1271 \ctikzset{tripoles/american and port/origin/.initial=0.8}
1272 \ctikzset{tripoles/american and port/inputs/.initial=2}
1273 % variable number of inputs
1274 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
1275 \ctikzset{tripoles/american nand port/inputs/.initial=2}
1276 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
1277 \ctikzset{tripoles/american nor port/inputs/.initial=2}
1278 \ctikzset{tripoles/american nor port/angle/.initial=70}
1279 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
1280 \ctikzset{tripoles/american or port/origin/.initial=0.8}
1281 \ctikzset{tripoles/american or port/inputs/.initial=2}
1282 \ctikzset{tripoles/american or port/angle/.initial=70}
1283 \ctikzset{tripoles/american or port/inner/.initial=0.3}
1284 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
1285 \ctikzset{tripoles/american xor port/inputs/.initial=2}
1286 \ctikzset{tripoles/american xor port/angle/.initial=70}
1287 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
1288 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
1289 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
1290 \ctikzset{tripoles/american xnor port/angle/.initial=70}
1291 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
1292
1293 \ctikzset{tripoles/european and port/width/.initial=1.4}
1294 \ctikzset{tripoles/european and port/height/.initial=.65}
1295 \ctikzset{tripoles/european and port/reserved/.initial=.6}
1296 \ctikzset{tripoles/european and port/input height/.initial=.6}
1297 \ctikzset{tripoles/european or port/width/.initial=1.4}
1298 \ctikzset{tripoles/european or port/height/.initial=.65}
1299 \ctikzset{tripoles/european or port/reserved/.initial=.6}
1300 \ctikzset{tripoles/european or port/input height/.initial=.6}
1301 \ctikzset{tripoles/european xor port/width/.initial=1.4}
1302 \ctikzset{tripoles/european xor port/height/.initial=.65}
1303 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
1304 \ctikzset{tripoles/european xor port/input height/.initial=.6}
1305 \ctikzset{tripoles/european nand port/width/.initial=1.4}
1306 \ctikzset{tripoles/european nand port/not height/.initial=.3}
1307 \ctikzset{tripoles/european nand port/not width/.initial=.8}
1308 \ctikzset{tripoles/european nand port/height/.initial=.65}
1309 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
1310 \ctikzset{tripoles/european nand port/input height/.initial=.6}
1311 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
1312 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
1313 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
1314 \ctikzset{tripoles/european buffer port/height/.initial=.65}
1315 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
1316 \ctikzset{tripoles/european buffer port/input height/.initial=0}
1317 \ctikzset{tripoles/european not port/width/.initial=1.4}
1318 \ctikzset{tripoles/european not port/not height/.initial=.3}
1319 \ctikzset{tripoles/european not port/not width/.initial=.8}
1320 \ctikzset{tripoles/european not port/height/.initial=.65}
1321 \ctikzset{tripoles/european not port/reserved/.initial=.6}
1322 \ctikzset{tripoles/european not port/input height/.initial=0}
1323 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
1324 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
1325 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
1326 \ctikzset{tripoles/european xnor port/height/.initial=.65}
1327 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
1328 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
1329 \ctikzset{tripoles/european nor port/width/.initial=1.4}
1330 \ctikzset{tripoles/european nor port/not height/.initial=.3}
1331 \ctikzset{tripoles/european nor port/not width/.initial=.8}
1332 \ctikzset{tripoles/european nor port/height/.initial=.65}
1333 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
1334 \ctikzset{tripoles/european nor port/input height/.initial=.6}
1335 % variable number of inputs
1336 \ctikzset{tripoles/european and port/origin/.initial=0.8}
1337 \ctikzset{tripoles/european and port/inputs/.initial=2}
1338 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
1339 \ctikzset{tripoles/european nand port/inputs/.initial=2}
1340 \ctikzset{tripoles/european or port/origin/.initial=0.8}
1341 \ctikzset{tripoles/european or port/inputs/.initial=2}
1342 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
1343 \ctikzset{tripoles/european nor port/inputs/.initial=2}
1344 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
1345 \ctikzset{tripoles/european xor port/inputs/.initial=2}
1346 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
1347 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
1348 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
1349 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
1350 \ctikzset{tripoles/european not port/origin/.initial=0.8}
1351 \ctikzset{tripoles/european not port/inputs/.initial=1}%
1352 %%% parameters that are not used anymore after multi-input
1353 %%% gates --- left for compatibility of source code.
1354 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
1355 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
1356 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
1357 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
1358 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
1359 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
1360 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
1361 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
1362 % switches for logic gates
1363 %
1364 \pgfkeys{/tikz/number inputs/.initial=0}
1365 \pgfkeys{/tikz/number inputs/.default=0}
1366
1367 %% flip-flop specific keys (most others are the same as chips)
1368
1369 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
1370 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
1371 \ctikzset{multipoles/flipflop/width/.initial=1.2}
1372 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
1373 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
1374
1375 %% muxdemuxes keys
1376
1377 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
1378 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
1379 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
1380 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
1381 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
1382 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
1383 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
1384 \ctikzset{multipoles/muxdemux/NL/.initial=8}
1385 \ctikzset{multipoles/muxdemux/NR/.initial=1}
1386 \ctikzset{multipoles/muxdemux/NB/.initial=3}
1387 \ctikzset{multipoles/muxdemux/NT/.initial=0}
1388 \ctikzset{multipoles/muxdemux/square pins/.initial=0}
1389 %
1390 % switches for op amps
1391 % changing input polarity
1392 %
1393 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
1394 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1395 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1396 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1397 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1398 %
1399 % changing output polarity (for fully diff objects)
1400 %
1401 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
1402 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1403 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1404 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1405 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1406
1407 % Operational amplifier
1408 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
1409 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
1410 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
1411 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
1412 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
1413 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1414
1415 % Fully differential operational amplifier
1416 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
1417 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
1418 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
1419 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
1420 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
1421 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
1422 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1423
1424 \ctikzset{tripoles/en amp/width/.initial=1.7}
1425 \ctikzset{tripoles/en amp/port width/.initial=.7}
1426 \ctikzset{tripoles/en amp/height/.initial=1.6}
1427 \ctikzset{tripoles/en amp/input height/.initial=.3}
1428 \ctikzset{tripoles/en amp/up pos/.initial=.45}
1429 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1430 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
1431 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
1432 \tikzset{
1433 en amp text/.code = {%
1434 \ctikzsetvalof{tripoles/en amp/text}{#1}%
1435 },
1436 en amp text A/.code = {%
1437 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
1438 },
1439 }
1440
1441 % Transconductance amplifier
1442 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
1443 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
1444 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
1445 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
1446 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
1447 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
1448 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1449
1450 % Instrumentation amplifier
1451 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
1452 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
1453 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
1454 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1455 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
1456 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
1457 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1458 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1459
1460 % Instrumentation amplifier with differential output
1461 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
1462 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
1463 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
1464 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1465 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
1466 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
1467 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
1468 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1469 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1470
1471 % Instrumentation amplifier with gain resistor terminals
1472 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
1473 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
1474 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
1475 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
1476 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
1477 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
1478 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
1479 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
1480 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1481
1482 % Plain amplifier
1483 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
1484 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
1485 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
1486 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
1487 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
1488
1489 % changing fonts and symbols of amplifiers
1490 \ctikzset{amplifiers/symbol font/.code={%
1491 \ctikzset{tripoles/inst amp ra/font=#1}%
1492 \ctikzset{tripoles/fd inst amp/font=#1}%
1493 \ctikzset{tripoles/inst amp/font=#1}%
1494 \ctikzset{tripoles/gm amp/font=#1}%
1495 \ctikzset{tripoles/en amp/font=#1}%
1496 \ctikzset{tripoles/fd op amp/font=#1}%
1497 \ctikzset{tripoles/op amp/font=#1}%
1498 }}
1499 \ctikzset{amplifiers/plus/.initial={$+$}}
1500 \ctikzset{amplifiers/minus/.initial={$-$}}
1501 \tikzset{amp symbol font/.code={%
1502 \ctikzset{amplifiers/symbol font={#1}}%
1503 }
1504 }
1505 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
1506 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
1507 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
1508 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
1509
1510 \ctikzset{tripoles/thyristor/height/.initial=1.10}
1511 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
1512 \ctikzset{tripoles/thyristor/width/.initial=1.0}
1513 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
1514 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
1515 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
1516
1517 \ctikzset{tripoles/triac/height/.initial=1.1}
1518 \ctikzset{tripoles/triac/width/.initial=1}
1519 \ctikzset{tripoles/triac/diode width left/.initial=.3}
1520 \ctikzset{tripoles/triac/diode width right/.initial=.3}
1521
1522 %% Cute switches
1523 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
1524 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
1525 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
1526 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
1527 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
1528
1529 \ctikzset{tripoles/spdt/width/.initial=.85}
1530 \ctikzset{tripoles/spdt/height/.initial=.45}
1531 \ctikzset{tripoles/spdt/margin/.initial=.45}
1532
1533 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
1534 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
1535 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
1536
1537 \ctikzset{tripoles/mixer/width/.initial=0.7}
1538 \ctikzset{tripoles/adder/width/.initial=0.7}
1539 \ctikzset{tripoles/circulator/width/.initial=.7}
1540 \ctikzset{tripoles/oscillator/width/.initial=.7}
1541
1542
1543 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
1544 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
1545
1546 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
1547 \ctikzset{quadpoles/transformer/width/.initial=1.5}
1548 \ctikzset{quadpoles/transformer/width1/.initial=.4}
1549 \ctikzset{quadpoles/transformer/height/.initial=1.5}
1550 \ctikzset{quadpoles/transformer/height1/.initial=.8}
1551 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
1552 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
1553 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
1554 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
1555 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
1556 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
1557 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
1558 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
1559 \ctikzset{quadpoles/fourport/width/.initial=1.3}
1560 \ctikzset{quadpoles/fourport/height/.initial=1.3}
1561 \ctikzset{quadpoles/coupler/width/.initial=1.3}
1562 \ctikzset{quadpoles/coupler/height/.initial=1.3}
1563 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
1564 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
1565
1566 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
1567
1568 \ctikzset{quadpoles style/.is choice}
1569 \ctikzset{quadpoles style/inward/.code={% default value
1570 \ctikzset{quadpoles/transformer/inner=0.4}%
1571 \ctikzset{quadpoles/transformer/width=1.5}%
1572 \ctikzset{quadpoles/transformer core/inner=0.4}%
1573 \ctikzset{quadpoles/transformer core/width=1.5}%
1574 \ctikzset{quadpoles/gyrator/inner=0.4}%
1575 \ctikzset{quadpoles/gyrator/width=1.5}%
1576 }%
1577 }
1578 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
1579 \ctikzset{quadpoles/transformer/inner=1}%
1580 \ctikzset{quadpoles/transformer/width=0.6}%
1581 \ctikzset{quadpoles/transformer core/inner=1}%
1582 \ctikzset{quadpoles/transformer core/width=0.6}%
1583 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
1584 \ctikzset{quadpoles/gyrator/width=0.6}%
1585 }%
1586 }
1587
1588 %
1589 % multipoles
1590 %
1591 \ctikzset{multipoles/thickness/.initial=2}
1592 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
1593 % DIP (dual in line package) chips
1594 \ctikzset{multipoles/dipchip/width/.initial=1.2}
1595 \ctikzset{multipoles/dipchip/num pins/.initial=8}
1596 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
1597 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
1598 % QFP (quad flat package) chips
1599 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
1600 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
1601 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
1602 % chip numbers
1603 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
1604 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
1605 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
1606 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
1607 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
1608 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
1609 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
1610 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
1611 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
1612 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
1613 % external chip pins
1614 \ctikzset{multipoles/external pins thickness/.initial=1}
1615 \ctikzset{multipoles/external pins width/.initial=0.2}
1616 \ctikzset{multipoles/external pad fraction/.initial=0}
1617 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
1618 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
1619 % topmarks
1620 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
1621 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
1622 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
1623 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
1624 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
1625
1626 % rotary switch by Romano
1627 \ctikzset{multipoles/rotary/thickness/.initial=1}
1628 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
1629 \ctikzset{multipoles/rotary/channels/.initial=5}
1630 \ctikzset{multipoles/rotary/angle/.initial=60}
1631 \ctikzset{multipoles/rotary/wiper/.initial=20}
1632 \ctikzset{multipoles/rotary/arrow/.is choice}
1633 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
1634 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
1635 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
1636 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
1637 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
1638 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
1639 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
1640
1641 \tikzset{%
1642 rotary switch/.style args={#1in#2wiper#3}{%
1643 shape=rotaryswitch,
1644 /tikz/circuitikz/multipoles/rotary/channels=#1,
1645 /tikz/circuitikz/multipoles/rotary/angle=#2,
1646 /tikz/circuitikz/multipoles/rotary/wiper=#3,
1647 },
1648 rotary switch -/.style args={#1in#2wiper#3}{
1649 rotary switch=#1 in #2 wiper #3,
1650 /tikz/circuitikz/multipoles/rotary/arrow=none,
1651 },
1652 rotary switch <-/.style args={#1in#2wiper#3}{
1653 rotary switch=#1 in #2 wiper #3,
1654 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
1655 },
1656 rotary switch ->/.style args={#1in#2wiper#3}{
1657 rotary switch=#1 in #2 wiper #3,
1658 /tikz/circuitikz/multipoles/rotary/arrow=cw,
1659 },
1660 rotary switch <->/.style args={#1in#2wiper#3}{
1661 rotary switch=#1 in #2 wiper #3,
1662 /tikz/circuitikz/multipoles/rotary/arrow=both,
1663 },
1664 % Notice that these should be the same as the initial values of the keys
1665 rotary switch/.default={5 in 60 wiper 20},
1666 rotary switch -/.default={5 in 60 wiper 20},
1667 rotary switch <-/.default={5 in 60 wiper 20},
1668 rotary switch ->/.default={5 in 60 wiper 20},
1669 rotary switch <->/.default={5 in 60 wiper 20},
1670 }
1671
1672 % %Mechanical section
1673 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
1674 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
1675 \ctikzset{bipoles/spring/height/.initial=.5}
1676 \ctikzset{bipoles/spring/width/.initial=.5}
1677 \ctikzset{bipoles/mass/height/.initial=.55}
1678 \ctikzset{bipoles/mass/box height/.initial=.4}
1679 \ctikzset{bipoles/mass/width/.initial=.5}
1680
1681 \ctikzset{bipoles/damper/height/.initial=.35}
1682 \ctikzset{bipoles/damper/length/.initial=.3}
1683 \ctikzset{bipoles/damper/width/.initial=.4}
1684
1685
1686 \ctikzset{bipole/.is family}
1687 \ctikzset{bipole/kind/.initial=}
1688 \ctikzset{bipole/name/.initial=}
1689 \newif\ifpgf@circuit@bipole@isvoltage
1690 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
1691 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
1692 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
1693 \newif\ifpgf@circuit@bipole@strokedsymbol
1694 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
1695 \newif\ifpgf@circuit@bipole@iscurrent
1696 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
1697
1698 \ctikzset{bipole/voltage/.is family}
1699 \newif\ifpgf@circuit@bipole@voltage@backward
1700 \ctikzset{bipole/voltage/direction/.is choice}
1701 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1702 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1703 \newif\ifpgf@circuit@bipole@voltage@below
1704 \ctikzset{bipole/voltage/position/.is choice}
1705 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
1706 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
1707
1708 \ctikzset{bipole/voltage/label/unit/.initial=}
1709 \ctikzset{bipole/voltage/label/name/.initial=}
1710
1711 \ctikzset{bipole/current/.is family}
1712 \newif\ifpgf@circuit@bipole@current@backward
1713 \ctikzset{bipole/current/direction/.is choice}
1714 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
1715 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
1716 \newif\ifpgf@circuit@bipole@current@before
1717 \ctikzset{bipole/current/x position/.is choice}
1718 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
1719 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
1720 \newif\ifpgf@circuit@bipole@current@below
1721 \ctikzset{bipole/current/y position/.is choice}
1722 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
1723 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
1724 \ctikzset{bipole/current/label/unit/.initial=}
1725 \ctikzset{bipole/current/label/name/.initial=}
1726
1727 \ctikzset{bipole/flow/.is family}
1728 \newif\ifpgf@circuit@bipole@flow@backward
1729 \ctikzset{bipole/flow/direction/.is choice}
1730 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
1731 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
1732 \newif\ifpgf@circuit@bipole@flow@before
1733 \ctikzset{bipole/flow/x position/.is choice}
1734 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
1735 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
1736 \newif\ifpgf@circuit@bipole@flow@below
1737 \ctikzset{bipole/flow/y position/.is choice}
1738 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
1739 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
1740 \ctikzset{bipole/flow/label/unit/.initial=}
1741 \ctikzset{bipole/flow/label/name/.initial=}
1742 \ctikzset{flow/distance/.initial = .5}
1743 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
1744
1745 \ctikzset{bipole/label/.is family}
1746 \ctikzset{bipole/label/position/.initial=90}
1747 \ctikzset{bipole/label/unit/.initial=}
1748 \ctikzset{bipole/label/name/.initial=}
1749 \ctikzset{bipole/annotation/.is family}
1750 \ctikzset{bipole/annotation/position/.initial=-90}
1751 \ctikzset{bipole/annotation/unit/.initial=}
1752 \ctikzset{bipole/annotation/name/.initial=}
1753
1754 \newif\ifpgf@circuit@europeanresistor
1755 \ctikzset{resistor/.is choice}
1756 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
1757 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
1758
1759 \ctikzset{inductor/.is choice}
1760 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
1761 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
1762 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
1763
1764 \newif\ifpgf@circuit@strokediode
1765 \newif\ifpgf@circuit@fulldiode
1766 \pgf@circuit@strokediodefalse
1767 \pgf@circuit@fulldiodefalse
1768
1769 \ctikzset{diode/.is choice}
1770 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
1771 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
1772 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
1773
1774 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
1775 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
1776 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
1777
1778 \ctikzset{thickness/.initial=2}
1779 \ctikzset{color/.initial=black}
1780 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
1781
1782 \newif\ifpgf@circ@siunitx
1783 \newif\ifpgf@circ@siunitx@res
1784
1785 \ctikzset{straight/.is choice}
1786 \ctikzset{straightvoltage value/.initial=true}
1787 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
1788 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
1789 \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
1790 \newif\ifpgf@circuit@bipole@voltage@straight
1791 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
1792
1793
1794 \ctikzset{voltage/.is family}
1795 \ctikzset{voltage/distance from node/.initial=.5} %\pgf@circ@Rlen units
1796 \ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
1797 \ctikzset{voltage/bump a/.initial=1.2}
1798 \ctikzset{voltage/bump b/.initial=1.5}
1799 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
1800 \ctikzset{voltage shift/.style={voltage/shift=#1}}
1801 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1802 \ctikzset{voltage/european label distance/.initial=1.4}
1803 \ctikzset{voltage/american label distance/.initial=1.1}
1804 % shaping the +/- sign, see pgfcircvoltage.tex
1805 \ctikzset{voltage/american font/.initial={}}
1806 \ctikzset{voltage/american plus/.initial={$+$}}
1807 \ctikzset{voltage/american minus/.initial={$-$}}
1808
1809 % special cases
1810 \ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
1811 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
1812 \ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
1813 %\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
1814 \ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
1815 \ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
1816 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
1817 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
1818 \ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
1819 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
1820 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
1821 \ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
1822 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
1823 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
1824 \ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
1825 %\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
1826 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
1827 \ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
1828 %\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
1829 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
1830 \ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
1831 %\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
1832 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
1833 \ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
1834 %\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
1835 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
1836 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
1837 %\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
1838 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
1839 %\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
1840 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
1841
1842 \ctikzset{current/.is family}
1843 \ctikzset{current/distance/.initial = .5}
1844
1845
1846 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
1847 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
1848 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
1849 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
1850 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
1851 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
1852
1853 \newif\ifpgf@circuit@europeangfsurgearrester
1854 \ctikzset{gas filled surge arrester choice/.is choice}
1855 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
1856 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
1857
1858 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
1859 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
1860 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
1861 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
1862 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
1863 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
1864 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
1865 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
1866 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
1867 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
1868
1869 % I should try to make the tree clearer (this voltage conflicts with the options above)
1870
1871 \newif\ifpgf@circuit@europeanvoltage
1872 \ctikzset{voltage/.is choice}
1873 \ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse}}
1874 \ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue}}
1875
1876 \newif\ifpgf@circuit@europeancurrent
1877 \ctikzset{current/.is choice}
1878 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
1879 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
1880
1881 % noise sources
1882 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
1883
1884 \ctikzset{label/align/.is choice}
1885 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
1886 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
1887 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
1888
1889 % seven segment displays by RGtti
1890
1891 \newif\ifpgf@circ@sevenseg@dot
1892 \newif\ifpgf@circ@sevenseg@box
1893 \def\pgf@circ@sevenseg@dotstate{empty}
1894 \ctikzset{seven seg/.is family}
1895 \ctikzset{seven seg/dot/.is choice}
1896 % none means no dot, not space for it. Empty means no dot, but space
1897 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
1898 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
1899 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
1900 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
1901 %
1902 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
1903 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
1904 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
1905 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
1906 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
1907 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
1908 \ctikzset{seven seg/box/.is choice}
1909 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
1910 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
1911
1912 \ctikzset{seven seg/bits/.initial=0000000}
1913
1914 \ctikzset{seven seg/value/.code={%
1915 \edef\@@tmp{#1}%
1916 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
1917 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
1918 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
1919 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
1920 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
1921 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
1922 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
1923 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
1924 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
1925 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
1926 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
1927 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
1928 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
1929 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
1930 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
1931 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
1932 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
1933 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
1934 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
1935 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
1936 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
1937 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
1938 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
1939 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
1940 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
1941 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
1942 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
1943 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
1944 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
1945 }}
1946
1947 \tikzset{%
1948 seven segment val/.style args={#1dot#2box#3}{%
1949 shape=bare7seg,
1950 /tikz/circuitikz/seven seg/value=#1,
1951 /tikz/circuitikz/seven seg/dot=#2,
1952 /tikz/circuitikz/seven seg/box=#3,
1953 },
1954 seven segment bits/.style args={#1dot#2box#3}{%
1955 shape=bare7seg,
1956 /tikz/circuitikz/seven seg/bits=#1,
1957 /tikz/circuitikz/seven seg/dot=#2,
1958 /tikz/circuitikz/seven seg/box=#3,
1959 },
1960 }
1961
1962
1963 %%%%%%%%%% new
1964 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
1965
1966 % Electronic tubes: diodetube, triode, tetrode and pentode
1967 \ctikzset{tubes/width/.initial=1} % relative width
1968 \ctikzset{tubes/height/.initial=1.4} % relative height
1969 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
1970 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
1971 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
1972 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
1973 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
1974 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
1975 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
1976 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
1977 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
1978 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
1979 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
1980 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
1981 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
1982
1983 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
1984 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1985 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1986 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
1987 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1988 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1989 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
1990 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
1991 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
1992
1993 %%%---------- close: tex/pgfcirc.defines
1994 %%%%%%%%%%% Springe nach tex/pgfcircutils
1995 %%%---------- open: tex/pgfcircutils.tex
1996 % Copyright 2018-2026 by Romano Giannetti
1997 % Copyright 2015-2026 by Stefan Lindner
1998 % Copyright 2013-2026 by Stefan Erhardt
1999 % Copyright 2007-2026 by Massimo Redaelli
2000 %
2001 % This file may be distributed and/or modified
2002 %
2003 % 1. under the LaTeX Project Public License and/or
2004 % 2. under the GNU Public License.
2005 %
2006 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2007
2008 \def\pgf@circ@handleSI#1{
2009 \noexpandarg
2010 \def\pgf@temp{}
2011 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
2012 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
2013
2014 \ifnum\pgf@circ@handleSI@unit@len=0
2015 \pgf@circ@siunitx@resfalse
2016 \else
2017 \IfEndWith{#1}{>}{
2018 \pgf@circ@siunitx@restrue
2019 \noexpandarg
2020 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
2021 %\typeout{si |#1|}
2022 }{
2023 \pgf@circ@siunitx@resfalse
2024 %\typeout{no si |#1|}
2025 }
2026 \fi
2027 }
2028
2029 \def\pgf@circ@ifkeyempty#1{
2030 \pgfextra{
2031 \ctikzset{#1/.get=\pgf@circ@temp}
2032 \edef\pgf@temp{}
2033 }
2034 \ifx\pgf@circ@temp\pgf@temp
2035 }
2036
2037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2038 %% Math routines
2039
2040 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
2041
2042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2043 %% useful commands
2044
2045 \ifpgfutil@format@is@latex
2046 %% flipping text
2047 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
2048 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
2049 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
2050 % text mode overbar
2051 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2052 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
2053 \else\ifpgfutil@format@is@plain
2054 % text mode overbar
2055 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2056 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2057 \else\ifpgfutil@format@is@context
2058 % text mode overbar
2059 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2060 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2061 \fi\fi\fi
2062
2063
2064 %%%---------- close: tex/pgfcircutils
2065
2066 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2067 %%%---------- open: tex/pgfcircshapes.tex
2068 % Copyright 2018-2026 by Romano Giannetti
2069 % Copyright 2015-2026 by Stefan Lindner
2070 % Copyright 2013-2026 by Stefan Erhardt
2071 % Copyright 2007-2026 by Massimo Redaelli
2072 %
2073 % This file may be distributed and/or modified
2074 %
2075 % 1. under the LaTeX Project Public License and/or
2076 % 2. under the GNU Public License.
2077 %
2078 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2079
2080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2081 %% Other shapes
2082
2083 %% Nothing
2084
2085 \pgfdeclareshape{emptyshape}{
2086 \savedanchor{\northeast}{%
2087 \pgf@x=.5\wd\pgfnodeparttextbox%
2088 \pgf@y=.5\ht\pgfnodeparttextbox%
2089 }
2090 \anchor{north}{\northeast\pgf@x=0cm\relax}
2091 \anchor{east}{\northeast\pgf@y=0cm\relax}
2092 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2093 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2094 \anchor{north east}{\northeast}
2095 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2096 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2097 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2098 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2099 \anchor{center}{
2100 \pgfpointorigin
2101 }
2102 }
2103 %
2104 % Provision for changing opacity. Only expert use, see the manual.
2105 %
2106 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2107 \tikzset{open poles opacity/.code={%
2108 \ctikzset{poles/open fill opacity=#1}%
2109 }}
2110 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2111 \tikzset{full poles opacity/.code={%
2112 \ctikzset{poles/full fill opacity=#1}%
2113 }}
2114
2115 %% Full terminal
2116
2117 \pgfdeclareshape{circ}{
2118 \anchor{center}{
2119 \pgfpointorigin
2120 }
2121 \savedanchor\northwest{%
2122 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2123 \pgf@x=-\pgf@y
2124 }
2125 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2126 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2127 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2128 \anchor{west}{ \northwest \pgf@y=0pt }
2129 \anchor{w}{ \northwest \pgf@y=0pt }
2130 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2131 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2132 \anchor{north}{ \northwest \pgf@x=0pt }
2133 \anchor{n}{ \northwest \pgf@x=0pt }
2134 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2135 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2136 \anchor{north west}{ \northwest }
2137 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2138 \anchorborder{
2139 \pgf@circ@res@left=\pgf@x
2140 \pgf@circ@res@up=\pgf@y
2141 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2142 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2143 }
2144 \behindforegroundpath{
2145
2146 \pgfscope
2147 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2148 \pgfsetcolor{\ctikzvalof{color}}
2149 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2150 \pgfusepath{draw,fill}
2151 \endpgfscope
2152
2153 }
2154 }
2155
2156 %% Empty round terminal
2157
2158 \pgfdeclareshape{ocirc}{
2159 \anchor{center}{
2160 \pgfpointorigin
2161 }
2162 \savedanchor\northwest{%
2163 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2164 \pgf@x=-\pgf@y
2165 }
2166 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2167 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2168 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2169 \anchor{west}{ \northwest \pgf@y=0pt }
2170 \anchor{w}{ \northwest \pgf@y=0pt }
2171 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2172 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2173 \anchor{north}{ \northwest \pgf@x=0pt }
2174 \anchor{n}{ \northwest \pgf@x=0pt }
2175 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2176 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2177 \anchor{north west}{ \northwest }
2178 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2179 \anchorborder{
2180 \pgf@circ@res@left=\pgf@x
2181 \pgf@circ@res@up=\pgf@y
2182 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2183 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2184 }
2185
2186 \behindforegroundpath{
2187
2188 \pgfscope
2189 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2190 \pgfsetcolor{\ctikzvalof{color}}
2191 \ifx\tikz@fillcolor\pgfutil@empty
2192 % set the default fill color to white
2193 \pgfsetfillcolor{white}
2194 % ...but override it if the class is defined!
2195 % note that this element has no class, but will inherit it when used
2196 % into another component
2197 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2198 \else
2199 \pgfsetfillcolor{\tikz@fillcolor}
2200 \fi
2201 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2202 \pgfusepath{draw,fill}
2203 \endpgfscope
2204
2205 }
2206 }
2207
2208 %% Diamond terminal
2209
2210 \pgfdeclareshape{diamondpole}{
2211 \anchor{center}{
2212 \pgfpointorigin
2213 }
2214 \savedanchor\northwest{%
2215 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2216 \pgf@x=-\pgf@y
2217 }
2218 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2219 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2220 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2221 \anchor{west}{ \northwest \pgf@y=0pt }
2222 \anchor{w}{ \northwest \pgf@y=0pt }
2223 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2224 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2225 \anchor{north}{ \northwest \pgf@x=0pt }
2226 \anchor{n}{ \northwest \pgf@x=0pt }
2227 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2228 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2229 \anchor{north west}{ \northwest }
2230 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2231 \anchorborder{
2232 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2233 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2234 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2235 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2236 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2237 \pgfextracty{\pgf@circ@res@up}{\northwest}
2238 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2239 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2240 \pgfpointintersectionoflines
2241 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2242 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2243 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2244 \pgf@x=\@@switchx\pgf@x
2245 \pgf@y=\@@switchy\pgf@y
2246 }
2247 \behindforegroundpath{
2248 \pgfscope
2249 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2250 \pgftransformrotate{45}
2251 \pgfpathrectanglecorners
2252 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2253 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2254 \pgfsetcolor{\ctikzvalof{color}}
2255 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2256 \pgfusepath{draw,fill}
2257 \endpgfscope
2258 }
2259 }
2260
2261 %% Diamond terminal, unfilled
2262
2263 \pgfdeclareshape{odiamondpole}{
2264 \anchor{center}{
2265 \pgfpointorigin
2266 }
2267 \savedanchor\northwest{%
2268 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2269 \pgf@x=-\pgf@y
2270 }
2271 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2272 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2273 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2274 \anchor{west}{ \northwest \pgf@y=0pt }
2275 \anchor{w}{ \northwest \pgf@y=0pt }
2276 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2277 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2278 \anchor{north}{ \northwest \pgf@x=0pt }
2279 \anchor{n}{ \northwest \pgf@x=0pt }
2280 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2281 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2282 \anchor{north west}{ \northwest }
2283 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2284 \anchorborder{
2285 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2286 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2287 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2288 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2289 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2290 \pgfextracty{\pgf@circ@res@up}{\northwest}
2291 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2292 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2293 \pgfpointintersectionoflines
2294 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2295 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2296 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2297 \pgf@x=\@@switchx\pgf@x
2298 \pgf@y=\@@switchy\pgf@y
2299 }
2300 \behindforegroundpath{
2301 \pgfscope
2302 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2303 \pgftransformrotate{45}
2304 \pgfpathrectanglecorners
2305 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2306 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2307 \pgfsetcolor{\ctikzvalof{color}}
2308 \ifx\tikz@fillcolor\pgfutil@empty
2309 % set the default fill color to white
2310 \pgfsetfillcolor{white}
2311 % ...but override it if the class is defined!
2312 % note that this element has no class, but will inherit it when used
2313 % into another component
2314 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2315 \else
2316 \pgfsetfillcolor{\tikz@fillcolor}
2317 \fi
2318 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2319 \pgfusepath{draw,fill}
2320 \endpgfscope
2321 }
2322 }
2323
2324 %% square terminal, filled
2325
2326 \pgfdeclareshape{squarepole}{
2327 \anchor{center}{
2328 \pgfpointorigin
2329 }
2330 \savedanchor\northwest{%
2331 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2332 \pgf@x=-\pgf@y
2333 }
2334 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2335 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2336 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2337 \anchor{west}{ \northwest \pgf@y=0pt }
2338 \anchor{w}{ \northwest \pgf@y=0pt }
2339 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2340 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2341 \anchor{north}{ \northwest \pgf@x=0pt }
2342 \anchor{n}{ \northwest \pgf@x=0pt }
2343 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2344 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2345 \anchor{north west}{ \northwest }
2346 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2347 \anchorborder{
2348 \pgf@xa=\pgf@x
2349 \pgf@ya=\pgf@y
2350 \pgfextracty{\pgf@circ@res@up}{\northwest}
2351 \pgfpointborderrectangle
2352 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2353 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2354 }
2355 \behindforegroundpath{
2356 \pgfscope
2357 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2358 \pgfpathrectanglecorners
2359 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2360 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2361 \pgfsetcolor{\ctikzvalof{color}}
2362 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2363 \pgfusepath{draw,fill}
2364 \endpgfscope
2365 }
2366 }
2367 %% square terminal, unfilled
2368
2369 \pgfdeclareshape{osquarepole}{
2370 \anchor{center}{
2371 \pgfpointorigin
2372 }
2373 \savedanchor\northwest{%
2374 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2375 \pgf@x=-\pgf@y
2376 }
2377 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2378 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2379 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2380 \anchor{west}{ \northwest \pgf@y=0pt }
2381 \anchor{w}{ \northwest \pgf@y=0pt }
2382 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2383 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2384 \anchor{north}{ \northwest \pgf@x=0pt }
2385 \anchor{n}{ \northwest \pgf@x=0pt }
2386 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2387 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2388 \anchor{north west}{ \northwest }
2389 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2390 \anchorborder{
2391 \pgf@xa=\pgf@x
2392 \pgf@ya=\pgf@y
2393 \pgfextracty{\pgf@circ@res@up}{\northwest}
2394 \pgfpointborderrectangle
2395 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2396 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2397 }
2398 \behindforegroundpath{
2399 \pgfscope
2400 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2401 \pgfpathrectanglecorners
2402 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2403 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2404 \pgfsetcolor{\ctikzvalof{color}}
2405 \ifx\tikz@fillcolor\pgfutil@empty
2406 % set the default fill color to white
2407 \pgfsetfillcolor{white}
2408 % ...but override it if the class is defined!
2409 % note that this element has no class, but will inherit it when used
2410 % into another component
2411 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2412 \else
2413 \pgfsetfillcolor{\tikz@fillcolor}
2414 \fi
2415 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2416 \pgfusepath{draw,fill}
2417 \endpgfscope
2418 }
2419 }
2420 % BNC connector
2421
2422 \pgfdeclareshape{bnc}{
2423 \anchor{center}{
2424 \pgfpointorigin
2425 }
2426 % BNC size is 2.5 times the size of the internal "ocirc"
2427 \savedanchor\northwest{%
2428 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2429 \pgf@y=2.5\pgf@y
2430 \pgf@x=-\pgf@y
2431 }
2432 % center is on the opening
2433 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2434 \anchor{zero}{ \pgfpointorigin }
2435 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2436 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2437 % geo-anchors
2438 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2439 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2440 \anchor{west}{ \northwest \pgf@y=0pt }
2441 \anchor{left}{ \northwest \pgf@y=0pt }
2442 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2443 \anchor{north}{ \northwest \pgf@x=0pt }
2444 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2445 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2446 \anchor{north west}{ \northwest }
2447 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2448 % put the node text above and centered
2449 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2450 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2451 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2452 }
2453 }
2454 \anchorborder{
2455 \pgf@circ@res@left=\pgf@x
2456 \pgf@circ@res@up=\pgf@y
2457 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2458 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2459 }
2460 \behindforegroundpath{
2461 \pgfextracty{\pgf@circ@res@other}{\northwest}
2462 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2463 \pgfscope
2464 \pgfstartlinewidth=\pgflinewidth
2465 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2466 \pgfsetcolor{\ctikzvalof{color}}
2467 % external circle
2468 \pgfscope
2469 % clipping path: first a rectangle bigger then the shape
2470 % to avoid problems with the line thickness
2471 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2472 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2473 % next the opening to the right
2474 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2475 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2476 % do the difference and clip before drawing
2477 \pgfseteorule
2478 \pgfusepath{clip}
2479 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2480 \pgfusepath{draw}
2481 \endpgfscope
2482 % internal circle
2483 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2484 \pgf@circ@draworfill
2485 % and the contact line to the right
2486 \pgfsetlinewidth{\pgfstartlinewidth}
2487 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2488 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2489 \pgfusepath{draw}
2490 \endpgfscope
2491 }
2492 }
2493
2494 %% Fill for correct rectangular joins
2495
2496 \pgfdeclareshape{rectjoinfill}{
2497 \savedanchor{\northeast}{%
2498 \pgf@x=.5\pgflinewidth%
2499 \pgf@y=.5\pgflinewidth%
2500 }
2501 \anchor{north}{\northeast\pgf@x=0cm\relax}
2502 \anchor{east}{\northeast\pgf@y=0cm\relax}
2503 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2504 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2505 \anchor{north east}{\northeast}
2506 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2507 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2508 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2509 \anchor{center}{
2510 \pgfpointorigin
2511 }
2512 \anchorborder{
2513 \pgf@circ@res@left=\pgf@x
2514 \pgf@circ@res@up=\pgf@y
2515 }
2516 \behindforegroundpath{
2517 \pgfscope
2518 \pgfpathrectanglecorners
2519 {\pgfpoint{0}{.5\pgflinewidth}}
2520 {\pgfpoint{0}{-.5\pgflinewidth}}
2521 \pgfsetcolor{\ctikzvalof{color}}
2522 \pgfusepath{draw,fill}
2523 \endpgfscope
2524 }
2525 }
2526
2527 %% transistor arrow
2528
2529 \def\pgf@circ@find@linescale{
2530 % find the scale inverse of the scale factor: line width do not scale
2531 % with scale=..., transform shape so we have to counteract it.
2532 \iftikz@fullytransformed % this is true if `transform shape` is active
2533 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2534 % Note that this trick is not working inside a `spy` environment...
2535 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2536 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2537 \else
2538 \pgfmathsetmacro{\@@factor}{1.0}
2539 \fi
2540 }
2541
2542 \pgfdeclareshape{trarrow}{%
2543 % this arrow is only filled but grows with the linewidth, more or less
2544 % like currarrow do
2545 \savedanchor{\northeast}{%
2546 \pgf@circ@res@step = \pgf@circ@Rlen
2547 \pgf@circ@find@linescale
2548 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2549 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2550 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2551 }
2552 % The arrow size should be more or less the same of a currarrow, which is
2553 % both filled and stroke, for backward output compatibility (more or less)
2554 %
2555 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2556 % |-\__ currarrow as the tip at (W,0)
2557 % | | and the upper tail at (-0.7*W, 0.8*W)
2558 % | \__ it then "overshoot" do to the linew width L
2559 % | \__ xangle \alpha
2560 % ---0------->
2561 %
2562 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2563 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2564 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2565 %
2566 \savedanchor{\northwest}{%
2567 \pgf@circ@res@step = \pgf@circ@Rlen
2568 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2569 \pgf@circ@find@linescale
2570 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2571 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2572 }
2573 \savedanchor{\tip}{%
2574 \pgf@circ@res@step = \pgf@circ@Rlen
2575 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2576 \pgf@circ@find@linescale
2577 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2578 }
2579 \anchor{north}{\northeast\pgf@x=0cm\relax}
2580 \anchor{east}{\northeast\pgf@y=0cm\relax}
2581 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2582 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2583 \anchor{north east}{\northeast}
2584 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2585 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2586 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2587 \anchor{center}{
2588 \pgfpointorigin
2589 }
2590 \anchor{tip}{
2591 \tip
2592 }
2593 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2594 \tip
2595 \pgf@circ@find@linescale
2596 \pgf@circ@res@temp=\@@factor\pgflinewidth
2597 \advance\pgf@x by -.5\pgf@circ@res@temp
2598 }
2599 \behindforegroundpath{
2600 \pgfscope
2601 \northwest
2602 \pgf@circ@res@up=\pgf@y
2603 \pgf@circ@res@left=\pgf@x
2604 \tip
2605 \pgf@circ@res@step = \pgf@x
2606 %
2607 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2608 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2609 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2610 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2611 \pgfpathclose
2612 \pgfsetcolor{\ctikzvalof{color}}
2613 \pgfusepath{fill} % just fill
2614 \endpgfscope
2615 }
2616 }
2617
2618 %% Current arrow
2619
2620 \pgfdeclareshape{currarrow}{
2621 \savedanchor{\northeast}{%
2622 \pgf@circ@res@step = \pgf@circ@Rlen
2623 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2624 \pgf@x=.5\pgf@circ@res@step
2625 \pgf@y=\pgf@x%
2626 }
2627 \anchor{north}{\northeast\pgf@x=0cm\relax}
2628 \anchor{east}{\northeast\pgf@y=0cm\relax}
2629 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2630 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2631 \anchor{north east}{\northeast}
2632 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2633 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2634 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2635 \anchor{center}{
2636 \pgfpointorigin
2637 }
2638 \anchor{tip}{
2639 \pgfpointorigin
2640 \pgf@circ@res@step = \pgf@circ@Rlen
2641 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2642 \pgf@x =\pgf@circ@res@step
2643 }
2644 \behindforegroundpath{
2645 \pgfscope
2646 \pgf@circ@res@step = \pgf@circ@Rlen
2647 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2648
2649 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2650 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2651 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2652 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2653 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2654 \pgfsetcolor{\ctikzvalof{color}}
2655 \pgfusepath{draw,fill}
2656
2657 \endpgfscope
2658 }
2659 }
2660
2661 %% Flow arrow
2662
2663 \pgfdeclareshape{flowarrow}{
2664 \savedanchor{\northeast}{%
2665 \pgf@circ@res@step = \pgf@circ@Rlen
2666 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2667 \pgf@y=.5\pgf@circ@res@step
2668 \pgf@circ@res@step = \pgf@circ@Rlen
2669 \divide \pgf@circ@res@step by 4
2670 \pgf@x=\pgf@circ@res@step%
2671 }
2672 \anchor{north}{\northeast\pgf@x=0cm\relax}
2673 \anchor{east}{\northeast\pgf@y=0cm\relax}
2674 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2675 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2676 \anchor{north east}{\northeast}
2677 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2678 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2679 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2680 \anchor{text}{% text centered above
2681 \pgfpointorigin
2682 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2683 }
2684 \anchor{center}{
2685 \pgfpointorigin
2686 }
2687 \anchor{tip}{
2688 \pgfpointorigin
2689 \pgf@circ@res@step = \pgf@circ@Rlen
2690 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2691 \pgf@x =\pgf@circ@res@step
2692 }
2693 \behindforegroundpath{
2694 \pgfscope
2695 \pgf@circ@res@step = \pgf@circ@Rlen
2696 \divide \pgf@circ@res@step by 4
2697 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2699 \pgfsetcolor{\ctikzvalof{color}}
2700 \pgfusepath{draw}
2701 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2702 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2703 \endpgfscope
2704 }
2705 }
2706
2707 %% Input arrow
2708
2709 \pgfdeclareshape{inputarrow}{
2710 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2711 \pgf@circ@res@step = \pgf@circ@Rlen
2712 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2713 \pgf@y=.5\pgf@circ@res@step
2714 \pgf@x=1.7\pgf@circ@res@step
2715 }
2716 \anchor{north}{\northeast\pgf@x=0cm\relax}
2717 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2718 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2719 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2720 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2721 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2722 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2723 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2724 \savedanchor{\tip}{
2725 \pgfpointorigin
2726 }
2727 \anchor{center}{
2728 \tip
2729 }
2730 \anchor{tip}{
2731 \tip
2732 }
2733 \behindforegroundpath{
2734
2735 \pgfscope
2736 \pgf@circ@res@step = \pgf@circ@Rlen
2737 \divide \pgf@circ@res@step by 16
2738
2739 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2740 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2741 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2742 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2743 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2744 \pgfsetcolor{\ctikzvalof{color}}
2745 \pgfusepath{fill}
2746
2747 \endpgfscope
2748 }
2749 }
2750
2751
2752 %% box
2753
2754 \pgfdeclareshape{box}{
2755 \anchor{center}{
2756 \pgfpointorigin
2757 }
2758 \behindforegroundpath{
2759
2760 \pgfscope
2761 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2762 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2763 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2764 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2765 \pgf@circ@draworfill
2766 \endpgfscope
2767 }
2768 }
2769
2770 %% box scaled with blocks
2771
2772 \pgfdeclareshape{blockbox}{
2773 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2774 \anchor{center}{
2775 \pgfpointorigin
2776 }
2777 \behindforegroundpath{
2778 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2779 \pgfscope
2780 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2781 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2782 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2783 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2784 \pgf@circ@draworfill
2785 \endpgfscope
2786 }
2787 }
2788
2789 % full nodes for wire crossing
2790
2791 \pgfdeclareshape{jump crossing}
2792 {
2793 \savedanchor\northwest{%
2794 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2795 \pgf@y=.5\pgf@y
2796 \pgf@x=-\pgf@y
2797 }
2798 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2799 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2800 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2801 \anchor{west}{ \northwest \pgf@y=0pt }
2802 \anchor{w}{ \northwest \pgf@y=0pt }
2803 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2804 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2805 \anchor{north}{ \northwest \pgf@x=0pt }
2806 \anchor{n}{ \northwest \pgf@x=0pt }
2807 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2808 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2809 \anchor{north west}{ \northwest }
2810 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2811 \behindbackgroundpath{
2812 \northwest
2813 \pgf@circ@res@up = \pgf@y
2814 \pgf@circ@res@down = -\pgf@y
2815 \pgf@circ@res@right = -\pgf@x
2816 \pgf@circ@res@left = \pgf@x
2817 % horizontal jumper
2818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2819 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2820 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2821 \pgfsetbeveljoin
2822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2823 % vertical, broken path
2824 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2825 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2826 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2827 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2828 \pgfusepath{draw}
2829
2830 }
2831 }
2832 \pgfdeclareshape{plain crossing}
2833 {
2834 \savedanchor\northwest{%
2835 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2836 \pgf@y=.5\pgf@y
2837 \pgf@x=-\pgf@y
2838 }
2839 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2840 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2841 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2842 \anchor{west}{ \northwest \pgf@y=0pt }
2843 \anchor{w}{ \northwest \pgf@y=0pt }
2844 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2845 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2846 \anchor{north}{ \northwest \pgf@x=0pt }
2847 \anchor{n}{ \northwest \pgf@x=0pt }
2848 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2849 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2850 \anchor{north west}{ \northwest }
2851 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2852 \behindbackgroundpath{
2853 \northwest
2854 \pgf@circ@res@up = \pgf@y
2855 \pgf@circ@res@down = -\pgf@y
2856 \pgf@circ@res@right = -\pgf@x
2857 \pgf@circ@res@left = \pgf@x
2858 % horizontal jumper
2859 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2861 % vertical, broken path
2862 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2863 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
2864 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
2865 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2866 \pgfusepath{draw}
2867
2868 }
2869 }
2870
2871 %%%---------- close: tex/pgfcircshapes
2872 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
2873 %%%---------- open: tex/pgfcircmonopoles.tex
2874 % Copyright 2018-2026 by Romano Giannetti
2875 % Copyright 2015-2026 by Stefan Lindner
2876 % Copyright 2013-2026 by Stefan Erhardt
2877 % Copyright 2007-2026 by Massimo Redaelli
2878 %
2879 % This file may be distributed and/or modified
2880 %
2881 % 1. under the LaTeX Project Public License and/or
2882 % 2. under the GNU Public License.
2883 %
2884 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2885
2886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2887 %% Monopoles
2888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2889
2890 %%%%%%%%%%%%%
2891 %% Grounds
2892 %%%%%%%%%%%%%
2893
2894
2895 %% Ground symbol
2896 % #1 -> name
2897 % #2 -> width
2898 % #3 -> depth
2899 % #4 -> code
2900 \long\def\pgf@circ@declareground#1#2#3#4{
2901 \pgfdeclareshape{#1}{
2902 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
2903 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2904 \savedanchor{\southeast}{
2905 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2906 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2907 \pgf@x=#2\pgf@x
2908 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2909 \pgf@y=-#3\pgf@y
2910 }
2911 \anchor{north}{\pgfpointorigin}
2912 \anchor{north east}{\southeast\pgf@y=0pt\relax}
2913 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
2914 \anchor{south east}{\southeast}
2915 \anchor{south}{\southeast\pgf@x=0pt\relax}
2916 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
2917 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
2918 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
2919 \anchor{left}{\pgfpointorigin}
2920 \anchor{right}{\pgfpointorigin}
2921 \anchor{center}{\pgfpointorigin}
2922 \behindforegroundpath{
2923 \pgf@circ@scaled@Rlen=\scaledRlen
2924 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2925 \pgfscope
2926 \pgfstartlinewidth=\pgflinewidth
2927 #4
2928 \endpgfscope
2929 }
2930 }
2931 }
2932
2933
2934 \pgf@circ@declareground{ground}{0.6}{1.6}{
2935 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2936 \pgfpathmoveto{\pgfpointorigin}
2937 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
2938 \pgfusepath{draw}
2939 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2940 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2941 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2942 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2943 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2944 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2945 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2946 \pgfusepath{draw}
2947 }
2948
2949 \pgf@circ@declareground{tlground}{0.6}{0.4}{
2950 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2951 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2952 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2953 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2954 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2955 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2956 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2957 \pgfusepath{draw}
2958 }
2959
2960
2961 \pgf@circ@declareground{rground}{0.6}{1}{
2962 \pgfpathmoveto{\pgfpointorigin}
2963 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2964 \pgfusepath{draw}
2965
2966 \pgfstartlinewidth=\pgflinewidth
2967 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
2968
2969 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2970 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2971 \pgfsetroundcap\pgfusepath{draw}
2972 }
2973
2974 \pgf@circ@declareground{tground}{0.6}{0}{
2975 \pgfpathmoveto{\pgfpointorigin}
2976 \pgfusepath{draw}
2977
2978 \pgfstartlinewidth=\pgflinewidth
2979 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
2980
2981 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2982 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2983 \pgfusepath{draw}
2984 }
2985
2986 \pgf@circ@declareground{sground}{0.6}{1.8}{
2987 \pgfpathmoveto{\pgfpointorigin}
2988 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2989 \pgfusepath{draw}
2990
2991 \pgfstartlinewidth=\pgflinewidth
2992 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2993
2994 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2995 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2996 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
2997 \pgfpathclose
2998 \pgf@circ@draworfill
2999 }
3000
3001 % noiseless ground
3002 \pgf@circ@declareground{nground}{0.9}{1.6}{
3003 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3004 \pgfpathmoveto{\pgfpointorigin}
3005 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3006 \pgfusepath{draw}
3007 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3008 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3009 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3010 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3011 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3012 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3013 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3014 \pgfusepath{draw}
3015 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3016 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3017 \pgfusepath{draw}
3018 }
3019
3020 % protective ground
3021 \pgf@circ@declareground{pground}{0.9}{1.8}{
3022 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3023 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3024 \pgf@circ@draworfill
3025 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3026 \pgfpathmoveto{\pgfpointorigin}
3027 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3028 \pgfusepath{draw}
3029 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3030 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3031 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3032 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3033 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3034 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3035 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3036 \pgfusepath{draw}
3037 }
3038
3039 % chassis ground
3040 \pgf@circ@declareground{cground}{1}{2}{
3041 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3042 \pgfpathmoveto{\pgfpointorigin}
3043 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3044 \pgfusepath{draw}
3045 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3046 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3047 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3048 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3049 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3050 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3051 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3052 \pgfusepath{draw}
3053 }
3054
3055 % Contributed by @fotesan https://github.com/fotesan
3056 % european ground
3057 \pgf@circ@declareground{eground}{1.1}{1.7}{
3058 \pgfpathmoveto{\pgfpointorigin}
3059 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3060 \pgfusepath{draw}
3061
3062 \pgfstartlinewidth=\pgflinewidth
3063 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3064
3065 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3066 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3067 \pgfusepath{draw}
3068
3069 \pgfsetlinewidth{\pgfstartlinewidth}
3070 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3071 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3072 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3073 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3074 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3075 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3076 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3077 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3078 \pgfusepath{draw}
3079 }
3080
3081 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3082 \pgfpathmoveto{\pgfpointorigin}
3083 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3084 \pgfusepath{draw}
3085
3086 \pgfstartlinewidth=\pgflinewidth
3087 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3088
3089 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3090 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3091 \pgfusepath{draw}
3092
3093 \pgfsetlinewidth{\pgfstartlinewidth}
3094 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3095 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3096 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3097 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3098 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3099 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3100 \pgfusepath{draw}
3101 }
3102
3103 %%%%%%%%%%%%%%%%%%
3104 %% Power supplies
3105 %%%%%%%%%%%%%%%%%%
3106
3107 % Vcc
3108 \pgfdeclareshape{vcc}{
3109 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3110 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3111 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3112 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3113 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3114 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3115 }
3116 \savedanchor{\northeast}{%
3117 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3118 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3119 \pgf@x=.5\pgf@circ@res@step
3120 \pgf@y=3\pgf@x%
3121 }
3122 \anchor{north}{\northeast\pgf@x=0cm\relax}
3123 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3124 \anchor{south}{\pgfpointorigin}
3125 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3126 \anchor{north east}{\northeast}
3127 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3128 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3129 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3130 \anchor{center}{\pgfpointorigin}
3131 \anchor{left}{\pgfpointorigin}
3132 \anchor{right}{\pgfpointorigin}
3133 \anchor{text}{
3134 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3135 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3136 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3137 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3138 \pgf@x=0pt
3139 \pgf@y=2\pgf@circ@res@step
3140 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3141 \pgf@x=-.5\wd\pgfnodeparttextbox
3142 }
3143 \behindforegroundpath{
3144 \pgf@circ@scaled@Rlen=\scaledRlen
3145 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3146 \pgfscope
3147 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3148 \ifx\pgf@temp\pgf@circ@temp
3149 \pgfstartlinewidth=\pgflinewidth
3150 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3151
3152 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3153 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3154 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3155 \pgfusepath{draw}
3156
3157 \pgfsetlinewidth{\pgfstartlinewidth}
3158 \else
3159 \pgfsetarrowsend{\pgf@circ@temp}
3160 \fi
3161 \pgfpathmoveto{\pgfpointorigin}
3162 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3163 \pgfusepath{draw}
3164 \endpgfscope
3165 }
3166 }
3167
3168 % Vee
3169 \pgfdeclareshape{vee}{
3170 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3171 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3172 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3173 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3174 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3175 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3176 }
3177 \savedanchor{\northeast}{%
3178 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3179 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3180 \pgf@x=.5\pgf@circ@res@step
3181 \pgf@y=-3\pgf@x%
3182 }
3183 \anchor{south}{\northeast\pgf@x=0cm\relax}
3184 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3185 \anchor{north}{\pgfpointorigin}
3186 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3187 \anchor{south east}{\northeast}
3188 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3189 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3190 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3191 \anchor{center}{\pgfpointorigin}
3192 \anchor{left}{\pgfpointorigin}
3193 \anchor{right}{\pgfpointorigin}
3194 \anchor{text}{
3195 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3196 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3197 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3198 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3199 \pgf@x=0pt
3200 \pgf@y=-2\pgf@circ@res@step
3201 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3202 \pgf@x=-.5\wd\pgfnodeparttextbox
3203 }
3204
3205 \behindforegroundpath{
3206 \pgf@circ@scaled@Rlen=\scaledRlen
3207 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3208 \pgfscope
3209 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3210 \ifx\pgf@temp\pgf@circ@temp
3211
3212 \pgfstartlinewidth=\pgflinewidth
3213 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3214
3215 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3216 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3217 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3218 \pgfusepath{draw}
3219 \pgfsetlinewidth{\pgfstartlinewidth}
3220 \else
3221 \pgfsetarrowsend{\pgf@circ@temp}
3222 \fi
3223 \pgfpathmoveto{\pgfpointorigin}
3224 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3225 \pgfusepath{draw}
3226 \endpgfscope
3227 }
3228 }
3229
3230 %%%%%%%%%%%%%%%%
3231 %% RF elements
3232 %%%%%%%%%%%%%%%%
3233
3234 % Legacy tlinestub
3235 % Contributed by Leonardo Azzinnari
3236 \pgfdeclareshape{tlinestub}{
3237 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3238 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3239 \savedanchor{\northeast}{%
3240 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3241 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3242 \pgf@x=1.2\pgf@circ@res@step
3243 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3244 \pgf@y=.2\pgf@circ@res@step%
3245 }
3246 % the center is on the left side of the shape for facility of usage
3247 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3248 \anchor{east}{\northeast\pgf@y=0cm\relax}
3249 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3250 \anchor{west}{\pgfpointorigin}
3251 \anchor{north east}{\northeast}
3252 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3253 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3254 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3255 \anchor{center}{\pgfpointorigin}
3256 \behindforegroundpath{
3257 \pgfstartlinewidth=\pgflinewidth
3258
3259 \pgf@circ@scaled@Rlen=\scaledRlen
3260 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3261 \pgf@circ@res@step=0.6\pgf@circ@scaled@Rlen
3262
3263 \pgfscope\begin{pgftransparencygroup}
3264 \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3265 \pgf@circ@maybefill
3266 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3267 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3268 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3269 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3270 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3271 \pgf@circ@draworfill
3272 \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3273 \pgfusepath{draw}
3274 \end{pgftransparencygroup} \endpgfscope
3275 \pgfpathmoveto{\pgfpointorigin}
3276 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3277 \pgfusepath{draw}
3278 }
3279 }
3280
3281 %% New antennas without tails
3282
3283 % main body of antennas
3284 \def\pgf@circ@antennabody{%
3285 \pgfstartlinewidth=\pgflinewidth
3286 \pgf@circ@scaled@Rlen=\scaledRlen
3287 \pgfsetcolor{\ctikzvalof{color}}
3288 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3289 \pgfscope
3290 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3291 \pgfpathmoveto{\pgfpointorigin}
3292 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3293 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3294 \pgfsetbeveljoin
3295 \pgfpathclose
3296 \pgf@circ@draworfill
3297 \endpgfscope
3298 \pgfsetlinewidth{\pgfstartlinewidth}
3299 \pgfpathmoveto{\pgfpointorigin}
3300 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3301 \pgfusepath{draw}
3302 }
3303
3304 % Waves for the antennas.
3305 \def\pgf@circ@antennawaves{%
3306 \pgfscope
3307 % define a triangle for clipping the waves
3308 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3309 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3310 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3311 \pgfpathclose
3312 \pgfusepath{clip}
3313 % ...and build the waves as clipped circles
3314 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3315 \pgfmathloop%
3316 \ifnum\pgf@circ@count@a>2
3317 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3318 \advance\pgf@circ@count@a-1\relax%
3319 \repeatpgfmathloop
3320 \pgfusepath{draw}
3321 \endpgfscope
3322 }
3323
3324 % additional shape with the waves
3325 \pgfdeclareshape{waves}{
3326 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3327 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3328 \anchor{center}{\pgfpointorigin}
3329 \savedanchor{\northeast}{
3330 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3331 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3332 \pgf@x=\pgf@circ@res@step
3333 \pgf@y=\pgf@circ@res@step
3334 }
3335 \anchor{text}{
3336 \northeast
3337 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3338 }
3339 \anchor{top}{\northeast\pgf@x=0pt}
3340 \anchor{right}{\northeast\pgf@y=0pt}
3341 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3342 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3343 \anchor{north}{\northeast\pgf@x=0pt}
3344 \anchor{north east}{\northeast}
3345 \anchor{east}{\northeast\pgf@y=0pt}
3346 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3347 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3348 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3349 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3350 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3351 \behindforegroundpath{
3352 \pgf@circ@scaled@Rlen=\scaledRlen
3353 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3354 \pgf@circ@res@step=0.5\pgf@circ@res@step
3355 \pgfsetcolor{\ctikzvalof{color}}
3356 \pgfscope
3357 % define a triangle for clipping the waves
3358 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3359 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3360 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3361 \pgfpathclose
3362 \pgfusepath{clip}
3363 % ...and build the waves as clipped circles
3364 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3365 \pgfmathloop%
3366 \ifnum\c@pgf@counta>1
3367 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3368 \advance\c@pgf@counta-1\relax%
3369 \repeatpgfmathloop
3370 \pgfusepath{draw}
3371 \endpgfscope
3372 }
3373 }
3374
3375 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3376
3377 \pgfdeclareshape{bareantenna}{
3378 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3379 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3380 \anchor{center}{\pgfpointorigin}
3381 \savedanchor{\northeast}{
3382 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3383 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3384 \pgf@x=\pgf@circ@res@step
3385 \pgf@y=2\pgf@circ@res@step
3386 }
3387 \anchor{text}{
3388 \northeast
3389 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3390 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3391 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3392 }
3393 \anchor{top}{\northeast\pgf@x=0pt}
3394 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3395 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3396 \anchor{bottom}{\pgfpointorigin}
3397 \anchor{north}{\northeast\pgf@x=0pt}
3398 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3399 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3400 \anchor{south}{\pgfpointorigin}
3401 \anchor{north east}{\northeast}
3402 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3403 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3404 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3405 \behindforegroundpath{
3406 \pgf@circ@antennabody
3407 }
3408 }
3409
3410 \pgfdeclareshape{bareTXantenna}{
3411 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3412 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3413 \anchor{center}{\pgfpointorigin}
3414 \savedanchor{\northeast}{
3415 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3416 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3417 \pgf@x=\pgf@circ@res@step
3418 \pgf@y=2\pgf@circ@res@step
3419 }
3420 \savedanchor{\savedwaves}{
3421 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3422 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3423 \pgf@x=4.2\pgf@circ@res@step
3424 \pgf@y=\pgf@circ@res@step
3425 }
3426 \anchor{text}{
3427 \northeast
3428 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3429 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3430 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3431 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3432 }
3433 \anchor{waves}{\savedwaves}
3434 \anchor{top}{\northeast\pgf@x=0pt}
3435 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3436 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3437 \anchor{bottom}{\pgfpointorigin}
3438 \anchor{north}{\northeast\pgf@x=0pt}
3439 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3440 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3441 \anchor{south}{\pgfpointorigin}
3442 \anchor{north east}{\northeast}
3443 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3444 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3445 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3446 \behindforegroundpath{
3447 \pgf@circ@antennabody
3448 \pgf@circ@antennawaves
3449 }
3450 }
3451
3452 \pgfdeclareshape{bareRXantenna}{
3453 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3454 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3455 \anchor{center}{\pgfpointorigin}
3456 \savedanchor{\northeast}{
3457 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3458 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3459 \pgf@x=\pgf@circ@res@step
3460 \pgf@y=2\pgf@circ@res@step
3461 }
3462 \savedanchor{\savedwaves}{
3463 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3464 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3465 \pgf@x=-4.2\pgf@circ@res@step
3466 \pgf@y=\pgf@circ@res@step
3467 }
3468 \anchor{text}{
3469 \northeast
3470 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3471 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3472 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3473 }
3474 \anchor{waves}{\savedwaves}
3475 \anchor{top}{\northeast\pgf@x=0pt}
3476 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3477 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3478 \anchor{bottom}{\pgfpointorigin}
3479 \anchor{north}{\northeast\pgf@x=0pt}
3480 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3481 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3482 \anchor{south}{\pgfpointorigin}
3483 \anchor{north east}{\northeast}
3484 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3485 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3486 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3487 \behindforegroundpath{
3488 \pgf@circ@antennabody
3489 \pgftransformxshift{-5.2\pgf@circ@res@step}
3490 \pgf@circ@antennawaves
3491 }
3492 }
3493
3494 % Microstrip monopoles
3495
3496 \pgfdeclareshape{mslstub}{
3497 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3498 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3499 \savedanchor{\southeast}{
3500 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3501 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3502 \pgf@x=.5\pgf@x
3503 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3504 \pgf@y=-.5\pgf@y
3505 }
3506 \savedanchor{\northwest}{
3507 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3508 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3509 \pgf@x=-.5\pgf@x
3510 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3511 \pgf@y=.5\pgf@y
3512 }
3513 \anchor{north}{\northwest\pgf@x=0pt\relax}
3514 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3515 \anchor{east}{\southeast\pgf@y=0pt\relax}
3516 \anchor{south east}{\southeast}
3517 \anchor{south}{\southeast\pgf@x=0pt\relax}
3518 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3519 \anchor{west}{\northwest\pgf@y=0pt\relax}
3520 \anchor{north west}{\northwest}
3521 %
3522 \anchor{center}{\northwest\pgf@y=0pt\relax}
3523 \anchor{left}{\northwest\pgf@y=0pt\relax}
3524 \anchor{right}{\southeast\pgf@y=0pt\relax}
3525 % put the node text above and centered
3526 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3527 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3528 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3529 }
3530 }
3531 \behindbackgroundpath{
3532 \pgfextracty{\pgf@circ@res@up}{\northwest}
3533 \pgfextractx{\pgf@circ@res@right}{\southeast}
3534 \pgfextractx{\pgf@circ@res@left}{\northwest}
3535 \pgfextracty{\pgf@circ@res@down}{\southeast}
3536 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3537 \pgfstartlinewidth=\pgflinewidth
3538 \pgfscope
3539 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3540 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3541 \pgf@circ@draworfill
3542 \endpgfscope
3543 }
3544 }
3545
3546 \pgfdeclareshape{msrstub}{
3547 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3548 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3549 \savedanchor{\southeast}{
3550 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3551 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3552 \pgf@x=.5\pgf@x
3553 \pgf@y=0pt\relax
3554 }
3555 \savedanchor{\northwest}{
3556 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3557 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3558 \pgf@x=-.5\pgf@x
3559 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
3560 \pgf@y=.5\pgf@y
3561 }
3562 \anchor{north}{\northwest\pgf@x=0pt\relax}
3563 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3564 \anchor{east}{\southeast\pgf@y=0pt\relax}
3565 \anchor{south east}{\southeast}
3566 \anchor{south}{\southeast\pgf@x=0pt\relax}
3567 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3568 \anchor{west}{\northwest\pgf@y=0pt\relax}
3569 \anchor{north west}{\northwest}
3570 %
3571 \anchor{center}{\pgfpointorigin}
3572 \anchor{left}{\pgfpointorigin}
3573 \anchor{right}{\pgfpointorigin}
3574 % put the node text above and centered
3575 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3576 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3577 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3578 }
3579 }
3580 \behindbackgroundpath{
3581 \pgfextracty{\pgf@circ@res@up}{\northwest}
3582 \pgfextractx{\pgf@circ@res@right}{\southeast}
3583 \pgfextractx{\pgf@circ@res@left}{\northwest}
3584 \pgfextracty{\pgf@circ@res@down}{\southeast}
3585 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3586 \pgfstartlinewidth=\pgflinewidth
3587 \pgfscope
3588 \pgfpathmoveto{\pgfpointorigin}
3589 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3590 \pgfusepath{draw}
3591 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3592 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
3593 \pgfpatharc{135}{45}{\pgf@circ@res@step}
3594 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
3595 \pgfpatharc{45}{135}{\pgf@circ@res@up}
3596 \pgfclosepath
3597 \pgf@circ@draworfill
3598 \endpgfscope
3599 }
3600 }
3601
3602 \pgfdeclareshape{msport}{
3603 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3604 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3605 \savedanchor{\southeast}{
3606 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3607 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3608 \pgf@x=.5\pgf@x
3609 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3610 \pgf@y=-.5\pgf@y
3611 }
3612 \savedanchor{\northwest}{
3613 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3614 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3615 \pgf@x=-.5\pgf@x
3616 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3617 \pgf@y=.5\pgf@y
3618 }
3619 \anchor{north}{\northwest\pgf@x=0pt\relax}
3620 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3621 \anchor{east}{\southeast\pgf@y=0pt\relax}
3622 \anchor{south east}{\southeast}
3623 \anchor{south}{\southeast\pgf@x=0pt\relax}
3624 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3625 \anchor{west}{\northwest\pgf@y=0pt\relax}
3626 \anchor{north west}{\northwest}
3627 %
3628 \anchor{center}{\northwest\pgf@y=0pt\relax}
3629 \anchor{left}{\northwest\pgf@y=0pt\relax}
3630 \anchor{right}{\southeast\pgf@y=0pt\relax}
3631 % put the node text above and centered
3632 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3633 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3634 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3635 }
3636 }
3637 \behindbackgroundpath{
3638 \pgfextracty{\pgf@circ@res@up}{\northwest}
3639 \pgfextractx{\pgf@circ@res@right}{\southeast}
3640 \pgfextractx{\pgf@circ@res@left}{\northwest}
3641 \pgfextracty{\pgf@circ@res@down}{\southeast}
3642 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
3643 \pgfstartlinewidth=\pgflinewidth
3644 \pgfscope
3645 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3647 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3648 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
3651 \pgfpathclose
3652 \pgf@circ@draworfill
3653 \endpgfscope
3654 }
3655 }
3656
3657 % Legacy antennas (with tails)
3658 \def\pgf@circ@shift@antenna@xy#1#2{%
3659 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
3660 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
3661 \relax}
3662
3663 % Legacy antenna
3664 \pgfdeclareshape{antenna}{
3665 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3666 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3667 \anchor{center}{\pgfpointorigin}
3668 \savedanchor{\northeast}{
3669 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3670 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3671 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3672 \pgf@y=4\pgf@circ@res@step
3673 }
3674 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
3675 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
3676 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
3677 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
3678 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3679 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3680 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
3681 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}}
3682 \anchor{text}{
3683 \northeast
3684 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
3685 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
3686 }
3687 \behindforegroundpath{
3688 \pgfstartlinewidth=\pgflinewidth
3689 \pgf@circ@scaled@Rlen=\scaledRlen
3690 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3691
3692 \pgftransformxshift{ -4\pgf@circ@res@step }
3693
3694 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3695 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3696
3697 \pgfusepath{draw}
3698
3699 \pgfscope
3700 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3701 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3702 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3703 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3704 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3705 \pgfsetcolor{\ctikzvalof{color}}
3706 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3707 \pgfusepath{draw}
3708 \endpgfscope
3709 \pgfsetlinewidth{\pgfstartlinewidth}
3710
3711 }
3712 }
3713
3714 % Legacy TX antenna
3715 \pgfdeclareshape{txantenna}{
3716 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3717 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3718 \anchor{center}{\pgfpointorigin}
3719 \savedanchor{\northeast}{
3720 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3721 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3722 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3723 \pgf@y=4\pgf@circ@res@step
3724 }
3725 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3726 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3727 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3728 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3729 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3730 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3731 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3732 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}}
3733 \anchor{text}{
3734 \northeast
3735 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
3736 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
3737 }
3738 \behindforegroundpath{
3739 \pgfstartlinewidth=\pgflinewidth
3740 \pgf@circ@scaled@Rlen=\scaledRlen
3741 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
3742
3743 \pgfpathmoveto{\pgfpointorigin}
3744 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3745 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3746 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3747
3748 \pgfusepath{draw}
3749
3750 \pgfscope
3751 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3752 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3753 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3754 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3755 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3756 \pgfsetcolor{\ctikzvalof{color}}
3757 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3758 \pgfusepath{draw}
3759 \endpgfscope
3760 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
3761 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3762 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3763 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
3764 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3765 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
3766 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3767 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
3768 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
3769 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
3770 \pgfusepath{draw}
3771 \pgfsetlinewidth{\pgfstartlinewidth}
3772
3773 }
3774 }
3775
3776 % Legacy RX antenna
3777 \pgfdeclareshape{rxantenna}{
3778 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3779 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3780 \anchor{center}{\pgfpointorigin}
3781 \savedanchor{\northeast}{
3782 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3783 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3784 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3785 \pgf@y=4\pgf@circ@res@step
3786 }
3787 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3788 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3789 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3790 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3791 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3792 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3793 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3794 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}}
3795 \anchor{text}{
3796 \northeast
3797 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
3798 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
3799 }
3800 \behindforegroundpath{
3801 \pgfstartlinewidth=\pgflinewidth
3802 \pgf@circ@scaled@Rlen=\scaledRlen
3803 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
3804
3805 \pgfpathmoveto{\pgfpointorigin}
3806 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3807 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3808 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3809
3810 \pgfusepath{draw}
3811
3812 \pgfscope
3813 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3814 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3815 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3816 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3817 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3818 \pgfsetcolor{\ctikzvalof{color}}
3819 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3820 \pgfusepath{draw}
3821 \endpgfscope
3822
3823 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
3824 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3825 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3826 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
3827 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3828 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
3829 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3830 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
3831 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
3832 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
3833 \pgfusepath{draw}
3834 \pgfsetlinewidth{\pgfstartlinewidth}
3835 }
3836 }
3837
3838 % Legacy match
3839 \pgfdeclareshape{match}{
3840 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3841 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3842 \savedanchor{\northeast}{%
3843 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3844 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3845 \pgf@x=2\pgf@circ@res@step
3846 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3847 \pgf@y=.5\pgf@circ@res@step%
3848 }
3849 % the center is on the left side of the shape for facility of usage
3850 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3851 \anchor{east}{\northeast\pgf@y=0cm\relax}
3852 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
3853 \anchor{west}{\pgfpointorigin}
3854 \anchor{north east}{\northeast}
3855 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3856 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3857 \anchor{south west}{\pgfpointorigin}
3858 \anchor{center}{
3859 \pgfpointorigin
3860 }
3861 \anchor{text}{
3862 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3863 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
3864 \pgf@x=1.5\pgf@x
3865 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
3866 \pgf@y=-1.5\ht\pgfnodeparttextbox
3867 }
3868 \behindforegroundpath{
3869 \pgf@circ@scaled@Rlen=\scaledRlen
3870 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
3871
3872 \pgfscope
3873 \pgfpathmoveto{\pgfpointorigin}
3874 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
3875 \pgfusepath{draw}
3876
3877 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3878 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
3879 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
3880 \pgfusepath{fill}
3881
3882 \pgfsetlinewidth{\pgfstartlinewidth}
3883 \endpgfscope
3884 }
3885 }
3886
3887 %%%---------- close: tex/pgfcircmonopoles
3888 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
3889 %%%---------- open: tex/pgfcircbipoles.tex
3890 % Copyright 2018-2026 by Romano Giannetti
3891 % Copyright 2015-2026 by Stefan Lindner
3892 % Copyright 2013-2026 by Stefan Erhardt
3893 % Copyright 2007-2026 by Massimo Redaelli
3894 %
3895 % This file may be distributed and/or modified
3896 %
3897 % 1. under the LaTeX Project Public License and/or
3898 % 2. under the GNU Public License.
3899 %
3900 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3901
3902 %% Generic macro for defining a bipole shape
3903 % #1 - additional anchors
3904 % #2 - lower y-size of the bipole (from the center).
3905 % #3 - #shape is the name of the shape
3906 % #4 - upper y-size of the bipole (from the center)
3907 % #5 - width of the bipole
3908 % #6 - macros drawing the bipole
3909 %
3910 \long\def\pgfcircdeclarebipole{%
3911 \pgfcircdeclarebipolescaled{default}}
3912
3913 %% Generic macro for defining a bipole shape
3914 % #1 - scale factor
3915 % #2 - additional anchors
3916 % #3 - lower y-size of the bipole (from the center).
3917 % #4 - #shape is the name of the shape
3918 % #5 - upper y-size of the bipole (from the center)
3919 % #6 - width of the bipole
3920 % #7 - macros drawing the bipole
3921 %
3922 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
3923 \pgfdeclareshape{#4shape}{
3924 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
3925 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3926 \savedanchor{\northeast}{
3927 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
3928 \pgf@y=#5\pgf@circ@scaled@Rlen
3929 \pgf@y=.5\pgf@y
3930 \pgf@x=#6\pgf@circ@scaled@Rlen
3931 \pgf@x=.5\pgf@x
3932 }
3933 \savedanchor{\northeastborder}{
3934 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
3935 \pgf@y=#5\pgf@circ@scaled@Rlen
3936 \pgf@y=.5\pgf@y
3937 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
3938 \pgf@x=#6\pgf@circ@scaled@Rlen
3939 \pgf@x=.5\pgf@x
3940 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
3941 }
3942 \savedanchor{\southwestborder}{
3943 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
3944 \pgf@y=-#3\pgf@circ@scaled@Rlen
3945 \pgf@y=.5\pgf@y
3946 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
3947 \pgf@x=-#6\pgf@circ@scaled@Rlen
3948 \pgf@x=.5\pgf@x
3949 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
3950 }
3951 \savedanchor{\southwest}{
3952 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
3953 \pgf@y=-#3\pgf@circ@scaled@Rlen
3954 \pgf@y=.5\pgf@y
3955 \pgf@x=-#6\pgf@circ@scaled@Rlen
3956 \pgf@x=.5\pgf@x
3957 }
3958 \savedanchor{\centerpoint}{
3959 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
3960 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
3961 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
3962 \pgfpointorigin
3963 \pgf@y=\pgf@circ@res@up
3964 \advance\pgf@y by\pgf@circ@res@down
3965 \pgf@y=.5\pgf@y
3966 }
3967 \anchor{center}{\pgfpointorigin}
3968 \anchor{n}{
3969 \northeast
3970 \pgf@x=0cm
3971 }
3972 \anchor{north east}{
3973 \northeast
3974 }
3975 \anchor{north west}{
3976 \northeast
3977 \pgf@x=-\pgf@x
3978 }
3979 \anchor{ne}{
3980 \northeast
3981 }
3982 \anchor{nw}{
3983 \northeast
3984 \pgf@x=-\pgf@x
3985 }
3986 \anchor{e}{
3987 \northeast
3988 \pgf@y=0cm
3989 }
3990 \anchor{s}{
3991 \southwest
3992 \pgf@x=0cm
3993 }
3994 \anchor{south east}{
3995 \southwest
3996 \pgf@x=-\pgf@x
3997 }
3998 \anchor{south west}{
3999 \southwest
4000 }
4001 \anchor{se}{
4002 \southwest
4003 \pgf@x=-\pgf@x
4004 }
4005 \anchor{sw}{
4006 \southwest
4007 }
4008 \anchor{w}{
4009 \southwest
4010 \pgf@y=0cm
4011 }
4012 \anchor{north}{
4013 \northeast
4014 \pgf@x=0cm
4015 }
4016 \anchor{east}{
4017 \northeast
4018 \pgf@y=0cm
4019 }
4020 \anchor{south}{
4021 \southwest
4022 \pgf@x=0cm
4023 }
4024 \anchor{west}{
4025 \southwest
4026 \pgf@y=0cm
4027 }
4028 \anchor{right}{
4029 \northeast
4030 \pgf@y=0cm
4031 }
4032 \anchor{above}{
4033 \northeast
4034 \pgf@x=0cm
4035 }
4036 \anchor{left}{
4037 \southwest
4038 \pgf@y=0cm
4039 }
4040 \anchor{below}{
4041 \southwest
4042 \pgf@x=0cm
4043 }
4044 \anchor{a}{
4045 \northeast
4046 \pgf@y=0cm
4047 }
4048 \anchor{b}{
4049 \southwest
4050 \pgf@y=0cm
4051 }
4052 \savedanchor{\textanchor}{%
4053 \pgf@y=\ht\pgfnodeparttextbox
4054 \pgf@x=-.5\wd\pgfnodeparttextbox
4055 }
4056 \anchor{text}{
4057 \textanchor
4058 }
4059 \anchorborder{%
4060 \ifpgf@circuit@bipole@inverted
4061 \pgf@circ@res@left=-\pgf@x
4062 \pgf@circ@res@right=-\pgf@y
4063 \else
4064 \pgf@circ@res@left=\pgf@x
4065 \pgf@circ@res@right=\pgf@y
4066 \fi
4067 \ifdim\pgf@circ@res@right>0cm
4068 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder}
4069 \else
4070 \southwestborder
4071 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
4072 \fi
4073 }
4074
4075 #2
4076
4077 \backgroundpath{
4078 \pgfsetcolor{\ctikzvalof{color}}
4079
4080 \northeast
4081 \pgf@circ@res@up = \pgf@y
4082 \pgf@circ@res@zero = 0cm
4083 \pgf@circ@res@left = -\pgf@x
4084 \pgf@circ@res@right = \pgf@x
4085 \southwest
4086 \pgf@circ@res@down = \pgf@y
4087 \pgf@circ@scaled@Rlen=\scaledRlen
4088 \pgfstartlinewidth=\pgflinewidth
4089 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
4090 #7
4091
4092 \pgfsetlinewidth{\pgfstartlinewidth}
4093 }
4094 }
4095 }
4096
4097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4098 %% Standard bipole shapes declarations
4099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4100
4101 %%%%%%%%%%%%%%%%%%%%%%%%
4102 % Resistive components
4103 %%%%%%%%%%%%%%%%%%%%%%%%
4104
4105 %% Short circuit
4106
4107 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4108 %%% natural length is zero.
4109 \pgfcircdeclarebipole
4110 {}
4111 {0}
4112 {short}
4113 {0}
4114 {0}
4115 { }
4116
4117 %% Open circuit
4118 \pgfcircdeclarebipole
4119 {}
4120 {\ctikzvalof{bipoles/open/height}}
4121 {open}
4122 {\ctikzvalof{bipoles/open/height}}
4123 {\ctikzvalof{bipoles/open/width}}
4124 { }
4125
4126 % multiwire(s)
4127 \pgfcircdeclarebipole
4128 {}
4129 {\ctikzvalof{bipoles/multiwire/height}}
4130 {multiwire}
4131 {\ctikzvalof{bipoles/multiwire/height}}
4132 {\ctikzvalof{bipoles/multiwire/width}}
4133 {
4134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4135 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4136 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4137 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4138 \pgfusepath{draw}
4139 }
4140
4141 \pgfcircdeclarebipole
4142 {}
4143 {\ctikzvalof{bipoles/multiwire/height}}
4144 {bmultiwire}
4145 {\ctikzvalof{bipoles/multiwire/height}}
4146 {\ctikzvalof{bipoles/multiwire/width}}
4147 {
4148 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4149 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4150 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4151 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4152 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4153 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4154 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4155 \pgfusepath{draw}
4156 }
4157 %% Generic bipole - used as resistor by some (bleah)
4158 \pgfcircdeclarebipolescaled{resistors}
4159 {}
4160 {\ctikzvalof{bipoles/generic/height}}
4161 {generic}
4162 {\ctikzvalof{bipoles/generic/height}}
4163 {\ctikzvalof{bipoles/generic/width}}
4164 {
4165 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4166 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4167 \pgf@circ@draworfill
4168 }
4169
4170 %% Generic empty tunable
4171 \pgfcircdeclarebipolescaled{resistors}
4172 {}
4173 {\ctikzvalof{bipoles/tgeneric/height}}
4174 {tgeneric}
4175 {\ctikzvalof{bipoles/tgeneric/height}}
4176 {\ctikzvalof{bipoles/tgeneric/width}}
4177 {
4178 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4179 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4180 \pgf@circ@draworfill
4181 \pgfscope
4182 \pgfsetarrowsend{latexslim}
4183 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4184 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4185 \pgfusepath{draw}
4186 \endpgfscope
4187 }
4188
4189 %% Generic asymmetric bipole
4190 \pgfcircdeclarebipolescaled{resistors}
4191 {}
4192 {\ctikzvalof{bipoles/ageneric/height}}
4193 {ageneric}
4194 {\ctikzvalof{bipoles/ageneric/height}}
4195 {\ctikzvalof{bipoles/ageneric/width}}
4196 {
4197 \pgfscope
4198 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4199 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4200 \pgf@circ@draworfill
4201 \endpgfscope
4202
4203 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4204 \pgfusepath{stroke,fill}
4205 }
4206
4207 %% Memristor
4208 \pgfcircdeclarebipolescaled{resistors}
4209 {}
4210 {\ctikzvalof{bipoles/memristor/height}}
4211 {memristor}
4212 {\ctikzvalof{bipoles/memristor/height}}
4213 {\ctikzvalof{bipoles/memristor/width}}
4214 {
4215 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4216 \divide \pgf@circ@res@step by 14
4217
4218 \pgfscope
4219 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4220 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4221 \pgf@circ@draworfill
4222 \endpgfscope
4223 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4224 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4225 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4226 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4227 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4228 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4229 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4230 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4231 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4232 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4233
4234 \pgfusepath{draw}
4235
4236 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4237 \pgfusepath{stroke,fill}
4238 }
4239
4240 %% Photoresistor
4241 \pgfcircdeclarebipolescaled{resistors}
4242 {}
4243 {\ctikzvalof{bipoles/photoresistor/height 2}}
4244 {photoresistor}
4245 {\ctikzvalof{bipoles/photoresistor/height}}
4246 {\ctikzvalof{bipoles/photoresistor/width}}
4247 {
4248 \pgfscope
4249 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4250 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4251 \pgf@circ@draworfill
4252 \endpgfscope
4253
4254 \pgfscope
4255 \pgfsetarrowsend{latexslim}
4256 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4257 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4258 \pgfusepath{draw}
4259 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4260 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4261 \pgfusepath{draw}
4262 \endpgfscope
4263 }
4264
4265 %% Thermistor
4266 \pgfcircdeclarebipolescaled{resistors}
4267 {{% anchor for labelling the type of dependency
4268 \anchor{label}{%
4269 \southwest
4270 \pgf@x=0.4\pgf@x
4271 \pgf@y=1.2\pgf@y
4272 }%
4273 }}
4274 {\ctikzvalof{bipoles/thermistor/height}}
4275 {thermistor}
4276 {\ctikzvalof{bipoles/thermistor/height}}
4277 {\ctikzvalof{bipoles/thermistor/width}}
4278 {
4279 \pgfscope
4280 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}
4281 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4282 \pgf@circ@draworfill
4283 \endpgfscope
4284
4285 %\pgfscope
4286 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4287 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4288 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4289 \pgfusepath{draw}
4290 %\endpgfscope
4291 }
4292
4293 %% Thermistor PTC
4294 \pgfcircdeclarebipolescaled{resistors}
4295 {}
4296 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4297 {thermistorptc}
4298 {\ctikzvalof{bipoles/thermistorptc/height}}
4299 {\ctikzvalof{bipoles/thermistorptc/width}}
4300 {
4301 \pgfscope
4302 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}
4303 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4304 \pgf@circ@draworfill
4305 \endpgfscope
4306 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4307 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4308 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4309 \pgfusepath{draw}
4310
4311 \pgfsetlinewidth{\pgfstartlinewidth}
4312 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4313 \pgfsetarrowsend{latexslim}
4314 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4315 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4316 \pgfusepath{draw}
4317 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4318 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4319 \pgfusepath{draw}
4320 }
4321
4322 %% Thermistor NTC
4323 \pgfcircdeclarebipolescaled{resistors}
4324 {}
4325 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4326 {thermistorntc}
4327 {\ctikzvalof{bipoles/thermistorntc/height}}
4328 {\ctikzvalof{bipoles/thermistorntc/width}}
4329 {
4330 \pgfscope
4331 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}
4332 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4333 \pgf@circ@draworfill
4334 \endpgfscope
4335
4336 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4337 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4338 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4339 \pgfusepath{draw}
4340
4341 \pgfsetlinewidth{\pgfstartlinewidth}
4342 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4343 \pgfsetarrowsend{latexslim}
4344 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4345 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4346 \pgfusepath{draw}
4347 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4348 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4349 \pgfusepath{draw}
4350 }
4351
4352 %% Generic tunable
4353 \pgfcircdeclarebipolescaled{resistors}
4354 {
4355 \savedanchor{\wiper}{
4356 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4357 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4358 \pgf@y=.5\pgf@ya
4359 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4360 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4361 }
4362 \anchor{wiper}{\wiper}
4363 \anchor{W}{\wiper}
4364 }
4365 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4366 {genericpotentiometer}
4367 {\ctikzvalof{bipoles/generic potentiometer/height}}
4368 {\ctikzvalof{bipoles/generic potentiometer/width}}
4369 {
4370
4371 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4372 \divide \pgf@circ@res@step by 14
4373
4374 \pgfscope
4375 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4376 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4377 \pgf@circ@draworfill
4378 \endpgfscope
4379 \pgfscope
4380 %\pgfsetlinewidth{\pgfstartlinewidth}
4381 \pgfsetarrowsend{latexslim}
4382 \pgfextractx{\pgf@circ@res@other}{\wiper}
4383 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4384 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4385 \pgfusepath{draw}
4386 \endpgfscope
4387 }
4388
4389 %% Zig zag resistores
4390 \def\pgf@circ@zigzag#1{%
4391 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4392
4393 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4394 \pgf@circ@res@other = \pgf@circ@res@left
4395 \pgf@circ@count@a=\zigs\relax
4396 % first half zig
4397 \advance\pgf@circ@res@other by \pgf@circ@res@step
4398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4399 \pgfmathloop%
4400 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4401 \ifnum\pgf@circ@count@a>0
4402 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4403 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4404 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4405 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4406 \repeatpgfmathloop%
4407 % last zig and a half
4408 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4409 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4410 \advance\pgf@circ@res@other by \pgf@circ@res@step
4411 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4412 \pgfsetbeveljoin
4413 \pgfusepath{draw}
4414 }
4415
4416 %% Resistor
4417 \pgfcircdeclarebipolescaled{resistors}
4418 {
4419 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4420 }
4421 {\ctikzvalof{bipoles/resistor/height}}
4422 {resistor}
4423 {\ctikzvalof{bipoles/resistor/height}}
4424 {\ctikzvalof{bipoles/resistor/width}}
4425 {
4426 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4427 \pgftransformationadjustments
4428 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4429 \pgf@circ@zigzag{1}
4430 }
4431
4432
4433 %% Variable resistor
4434 \pgfcircdeclarebipolescaled{resistors}
4435 {
4436 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4437 }
4438 {\ctikzvalof{bipoles/vresistor/height}}
4439 {vresistor}
4440 {\ctikzvalof{bipoles/vresistor/height}}
4441 {\ctikzvalof{bipoles/vresistor/width}}
4442 {
4443 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4444 \pgftransformationadjustments
4445 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4446 \pgf@circ@zigzag{.5}
4447
4448 \pgfscope
4449 \pgfsetarrowsend{latexslim}
4450 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4451 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4452 \pgfusepath{draw}
4453 \endpgfscope
4454 }
4455
4456 %% Potentiometer
4457 \pgfcircdeclarebipolescaled{resistors}
4458 {
4459 \savedanchor{\wiper}{
4460 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4461 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
4462 \pgf@y=.5\pgf@ya
4463 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
4464 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
4465 }
4466 \anchor{wiper}{\wiper}
4467 \anchor{W}{\wiper}
4468 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4469 }
4470 {\ctikzvalof{bipoles/potentiometer/height 2}}
4471 {potentiometer}
4472 {\ctikzvalof{bipoles/potentiometer/height}}
4473 {\ctikzvalof{bipoles/potentiometer/width}}
4474 {
4475 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4476 \pgftransformationadjustments
4477 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4478 \pgf@circ@zigzag{1}
4479
4480 \pgfscope
4481 %\pgfsetlinewidth{\pgfstartlinewidth}
4482 \pgfsetarrowsend{latexslim}
4483 \pgfextractx{\pgf@circ@res@other}{\wiper}
4484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4485 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4486 \pgfusepath{draw}
4487 \endpgfscope
4488 }
4489
4490 %% Resistive sensor
4491 \pgfcircdeclarebipolescaled{resistors}
4492 {% anchor for labelling the type of dependency
4493 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
4494 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4495 }
4496 {\ctikzvalof{bipoles/resistivesens/height}}
4497 {resistivesens}
4498 {\ctikzvalof{bipoles/resistivesens/height}}
4499 {\ctikzvalof{bipoles/resistivesens/width}}
4500 {%
4501 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4502 \pgftransformationadjustments
4503 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4504 \pgf@circ@zigzag{.5}
4505
4506 \pgfscope
4507 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4508 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4509 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
4510 \pgfusepath{draw}
4511 \endpgfscope
4512 }
4513
4514 %%%%%%%%%%%%%%
4515 %% Capacitors
4516 %%%%%%%%%%%%%
4517
4518 %% Plain Capacitor
4519 \pgfcircdeclarebipolescaled{capacitors}
4520 {}
4521 {\ctikzvalof{bipoles/capacitor/height}}
4522 {capacitor}
4523 {\ctikzvalof{bipoles/capacitor/height}}
4524 {\ctikzvalof{bipoles/capacitor/width}}
4525 {
4526 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4527 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4528 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4529
4530 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4531 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4532 \pgfusepath{draw}
4533
4534 }
4535
4536 %% Capacitive sensor
4537 \pgfcircdeclarebipolescaled{capacitors}
4538 {
4539 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
4540 }
4541 {\ctikzvalof{bipoles/capacitor/height}}
4542 {capacitivesens}
4543 {\ctikzvalof{bipoles/capacitor/height}}
4544 {\ctikzvalof{bipoles/capacitor/width}}
4545 {
4546 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4548 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4549
4550 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4551 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4552 \pgfusepath{draw}
4553 \pgfscope
4554 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
4555 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4556 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4557 \pgfusepath{draw}
4558 \endpgfscope
4559 }
4560
4561 %% Polar Capacitor (DEPRECATED)
4562 \pgfcircdeclarebipolescaled{capacitors}
4563 {}
4564 {\ctikzvalof{bipoles/pcapacitor/height}}
4565 {polarcapacitor}
4566 {\ctikzvalof{bipoles/pcapacitor/height}}
4567 {\ctikzvalof{bipoles/pcapacitor/width}}
4568 {
4569 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4570
4571 \pgfscope
4572 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
4573 \pgftransformrotate{-90}
4574 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4575 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4576 \pgfusepath{draw}
4577 \endpgfscope
4578
4579 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4580 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4581 \pgfusepath{draw}
4582 }
4583
4584
4585 %% Curved capacitor
4586 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
4587 % for a rationale
4588 %
4589 \pgfcircdeclarebipolescaled{capacitors}
4590 {}
4591 {\ctikzvalof{bipoles/ccapacitor/height}}
4592 {ccapacitor}
4593 {\ctikzvalof{bipoles/ccapacitor/height}}
4594 {\ctikzvalof{bipoles/ccapacitor/width}}
4595 {
4596 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4597
4598 \pgfscope
4599 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}}
4600 \pgftransformrotate{-90}
4601 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4602 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4603 \pgfusepath{draw}
4604 \endpgfscope
4605
4606 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4607 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4608 \pgfusepath{draw}
4609 }
4610
4611
4612
4613
4614 %% Electrolytic Capacitor
4615 \pgfcircdeclarebipolescaled{capacitors}
4616 {}
4617 {\ctikzvalof{bipoles/ecapacitor/height}}
4618 {ecapacitor}
4619 {\ctikzvalof{bipoles/ecapacitor/height}}
4620 {\ctikzvalof{bipoles/ecapacitor/width}}
4621 {
4622 \pgfsetrectcap
4623 % % % Draw plus pole
4624 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4625 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4626 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
4627 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4628 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4629 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4630 \pgf@circ@draworfill
4631 % % Draw minus pole
4632 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4633 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4634 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4635 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4636 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4637 \pgfsetfillcolor{\ctikzvalof{color}}
4638 \pgfusepath{draw,fill}
4639 \pgfsetfillcolor{\ctikzvalof{color}}
4640 % % plus pole annotation
4641 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
4642 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
4643 }
4644
4645 %% Variable Capacitor
4646 \pgfcircdeclarebipolescaled{capacitors}
4647 {}
4648 {\ctikzvalof{bipoles/vcapacitor/height}}
4649 {vcapacitor}
4650 {\ctikzvalof{bipoles/vcapacitor/height}}
4651 {\ctikzvalof{bipoles/vcapacitor/width}}
4652 {
4653 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right
4654
4655 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4656 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
4657 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
4658
4659 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
4660 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
4661 \pgfusepath{draw}
4662
4663 \pgfscope
4664 \pgfsetarrowsend{latexslim}
4665 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4667 \pgfusepath{draw}
4668 \endpgfscope
4669
4670 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4671 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
4672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4674 \pgfsetlinewidth{\pgfstartlinewidth}
4675 \pgfusepath{draw}
4676 }
4677
4678
4679 %% Piezoelectric Element
4680
4681 \pgfcircdeclarebipolescaled{capacitors}
4682 {}
4683 {\ctikzvalof{bipoles/piezoelectric/height}}
4684 {piezoelectric}
4685 {\ctikzvalof{bipoles/piezoelectric/height}}
4686 {\ctikzvalof{bipoles/piezoelectric/width}}
4687 {
4688 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
4689 % \divide \pgf@circ@res@step by 5
4690
4691 %% Outer markings
4692 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4693 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4694 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4695
4696 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4697 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4698 \pgfusepath{draw}
4699
4700 %% Inner Box
4701 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
4702 \pgfscope
4703 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4704 \pgfpathrectanglecorners
4705 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
4706 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
4707 \pgf@circ@draworfill
4708 \endpgfscope
4709 }
4710
4711 %%%%%%%%%%%%%%%
4712 %% Inductors
4713 %%%%%%%%%%%%%%%
4714
4715 %% cute inductor
4716 \pgfcircdeclarebipolescaled{inductors}
4717 {
4718 \savedanchor{\midtap}{%
4719 \pgf@x=0pt\relax
4720 \pgfmathsetlength{\pgf@y}{%
4721 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4722 \ctikzvalof{bipoles/cuteinductor/height} :% even
4723 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4724 *\pgf@circ@scaled@Rlen/2
4725 }
4726 }
4727 \anchor{midtap}{\midtap}
4728 }
4729 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4730 {cuteinductor}
4731 {\ctikzvalof{bipoles/cuteinductor/height}}
4732 {\ctikzvalof{bipoles/cuteinductor/width}}
4733 {
4734 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4735 \pgftransformationadjustments
4736
4737 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4738 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4739
4740
4741 \pgfmathsetlength{\pgf@circ@res@step}
4742 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4743
4744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4745 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4746 {
4747 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4748 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4749 }
4750 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4751 \pgfsetbuttcap
4752 \pgfsetbeveljoin
4753 \pgfusepath{stroke}
4754 }
4755
4756 %% cute inductive sensor
4757 \pgfcircdeclarebipolescaled{inductors}
4758 {% anchor for labelling the type of dependency
4759 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
4760 \savedanchor{\midtap}{%
4761 \pgf@x=0pt\relax
4762 \pgfmathsetlength{\pgf@y}{%
4763 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4764 \ctikzvalof{bipoles/cuteinductor/height} :% even
4765 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4766 *\pgf@circ@scaled@Rlen/2
4767 }
4768 }
4769 \anchor{midtap}{\midtap}
4770 }
4771 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4772 {scuteinductor}
4773 {\ctikzvalof{bipoles/cuteinductor/height}}
4774 {\ctikzvalof{bipoles/cuteinductor/width}}
4775 {
4776 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4777 \pgftransformationadjustments
4778
4779 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4780 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4781
4782
4783 \pgfmathsetlength{\pgf@circ@res@step}
4784 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4785
4786 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4787 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4788 {
4789 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4790 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4791 }
4792 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4793 \pgfsetbuttcap
4794 \pgfsetbeveljoin
4795 \pgfusepath{stroke}
4796 \pgfscope
4797 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
4798 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4799 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4800 \pgfusepath{draw}
4801 \endpgfscope
4802 }
4803
4804 %% cute choke
4805 \pgfcircdeclarebipolescaled{inductors}
4806 {
4807 \savedanchor{\midtap}{%
4808 \pgf@x=0pt\relax
4809 \pgfmathsetlength{\pgf@y}{%
4810 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4811 \ctikzvalof{bipoles/cuteinductor/height} :% even
4812 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4813 *\pgf@circ@scaled@Rlen/2
4814 }
4815 }
4816 \anchor{midtap}{\midtap}
4817 }
4818 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
4819 {cutechoke}
4820 {\ctikzvalof{bipoles/cutechoke/height}}
4821 {\ctikzvalof{bipoles/cutechoke/width}}
4822 {
4823 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4824 \pgftransformationadjustments
4825
4826 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4827 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
4828
4829
4830 \pgfmathsetlength{\pgf@circ@res@step}
4831 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
4832
4833 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4834 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
4835 {
4836 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4837 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4838 }
4839 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4840 \pgfsetbuttcap
4841 \pgfsetbeveljoin
4842 \pgfusepath{stroke}
4843
4844 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
4845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
4846 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4847 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
4848 \pgfusepath{stroke}
4849
4850 \ifpgf@circuit@bipole@twolineschoke
4851 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}}
4852 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}}
4853 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4854 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
4855 \pgfusepath{stroke}
4856 \fi
4857 }
4858
4859 %% variable cute inductor
4860 \pgfcircdeclarebipolescaled{inductors}
4861 {
4862 \savedanchor{\midtap}{%
4863 \pgf@x=0pt\relax
4864 \pgfmathsetlength{\pgf@y}{%
4865 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4866 \ctikzvalof{bipoles/cuteinductor/height} :% even
4867 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4868 *\pgf@circ@scaled@Rlen/2
4869 }
4870 }
4871 \anchor{midtap}{\midtap}
4872 }
4873 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
4874 {vcuteinductor}
4875 {\ctikzvalof{bipoles/vcuteinductor/height}}
4876 {\ctikzvalof{bipoles/vcuteinductor/width}}
4877 {
4878 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4879 \pgftransformationadjustments
4880
4881 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4882 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
4883
4884
4885 \pgfmathsetlength{\pgf@circ@res@step}
4886 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
4887
4888 \pgfscope
4889 \pgfsetarrowsend{latexslim}
4890 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4891 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4892 \pgfusepath{draw}
4893 \endpgfscope
4894
4895 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4896 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
4897 {
4898 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
4899 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
4900 }
4901 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
4902 \pgfsetbuttcap
4903 \pgfsetbeveljoin
4904 \pgfusepath{stroke}
4905 }
4906
4907 %% american inductor
4908 \pgfcircdeclarebipolescaled{inductors}
4909 {
4910 \savedanchor{\midtap}{%
4911 \pgf@x=0pt\relax
4912 \pgfmathsetlength{\pgf@y}{%
4913 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
4914 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
4915 0) %odd
4916 *\pgf@circ@scaled@Rlen/2
4917 }
4918 }
4919 \anchor{midtap}{\midtap}
4920 }
4921 {\ctikzvalof{bipoles/americaninductor/height 2}}
4922 {americaninductor}
4923 {\ctikzvalof{bipoles/americaninductor/height}}
4924 {\ctikzvalof{bipoles/americaninductor/width}}
4925 {
4926 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
4927 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4928 \pgftransformationadjustments
4929 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
4930 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
4931 \divide \pgf@circ@res@step by 2
4932 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
4933
4934 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4935 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
4936 {
4937 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
4938 }
4939 \pgfsetbuttcap
4940 \pgfsetbeveljoin
4941 \pgfusepath{stroke}
4942 }
4943
4944
4945 %% american inductive sensor
4946 \pgfcircdeclarebipolescaled{inductors}
4947 {% anchor for labelling the type of dependency
4948 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
4949 \savedanchor{\midtap}{%
4950 \pgf@x=0pt\relax
4951 \pgfmathsetlength{\pgf@y}{%
4952 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
4953 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
4954 0) %odd
4955 *\pgf@circ@scaled@Rlen/2
4956 }
4957 }
4958 \anchor{midtap}{\midtap}
4959 }
4960 {\ctikzvalof{bipoles/americaninductor/height 2}}
4961 {samericaninductor}
4962 {\ctikzvalof{bipoles/americaninductor/height}}
4963 {\ctikzvalof{bipoles/americaninductor/width}}
4964 {
4965 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
4966 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4967 \pgftransformationadjustments
4968 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
4969 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
4970 \divide \pgf@circ@res@step by 2
4971 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
4972
4973 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
4974 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
4975 {
4976 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
4977 }
4978 \pgfsetbuttcap
4979 \pgfsetbeveljoin
4980 \pgfusepath{stroke}
4981 \pgfscope
4982 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
4983 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4984 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4985 \pgfusepath{draw}
4986 \endpgfscope
4987 }
4988
4989 %% variable american inductor
4990 \pgfcircdeclarebipolescaled{inductors}
4991 {
4992 \savedanchor{\midtap}{%
4993 \pgf@x=0pt\relax
4994 \pgfmathsetlength{\pgf@y}{%
4995 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
4996 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
4997 0) %odd
4998 *\pgf@circ@scaled@Rlen/2
4999 }
5000 }
5001 \anchor{midtap}{\midtap}
5002 }
5003 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5004 {vamericaninductor}
5005 {\ctikzvalof{bipoles/vamericaninductor/height}}
5006 {\ctikzvalof{bipoles/vamericaninductor/width}}
5007 {
5008 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5009 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5010 \pgftransformationadjustments
5011 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5012 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5013 \divide \pgf@circ@res@step by 2
5014 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5015
5016 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5017 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5018 {
5019 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5020 }
5021 \pgfsetbuttcap
5022 \pgfsetbeveljoin
5023 \pgfusepath{stroke}
5024
5025 \pgfscope
5026 \pgfsetarrowsend{latexslim}
5027 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5028 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5029 \pgfusepath{draw}
5030 \endpgfscope
5031 }
5032
5033 %% Generic bipole, filled - used as inductor by some
5034 \pgfcircdeclarebipolescaled{inductors}
5035 {
5036 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5037 }
5038 {\ctikzvalof{bipoles/fullgeneric/height}}
5039 {fullgeneric}
5040 {\ctikzvalof{bipoles/fullgeneric/height}}
5041 {\ctikzvalof{bipoles/fullgeneric/width}}
5042 {
5043 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5044 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5045
5046 \pgfusepath{draw,fill}
5047 }
5048
5049 %% Generic sensor, filled - used as inductive sensor by some
5050 \pgfcircdeclarebipolescaled{inductors}
5051 {% anchor for labelling the type of dependency
5052 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5053 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5054 }
5055 {\ctikzvalof{bipoles/fullgeneric/height}}
5056 {sfullgeneric}
5057 {\ctikzvalof{bipoles/fullgeneric/height}}
5058 {\ctikzvalof{bipoles/fullgeneric/width}}
5059 {
5060
5061 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5062 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5063 \pgfusepath{draw,fill}
5064 %\pgfscope
5065 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5066 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5067 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5068 \pgfusepath{draw}
5069 %\endpgfscope
5070 }
5071
5072 %% Generic full tunable
5073 \pgfcircdeclarebipolescaled{inductors}
5074 {
5075 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5076 }
5077 {\ctikzvalof{bipoles/tfullgeneric/height}}
5078 {tfullgeneric}
5079 {\ctikzvalof{bipoles/tfullgeneric/height}}
5080 {\ctikzvalof{bipoles/tfullgeneric/width}}
5081 {
5082 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5083 \divide \pgf@circ@res@step by 14
5084
5085 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5086 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5087 \pgfusepath{draw,fill}
5088
5089 \pgfscope
5090 \pgfsetarrowsend{latexslim}
5091 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5092 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5093 \pgfusepath{draw}
5094 \endpgfscope
5095 }
5096
5097 %%%%%%%%%%%
5098 %% Battery
5099 %%%%%%%%%%%
5100
5101 %% Battery
5102 \pgfcircdeclarebipolescaled{batteries}
5103 {}
5104 {\ctikzvalof{bipoles/battery/height}}
5105 {battery}
5106 {\ctikzvalof{bipoles/battery/height}}
5107 {\ctikzvalof{bipoles/battery/width}}
5108 {
5109 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5110 \divide \pgf@circ@res@step by 6
5111
5112 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5113
5114 \ifpgf@circ@fixbatteries
5115 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5116 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5117
5118 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5119 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5120
5121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5122 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5123
5124 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5126 \else
5127 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5128 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5129
5130 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5131 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5132
5133 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5134 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5135
5136 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5137 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5138 \fi
5139 \pgfusepath{draw}
5140 }
5141
5142
5143 %% Battery 1 % poles with equl thickness
5144
5145 \pgfcircdeclarebipolescaled{batteries}
5146 {}
5147 {\ctikzvalof{bipoles/battery1/height}}
5148 {battery1}
5149 {\ctikzvalof{bipoles/battery1/height}}
5150 {\ctikzvalof{bipoles/battery1/width}}
5151 {
5152 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5154 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5155 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5156 \pgfusepath{draw}
5157
5158 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5159 \ifpgf@circ@fixbatteries
5160 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5161 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5162
5163 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5164 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5165 \else
5166 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5167 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5168
5169 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5170 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5171 \fi
5172 \pgfusepath{draw}
5173 }
5174
5175 %% Battery 2 % negative pole thicker
5176
5177 \pgfcircdeclarebipolescaled{batteries}
5178 {}
5179 {\ctikzvalof{bipoles/battery2/height}}
5180 {battery2}
5181 {\ctikzvalof{bipoles/battery2/height}}
5182 {\ctikzvalof{bipoles/battery2/width}}
5183 {
5184 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5185 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5186 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5187 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5188 \pgfusepath{draw}
5189
5190 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5191 \ifpgf@circ@fixbatteries
5192 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5193 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5194 \pgfusepath{draw}
5195 \pgfsetlinewidth{3\pgflinewidth}
5196 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5197 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5198 \else
5199 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5200 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5201 \pgfusepath{draw}
5202 \pgfsetlinewidth{3\pgflinewidth}
5203 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5204 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5205 \fi
5206 \pgfusepath{draw}
5207 }
5208
5209 %%%%%%%%%%%
5210 %% Round and diamond sources
5211 %%%%%%%%%%%
5212
5213 %% Independent voltage source
5214 \pgfcircdeclarebipolescaled{sources}
5215 {}
5216 {\ctikzvalof{bipoles/vsource/height}}
5217 {vsource}
5218 {\ctikzvalof{bipoles/vsource/height}}
5219 {\ctikzvalof{bipoles/vsource/width}}
5220 {
5221
5222 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5223
5224 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5225 \pgf@circ@draworfill
5226 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5227 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5228 \pgfusepath{draw}
5229 }
5230
5231 %% Independent voltage source - American style
5232 \pgfcircdeclarebipolescaled{sources}
5233 {}
5234 {\ctikzvalof{bipoles/vsourceam/height}}
5235 {vsourceAM}
5236 {\ctikzvalof{bipoles/vsourceam/height}}
5237 {\ctikzvalof{bipoles/vsourceam/width}}
5238 {
5239
5240 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5241 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5242 \pgf@circ@draworfill
5243 \pgfsetcolor{\ctikzvalof{color}}
5244 \ifpgf@circ@oldvoltagedirection
5245 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
5246 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}
5247 \else
5248 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$}
5249 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$}
5250 \fi
5251 }
5252
5253 %% Independent sinusoidal voltage source
5254 \pgfcircdeclarebipolescaled{sources}
5255 {}
5256 {\ctikzvalof{bipoles/vsourcesin/height}}
5257 {vsourcesin}
5258 {\ctikzvalof{bipoles/vsourcesin/height}}
5259 {\ctikzvalof{bipoles/vsourcesin/width}}
5260 {
5261
5262 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5263 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5264 \pgf@circ@draworfill
5265
5266 \pgf@circ@res@up = .5\pgf@circ@res@up
5267 \pgfscope
5268 \pgftransformrotate{90}
5269 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5270 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5271 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5272 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5273 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5274 \pgfusepath{draw}
5275 \endpgfscope
5276 }
5277
5278 % Square Voltage source - contributed by Alistair Kwan
5279 \pgfcircdeclarebipolescaled{sources}
5280 {}
5281 {\ctikzvalof{bipoles/vsourcesquare/height}}
5282 {vsourcesquare}
5283 {\ctikzvalof{bipoles/vsourcesquare/height}}
5284 {\ctikzvalof{bipoles/vsourcesquare/width}}
5285 {
5286 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5287 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5288 \pgf@circ@draworfill
5289 \pgf@circ@res@up = .5\pgf@circ@res@up
5290 \pgfscope
5291 \pgftransformrotate{90}
5292 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5293 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
5294 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
5295 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5296 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5297 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5298 \pgfusepath{draw}
5299 \endpgfscope
5300 }
5301
5302 % Triangle Voltage source - contributed by Ralf Farkas
5303 \pgfcircdeclarebipolescaled{sources}
5304 {}
5305 {\ctikzvalof{bipoles/vsourcetri/height}}
5306 {vsourcetri}
5307 {\ctikzvalof{bipoles/vsourcetri/height}}
5308 {\ctikzvalof{bipoles/vsourcetri/width}}
5309 {
5310
5311 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5312 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5313 \pgf@circ@draworfill
5314
5315 \pgf@circ@res@up = .5\pgf@circ@res@up
5316 \pgfscope
5317 \pgftransformrotate{90}
5318 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5319 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
5320 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
5321 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5322 \pgfusepath{draw}
5323 \endpgfscope
5324 }
5325
5326
5327 %% PV Source
5328 \pgfcircdeclarebipolescaled{sources}
5329 {}
5330 {\ctikzvalof{bipoles/pvsource/height}}
5331 {pvsource}
5332 {\ctikzvalof{bipoles/pvsource/height}}
5333 {\ctikzvalof{bipoles/pvsource/width}}
5334 {
5335 \pgfpointorigin
5336 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5337 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5338 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5339 \pgf@circ@draworfill
5340
5341 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
5342 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5343 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
5344 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5345 \pgfusepath{draw}
5346
5347 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5348 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
5349 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
5350
5351 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
5352 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
5353 \pgfusepath{draw}
5354
5355 %Arrow Part
5356 \pgfscope
5357 \pgfsetarrowsend{latex}
5358 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5359 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5360 \pgfusepath{draw}
5361 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5362 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5363 \pgfusepath{draw}
5364 \endpgfscope
5365
5366 }
5367
5368 %% Empty Source
5369 \pgfcircdeclarebipolescaled{sources}
5370 {}
5371 {\ctikzvalof{bipoles/esource/height}}
5372 {esource}
5373 {\ctikzvalof{bipoles/esource/height}}
5374 {\ctikzvalof{bipoles/esource/width}}
5375 {
5376 \pgfpointorigin
5377 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5378 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5379 \pgf@circ@draworfill
5380 }
5381
5382 %% DC Current Source with open shape
5383 \pgfcircdeclarebipolescaled{sources}
5384 {}
5385 {\ctikzvalof{bipoles/dcisource/height}}
5386 {dcisource}
5387 {\ctikzvalof{bipoles/dcisource/height}}
5388 {\ctikzvalof{bipoles/dcisource/width}}
5389 {
5390 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5391 \pgfpathmoveto{\pgfpointorigin}
5392 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5393 \pgf@circ@maybefill
5394 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
5395 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
5396 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
5397 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
5398 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
5399 \pgfusepath{draw}
5400
5401 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5402 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5403 \pgfusepath{draw}
5404 \pgfscope
5405 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5406 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5407 \endpgfscope
5408 }
5409
5410 %% DC-Voltage source
5411 \pgfcircdeclarebipolescaled{sources}
5412 {}
5413 {\ctikzvalof{bipoles/dcvsource/height}}
5414 {dcvsource}
5415 {\ctikzvalof{bipoles/dcvsource/height}}
5416 {\ctikzvalof{bipoles/dcvsource/width}}
5417 {
5418 \pgfpointorigin
5419 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5420 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5421 \pgf@circ@draworfill
5422 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
5423 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
5424 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
5425 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
5426 \pgfusepath{draw}
5427 }
5428
5429 %% Independent current source
5430 \pgfcircdeclarebipolescaled{sources}
5431 {}
5432 {\ctikzvalof{bipoles/isource/height}}
5433 {isource}
5434 {\ctikzvalof{bipoles/isource/height}}
5435 {\ctikzvalof{bipoles/isource/width}}
5436 {
5437 \pgfpointorigin
5438 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5439 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5440 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5441 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5442 \pgf@circ@draworfill
5443 }
5444
5445 %% Independent double oo source
5446 \pgfcircdeclarebipolescaled{sources}
5447 {}
5448 {\ctikzvalof{bipoles/oosource/height}}
5449 {oosource}
5450 {\ctikzvalof{bipoles/oosource/height}}
5451 {\ctikzvalof{bipoles/oosource/width}}
5452 {
5453 \pgfpointorigin
5454 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5455 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5456 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5457 \pgf@circ@maybefill
5458 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
5459 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
5460 \pgf@circ@draworfill
5461 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5462 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5463 \pgfusepath{draw}
5464 }
5465
5466 %% Independent current source - American
5467 \pgfcircdeclarebipolescaled{sources}
5468 {}
5469 {\ctikzvalof{bipoles/isourceam/height}}
5470 {isourceAM}
5471 {\ctikzvalof{bipoles/isourceam/height}}
5472 {\ctikzvalof{bipoles/isourceam/width}}
5473 {
5474 \pgfpointorigin
5475 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5476 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5477 \pgf@circ@draworfill
5478
5479 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5480 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
5481 \pgfusepath{draw}
5482 \pgfscope
5483 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5484 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5485 \endpgfscope
5486 }
5487
5488 %% Independent sinusoidal current source
5489 \pgfcircdeclarebipolescaled{sources}
5490 {}
5491 {\ctikzvalof{bipoles/isource/height}}
5492 {isourcesin}
5493 {\ctikzvalof{bipoles/isource/height}}
5494 {\ctikzvalof{bipoles/isource/width}}
5495 {
5496 \pgfpointorigin
5497 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5498 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5499 \pgf@circ@draworfill
5500
5501 \pgf@circ@res@up = .5\pgf@circ@res@up
5502 \pgfscope
5503 \pgftransformrotate{90}
5504 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5505 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5506 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5507 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5508 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5509 \pgfusepath{draw}
5510 \endpgfscope
5511 }
5512
5513 %% Empty controlled source
5514 \pgfcircdeclarebipolescaled{csources}
5515 {}
5516 {\ctikzvalof{bipoles/ecsource/height}}
5517 {ecsource}
5518 {\ctikzvalof{bipoles/ecsource/height}}
5519 {\ctikzvalof{bipoles/ecsource/width}}
5520 {
5521
5522 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5523
5524 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5526 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5528 \pgfpathclose
5529 \pgf@circ@draworfill
5530 }
5531
5532 %% Controlled voltage source
5533 \pgfcircdeclarebipolescaled{csources}
5534 {}
5535 {\ctikzvalof{bipoles/cvsource/height}}
5536 {cvsource}
5537 {\ctikzvalof{bipoles/cvsource/height}}
5538 {\ctikzvalof{bipoles/cvsource/width}}
5539 {
5540
5541 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5542
5543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5544 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5546 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5547 \pgfpathclose
5548 \pgf@circ@draworfill
5549
5550 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5551 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5552 \pgfusepath{draw}
5553 }
5554
5555 %% Controlled voltage source - American
5556 \pgfcircdeclarebipolescaled{csources}
5557 {}
5558 {\ctikzvalof{bipoles/cvsourceam/height}}
5559 {cvsourceAM}
5560 {\ctikzvalof{bipoles/cvsourceam/height}}
5561 {\ctikzvalof{bipoles/cvsourceam/width}}
5562 {
5563 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5564 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5565 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5567 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5568 \pgfpathclose
5569 \pgf@circ@draworfill
5570
5571 \pgfsetcolor{\ctikzvalof{color}}
5572 \ifpgf@circ@oldvoltagedirection
5573 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$}
5574 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$}
5575 \else
5576 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$-$}
5577 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$+$}
5578 \fi
5579 }
5580
5581 %% Controlled sinusoidal voltage source
5582 \pgfcircdeclarebipolescaled{csources}
5583 {}
5584 {\ctikzvalof{bipoles/cvsourcesin/height}}
5585 {cvsourcesin}
5586 {\ctikzvalof{bipoles/cvsourcesin/height}}
5587 {\ctikzvalof{bipoles/cvsourcesin/width}}
5588 {
5589
5590 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5591
5592 \pgfscope
5593 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5594 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5595 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5596 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5597 \pgfpathclose
5598 \pgf@circ@draworfill
5599 \endpgfscope
5600
5601 \pgf@circ@res@up = .5\pgf@circ@res@up
5602 \pgfscope
5603 \pgftransformrotate{90}
5604 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5605 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5606 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5607 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5608 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5609 \pgfusepath{draw}
5610 \endpgfscope
5611 }
5612
5613 %% Controlled sinusoidal current source
5614 \pgfcircdeclarebipolescaled{csources}
5615 {}
5616 {\ctikzvalof{bipoles/cvsourcesin/height}}
5617 {cisourcesin}
5618 {\ctikzvalof{bipoles/cvsourcesin/height}}
5619 {\ctikzvalof{bipoles/cvsourcesin/width}}
5620 {
5621
5622 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5623
5624 \pgfscope
5625 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5626 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5627 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5628 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5629 \pgfpathclose
5630 \pgf@circ@draworfill
5631 \endpgfscope
5632
5633 \pgf@circ@res@up = .5\pgf@circ@res@up
5634 \pgfscope
5635 \pgftransformrotate{90}
5636 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5637 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5638 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5639 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5640 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5641 \pgfusepath{draw}
5642 \endpgfscope
5643 }
5644
5645 %% Controlled current source
5646 \pgfcircdeclarebipolescaled{csources}
5647 {}
5648 {\ctikzvalof{bipoles/cisource/height}}
5649 {cisource}
5650 {\ctikzvalof{bipoles/cisource/height}}
5651 {\ctikzvalof{bipoles/cisource/width}}
5652 {
5653
5654 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5655
5656 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5657 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5658 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5659 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5660 \pgfpathclose
5661 \pgf@circ@draworfill
5662
5663 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5664 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5665 \pgfusepath{draw}
5666 }
5667
5668 %% Controlled current source - American
5669 \pgfcircdeclarebipolescaled{csources}
5670 {}
5671 {\ctikzvalof{bipoles/cisourceam/height}}
5672 {cisourceAM}
5673 {\ctikzvalof{bipoles/cisourceam/height}}
5674 {\ctikzvalof{bipoles/cisourceam/width}}
5675 {
5676 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5677
5678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5679 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5680 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5682 \pgfpathclose
5683 \pgf@circ@draworfill
5684 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5685 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
5686 \pgfusepath{draw}
5687 \pgfscope
5688 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5689 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5690 \endpgfscope
5691 }
5692
5693 %% Cute Independent voltage source
5694 \pgfcircdeclarebipolescaled{sources}
5695 {}
5696 {\ctikzvalof{bipoles/vsource/height}}
5697 {vsourceC}
5698 {\ctikzvalof{bipoles/vsource/height}}
5699 {\ctikzvalof{bipoles/vsource/width}}
5700 {
5701 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5702 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5703 \pgf@circ@draworfill
5704 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5705 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5706 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
5707 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5708 \pgfsetroundcap\pgfusepath{draw}
5709 }
5710
5711 %% Cute Independent current source
5712 \pgfcircdeclarebipolescaled{sources}
5713 {}
5714 {\ctikzvalof{bipoles/isource/height}}
5715 {isourceC}
5716 {\ctikzvalof{bipoles/isource/height}}
5717 {\ctikzvalof{bipoles/isource/width}}
5718 {
5719 \pgfpointorigin
5720 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5721 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5722 \pgf@circ@draworfill
5723 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5724 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5725 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
5726 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
5727 \pgfsetroundcap\pgfusepath{draw}
5728 }
5729
5730 %% Cute Controlled voltage source
5731 \pgfcircdeclarebipolescaled{csources}
5732 {}
5733 {\ctikzvalof{bipoles/cvsource/height}}
5734 {cvsourceC}
5735 {\ctikzvalof{bipoles/cvsource/height}}
5736 {\ctikzvalof{bipoles/cvsource/width}}
5737 {
5738 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5741 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5742 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5743 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5744 \pgf@circ@draworfill
5745 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5746 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5747 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
5748 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5749 \pgfsetroundcap\pgfusepath{draw}
5750 }
5751
5752 %% Cute Controlled current source
5753 \pgfcircdeclarebipolescaled{csources}
5754 {}
5755 {\ctikzvalof{bipoles/cisource/height}}
5756 {cisourceC}
5757 {\ctikzvalof{bipoles/cisource/height}}
5758 {\ctikzvalof{bipoles/cisource/width}}
5759 {
5760 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
5763 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5764 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
5765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5766 \pgf@circ@draworfill
5767 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5768 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
5770 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
5771 \pgfsetroundcap\pgfusepath{draw}
5772 }
5773
5774 %% Noise voltage source
5775 \pgfcircdeclarebipolescaled{sources}
5776 {}
5777 {\ctikzvalof{bipoles/vsource/height}}
5778 {vsourceN}
5779 {\ctikzvalof{bipoles/vsource/height}}
5780 {\ctikzvalof{bipoles/vsource/width}}
5781 {
5782 \pgfscope
5783 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5784 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5785 %
5786 \pgf@circ@scaled@Rlen=\scaledRlen
5787 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
5788 \edef\pgf@noise@temp{dashed}
5789 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
5790 \ifx\pgf@noise@temp\pgf@noise@fill
5791 % fillable in this case
5792 \pgf@circ@draworfillandclip
5793 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
5794 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
5795 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5796 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5797 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5798 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5799 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5800 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5803 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5806 %
5807 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
5808 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5809 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5810 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
5811 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5813 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
5814 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5816 \pgfusepath{draw}
5817 \else
5818 \pgfsetfillcolor{\pgf@noise@fill}
5819 \pgfusepath{draw,fill}
5820 \fi
5821 \endpgfscope
5822 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5823 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5824 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
5825 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5826 \pgfsetroundcap\pgfusepath{draw}
5827 }
5828 %% Noise current source
5829
5830 \pgfcircdeclarebipolescaled{sources}
5831 {}
5832 {\ctikzvalof{bipoles/isource/height}}
5833 {isourceN}
5834 {\ctikzvalof{bipoles/isource/height}}
5835 {\ctikzvalof{bipoles/isource/width}}
5836 {
5837 \pgfpointorigin
5838 \pgfscope
5839 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5840 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5841 %
5842 \pgf@circ@scaled@Rlen=\scaledRlen
5843 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
5844 \edef\pgf@noise@temp{dashed}
5845 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
5846 \ifx\pgf@noise@temp\pgf@noise@fill
5847 % fillable in this case
5848 \pgf@circ@draworfillandclip
5849 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
5850 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
5851 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5852 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5853 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5856 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5857 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5858 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5859 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
5860 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5861 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5862 %
5863 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
5864 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5865 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5866 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
5867 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5868 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5869 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
5870 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5871 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5872 \pgfusepath{draw}
5873 \else
5874 \pgfsetfillcolor{\pgf@noise@fill}
5875 \pgfusepath{draw,fill}
5876 \fi
5877 \endpgfscope
5878 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
5879 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
5880 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
5881 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
5882 \pgfsetroundcap\pgfusepath{draw}
5883 }
5884
5885 %%%%%%%%%%%%%%
5886 %% Diodes
5887 %%%%%%%%%%%%%%
5888
5889 %% Black generic diode
5890 \pgfcircdeclarebipolescaled{diodes}
5891 {}
5892 {\ctikzvalof{bipoles/diode/height}}
5893 {fulldiode}
5894 {\ctikzvalof{bipoles/diode/height}}
5895 {\ctikzvalof{bipoles/diode/width}}
5896 {
5897
5898 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5899
5900 \pgfscope
5901 \pgftransformxshift{\pgf@circ@res@left}
5902 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5903 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5904 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5905 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5906 \pgfusepath{draw,fill}
5907 \endpgfscope
5908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5909 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5910 \pgfusepath{draw}
5911 }
5912
5913 %% Black Zener diode
5914 \pgfcircdeclarebipolescaled{diodes}
5915 {}
5916 {\ctikzvalof{bipoles/diode/height}}
5917 {fullzdiode}
5918 {\ctikzvalof{bipoles/diode/height}}
5919 {\ctikzvalof{bipoles/diode/width}}
5920 {
5921
5922 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5923
5924 \pgfscope
5925 \pgftransformxshift{\pgf@circ@res@left}
5926 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5927 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5928 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5929 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5930 \pgfusepath{draw,fill}
5931 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
5932 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
5933 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
5934 \pgfusepath{draw}
5935 \endpgfscope
5936 }
5937
5938 %% Black alternative zigzag Zener diode
5939 \pgfcircdeclarebipolescaled{diodes}
5940 {}
5941 {\ctikzvalof{bipoles/diode/height}}
5942 {fullzzdiode}
5943 {\ctikzvalof{bipoles/diode/height}}
5944 {\ctikzvalof{bipoles/diode/width}}
5945 {
5946
5947 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5948
5949 \pgfscope
5950 \pgftransformxshift{\pgf@circ@res@left}
5951 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5952 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5953 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5954 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5955 \pgfusepath{draw,fill}
5956 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
5957 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
5958 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
5959 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
5960 \pgfusepath{draw}
5961 \endpgfscope
5962 }
5963
5964 %% Black Schottky diode
5965 \pgfcircdeclarebipolescaled{diodes}
5966 {}
5967 {\ctikzvalof{bipoles/diode/height}}
5968 {fullsdiode}
5969 {\ctikzvalof{bipoles/diode/height}}
5970 {\ctikzvalof{bipoles/diode/width}}
5971 {
5972
5973 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5974 \pgfscope
5975 \pgftransformxshift{\pgf@circ@res@left}
5976 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5977 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5978 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
5980 \pgfusepath{draw,fill}
5981
5982 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
5983 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
5984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
5985 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
5986 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
5987 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
5988 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
5989 \pgfusepath{draw}
5990 \endpgfscope
5991
5992 }
5993
5994 %% Black tunnel diode
5995 \pgfcircdeclarebipolescaled{diodes}
5996 {}
5997 {\ctikzvalof{bipoles/diode/height}}
5998 {fulltdiode}
5999 {\ctikzvalof{bipoles/diode/height}}
6000 {\ctikzvalof{bipoles/diode/width}}
6001 {
6002
6003 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6004 \pgfscope
6005 \pgftransformxshift{\pgf@circ@res@left}
6006 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6007 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6008 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6009 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6010 \pgfusepath{draw,fill}
6011
6012 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6013 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6014 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6015 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6016 \pgfusepath{draw}
6017 \endpgfscope
6018 }
6019
6020 %% Black light emitting diode
6021 \pgfcircdeclarebipolescaled{diodes}
6022 {}
6023 {\ctikzvalof{bipoles/diode/height}}
6024 {fulllediode}
6025 {\ctikzvalof{bipoles/diode/height}}
6026 {\ctikzvalof{bipoles/diode/width}}
6027 {
6028
6029 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6030 \pgfscope
6031 \pgftransformxshift{\pgf@circ@res@left}
6032 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6033 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6034 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6035 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6036 \pgfusepath{draw,fill}
6037 \endpgfscope
6038 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6039 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6040 \pgfusepath{draw}
6041
6042 \pgfsetlinewidth{\pgfstartlinewidth}
6043 \pgfsetarrowsend{latexslim}
6044 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6045 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6046 \pgfusepath{draw}
6047 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6048 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6049 \pgfusepath{draw}
6050
6051 }
6052
6053 %% Black photodiode
6054 \pgfcircdeclarebipolescaled{diodes}
6055 {}
6056 {\ctikzvalof{bipoles/diode/height}}
6057 {fullpdiode}
6058 {\ctikzvalof{bipoles/diode/height}}
6059 {\ctikzvalof{bipoles/diode/width}}
6060 {
6061
6062 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6063 \pgfscope
6064 \pgftransformxshift{\pgf@circ@res@left}
6065 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6066 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6067 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6068 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6069 \pgfusepath{draw,fill}
6070 \endpgfscope
6071 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6072 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6073 \pgfusepath{draw}
6074
6075 \pgfsetlinewidth{\pgfstartlinewidth}
6076 \pgfsetarrowsstart{latexslim}
6077 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6078 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6079 \pgfusepath{draw}
6080 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6081 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6082 \pgfusepath{draw}
6083 }
6084
6085 %% Black varcap
6086 \pgfcircdeclarebipolescaled{diodes}
6087 {}
6088 {\ctikzvalof{bipoles/varcap/height}}
6089 {fullvarcap}
6090 {\ctikzvalof{bipoles/varcap/height}}
6091 {\ctikzvalof{bipoles/varcap/width}}
6092 {
6093 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
6094 \pgfsetlinewidth{\pgf@circ@res@temp}
6095 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6096 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6097 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6099 \pgfusepath{draw,fill}
6100 %
6101 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
6102 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
6103 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6104 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6105 \pgfusepath{draw}
6106 }
6107
6108 %% Code for the diode triangle
6109 \def\pgf@circ@basicdiodeshape{
6110 % \pgfscope
6111 \pgftransformxshift{\pgf@circ@res@left}
6112 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6113 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6114 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6115 \pgfpathclose
6116 \pgf@circ@draworfill
6117 \pgfscope
6118 % to allow filling, we need to draw explicitly the stroke here.
6119 \pgfsetlinewidth{\pgfstartlinewidth}
6120 \ifpgf@circuit@bipole@strokedsymbol
6121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6122 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
6123 \pgfusepath{draw}
6124 \fi
6125 \endpgfscope
6126 % \endpgfscope
6127 }
6128
6129 %% Empty generic diode
6130 \pgfcircdeclarebipolescaled{diodes}
6131 {}
6132 {\ctikzvalof{bipoles/diode/height}}
6133 {emptydiode}
6134 {\ctikzvalof{bipoles/diode/height}}
6135 {\ctikzvalof{bipoles/diode/width}}
6136 {
6137 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6138 \pgfscope
6139 \pgf@circ@basicdiodeshape
6140 \endpgfscope
6141 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6142 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6143 \pgfusepath{draw}
6144 }
6145
6146 %% Empty Zener diode
6147 \pgfcircdeclarebipolescaled{diodes}
6148 {}
6149 {\ctikzvalof{bipoles/diode/height}}
6150 {emptyzdiode}
6151 {\ctikzvalof{bipoles/diode/height}}
6152 {\ctikzvalof{bipoles/diode/width}}
6153 {
6154
6155 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6156
6157 \pgfscope
6158 \pgf@circ@basicdiodeshape
6159 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6160 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6161 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6162 \pgfusepath{draw}
6163 \endpgfscope
6164 }
6165
6166 %% Empty alternative zigzag Zener diode
6167 \pgfcircdeclarebipolescaled{diodes}
6168 {}
6169 {\ctikzvalof{bipoles/diode/height}}
6170 {emptyzzdiode}
6171 {\ctikzvalof{bipoles/diode/height}}
6172 {\ctikzvalof{bipoles/diode/width}}
6173 {
6174
6175 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6176
6177 \pgfscope
6178 \pgf@circ@basicdiodeshape
6179 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
6180 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6181 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6182 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
6183 \pgfusepath{draw}
6184 \endpgfscope
6185 }
6186 %% Empty Schottky diode
6187 \pgfcircdeclarebipolescaled{diodes}
6188 {}
6189 {\ctikzvalof{bipoles/diode/height}}
6190 {emptysdiode}
6191 {\ctikzvalof{bipoles/diode/height}}
6192 {\ctikzvalof{bipoles/diode/width}}
6193 {
6194
6195 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6196 \pgfscope
6197 \pgf@circ@basicdiodeshape
6198 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
6199 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6202 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6203 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6204 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
6205 \pgfusepath{draw}
6206 \endpgfscope
6207
6208 }
6209
6210 %% Empty tunnel diode
6211 \pgfcircdeclarebipolescaled{diodes}
6212 {}
6213 {\ctikzvalof{bipoles/diode/height}}
6214 {emptytdiode}
6215 {\ctikzvalof{bipoles/diode/height}}
6216 {\ctikzvalof{bipoles/diode/width}}
6217 {
6218
6219 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6220 \pgfscope
6221 \pgf@circ@basicdiodeshape
6222 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6223 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6224 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6225 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6226 \pgfusepath{draw}
6227 \endpgfscope
6228 }
6229
6230 %% Empty light emitting diode
6231 \pgfcircdeclarebipolescaled{diodes}
6232 {}
6233 {\ctikzvalof{bipoles/diode/height}}
6234 {emptylediode}
6235 {\ctikzvalof{bipoles/diode/height}}
6236 {\ctikzvalof{bipoles/diode/width}}
6237 {
6238
6239 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6240 \pgfscope
6241 \pgf@circ@basicdiodeshape
6242 \endpgfscope
6243 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6244 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6245 \pgfusepath{draw}
6246
6247 \pgfsetlinewidth{\pgfstartlinewidth}
6248 \pgfsetarrowsend{latexslim}
6249 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6250 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6251 \pgfusepath{draw}
6252 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6253 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6254 \pgfusepath{draw}
6255 }
6256
6257 %% Empty photodiode
6258 \pgfcircdeclarebipolescaled{diodes}
6259 {}
6260 {\ctikzvalof{bipoles/diode/height}}
6261 {emptypdiode}
6262 {\ctikzvalof{bipoles/diode/height}}
6263 {\ctikzvalof{bipoles/diode/width}}
6264 {
6265
6266 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6267 \pgfscope
6268 \pgf@circ@basicdiodeshape
6269 \endpgfscope
6270 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6271 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6272 \pgfusepath{draw}
6273
6274 \pgfsetlinewidth{\pgfstartlinewidth}
6275 \pgfsetarrowsstart{latexslim}
6276 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6277 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6278 \pgfusepath{draw}
6279 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6280 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6281 \pgfusepath{draw}
6282 }
6283
6284 %% Empty varcap
6285 \pgfcircdeclarebipolescaled{diodes}
6286 {}
6287 {\ctikzvalof{bipoles/varcap/height}}
6288 {emptyvarcap}
6289 {\ctikzvalof{bipoles/varcap/height}}
6290 {\ctikzvalof{bipoles/varcap/width}}
6291 {
6292 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
6293 \pgfsetlinewidth{\pgf@circ@res@temp}
6294 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6296 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6297 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6298 \pgfpathclose
6299 \pgf@circ@draworfill
6300 \pgfscope
6301 % to allow filling, we need to draw explicitily the stroke here.
6302 \pgfsetlinewidth{\pgfstartlinewidth}
6303 \ifpgf@circuit@bipole@strokedsymbol
6304 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6305 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6306 \pgfusepath{draw}
6307 \fi
6308 \endpgfscope
6309 %
6310 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
6311 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
6312 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6313 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6314 \pgfusepath{draw}
6315 }
6316
6317 %% Empty bidirectionaldiode
6318 \pgfcircdeclarebipolescaled{diodes}
6319 {}
6320 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6321 {emptybidirectionaldiode}
6322 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6323 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
6324 {
6325
6326 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6327
6328 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
6329 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
6330
6331 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6332 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6333 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6334 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6335
6336 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6337 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6338 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6339 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6340
6341 \pgf@circ@draworfill
6342
6343 \pgfsetlinewidth{\pgfstartlinewidth}
6344
6345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6346 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6347
6348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6349 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6350
6351 \pgfusepath{draw}
6352 }
6353
6354 %% Full bidirectionaldiode
6355 \pgfcircdeclarebipolescaled{diodes}
6356 {}
6357 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6358 {fullbidirectionaldiode}
6359 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6360 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
6361 {
6362
6363 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6364
6365 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
6366 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
6367
6368 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6369 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6370 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6372
6373 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6374 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6377
6378 \pgfusepath{draw, fill}
6379
6380 \pgfsetlinewidth{\pgfstartlinewidth}
6381
6382 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6383 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6384
6385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6387
6388 \pgfusepath{draw}
6389 }
6390
6391 %% Black thyristor
6392 \pgfcircdeclarebipolescaled{diodes}
6393 {
6394 \anchor{gate}{\northeast}
6395 \anchor{anode}{\southwest\pgf@y=0cm}
6396 \anchor{G}{\northeast}
6397 \anchor{cathode}{\northeast\pgf@y=0cm }
6398 }
6399 {\ctikzvalof{tripoles/thyristor/height 2}}
6400 {fullthyristor}
6401 {\ctikzvalof{tripoles/thyristor/height}}
6402 {\ctikzvalof{tripoles/thyristor/width}}
6403 {
6404
6405 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6406
6407 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
6408 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
6409
6410 \pgfscope
6411 \pgftransformxshift{\pgf@circ@res@other}
6412 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6413
6414 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
6415 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6416 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6417 \pgfusepath{draw,fill}
6418
6419 \pgfsetlinewidth{\pgfstartlinewidth}
6420
6421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6422 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
6423 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
6424 \pgfusepath{draw}
6425 \endpgfscope
6426
6427 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6428 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
6429
6430 \pgfusepath{draw}
6431
6432 \pgfsetlinewidth{\pgfstartlinewidth}
6433
6434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6436
6437 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6438 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6439
6440 \pgfusepath{draw}
6441
6442 }
6443
6444 %% Empty thyristor
6445
6446 \pgfcircdeclarebipolescaled{diodes}
6447 {
6448 \anchor{gate}{\northeast}
6449 \anchor{anode}{\southwest\pgf@y=0cm}
6450 \anchor{G}{\northeast}
6451 \anchor{cathode}{\northeast\pgf@y=0cm }
6452 }
6453 {\ctikzvalof{tripoles/thyristor/height 2}}
6454 {emptythyristor}
6455 {\ctikzvalof{tripoles/thyristor/height}}
6456 {\ctikzvalof{tripoles/thyristor/width}}
6457 {
6458
6459 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6460
6461 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
6462 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
6463
6464 \pgfscope
6465 \pgftransformxshift{\pgf@circ@res@other}
6466 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6467
6468 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
6469 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6470 \pgfpathclose
6471 \pgf@circ@draworfill
6472 \pgfscope
6473 % to allow filling, we need to draw explicitily the stroke here.
6474 \pgfsetlinewidth{\pgfstartlinewidth}
6475 \ifpgf@circuit@bipole@strokedsymbol
6476 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6477 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
6478 \pgfusepath{draw}
6479 \fi
6480 \endpgfscope
6481
6482 \pgfsetlinewidth{\pgfstartlinewidth}
6483
6484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6485 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
6486 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
6487 \pgfusepath{draw}
6488 \endpgfscope
6489
6490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
6492
6493 \pgfusepath{draw}
6494
6495 \pgfsetlinewidth{\pgfstartlinewidth}
6496
6497 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6498 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6499
6500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6501 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6502
6503 \pgfusepath{draw}
6504 }
6505
6506 %% Empty triac
6507 \pgfcircdeclarebipolescaled{diodes}
6508 {
6509 \anchor{gate}{\northeast}
6510 \anchor{anode}{\southwest\pgf@y=0cm}
6511 \anchor{G}{\northeast}
6512 \anchor{cathode}{\northeast\pgf@y=0cm }
6513 }
6514 {\ctikzvalof{tripoles/triac/height}}
6515 {emptytriac}
6516 {\ctikzvalof{tripoles/triac/height}}
6517 {\ctikzvalof{tripoles/triac/width}}
6518 {
6519
6520 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6521
6522 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
6523 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
6524
6525 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6526 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6528 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6529
6530 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6531 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6533 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6534
6535 \pgf@circ@draworfill
6536
6537 \pgfsetlinewidth{\pgfstartlinewidth}
6538
6539 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6540 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
6542
6543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6544 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6545
6546 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6547 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6548
6549 \pgfusepath{draw}
6550 }
6551
6552 %% Full triac
6553 \pgfcircdeclarebipolescaled{diodes}
6554 {
6555 \anchor{gate}{\northeast}
6556 \anchor{anode}{\southwest\pgf@y=0cm}
6557 \anchor{G}{\northeast}
6558 \anchor{cathode}{\northeast\pgf@y=0cm }
6559 }
6560 {\ctikzvalof{tripoles/triac/height}}
6561 {fulltriac}
6562 {\ctikzvalof{tripoles/triac/height}}
6563 {\ctikzvalof{tripoles/triac/width}}
6564 {
6565 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6566
6567 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
6568 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
6569
6570 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6571 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6572 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6573 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6574
6575 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6576 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6577 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6578 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6579
6580 \pgfusepath{draw,fill}
6581
6582 \pgfsetlinewidth{\pgfstartlinewidth}
6583
6584 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6585 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6586 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
6587
6588 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6589 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6590
6591 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6592 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6593
6594 \pgfusepath{draw}
6595 }
6596
6597 %%%%%%%%%%%%%
6598 %% switches
6599 %%%%%%%%%%%%%
6600
6601 %% (Closing) SPST
6602 \pgfcircdeclarebipolescaled{switches}
6603 {}
6604 {\ctikzvalof{bipoles/spst/depth}}
6605 {cspst}
6606 {\ctikzvalof{bipoles/spst/height}}
6607 {\ctikzvalof{bipoles/spst/width}}
6608 {
6609 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6610 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6611 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
6612 \pgfusepath{draw}
6613
6614 \pgfscope
6615 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
6616 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
6617 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
6618 \pgfsetarrowsend{latexslim}
6619 \pgfsetbeveljoin
6620 \pgfusepath{draw}
6621 \endpgfscope
6622 }
6623
6624 %% Opening SPST
6625 \pgfcircdeclarebipolescaled{switches}
6626 {}
6627 {\ctikzvalof{bipoles/spst/depth}}
6628 {ospst}
6629 {\ctikzvalof{bipoles/spst/height}}
6630 {\ctikzvalof{bipoles/spst/width}}
6631 {
6632
6633 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6634 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6635 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
6636 \pgfusepath{draw}
6637
6638 \pgfscope
6639 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
6640 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
6641 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
6642 \pgfsetarrowsend{latexslim}
6643 \pgfsetbeveljoin
6644 \pgfusepath{draw}
6645 \endpgfscope
6646 }
6647
6648 %% Normal open Switch
6649 \pgfcircdeclarebipolescaled{switches}
6650 {}
6651 {\ctikzvalof{bipoles/nos/depth}}
6652 {nos}
6653 {\ctikzvalof{bipoles/nos/height}}
6654 {\ctikzvalof{bipoles/nos/width}}
6655 {
6656
6657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6658 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6659 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
6660 \pgfsetbuttcap
6661 \pgfusepath{draw}
6662 }
6663
6664 %% Normal closed Switch
6665 \pgfcircdeclarebipolescaled{switches}
6666 {}
6667 {\ctikzvalof{bipoles/ncs/depth}}
6668 {ncs}
6669 {\ctikzvalof{bipoles/ncs/height}}
6670 {\ctikzvalof{bipoles/ncs/width}}
6671 {
6672 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6673 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6674 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
6675 \pgfusepath{draw}
6676 \pgfsetlinewidth{\pgfstartlinewidth}
6677 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6678 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
6679 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
6680 \pgfusepath{draw}
6681 }
6682
6683 %% Push Button
6684 \pgfcircdeclarebipolescaled{switches}
6685 {}
6686 {\ctikzvalof{bipoles/pushbutton/height 2}}
6687 {pushbutton}
6688 {\ctikzvalof{bipoles/pushbutton/height}}
6689 {\ctikzvalof{bipoles/pushbutton/width}}
6690 {
6691 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6692 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6693 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6694 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
6695 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
6696 \pgfusepath{draw}
6697
6698 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
6699 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
6700 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
6701 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
6702 }
6703
6704 %% Normally closed Push Button
6705 \pgfcircdeclarebipolescaled{switches}
6706 {}
6707 {\ctikzvalof{bipoles/pushbutton/height 2}}
6708 {ncpushbutton}
6709 {\ctikzvalof{bipoles/pushbutton/height}}
6710 {\ctikzvalof{bipoles/pushbutton/width}}
6711 {
6712 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6713 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
6714 % Warning, if the nodes will have a class, we have to touch this.
6715 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
6716 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
6717 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
6718 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
6719 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
6720 \pgfusepath{draw}
6721 %
6722 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
6723 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
6724 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
6725 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
6726 }
6727 %%% reed switches
6728 \pgfcircdeclarebipolescaled{switches}
6729 {}
6730 {\ctikzvalof{bipoles/reed/depth}}
6731 {reed}
6732 {\ctikzvalof{bipoles/reed/height}}
6733 {\ctikzvalof{bipoles/reed/width}}
6734 {
6735 % this is designed to be the same as a "nos".
6736 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
6737 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
6738 \pgfscope
6739 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6740 % eclosure
6741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
6742 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
6743 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
6744 \pgfpatharc{270}{90}{\pgf@circ@res@up}
6745 \pgfpathclose
6746 \pgf@circ@draworfill
6747 % switch
6748 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
6749 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
6750 % connection lines
6751 \pgfsetbuttcap
6752 \pgfusepath{draw}
6753 \endpgfscope
6754 % connection lines
6755 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6756 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
6757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6758 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
6759 \pgfusepath{draw}
6760 }
6761
6762 % cute switch "to" shapes help function
6763 % #1 -> name
6764 % #2 -> barposition
6765 % #3 -> arrowcode
6766 \long\def\pgfcircdeclarecutesw#1#2#3{
6767 \pgfcircdeclarebipolescaled{switches}
6768 {
6769 \savedanchor\midlever{
6770 % these values are calculated when we create the definition of the shape.
6771 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
6772 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
6773 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
6774 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
6775 \pgf@circ@res@down = -.5\pgf@y
6776 \pgf@circ@res@up = .5\pgf@y
6777 \pgfextracty{\pgf@circ@res@other}{#2}
6778 \pgf@x=0pt
6779 \pgf@y=.5\pgf@circ@res@other
6780 }
6781 % radius of the connector
6782 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
6783 % If cnnecting nodes are scaled, we have to modify this
6784 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
6785 % shapename
6786 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
6787 % shape type
6788 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
6789 % mid of the lever, to stack switches
6790 \anchor{mid}{\midlever}
6791 \anchor{cout}{\northeast \pgf@y=0cm}
6792 \anchor{cin}{\southwest\pgf@y=0cm}
6793 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
6794 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
6795 }
6796 {\ctikzvalof{bipoles/cuteswitch/height 2}}
6797 {#1}
6798 {\ctikzvalof{bipoles/cuteswitch/height}}
6799 {\ctikzvalof{bipoles/cuteswitch/width}}{
6800 \pgfscope
6801 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
6802 % If cnnecting nodes are scaled, we have to modify this
6803 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
6804 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
6805 \pgfsetlinewidth{2\pgf@circ@res@temp}
6806 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6807 \pgfpathlineto{#2}
6808 \pgfsetroundcap\pgfusepath{draw}
6809 \endpgfscope
6810 \pgfscope % arrow
6811 #3
6812 \endpgfscope
6813 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
6814 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
6815 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
6816 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
6817 }
6818 }
6819
6820 %% closed cute switch
6821 \pgfcircdeclarecutesw{cuteclosedswitch}
6822 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
6823 {}
6824
6825 %% open cute switch
6826 \pgfcircdeclarecutesw{cuteopenswitch}
6827 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6828 {}
6829
6830 %% closing cute switch
6831 \pgfcircdeclarecutesw{cuteclosingswitch}
6832 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6833 {
6834 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6835 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
6836 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
6837 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
6838 \pgfsetarrowsend{latexslim}
6839 \pgfusepath{draw}
6840 }
6841
6842 %% opening cute switch
6843 \pgfcircdeclarecutesw{cuteopeningswitch}
6844 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
6845 {
6846 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6847 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
6848 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
6849 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
6850 \pgfsetarrowsend{latexslim}
6851 \pgfusepath{draw}
6852 }
6853
6854 %%%%%%%%%%%%%%%%%
6855 %% Instruments
6856 %%%%%%%%%%%%%%%%%
6857
6858 % % METERINGSHAPE
6859 \long\def\drawmeteringcircle{
6860 \def\pgf@circ@temp{right}
6861 \ifx\tikz@res@label@pos\pgf@circ@temp
6862 \pgf@circ@res@step=-1.2\pgf@circ@res@up
6863 \else
6864 \def\pgf@circ@temp{below}
6865 \ifx\tikz@res@label@pos\pgf@circ@temp
6866 \pgf@circ@res@step=-1.2\pgf@circ@res@up
6867 \else
6868 \pgf@circ@res@step=1.2\pgf@circ@res@up
6869 \fi
6870 \fi
6871 %draw connections to circle
6872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6873 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
6874 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
6875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6876 \pgfusepath{draw}
6877 %draw circle
6878 \pgfscope
6879 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6880 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
6881 \pgf@circ@draworfill
6882 \endpgfscope
6883 %draw arrow
6884 \pgfscope
6885 \pgfsetarrowsend{latex}
6886 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6887 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
6888 \pgfusepath{draw}
6889 \endpgfscope
6890 }
6891
6892 %AMPEREMETER
6893 \pgfcircdeclarebipolescaled{instruments}
6894 {}
6895 {\ctikzvalof{bipoles/ammeter/height}}
6896 {ammeter}
6897 {\ctikzvalof{bipoles/ammeter/height}}
6898 {\ctikzvalof{bipoles/ammeter/width}}
6899 {
6900 \drawmeteringcircle
6901 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
6902 }
6903 %OHMMETER
6904 \pgfcircdeclarebipolescaled{instruments}
6905 {}
6906 {\ctikzvalof{bipoles/ohmmeter/height}}
6907 {ohmmeter}
6908 {\ctikzvalof{bipoles/ohmmeter/height}}
6909 {\ctikzvalof{bipoles/ohmmeter/width}}
6910 {
6911 \drawmeteringcircle
6912 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
6913 }
6914 %VOLTMETER
6915 \pgfcircdeclarebipolescaled{instruments}
6916 {}
6917 {\ctikzvalof{bipoles/voltmeter/height}}
6918 {voltmeter}
6919 {\ctikzvalof{bipoles/voltmeter/height}}
6920 {\ctikzvalof{bipoles/voltmeter/width}}
6921 {
6922 \drawmeteringcircle
6923 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
6924
6925 }
6926
6927 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
6928 \pgfcircdeclarebipolescaled{instruments}
6929 {
6930 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
6931 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
6932 % put the node text above and centered
6933 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
6934 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
6935 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
6936 }
6937 }
6938 }
6939 {\ctikzvalof{bipoles/oscope/height}}
6940 {oscope}
6941 {\ctikzvalof{bipoles/oscope/height}}
6942 {\ctikzvalof{bipoles/oscope/width}}
6943 {
6944 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6945 \pgfextracty{\pgf@circ@res@up}{\northeast}
6946 \pgfextractx{\pgf@circ@res@right}{\northeast}
6947 \pgfextractx{\pgf@circ@res@left}{\southwest}
6948 \pgfextracty{\pgf@circ@res@down}{\southwest}
6949 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
6950 \pgfscope
6951 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
6952 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6953 % this would create a round (analog?) scope...
6954 % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6955 \pgf@circ@draworfill
6956 \endpgfscope
6957 % get the rotation
6958 \ifpgf@circuit@straightinstruments
6959 \pgfgettransformentries\a\b\temp\temp\temp\temp
6960 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
6961 \else
6962 \edef\rot{0}
6963 \fi
6964 % and unrotate the scope
6965 \pgfscope
6966 \pgftransformrotate{\rot}
6967 % grid
6968 \pgfscope
6969 \pgfsetlinewidth{0.5\pgfstartlinewidth}
6970 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
6971 \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]%
6972 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
6973 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
6974 \pgfsetstrokeopacity{0.5}
6975 \pgfusepath{draw}
6976 \endpgfscope
6977 % function displayed, thanks to
6978 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6979 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
6980 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
6981 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
6982 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
6983 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
6984 \pgfusepath{draw}
6985 \endpgfscope
6986 }
6987
6988 % generic round meter with always horizontal text, no arrow
6989 \pgfcircdeclarebipolescaled{instruments}
6990 {}
6991 {\ctikzvalof{bipoles/esource/height}}
6992 {rmeter}
6993 {\ctikzvalof{bipoles/esource/height}}
6994 {\ctikzvalof{bipoles/esource/width}}
6995 {
6996 \pgfpointorigin
6997 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6998 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6999 \pgf@circ@draworfill
7000 % draw the text label
7001 % get the rotation
7002 \ifpgf@circuit@straightinstruments
7003 \pgfgettransformentries\a\b\temp\temp\temp\temp
7004 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7005 \else
7006 \edef\rot{0}
7007 \fi
7008 % and unrotate the scope
7009 \pgfscope
7010 \pgfsetcolor{\ctikzvalof{color}}
7011 \pgftransformrotate{\rot}
7012 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
7013 \endpgfscope
7014 }
7015
7016 % generic round meter with always horizontal text, with arrow
7017 \pgfcircdeclarebipolescaled{instruments}
7018 {}
7019 {\ctikzvalof{bipoles/esource/height}}
7020 {rmeterwa}
7021 {\ctikzvalof{bipoles/esource/height}}
7022 {\ctikzvalof{bipoles/esource/width}}
7023 {
7024 \pgfpointorigin
7025 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7026 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7027 \pgf@circ@draworfill
7028 % draw the text label
7029 % get the rotation
7030 \ifpgf@circuit@straightinstruments
7031 \pgfgettransformentries\a\b\temp\temp\temp\temp
7032 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7033 \else
7034 \edef\rot{0}
7035 \fi
7036 % and unrotate the scope
7037 \pgfscope
7038 \pgftransformrotate{\rot}
7039 \pgfsetcolor{\ctikzvalof{color}}
7040 \pgfsetlinewidth{\pgfstartlinewidth}
7041 % arrow: create a center hole to have better visual
7042 \pgfscope
7043 % clipping path: first a rectangle bigger then the shape
7044 % to avoid problems with the line thickness
7045 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7046 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7047 % next open a circle into it
7048 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
7049 % do the difference and clip before drawing
7050 \pgfseteorule
7051 \pgfusepath{clip}
7052 \pgfsetarrowsend{latexslim}
7053 % the arrow is better if it has a bit of breath and it's not 45º
7054 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
7055 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
7056 \pgfusepath{draw}
7057 \endpgfscope
7058 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
7059 \endpgfscope
7060 }
7061
7062 % generic square meter with always horizontal text
7063 \pgfcircdeclarebipolescaled{instruments}
7064 {
7065 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7066 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7067 % put the node text above and centered
7068 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7069 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7070 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7071 }
7072 }
7073 }
7074 {\ctikzvalof{bipoles/smeter/height}}
7075 {smeter}
7076 {\ctikzvalof{bipoles/smeter/height}}
7077 {\ctikzvalof{bipoles/smeter/width}}
7078 {
7079 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7080 \pgfextracty{\pgf@circ@res@up}{\northeast}
7081 \pgfextractx{\pgf@circ@res@right}{\northeast}
7082 \pgfextractx{\pgf@circ@res@left}{\southwest}
7083 \pgfextracty{\pgf@circ@res@down}{\southwest}
7084 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7085 \pgfscope
7086 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7087 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7088 \pgf@circ@draworfill
7089 \endpgfscope
7090 % get the rotation
7091 \ifpgf@circuit@straightinstruments
7092 \pgfgettransformentries\a\b\temp\temp\temp\temp
7093 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7094 \else
7095 \edef\rot{0}
7096 \fi
7097 % and unrotate the scope
7098 \pgfscope
7099 \pgftransformrotate{\rot}
7100 % the metering window
7101 \pgfscope
7102 \def\@starta{105}\def\@stopa{75}
7103 \pgfsetlinewidth{\pgfstartlinewidth}
7104 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
7105 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
7106 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
7107 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
7108 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
7109 \pgfclosepath
7110 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
7111 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
7112 \pgfusepath{draw}
7113 \endpgfscope
7114 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
7115 \endpgfscope
7116 }
7117
7118 % probes qucs style:
7119 % #1 : name
7120 % #2 : extra code
7121 \long\def\pgfcirc@qucsprobe#1#2{
7122 \pgfcircdeclarebipolescaled{instruments}
7123 {
7124 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
7125 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
7126 % put the node text above and centered
7127 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7128 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7129 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7130 }
7131 }
7132 }
7133 {\ctikzvalof{bipoles/qmeter/depth}}
7134 {#1}
7135 {\ctikzvalof{bipoles/qmeter/height}}
7136 {\ctikzvalof{bipoles/qmeter/width}}
7137 {
7138 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7139 \pgfextracty{\pgf@circ@res@up}{\northeast}
7140 \pgfextractx{\pgf@circ@res@right}{\northeast}
7141 \pgfextractx{\pgf@circ@res@left}{\southwest}
7142 \pgfextracty{\pgf@circ@res@down}{\southwest}
7143 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7144 \pgfscope
7145 \pgfscope
7146 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7147 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7148 \pgf@circ@draworfill
7149 \endpgfscope
7150 \def\@starta{103}\def\@stopa{77}
7151 \pgfsetlinewidth{\pgfstartlinewidth}
7152 \pgfscope
7153 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
7154 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
7155 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
7156 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
7157 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
7158 \pgfclosepath
7159 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
7160 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
7161 \pgfusepath{draw}
7162 \pgf@circ@draworfill
7163 \endpgfscope
7164 #2
7165 \endpgfscope
7166 }
7167 }
7168
7169 \pgfcirc@qucsprobe{qiprobe}{
7170 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7171 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7172 \pgfusepath{draw}
7173 \pgfnode{currarrow}{center}{}{}{}
7174 }
7175
7176 \pgfcirc@qucsprobe{qvprobe}{
7177 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
7178 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7179 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
7180 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
7181 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
7182 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7183 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
7184 \pgfusepath{draw}
7185 \pgfscope
7186 % "+" and "-", drawn so that they scale correctly
7187 \pgfsetlinewidth{2\pgfstartlinewidth}
7188 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
7189 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
7190 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7191 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7192 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7193 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7194 \pgfusepath{draw}
7195 \endpgfscope
7196 }
7197
7198 \pgfcirc@qucsprobe{qpprobe}{
7199 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7201 \pgfusepath{draw}
7202 \pgfnode{currarrow}{center}{}{}{}
7203 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
7204 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
7205 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
7206 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
7207 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
7208 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
7209 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
7210 \pgfusepath{draw}
7211 \pgfscope
7212 % "+" and "-", drawn so that they scale correctly
7213 \pgfsetlinewidth{2\pgfstartlinewidth}
7214 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
7215 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
7216 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7217 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7218 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7219 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7220 \pgfusepath{draw}
7221 \endpgfscope
7222 }
7223
7224 % current loop for oscope and similar: stylized
7225 \pgfcircdeclarebipolescaled{instruments}
7226 {
7227 \anchor{i}{\northeast\pgf@x=0pt\relax}
7228 \anchor{text}{
7229 \pgfextracty{\pgf@circ@res@up}{\northeast}
7230 \pgfextractx{\pgf@circ@res@left}{\northeast}
7231 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
7232 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7233 }
7234 }
7235 }
7236 {\ctikzvalof{bipoles/iloop/height}}
7237 {iloop}
7238 {\ctikzvalof{bipoles/iloop/height}}
7239 {\ctikzvalof{bipoles/iloop/width}}
7240 {
7241 \pgfextracty{\pgf@circ@res@up}{\northeast}
7242 \pgfextractx{\pgf@circ@res@right}{\northeast}
7243 \pgf@circ@res@down=-\pgf@circ@res@up
7244 \pgf@circ@res@left=-\pgf@circ@res@right
7245 \pgfscope
7246 \pgfstartlinewidth=\pgflinewidth
7247 \pgfsetcolor{\ctikzvalof{color}}
7248 % external ellipse
7249 \pgfscope
7250 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
7251 % clipping path: first a rectangle bigger then the shape
7252 % to avoid problems with the line thickness
7253 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7254 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7255 % next the opening to the left
7256 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
7257 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
7258 % do the difference and clip before drawing
7259 \pgfseteorule
7260 \pgfusepath{clip}
7261 \pgfpathellipse{\pgfpointorigin}{
7262 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
7263 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
7264 \pgfusepath{draw}
7265 \endpgfscope
7266 % internal wire
7267 \pgfsetlinewidth{\pgfstartlinewidth}
7268 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7269 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
7270 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
7271 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7272 % and the contact line up
7273 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7274 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7275 \pgfusepath{draw}
7276 \endpgfscope
7277 }
7278
7279 % current loop for oscope and similar: real (double connection)
7280 \pgfcircdeclarebipolescaled{instruments}
7281 {
7282 \anchor{i+}{
7283 \pgfextracty{\pgf@circ@res@up}{\northeast}
7284 \pgfextractx{\pgf@circ@res@right}{\northeast}
7285 \pgf@circ@res@step=0.4\pgf@circ@res@right
7286 \pgf@circ@res@other=0.8\pgf@circ@res@up
7287 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
7288 \pgf@y=\pgf@circ@res@up
7289 }
7290 \anchor{i-}{
7291 \pgfextracty{\pgf@circ@res@up}{\northeast}
7292 \pgfextractx{\pgf@circ@res@right}{\northeast}
7293 \pgf@circ@res@step=0.4\pgf@circ@res@right
7294 \pgf@circ@res@other=0.8\pgf@circ@res@up
7295 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
7296 \pgf@y=\pgf@circ@res@up
7297 }
7298 \anchor{text}{
7299 \pgfextracty{\pgf@circ@res@up}{\northeast}
7300 \pgfextractx{\pgf@circ@res@left}{\northeast}
7301 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
7302 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7303 }
7304 }
7305 }
7306 {\ctikzvalof{bipoles/iloop/height}}
7307 {iloop2}
7308 {\ctikzvalof{bipoles/iloop/height}}
7309 {\ctikzvalof{bipoles/iloop/width}}
7310 {
7311 \pgfextracty{\pgf@circ@res@up}{\northeast}
7312 \pgfextractx{\pgf@circ@res@right}{\northeast}
7313 \pgf@circ@res@down=-\pgf@circ@res@up
7314 \pgf@circ@res@left=-\pgf@circ@res@right
7315 % must be the same than internal i+ and i- anchors definition
7316 \pgf@circ@res@step=0.4\pgf@circ@res@right
7317 \pgf@circ@res@other=0.8\pgf@circ@res@up
7318 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
7319 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
7320 \pgfscope
7321 \pgfstartlinewidth=\pgflinewidth
7322 \pgfsetcolor{\ctikzvalof{color}}
7323 % external ellipse
7324 \pgfscope
7325 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
7326 % clipping path: first a rectangle bigger then the shape
7327 % to avoid problems with the line thickness
7328 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7329 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7330 % next the opening to the left
7331 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
7332 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
7333 % do the difference and clip before drawing
7334 \pgfseteorule
7335 \pgfusepath{clip}
7336 \pgfpathmoveto{\@plus}
7337 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
7338 \pgfusepath{draw}
7339 \endpgfscope
7340 % internal wire
7341 \pgfsetlinewidth{\pgfstartlinewidth}
7342 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7343 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
7344 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
7345 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7346 % and the contact line up
7347 % I use ...left and ---right as temporal lengths here to avoid defining more
7348 \pgfextractx{\pgf@circ@res@left}{\@plus}
7349 \pgfextractx{\pgf@circ@res@right}{\@minus}
7350 \pgfpathmoveto{\@plus}
7351 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7352 \pgfpathmoveto{\@minus}
7353 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7354 \pgfusepath{draw}
7355 \endpgfscope
7356 }
7357
7358
7359 %% Varistor
7360 \pgfcircdeclarebipolescaled{resistors}
7361 {}
7362 {\ctikzvalof{bipoles/varistor/height}}
7363 {varistor}
7364 {\ctikzvalof{bipoles/varistor/height}}
7365 {\ctikzvalof{bipoles/varistor/width}}
7366 {
7367 \pgfscope
7368 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}
7369 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7370 \pgf@circ@draworfill
7371 \endpgfscope
7372
7373 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
7374 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
7375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7376 \pgfusepath{draw}
7377
7378 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
7379 }
7380
7381 %%%%%%%%%%%%%%
7382 %% RF bipoles
7383 %%%%%%%%%%%%%%
7384
7385 % transmission line
7386 \pgfcircdeclarebipolescaled{RF}
7387 {}
7388 {\ctikzvalof{bipoles/tline/height}}
7389 {tline}
7390 {\ctikzvalof{bipoles/tline/height}}
7391 {\ctikzvalof{bipoles/tline/width}}
7392 {
7393 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
7394 \begin{pgftransparencygroup}
7395 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7396 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
7397 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
7398 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
7399 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
7400 \pgf@circ@draworfill
7401 \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
7402 {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
7403 \pgf@circ@draworfill
7404 \end{pgftransparencygroup}
7405 \pgfsetlinewidth{\pgfstartlinewidth}
7406 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
7407 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7408 \pgfusepath{stroke}
7409 }
7410
7411 % microstrip transmission line
7412 \pgfcircdeclarebipolescaled{RF}
7413 {}
7414 {\ctikzvalof{bipoles/mstline/height}}
7415 {mstline}
7416 {\ctikzvalof{bipoles/mstline/height}}
7417 {\ctikzvalof{bipoles/mstline/width}}
7418 {
7419 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7420 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7421 \pgf@circ@draworfill
7422 }
7423
7424 %%%%%%%%%%%%%%%%%%%
7425 %% Block diagrams
7426 %%%%%%%%%%%%%%%%%%%
7427
7428 %% Draw the two-port fillable box
7429 \def\pgf@circ@twoportbox{
7430 \pgfscope
7431 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7432 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7433 \pgf@circ@draworfill
7434 \endpgfscope
7435 }
7436
7437 %% Generic two port box
7438 \pgfcircdeclarebipolescaled{blocks}
7439 {}
7440 {\ctikzvalof{bipoles/twoport/height}}
7441 {twoport}
7442 {\ctikzvalof{bipoles/twoport/height}}
7443 {\ctikzvalof{bipoles/twoport/width}}
7444 {
7445 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
7446 \divide \pgf@circ@res@step by 2
7447
7448 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7449 \pgf@circ@res@other = \pgf@circ@res@left
7450 \advance\pgf@circ@res@other by \pgf@circ@res@step
7451 \ifpgf@circuit@dashed
7452 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7453 \fi
7454 % draw outer box
7455 \pgf@circ@twoportbox
7456 \ifpgf@circuit@inputarrow
7457 {
7458 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7459 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7460 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7461 }
7462 \fi
7463
7464 % rotate inner symbol
7465 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7466 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7467 \pgftransformrotate{270}
7468 \fi\fi
7469 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
7470 \pgftransformrotate{180}
7471 \fi\fi
7472 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
7473 \pgftransformrotate{90}
7474 \fi\fi
7475
7476 % draw inner symbol
7477 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
7478
7479 }
7480
7481 %% voltage controled oscillator
7482 \pgfcircdeclarebipolescaled{blocks}
7483 {}
7484 {\ctikzvalof{bipoles/vco/width}}
7485 {vco}
7486 {\ctikzvalof{bipoles/twoport/width}}
7487 {\ctikzvalof{bipoles/vco/width}}
7488 {
7489 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
7490 \divide \pgf@circ@res@step by 2
7491
7492 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7493 \pgf@circ@res@other = \pgf@circ@res@left
7494 \advance\pgf@circ@res@other by \pgf@circ@res@step
7495
7496 \ifpgf@circuit@dashed
7497 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7498 \fi
7499 % draw circle
7500 \pgfscope
7501 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7502 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
7503 \pgf@circ@draworfill
7504 \endpgfscope
7505 \ifpgf@circuit@inputarrow
7506 {
7507 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7508 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7509 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7510 }
7511 \fi
7512
7513 % rotate inner symbol
7514 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7515 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7516 \pgftransformrotate{270}
7517 \fi\fi
7518 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7519 \pgftransformrotate{180}
7520 \fi\fi
7521 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
7522 \pgftransformrotate{90}
7523 \fi\fi
7524
7525 % draw inner sine waves
7526 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7527 \pgfsetlinewidth{\pgfstartlinewidth}
7528 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
7529 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7530 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7531 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7532 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7533 \pgfusepath{draw}
7534 }
7535
7536 %% bandpass filter
7537 \pgfcircdeclarebipolescaled{blocks}
7538 {}
7539 {\ctikzvalof{bipoles/bandpass/width}}
7540 {bandpass}
7541 {\ctikzvalof{bipoles/bandpass/width}}
7542 {\ctikzvalof{bipoles/bandpass/width}}
7543 {
7544
7545 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
7546 \divide \pgf@circ@res@step by 2
7547
7548 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7549 \pgf@circ@res@other = \pgf@circ@res@left
7550 \advance\pgf@circ@res@other by \pgf@circ@res@step
7551
7552 \ifpgf@circuit@dashed
7553 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7554 \fi
7555
7556 % draw outer box
7557 \pgf@circ@twoportbox
7558
7559 \ifpgf@circuit@inputarrow
7560 {
7561 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7562 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7563 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7564 }
7565 \fi
7566
7567 % rotate inner symbol
7568 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7569 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7570 \pgftransformrotate{270}
7571 \fi\fi
7572 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7573 \pgftransformrotate{180}
7574 \fi\fi
7575 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
7576 \pgftransformrotate{90}
7577 \fi\fi
7578
7579 % draw inner symbol
7580 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7581 \pgfsetarrows{-} %never draw arrows
7582 \pgfsetlinewidth{\pgfstartlinewidth}
7583 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
7584 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7585 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7586 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7587 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7588 \pgfusepath{draw}
7589 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
7590 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
7591 \pgfusepath{draw}
7592
7593 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
7594 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7595 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7596 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7597 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7598 \pgfusepath{draw}
7599
7600 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
7601 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7602 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7603 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7604 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7605 \pgfusepath{draw}
7606 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
7607 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
7608 \pgfusepath{draw}
7609 }
7610
7611 %% bandstop filter
7612 \pgfcircdeclarebipolescaled{blocks}
7613 {}
7614 {\ctikzvalof{bipoles/bandstop/width}}
7615 {bandstop}
7616 {\ctikzvalof{bipoles/bandstop/width}}
7617 {\ctikzvalof{bipoles/bandstop/width}}
7618 {
7619 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
7620 \divide \pgf@circ@res@step by 2
7621
7622 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7623 \pgf@circ@res@other = \pgf@circ@res@left
7624 \advance\pgf@circ@res@other by \pgf@circ@res@step
7625
7626 \ifpgf@circuit@dashed
7627 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7628 \fi
7629
7630 % draw outer box
7631 \pgf@circ@twoportbox
7632
7633 \ifpgf@circuit@inputarrow
7634 {
7635 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7636 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7637 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7638 }
7639 \fi
7640
7641 % rotate inner symbol
7642 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7643 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7644 \pgftransformrotate{270}
7645 \fi\fi
7646 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
7647 \pgftransformrotate{180}
7648 \fi\fi
7649 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
7650 \pgftransformrotate{90}
7651 \fi\fi
7652
7653 % draw inner symbol
7654 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
7655 \pgfsetarrows{-}%never draw arrows
7656 \pgfsetlinewidth{\pgfstartlinewidth}
7657 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
7658 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7659 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7660 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7661 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7662 \pgfusepath{draw}
7663
7664 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
7665 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7666 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7667 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7668 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7669 \pgfusepath{draw}
7670 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
7671 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
7672 \pgfusepath{draw}
7673
7674 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
7675 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7676 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7677 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7678 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7679 \pgfusepath{draw}
7680 }
7681
7682 %% highpass filter
7683 \pgfcircdeclarebipolescaled{blocks}
7684 {}
7685 {\ctikzvalof{bipoles/highpass/width}}
7686 {highpass}
7687 {\ctikzvalof{bipoles/highpass/width}}
7688 {\ctikzvalof{bipoles/highpass/width}}
7689 {
7690 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
7691 \divide \pgf@circ@res@step by 2
7692
7693 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7694 \pgf@circ@res@other = \pgf@circ@res@left
7695 \advance\pgf@circ@res@other by \pgf@circ@res@step
7696
7697 \ifpgf@circuit@dashed
7698 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7699 \fi
7700
7701 % draw outer box
7702 \pgf@circ@twoportbox
7703
7704 \ifpgf@circuit@inputarrow
7705 {
7706 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7707 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7708 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7709 }
7710 \fi
7711
7712 % rotate inner symbol
7713 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7714 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7715 \pgftransformrotate{270}
7716 \fi\fi
7717 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7718 \pgftransformrotate{180}
7719 \fi\fi
7720 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
7721 \pgftransformrotate{90}
7722 \fi\fi
7723
7724 % draw inner symbol
7725 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7726 \pgfsetarrows{-} %never draw arrows
7727 \pgfsetlinewidth{\pgfstartlinewidth}
7728 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
7729 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7730 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7731 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7732 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7733 \pgfusepath{draw}
7734
7735 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
7736 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7737 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7738 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7739 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7740 \pgfusepath{draw}
7741 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
7742 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
7743 \pgfusepath{draw}
7744
7745 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
7746 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7747 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7748 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7749 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7750 \pgfusepath{draw}
7751 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
7752 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
7753 \pgfusepath{draw}
7754 }
7755
7756 %% lowpass filter
7757 \pgfcircdeclarebipolescaled{blocks}
7758 {}
7759 {\ctikzvalof{bipoles/lowpass/width}}
7760 {lowpass}
7761 {\ctikzvalof{bipoles/lowpass/width}}
7762 {\ctikzvalof{bipoles/lowpass/width}}
7763 {
7764 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
7765 \divide \pgf@circ@res@step by 2
7766
7767 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7768 \pgf@circ@res@other = \pgf@circ@res@left
7769 \advance\pgf@circ@res@other by \pgf@circ@res@step
7770
7771 \ifpgf@circuit@dashed
7772 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7773 \fi
7774
7775 % draw outer box
7776 \pgf@circ@twoportbox
7777
7778 \ifpgf@circuit@inputarrow
7779 {
7780 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7781 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7782 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7783 }
7784 \fi
7785
7786 % rotate inner symbol
7787 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7788 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7789 \pgftransformrotate{270}
7790 \fi\fi
7791 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7792 \pgftransformrotate{180}
7793 \fi\fi
7794 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
7795 \pgftransformrotate{90}
7796 \fi\fi
7797
7798 % draw inner symbol
7799 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7800 \pgfsetarrows{-} %never draw arrows
7801 \pgfsetlinewidth{\pgfstartlinewidth}
7802 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
7803 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7804 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7805 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7806 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7807 \pgfusepath{draw}
7808 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
7809 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
7810 \pgfusepath{draw}
7811
7812 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
7813 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7814 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7815 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7816 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7817 \pgfusepath{draw}
7818 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
7819 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
7820 \pgfusepath{draw}
7821
7822 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
7823 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7824 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7825 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
7826 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
7827 \pgfusepath{draw}
7828 }
7829
7830 %% ADC
7831 \pgfcircdeclarebipolescaled{blocks}
7832 {}
7833 {\ctikzvalof{bipoles/adc/width}}
7834 {adc}
7835 {\ctikzvalof{bipoles/adc/width}}
7836 {\ctikzvalof{bipoles/adc/width}}
7837 {
7838 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
7839 \divide \pgf@circ@res@step by 2
7840
7841 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7842 \pgf@circ@res@other = \pgf@circ@res@left
7843 \advance\pgf@circ@res@other by \pgf@circ@res@step
7844
7845 \ifpgf@circuit@dashed
7846 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7847 \fi
7848
7849 % draw outer box
7850 \pgf@circ@twoportbox
7851
7852 \ifpgf@circuit@inputarrow
7853 {
7854 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7855 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7856 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7857 }
7858 \fi
7859
7860 % rotate inner symbol
7861 \def\texti{A}
7862 \def\textii{D}
7863 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7864 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7865 \def\texti{D}
7866 \def\textii{A}
7867 \pgftransformrotate{270}
7868 \fi\fi
7869 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7870 \def\texti{D}
7871 \def\textii{A}
7872 \pgftransformrotate{180}
7873 \fi\fi
7874 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
7875 \pgftransformrotate{90}
7876 \def\texti{A}
7877 \def\textii{D}
7878 \fi\fi
7879
7880 % draw inner symbol
7881 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7882 \pgfsetarrows{-} %never draw arrows
7883 \pgfsetlinewidth{\pgfstartlinewidth}
7884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7886 \pgfusepath{draw}
7887
7888 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
7889 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
7890 }
7891
7892 %% DAC
7893 \pgfcircdeclarebipolescaled{blocks}
7894 {}
7895 {\ctikzvalof{bipoles/dac/width}}
7896 {dac}
7897 {\ctikzvalof{bipoles/dac/width}}
7898 {\ctikzvalof{bipoles/dac/width}}
7899 {
7900 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
7901 \divide \pgf@circ@res@step by 2
7902
7903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7904 \pgf@circ@res@other = \pgf@circ@res@left
7905 \advance\pgf@circ@res@other by \pgf@circ@res@step
7906
7907 \ifpgf@circuit@dashed
7908 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7909 \fi
7910
7911 % draw outer box
7912 \pgf@circ@twoportbox
7913
7914 \ifpgf@circuit@inputarrow
7915 {
7916 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7917 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7918 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7919 }
7920 \fi
7921
7922 % rotate inner symbol
7923 \def\texti{D}
7924 \def\textii{A}
7925 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7926 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7927 \def\texti{A}
7928 \def\textii{D}
7929 \pgftransformrotate{270}
7930 \fi\fi
7931 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
7932 \def\texti{A}
7933 \def\textii{D}
7934 \pgftransformrotate{180}
7935 \fi\fi
7936 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
7937 \pgftransformrotate{90}
7938 \def\texti{D}
7939 \def\textii{A}
7940 \fi\fi
7941
7942 % draw inner symbol
7943 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
7944 \pgfsetarrows{-} %never draw arrows
7945 \pgfsetlinewidth{\pgfstartlinewidth}
7946 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7947 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7948 \pgfusepath{draw}
7949
7950 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
7951 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
7952 }
7953
7954 %% DSP
7955 \pgfcircdeclarebipolescaled{blocks}
7956 {}
7957 {\ctikzvalof{bipoles/dsp/width}}
7958 {dsp}
7959 {\ctikzvalof{bipoles/dsp/width}}
7960 {\ctikzvalof{bipoles/dsp/width}}
7961 {
7962 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
7963 \divide \pgf@circ@res@step by 2
7964
7965 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7966 \pgf@circ@res@other = \pgf@circ@res@left
7967 \advance\pgf@circ@res@other by \pgf@circ@res@step
7968
7969 \ifpgf@circuit@dashed
7970 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7971 \fi
7972
7973 % draw outer box
7974 \pgf@circ@twoportbox
7975
7976 \ifpgf@circuit@inputarrow
7977 {
7978 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7979 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7980 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
7981 }
7982 \fi
7983
7984 % rotate inner symbol
7985 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7986 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
7987 \pgftransformrotate{270}
7988 \fi\fi
7989 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
7990 \pgftransformrotate{180}
7991 \fi\fi
7992 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
7993 \pgftransformrotate{90}
7994 \fi\fi
7995
7996 % draw inner symbol
7997 \pgftext[center,x=0,y=0]{\textsf{DSP}}
7998 }
7999
8000 %% FFT
8001 \pgfcircdeclarebipolescaled{blocks}
8002 {}
8003 {\ctikzvalof{bipoles/fft/width}}
8004 {fft}
8005 {\ctikzvalof{bipoles/fft/width}}
8006 {\ctikzvalof{bipoles/fft/width}}
8007 {
8008 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
8009 \divide \pgf@circ@res@step by 2
8010
8011 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8012 \pgf@circ@res@other = \pgf@circ@res@left
8013 \advance\pgf@circ@res@other by \pgf@circ@res@step
8014
8015 \ifpgf@circuit@dashed
8016 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8017 \fi
8018
8019 % draw outer box
8020 \pgf@circ@twoportbox
8021
8022 \ifpgf@circuit@inputarrow
8023 {
8024 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8025 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8026 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8027 }
8028 \fi
8029
8030 % rotate inner symbol
8031 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8032 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8033 \pgftransformrotate{270}
8034 \fi\fi
8035 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8036 \pgftransformrotate{180}
8037 \fi\fi
8038 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8039 \pgftransformrotate{90}
8040 \fi\fi
8041
8042 % draw inner symbol
8043 \pgftext[center,x=0,y=0]{\textsf{FFT}}
8044 }
8045
8046 %% Amplifier
8047 \pgfcircdeclarebipolescaled{blocks}
8048 {}
8049 {
8050 \ifpgf@circuit@boxed
8051 \ctikzvalof{bipoles/twoport/width}
8052 \else
8053 \ctikzvalof{bipoles/amp/width}
8054 \fi
8055 }
8056 {amp}
8057 {
8058 \ifpgf@circuit@boxed
8059 \ctikzvalof{bipoles/twoport/width}
8060 \else
8061 \ctikzvalof{bipoles/amp/width}
8062 \fi
8063 }
8064 {
8065 \ifpgf@circuit@boxed
8066 \ctikzvalof{bipoles/twoport/width}
8067 \else
8068 \ctikzvalof{bipoles/amp/width}
8069 \fi
8070 }
8071 {
8072 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8073
8074 \ifpgf@circuit@dashed
8075 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8076 \fi
8077
8078 % draw outer box
8079 \ifpgf@circuit@boxed
8080 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8081 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
8082 \pgf@circ@draworfill
8083 \fi
8084
8085 % draw input arrow
8086 \ifpgf@circuit@inputarrow
8087 {
8088 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8089 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8090 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8091 }
8092 \fi
8093
8094 \ifpgf@circuit@boxed
8095 \pgfsetlinewidth{\pgfstartlinewidth}
8096 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
8097 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
8098 \else
8099 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8100 \fi
8101
8102 \pgfsetarrows{-} %never draw arrows
8103
8104 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
8105 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
8106 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
8107
8108 \pgfpathclose
8109 \pgf@circ@draworfill
8110
8111 % draw inner text
8112 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
8113 }
8114
8115
8116 %% variable amplifier
8117 \pgfcircdeclarebipolescaled{blocks}
8118 {}
8119 {
8120 \ifpgf@circuit@boxed
8121 \ctikzvalof{bipoles/twoport/width}
8122 \else
8123 \ctikzvalof{bipoles/amp/width}
8124 \fi
8125 }
8126 {vamp}
8127 {
8128 \ifpgf@circuit@boxed
8129 \ctikzvalof{bipoles/twoport/width}
8130 \else
8131 \ctikzvalof{bipoles/amp/width}
8132 \fi
8133 }
8134 {
8135 \ifpgf@circuit@boxed
8136 \ctikzvalof{bipoles/twoport/width}
8137 \else
8138 \ctikzvalof{bipoles/amp/width}
8139 \fi
8140 }
8141 {
8142 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8143
8144 \ifpgf@circuit@dashed
8145 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8146 \fi
8147
8148 % draw outer box
8149 \ifpgf@circuit@boxed
8150 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
8151 \fi
8152
8153 % draw input arrow
8154 \ifpgf@circuit@inputarrow
8155 {
8156 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8157 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8158 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8159 }
8160 \fi
8161
8162 \ifpgf@circuit@boxed
8163 \pgfsetlinewidth{\pgfstartlinewidth}
8164 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
8165 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
8166 \else
8167 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8168 \fi
8169
8170
8171 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8172 \pgfsetarrows{-} %never draw arrows
8173
8174 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
8175 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
8176 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
8177
8178 \pgfpathclose
8179 \pgf@circ@draworfill
8180
8181 % draw inner text
8182 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
8183
8184 % draw arrow
8185 \pgfsetlinewidth{\pgfstartlinewidth}
8186 \pgfsetarrowsend{latex}
8187 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8188 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
8189 \pgfusepath{draw}
8190 }
8191
8192 %% pi attenuator
8193 \pgfcircdeclarebipolescaled{blocks}
8194 {}
8195 {\ctikzvalof{bipoles/piattenuator/width}}
8196 {piattenuator}
8197 {\ctikzvalof{bipoles/piattenuator/width}}
8198 {\ctikzvalof{bipoles/piattenuator/width}}
8199 {
8200 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
8201 \divide \pgf@circ@res@step by 2
8202
8203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8204 \pgf@circ@res@other = \pgf@circ@res@left
8205 \advance\pgf@circ@res@other by \pgf@circ@res@step
8206
8207 \ifpgf@circuit@dashed
8208 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8209 \fi
8210
8211 % draw outer box
8212 \pgf@circ@twoportbox
8213
8214 \ifpgf@circuit@inputarrow
8215 {
8216 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8217 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8218 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8219 }
8220 \fi
8221
8222 % rotate inner symbol
8223 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8224 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8225 \pgftransformrotate{270}
8226 \fi\fi
8227 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8228 \pgftransformrotate{90}
8229 \fi\fi
8230
8231 % draw inner symbol
8232 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8233 \pgfsetarrows{-} %never draw arrows
8234 \pgfsetlinewidth{\pgfstartlinewidth}
8235 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
8236 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8237 \pgfusepath{draw}
8238 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
8239 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8240 \pgfusepath{draw}
8241 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8242 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8243 \pgfusepath{draw}
8244 }
8245
8246 %% variable pi attenuator
8247 \pgfcircdeclarebipolescaled{blocks}
8248 {}
8249 {\ctikzvalof{bipoles/vpiattenuator/width}}
8250 {vpiattenuator}
8251 {\ctikzvalof{bipoles/vpiattenuator/width}}
8252 {\ctikzvalof{bipoles/vpiattenuator/width}}
8253 {
8254 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
8255 \divide \pgf@circ@res@step by 2
8256
8257 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8258 \pgf@circ@res@other = \pgf@circ@res@left
8259 \advance\pgf@circ@res@other by \pgf@circ@res@step
8260
8261 \ifpgf@circuit@dashed
8262 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8263 \fi
8264
8265 % draw outer box
8266 \pgf@circ@twoportbox
8267
8268 \ifpgf@circuit@inputarrow
8269 {
8270 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8271 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8272 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8273 }
8274 \fi
8275
8276 % rotate inner symbol
8277 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8278 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8279 \pgftransformrotate{270}
8280 \fi\fi
8281 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8282 \pgftransformrotate{90}
8283 \fi\fi
8284
8285 % draw inner symbol
8286 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8287 \pgfsetarrows{-} %never draw arrows
8288 \pgfsetlinewidth{\pgfstartlinewidth}
8289 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
8290 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8291 \pgfusepath{draw}
8292 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
8293 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8294 \pgfusepath{draw}
8295 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8296 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8297 \pgfusepath{draw}
8298
8299 \pgfsetarrowsend{latex}
8300 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8301 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8302 \pgfusepath{draw}
8303 }
8304
8305 %% T attenuator
8306 \pgfcircdeclarebipolescaled{blocks}
8307 {}
8308 {\ctikzvalof{bipoles/tattenuator/width}}
8309 {tattenuator}
8310 {\ctikzvalof{bipoles/tattenuator/width}}
8311 {\ctikzvalof{bipoles/tattenuator/width}}
8312 {
8313 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
8314 \divide \pgf@circ@res@step by 2
8315
8316 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8317 \pgf@circ@res@other = \pgf@circ@res@left
8318 \advance\pgf@circ@res@other by \pgf@circ@res@step
8319
8320 \ifpgf@circuit@dashed
8321 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8322 \fi
8323
8324 % draw outer box
8325 \pgf@circ@twoportbox
8326
8327 \ifpgf@circuit@inputarrow
8328 {
8329 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8330 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8331 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8332 }
8333 \fi
8334
8335 % rotate inner symbol
8336 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8337 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8338 \pgftransformrotate{270}
8339 \fi\fi
8340 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8341 \pgftransformrotate{90}
8342 \fi\fi
8343
8344 % draw inner symbol
8345 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8346 \pgfsetarrows{-} %never draw arrows
8347 \pgfsetlinewidth{\pgfstartlinewidth}
8348 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
8349 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
8350 \pgfusepath{draw}
8351 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8352 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8353 \pgfusepath{draw}
8354 }
8355
8356 %% variable T attenuator
8357 \pgfcircdeclarebipolescaled{blocks}
8358 {}
8359 {\ctikzvalof{bipoles/vtattenuator/width}}
8360 {vtattenuator}
8361 {\ctikzvalof{bipoles/vtattenuator/width}}
8362 {\ctikzvalof{bipoles/vtattenuator/width}}
8363 {
8364 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
8365 \divide \pgf@circ@res@step by 2
8366
8367 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8368 \pgf@circ@res@other = \pgf@circ@res@left
8369 \advance\pgf@circ@res@other by \pgf@circ@res@step
8370
8371 \ifpgf@circuit@dashed
8372 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8373 \fi
8374
8375 % draw outer box
8376 \pgf@circ@twoportbox
8377
8378 \ifpgf@circuit@inputarrow
8379 {
8380 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8381 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8382 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8383 }
8384 \fi
8385
8386 % rotate inner symbol
8387 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8388 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8389 \pgftransformrotate{270}
8390 \fi\fi
8391 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8392 \pgftransformrotate{90}
8393 \fi\fi
8394
8395 % draw inner symbol
8396 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8397 \pgfsetarrows{-} %never draw arrows
8398 \pgfsetlinewidth{\pgfstartlinewidth}
8399 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
8400 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
8401 \pgfusepath{draw}
8402 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8403 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8404 \pgfusepath{draw}
8405
8406 \pgfsetarrowsend{latex}
8407 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8408 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8409 \pgfusepath{draw}
8410 }
8411
8412 %% phase shifter
8413 \pgfcircdeclarebipolescaled{blocks}
8414 {}
8415 {\ctikzvalof{bipoles/phaseshifter/width}}
8416 {phaseshifter}
8417 {\ctikzvalof{bipoles/phaseshifter/width}}
8418 {\ctikzvalof{bipoles/phaseshifter/width}}
8419 {
8420 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
8421 \divide \pgf@circ@res@step by 2
8422
8423 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8424 \pgf@circ@res@other = \pgf@circ@res@left
8425 \advance\pgf@circ@res@other by \pgf@circ@res@step
8426
8427 \ifpgf@circuit@dashed
8428 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8429 \fi
8430
8431 % draw outer box
8432 \pgf@circ@twoportbox
8433
8434 \ifpgf@circuit@inputarrow
8435 {
8436 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8437 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8438 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8439 }
8440 \fi
8441
8442 % rotate inner symbol
8443 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8444 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8445 \pgftransformrotate{270}
8446 \fi\fi
8447 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8448 \pgftransformrotate{180}
8449 \fi\fi
8450 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8451 \pgftransformrotate{90}
8452 \fi\fi
8453
8454 % inner symbol
8455 \pgftext[center,x=0,y=0]{\Large$\varphi$}
8456 }
8457
8458 %% variable phase shifter
8459 \pgfcircdeclarebipolescaled{blocks}
8460 {}
8461 {\ctikzvalof{bipoles/phaseshifter/width}}
8462 {vphaseshifter}
8463 {\ctikzvalof{bipoles/vphaseshifter/width}}
8464 {\ctikzvalof{bipoles/vphaseshifter/width}}
8465 {
8466 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
8467 \divide \pgf@circ@res@step by 2
8468
8469 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8470 \pgf@circ@res@other = \pgf@circ@res@left
8471 \advance\pgf@circ@res@other by \pgf@circ@res@step
8472
8473 \ifpgf@circuit@dashed
8474 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8475 \fi
8476
8477 % draw outer box
8478 \pgf@circ@twoportbox
8479
8480 \ifpgf@circuit@inputarrow
8481 {
8482 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8483 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8484 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8485 }
8486 \fi
8487
8488 % rotate inner symbol
8489 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8490 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8491 \pgftransformrotate{270}
8492 \fi\fi
8493 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8494 \pgftransformrotate{180}
8495 \fi\fi
8496 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8497 \pgftransformrotate{90}
8498 \fi\fi
8499
8500 % inner symbol
8501 \pgftext[center,x=0,y=0]{\Large$\varphi$}
8502
8503 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8504 \pgfsetlinewidth{\pgfstartlinewidth}
8505 \pgfsetarrowsend{latex}
8506 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
8507 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
8508 \pgfusepath{draw}
8509 }
8510
8511 %% detector
8512 \pgfcircdeclarebipolescaled{blocks}
8513 {}
8514 {\ctikzvalof{bipoles/detector/width}}
8515 {detector}
8516 {\ctikzvalof{bipoles/detector/width}}
8517 {\ctikzvalof{bipoles/detector/width}}
8518 {
8519 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
8520 \divide \pgf@circ@res@step by 2
8521
8522 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8523 \pgf@circ@res@other = \pgf@circ@res@left
8524 \advance\pgf@circ@res@other by \pgf@circ@res@step
8525
8526 \ifpgf@circuit@dashed
8527 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8528 \fi
8529
8530 % draw outer box
8531 \pgf@circ@twoportbox
8532
8533 \ifpgf@circuit@inputarrow
8534 {
8535 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8536 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8537 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8538 }
8539 \fi
8540
8541 % draw inner stuff
8542 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8543 \pgfsetarrows{-} %never draw arrows
8544 \pgfsetlinewidth{0.8\pgfstartlinewidth}
8545 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
8546 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
8547 \pgfusepath{draw}
8548
8549 \ifpgf@circuit@fulldiode
8550 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
8551 \pgftransformscale{\pgfmathresult}
8552 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
8553 \else
8554 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
8555 \pgftransformscale{\pgfmathresult}
8556 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
8557 \fi
8558
8559 }
8560
8561 %%%%%%%%%%%%%%%%%%%%%%%
8562 %% MECHANICAL SYMBOLS
8563 %%%%%%%%%%%%%%%%%%%%%%%
8564
8565 %% mechanical capacitance - stiffness/spring
8566
8567 \pgfcircdeclarebipolescaled{mechanicals}
8568 {}
8569 {\ctikzvalof{bipoles/spring/height}}
8570 {spring}
8571 {\ctikzvalof{bipoles/spring/height}}
8572 {\ctikzvalof{bipoles/spring/width}}{
8573 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8574 \pgftransformationadjustments
8575
8576 \pgfmathsetlength{\pgf@circ@res@step}
8577 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
8578
8579 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
8580 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
8581 \pgf@circ@res@other = \pgf@circ@res@left
8582 \advance\pgf@circ@res@other by \pgf@circ@res@step
8583 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
8584 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8585 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
8586 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8587 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
8588 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8589 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
8590 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8591 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
8592 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8593 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
8594 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8595 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
8596 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
8597 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
8598 \advance\pgf@circ@res@other by \pgf@circ@res@step
8599 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
8600 \pgfsetbuttcap
8601 \pgfsetbeveljoin
8602 \pgfusepath{stroke}
8603 }
8604
8605 %% mechanical inductance - mass
8606 \pgfcircdeclarebipolescaled{mechanicals}
8607 {}
8608 {\ctikzvalof{bipoles/mass/box height}}
8609 {mass}
8610 {\ctikzvalof{bipoles/mass/height}}
8611 {\ctikzvalof{bipoles/mass/width}}
8612 {
8613 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8614 \pgftransformationadjustments
8615 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8616 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
8617 \pgf@circ@draworfill
8618
8619 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8620 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8621 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8622 \pgfsetrectcap
8623 \pgfsetmiterjoin
8624 \pgfusepath{stroke}
8625 }
8626
8627 %% mechanical resistor - damper
8628 \pgfcircdeclarebipolescaled{mechanicals}
8629 {}
8630 {\ctikzvalof{bipoles/damper/height}}
8631 {damper}
8632 {\ctikzvalof{bipoles/damper/height}}
8633 {\ctikzvalof{bipoles/damper/width}}
8634 {
8635 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8636 \pgf@circ@maybefill
8637
8638 % line into the damper
8639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8640 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
8641 {\pgf@circ@res@zero}}
8642 \pgfusepath{stroke}
8643
8644 % damper box
8645 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8647 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8648 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8650
8651 \pgfsetrectcap
8652 \pgfsetmiterjoin
8653 \pgfusepath{stroke}
8654
8655 % damper vertical element
8656 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
8657 {.8\pgf@circ@res@down}}
8658 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
8659 {.8\pgf@circ@res@up}}
8660 \pgfsetbuttcap
8661 \pgfusepath{stroke}
8662
8663 }
8664 %% mechanical viscoelastic element, suggested by @alex
8665 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
8666 \pgfcircdeclarebipolescaled{mechanicals}
8667 {} % extra anchors
8668 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
8669 {viscoe} % name
8670 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
8671 {\ctikzvalof{bipoles/damper/width}} % width
8672 { % draw the bipole
8673 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8674 \pgf@circ@maybefill
8675
8676 % spring into the damper
8677 \pgfscope
8678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8679 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8680 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
8681 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
8682 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
8683 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
8684 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
8685 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
8686 \pgfusepath{stroke}
8687 \endpgfscope
8688 % damper box
8689 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8690 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8691 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8692 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8693 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8694
8695 \pgfsetrectcap
8696 \pgfsetmiterjoin
8697 \pgfusepath{stroke}
8698
8699 % damper vertical element
8700 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
8701 {.8\pgf@circ@res@down}}
8702 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
8703 {.8\pgf@circ@res@up}}
8704 \pgfsetbuttcap
8705 \pgfusepath{stroke}
8706
8707 }
8708
8709 %%%%%%%%%%%%%%%%
8710 %% Crossing
8711 %%%%%%%%%%%%%%%%
8712
8713 %% crossing bipole (but see also nodes)
8714 \pgfcircdeclarebipole
8715 {}
8716 {\ctikzvalof{bipoles/crossing/size}}
8717 {crossing}
8718 {\ctikzvalof{bipoles/crossing/size}}
8719 {\ctikzvalof{bipoles/crossing/size}}{
8720 \pgfscope
8721 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8722 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
8723 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
8724 \pgfsetbeveljoin
8725 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8726 \pgfusepath{draw}
8727 \endpgfscope
8728 }
8729
8730 %%%%%%%%%%%%%%%%%%%%%%%%%
8731 %% Miscellaneous bipoles
8732 %%%%%%%%%%%%%%%%%%%%%%%%%
8733
8734 %% loudspeaker and microphone
8735
8736 \pgfcircdeclarebipolescaled{misc}
8737 {}
8738 {\ctikzvalof{bipoles/loudspeaker/depth}}
8739 {loudspeaker}
8740 {\ctikzvalof{bipoles/loudspeaker/height}}
8741 {\ctikzvalof{bipoles/loudspeaker/width}}{
8742
8743 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
8744 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8745 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
8746 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
8747 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
8748 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
8749 \pgfpathclose
8750 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8751 \pgf@circ@draworfill
8752 }
8753
8754 \pgfcircdeclarebipolescaled{misc}
8755 {}
8756 {\ctikzvalof{bipoles/mic/depth}}
8757 {mic}
8758 {\ctikzvalof{bipoles/mic/height}}
8759 {\ctikzvalof{bipoles/mic/width}}{
8760
8761 \pgfscope
8762 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8763 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
8764 \pgf@circ@draworfill
8765 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
8766 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
8767 \pgfusepath{draw}
8768 \endpgfscope
8769 \pgfscope
8770 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8771 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
8772 % 0.25358 is 0.6-0.4*cos(30)
8773 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
8774 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
8775 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
8776 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8777 \pgfusepath{draw}
8778
8779 \pgfusepath{draw}
8780 \endpgfscope
8781 }
8782
8783 %% european gas filled surge arrester
8784 \pgfcircdeclarebipolescaled{misc}
8785 {}
8786 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
8787 {european gas filled surge arrester}
8788 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
8789 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
8790 {
8791
8792 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8793 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8794
8795 \pgf@circ@draworfill
8796
8797 \pgfscope
8798 \pgfsetarrowsend{latexslim}
8799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8800 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
8801 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8802 \pgfusepath{draw}
8803
8804 \endpgfscope
8805 }
8806
8807 %% american gas filled surge arrester
8808 \pgfcircdeclarebipolescaled{misc}
8809 {}
8810 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
8811 {american gas filled surge arrester}
8812 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
8813 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
8814
8815 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8816 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
8817 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
8818 \pgfusepath{draw}
8819
8820 \pgfscope
8821 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8822 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
8823 \pgf@circ@draworfill
8824 \endpgfscope
8825
8826 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
8827 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8828 \pgfusepath{draw}
8829
8830 \pgfscope
8831 \pgfsetarrowsend{latex}
8832
8833 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8834 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
8835 \pgfusepath{draw}
8836
8837 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8838 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
8839 \pgfusepath{draw}
8840 \endpgfscope{}
8841
8842 \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down}
8843 \pgfusepath{fill}
8844 }
8845
8846 %% thermocouple
8847 \pgfcircdeclarebipolescaled{misc}
8848 {}
8849 {\ctikzvalof{bipoles/thermocouple/height 2}}
8850 {thermocouple}
8851 {\ctikzvalof{bipoles/thermocouple/height}}
8852 {\ctikzvalof{bipoles/thermocouple/width}}
8853 {
8854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
8855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
8856 \pgfusepath{draw}
8857 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
8858 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8859 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
8860 \pgfusepath{draw}
8861 \pgfsetlinewidth{\pgfstartlinewidth}
8862 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
8863 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
8864 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
8865 \pgfusepath{draw}
8866 }
8867
8868 %% fuse
8869 \pgfcircdeclarebipolescaled{misc}
8870 {}
8871 {\ctikzvalof{bipoles/fuse/height}}
8872 {fuse}
8873 {\ctikzvalof{bipoles/fuse/height}}
8874 {\ctikzvalof{bipoles/fuse/width}}
8875 {
8876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
8877 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
8878 \pgfusepath{draw}
8879
8880 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8881 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8882
8883 \pgf@circ@draworfill
8884 }
8885
8886 %% asymmetric fuse
8887 \pgfcircdeclarebipolescaled{misc}
8888 {}
8889 {\ctikzvalof{bipoles/afuse/height}}
8890 {afuse}
8891 {\ctikzvalof{bipoles/afuse/height}}
8892 {\ctikzvalof{bipoles/afuse/width}}
8893 {
8894 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
8895 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
8896 \pgfusepath{draw}
8897
8898 \pgfscope
8899 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8900 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8901 \pgf@circ@draworfill
8902 \endpgfscope
8903
8904 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8905 \pgfusepath{stroke,fill}
8906 }
8907
8908 %% SQUID added by Cor Molenaar 5 March 2010
8909 \pgfcircdeclarebipolescaled{misc}
8910 {}
8911 {\ctikzvalof{bipoles/squid/height}}
8912 {squid}
8913 {\ctikzvalof{bipoles/squid/height}}
8914 {\ctikzvalof{bipoles/squid/width}}
8915 {
8916 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8917
8918 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8919 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
8920 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
8921 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
8922 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
8923 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
8924 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
8925 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
8926 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
8927
8928 \pgfusepath{draw}
8929 }
8930
8931 % Generic barrier added by Cor Molenaar 5 March 2010
8932 \pgfcircdeclarebipolescaled{misc}
8933 {}
8934 {\ctikzvalof{bipoles/barrier/height}}
8935 {barrier}
8936 {\ctikzvalof{bipoles/barrier/height}}
8937 {\ctikzvalof{bipoles/barrier/width}}
8938 {
8939 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8940
8941 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
8942 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
8943 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
8944 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
8945 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
8946 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
8947
8948 \pgfusepath{draw}
8949 }
8950
8951 %% Lamp
8952 \pgfcircdeclarebipolescaled{misc}
8953 {}
8954 {\ctikzvalof{bipoles/lamp/height}}
8955 {lamp}
8956 {\ctikzvalof{bipoles/lamp/height}}
8957 {\ctikzvalof{bipoles/lamp/width}}
8958 {
8959 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8960
8961 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8962 \pgf@circ@draworfill
8963 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
8964 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
8965 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
8966 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
8967 \pgfusepath{draw}
8968 }
8969
8970 %% bulb
8971 \pgfcircdeclarebipolescaled{misc}
8972 {}
8973 {\ctikzvalof{bipoles/bulb/height}}
8974 {bulb}
8975 {\ctikzvalof{bipoles/bulb/height}}
8976 {\ctikzvalof{bipoles/bulb/width}}
8977 {%
8978 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8979 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
8980 \pgf@circ@draworfill
8981 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8982 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
8983 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
8984 \pgfsetbeveljoin
8985 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8986 \pgfusepath{draw}
8987 }
8988
8989
8990 % end of pgfcircbipoles.tex
8991 %%%---------- close: tex/pgfcircbipoles
8992 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
8993 %%%---------- open: tex/pgfcirctripoles.tex
8994 % Copyright 2018-2026 by Romano Giannetti
8995 % Copyright 2015-2026 by Stefan Lindner
8996 % Copyright 2013-2026 by Stefan Erhardt
8997 % Copyright 2007-2026 by Massimo Redaelli
8998 %
8999 % This file may be distributed and/or modified
9000 %
9001 % 1. under the LaTeX Project Public License and/or
9002 % 2. under the GNU Public License.
9003 %
9004 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
9005
9006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9007 %% Tripoles
9008
9009 %%%%%%%%%%%%%
9010 %% switches
9011 %%%%%%%%%%%%%
9012
9013 % Legacy spdt
9014 \pgfdeclareshape{spdt}{
9015 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
9016 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9017 \savedanchor\northwest{%
9018 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9019 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
9020 \pgf@y=.5\pgf@y
9021 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
9022 \pgf@x=.5\pgf@x
9023 }
9024 \anchor{left}{%
9025 \northwest
9026 \pgf@y=0pt
9027 }
9028 \anchor{in}{
9029 \northwest
9030 \pgf@y=0pt
9031 }
9032 \anchor{out 1}{
9033 \northwest
9034 \pgf@x=-\pgf@x
9035 }
9036 \anchor{out 2}{
9037 \northwest
9038 \pgf@x=-\pgf@x
9039 \pgf@y=-\pgf@y
9040 }
9041 \anchor{center}{
9042 \pgf@y=0pt
9043 \pgf@x=0pt
9044 }
9045 \anchor{east}{
9046 \northwest
9047 \pgf@y=0pt
9048 \pgf@x=-\pgf@x
9049 }
9050 \anchor{west}{
9051 \northwest
9052 \pgf@y=0pt
9053 }
9054 \anchor{south}{
9055 \northwest
9056 \pgf@x=0pt
9057 \pgf@y=-\pgf@y
9058 }
9059 \anchor{north}{
9060 \northwest
9061 \pgf@x=0pt
9062 }
9063 \anchor{south west}{
9064 \northwest
9065 \pgf@y=-\pgf@y
9066 }
9067 \anchor{north east}{
9068 \northwest
9069 \pgf@x=-\pgf@x
9070 }
9071 \anchor{north west}{
9072 \northwest
9073 }
9074 \anchor{south east}{
9075 \northwest
9076 \pgf@x=-\pgf@x
9077 \pgf@y=-\pgf@y
9078 }
9079 \backgroundpath{
9080 \pgfsetcolor{\ctikzvalof{color}}
9081
9082 \northwest
9083 \pgf@circ@res@up = \pgf@y
9084 \pgf@circ@res@down = -\pgf@y
9085 \pgf@circ@res@right = -\pgf@x
9086 \pgf@circ@res@left = \pgf@x
9087 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
9088
9089
9090 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9091 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
9092 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9093 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
9094
9095 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9096 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9097
9098 \pgfusepath{draw}
9099
9100 \pgfscope
9101 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
9102 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
9103 \endpgfscope
9104 \pgfscope
9105 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
9106 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
9107 \endpgfscope
9108 \pgfscope
9109 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
9110 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
9111 \endpgfscope
9112
9113 \pgfscope
9114 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
9115 \pgfpathlineto{
9116 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
9117 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
9118 }
9119 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9120 \pgfusepath{draw}
9121 \endpgfscope
9122 }
9123 }
9124
9125
9126 % cute switch "node" shapes, matching with cute "to" shapes
9127 % #1 -> name
9128 % #2 -> barposition
9129 % #3 -> arrowcode
9130 \long\def\pgfcircdeclarecutespdt#1#2#3{
9131 \pgfdeclareshape{#1}
9132 {
9133 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
9134 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9135 \savedanchor\northwest{%
9136 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9137 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9138 \pgf@y=.5\pgf@y
9139 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
9140 \pgf@x=.25\pgf@x
9141 }
9142 \savedanchor\midlever{
9143 % these values are calculated when we create the definition of the shape.
9144 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9145 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9146 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
9147 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9148 \pgf@circ@res@down = -.5\pgf@y
9149 \pgf@circ@res@up = .5\pgf@y
9150 \pgfextracty{\pgf@circ@res@other}{#2}
9151 \pgf@x=0pt
9152 \pgf@y=.5\pgf@circ@res@other
9153 }
9154 % radius of the connector
9155 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9156 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
9157 % shapename
9158 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
9159 % shape type
9160 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
9161 % mid of the lever, to stack switches
9162 \anchor{mid}{\midlever}
9163 % center anchors
9164 \anchor{cin}{ \northwest \pgf@y=0pt}
9165 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
9166 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9167 % horizontal angles
9168 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
9169 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
9170 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
9171
9172 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
9173 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
9174 \anchor{west}{ \northwest \pgf@y=0pt }
9175 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
9176 \anchor{north}{ \northwest \pgf@x=0pt }
9177 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
9178 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
9179 \anchor{north west}{ \northwest }
9180 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9181
9182 \backgroundpath{
9183 \pgfsetcolor{\ctikzvalof{color}}
9184 \northwest
9185 \pgf@circ@res@up = \pgf@y
9186 \pgf@circ@res@down = -\pgf@y
9187 \pgf@circ@res@right = -\pgf@x
9188 \pgf@circ@res@left = \pgf@x
9189
9190 \pgfscope
9191 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9192 \pgf@circ@res@temp=\radius\relax
9193 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9194 \pgfsetlinewidth{2\pgf@circ@res@temp}
9195 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9196 \pgfpathlineto{#2}
9197 \pgfsetroundcap\pgfusepath{draw}
9198 \endpgfscope
9199 \pgfscope % arrow
9200 #3
9201 \endpgfscope
9202 % terminals
9203 \pgfscope
9204 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9205 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
9206 \endpgfscope
9207 \pgfscope
9208 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9209 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
9210 \endpgfscope
9211 \pgfscope
9212 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9213 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
9214 \endpgfscope
9215
9216 }
9217 }
9218 }
9219
9220 \pgfcircdeclarecutespdt{cute spdt up}
9221 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
9222 {}
9223
9224 \pgfcircdeclarecutespdt{cute spdt mid}
9225 {\pgfpoint{\pgf@circ@res@right}{0pt}}
9226 {}
9227
9228 \pgfcircdeclarecutespdt{cute spdt down}
9229 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
9230 {}
9231
9232 \pgfcircdeclarecutespdt{cute spdt up arrow}
9233 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
9234 {
9235 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9236 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9237 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
9238 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
9239 \pgfsetarrowsend{latexslim}
9240 \pgfusepath{draw}
9241 }
9242
9243 \pgfcircdeclarecutespdt{cute spdt mid arrow}
9244 {\pgfpoint{\pgf@circ@res@right}{0pt}}
9245 {
9246 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9247 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9248 \pgfsetarrowsstart{latexslim}
9249 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
9250 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
9251 \pgfsetarrowsend{latexslim}
9252 \pgfusepath{draw}
9253 }
9254
9255 \pgfcircdeclarecutespdt{cute spdt down arrow}
9256 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
9257 {
9258 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9259 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9260 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
9261 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
9262 \pgfsetarrowsend{latexslim}
9263 \pgfusepath{draw}
9264 }
9265
9266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9268 %%
9269 %% Logic ports
9270 %%
9271 %% Code from John Kormylo at tex.stackexchange.com
9272 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
9273 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
9274 %%
9275
9276 \newcount\pgf@circ@res@count% reserve global register
9277
9278 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
9279 {%
9280 \pgfextracty{\pgf@circ@res@up}{\northeast}%
9281 \step
9282 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
9283 \advance\pgf@y by -#1\pgf@circ@res@step\relax
9284 }%
9285
9286 % #1 = \pgfmathcounter #2=type #3 specificic port
9287 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
9288 \def\pgf@circ@logicport@baseinput#1#2#3%
9289 {%
9290 % and and nand
9291 \ifnum #2=1\relax
9292 \pgfextracty{\pgf@circ@res@up}{\northeast}%
9293 \pgfextractx{\pgf@circ@res@left}{\southwest}%
9294 \step
9295 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
9296 \advance\pgf@y by -#1\pgf@circ@res@step\relax
9297 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
9298 \fi
9299 % or and nor
9300 \ifnum #2=2\relax
9301 \pgfextracty{\pgf@circ@res@up}{\northeast}%
9302 \pgfextractx{\pgf@circ@res@left}{\southwest}%
9303 \pgfextractx{\pgf@circ@res@right}{\northeast}%
9304 \step
9305 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
9306 \advance\pgf@y by -#1\pgf@circ@res@step\relax
9307 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
9308 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
9309 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9310 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
9311 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
9312 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9313 \pgf@circ@res@temp=\pgf@y
9314 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
9315 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9316 \pgf@x=\pgf@circ@res@other
9317 \fi
9318 % xor and xnor
9319 \ifnum #2=3\relax
9320 \pgfextracty{\pgf@circ@res@up}{\northeast}%
9321 \pgfextractx{\pgf@circ@res@left}{\southwest}%
9322 \pgfextractx{\pgf@circ@res@right}{\northeast}%
9323 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
9324 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
9325 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9326 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
9327 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
9328 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9329 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
9330 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
9331 % this compensates for the effect of the line width on the gap between the arcs
9332 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
9333 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
9334
9335 \step
9336 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
9337 \advance\pgf@y by -#1\pgf@circ@res@step\relax
9338 \pgf@circ@res@temp=\pgf@y
9339 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
9340 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9341 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
9342 \pgf@x=\pgf@circ@res@other
9343 \fi
9344 % european
9345 \ifnum #2=4\relax
9346 \pgfextracty{\pgf@circ@res@up}{\northeast}%
9347 \pgfextractx{\pgf@circ@res@other}{\left}%
9348 \step
9349 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
9350 \advance\pgf@y by -#1\pgf@circ@res@step\relax
9351 \pgf@x=\pgf@circ@res@other
9352 \fi
9353 }%
9354
9355 %%% american
9356 \long\def\pgfcircdeclarelogicport#1#2#3{%
9357 \pgfdeclareshape{american #1 port}%
9358 {%
9359 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
9360 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9361 \savedmacro\resize{% automatic
9362 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9363 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
9364 \pgf@circ@res@up = .5\pgf@circ@res@up
9365 \pgf@circ@res@down = -\pgf@circ@res@up
9366 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
9367 \pgf@circ@res@right = .5\pgf@circ@res@right
9368 \pgf@circ@res@left = -\pgf@circ@res@right
9369 }%
9370 \savedmacro\inputs{% get number of inputs
9371 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
9372 \ifnum\pgf@circ@res@count=0
9373 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
9374 \fi
9375 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
9376 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
9377 \def\inputs{\the\pgf@circ@res@count}%
9378 }%
9379 \savedanchor\step{% 1/2 gap at edges
9380 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9381 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
9382 \divide\pgf@circ@res@step by \pgf@circ@res@count
9383 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
9384 }%
9385 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9386 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9387 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
9388 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
9389 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
9390
9391 \anchor{center}{\origin}% for backwards compatibility
9392 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
9393
9394 % create input anchors
9395 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
9396 \pgfmathloop%
9397 \ifnum\pgfmathcounter>\pgf@circ@res@count%
9398 \else%
9399 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
9400 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
9401 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
9402 }%
9403 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
9404 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
9405 }%
9406 %}{}%
9407 \repeatpgfmathloop%
9408 }
9409
9410 \anchor{out}{\northeast\pgf@y=0pt}
9411 \anchor{bout}{\right\pgf@y=0pt}
9412
9413
9414 \anchor{left}{\left}% edges of component minus leads
9415 \anchor{right}{\right}
9416
9417 \anchor{north east}{\northeast}% see \Compass macro
9418 \anchor{south west}{\southwest}
9419 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
9420 \pgfpoint{0cm}{\pgf@circ@res@up}}
9421 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
9422 \pgfextractx{\pgf@circ@res@left}{\southwest}%
9423 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9424 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
9425 \pgfpoint{\pgf@circ@res@left}{0cm}}
9426 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
9427 \pgfpoint{0cm}{\pgf@circ@res@down}}
9428 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
9429 \pgfextractx{\pgf@circ@res@right}{\northeast}%
9430 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9431 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
9432 \pgfpoint{\pgf@circ@res@right}{0cm}}
9433
9434 \backgroundpath{
9435 \pgfsetcolor{\ctikzvalof{color}}
9436 #3
9437 }
9438 }
9439 }
9440 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9441 \pgfcircdeclarelogicport{and}{1}{
9442 \pgfextracty{\pgf@circ@res@temp}{\step}%
9443 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9444 \pgf@circ@res@count = \inputs\relax
9445 \ifpgfcirc@draw@leads
9446 %input leads
9447 \loop\ifnum\pgf@circ@res@count>0
9448 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9449 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9450 \pgfpathlineto{\pgfpoint
9451 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
9452 {\pgf@circ@res@temp}}
9453 \advance\pgf@circ@res@count by -1
9454 \repeat
9455 \fi
9456 % output lead
9457 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9458 \pgfpathlineto{\pgfpoint
9459 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right}
9460 {0pt}}
9461 \pgfusepath{draw}
9462
9463
9464 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9465 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
9466
9467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9469 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
9470 \pgfpathclose
9471 \pgf@circ@draworfill
9472 }
9473 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9474 \pgfcircdeclarelogicport{nand}{1}{
9475 \pgfextracty{\pgf@circ@res@temp}{\step}%
9476 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9477 \pgf@circ@res@count = \inputs\relax
9478 \ifpgfcirc@draw@leads
9479 %input leads
9480 \loop\ifnum\pgf@circ@res@count>0
9481 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9482 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9483 \pgfpathlineto{\pgfpoint
9484 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
9485 {\pgf@circ@res@temp}}
9486 \advance\pgf@circ@res@count by -1
9487 \repeat
9488 \fi
9489
9490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9491 \pgfpathlineto{\pgfpoint
9492 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
9493
9494 \pgfusepath{draw}
9495 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9496 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
9497 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
9498 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
9499
9500 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
9501 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
9502 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
9503 \pgfpathclose
9504
9505 \pgfpathellipse
9506 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
9507 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
9508 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
9509
9510 \pgf@circ@draworfill
9511 }
9512 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9513 \pgfcircdeclarelogicport{nor}{2}{
9514 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
9515 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
9516 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9517 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
9518 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
9519 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9520
9521 \pgfextracty{\pgf@circ@res@temp}{\step}%
9522 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9523 \pgf@circ@res@count = \inputs\relax
9524 \ifpgfcirc@draw@leads
9525 %input leads
9526 \loop\ifnum\pgf@circ@res@count>0
9527 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9528 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9529 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
9530 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9531 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
9532 \advance\pgf@circ@res@count by -1
9533 \repeat
9534 \fi
9535
9536 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
9537 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9538 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9539
9540 \pgfusepath{draw}
9541
9542 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9543
9544 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
9545 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
9546 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
9547 \advance\pgf@circ@res@other by -\pgf@circ@res@step
9548
9549 % main shape
9550 \ifpgfcirc@roundy@or@shapes
9551 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
9552 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
9553 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9554 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
9555 \pgfpathclose
9556 \else
9557 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9558 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9559 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9560 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
9561 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9562 \pgfpathclose
9563 \fi
9564
9565 % not dot
9566 \pgfpathellipse
9567 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
9568 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
9569 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
9570
9571 \pgf@circ@draworfill
9572 }
9573 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9574 \pgfcircdeclarelogicport{or}{2}{
9575 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
9576 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
9577 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9578 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
9579 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
9580 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9581
9582 \pgfextracty{\pgf@circ@res@temp}{\step}%
9583 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9584 \pgf@circ@res@count = \inputs\relax
9585 \ifpgfcirc@draw@leads
9586 %input leads
9587 \loop\ifnum\pgf@circ@res@count>0
9588 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9589 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9590 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
9591 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9592 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
9593 \advance\pgf@circ@res@count by -1
9594 \repeat
9595 \fi
9596
9597 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
9598 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9599 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9600
9601 \pgfusepath{draw}
9602
9603 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9604
9605 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
9606
9607 % main shape
9608 \ifpgfcirc@roundy@or@shapes
9609 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
9610 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
9611 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9612 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
9613 \pgfpathclose
9614 \else
9615 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9616 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9617 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9618 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
9619 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9620 \pgfpathclose
9621 \fi
9622
9623 \pgf@circ@draworfill
9624 }
9625 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626 \pgfcircdeclarelogicport{xor}{3}{
9627 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
9628 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
9629 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9630 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
9631 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
9632 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9633 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
9634 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
9635 % this compensates for the effect of the line width on the gap between the arcs
9636 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
9637 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
9638
9639 \pgfextracty{\pgf@circ@res@temp}{\step}%
9640 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9641 \pgf@circ@res@count = \inputs\relax
9642 \ifpgfcirc@draw@leads
9643 %input leads
9644 \loop\ifnum\pgf@circ@res@count>0
9645 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9647 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
9648 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9649 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
9650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
9651 \advance\pgf@circ@res@count by -1
9652 \repeat
9653 \fi
9654
9655 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
9656 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9657 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9658
9659 \pgfusepath{draw}
9660
9661 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9662
9663 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
9664
9665 % main shape
9666 \ifpgfcirc@roundy@or@shapes
9667 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
9668 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
9669 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9670 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
9671 \pgfpathclose
9672 \else
9673 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9674 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9675 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9676 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
9677 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9678 \pgfpathclose
9679 \fi
9680 \pgf@circ@draworfill
9681
9682 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
9683
9684 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
9685 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
9686
9687 \pgfusepath{draw}
9688 }
9689 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9690 \pgfcircdeclarelogicport{xnor}{3}{
9691 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
9692 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
9693 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
9694 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
9695 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
9696 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
9697 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
9698 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
9699 % this compensates for the effect of the line width on the gap between the arcs
9700 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
9701 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
9702
9703 \pgfextracty{\pgf@circ@res@temp}{\step}%
9704 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
9705 \pgf@circ@res@count = \inputs\relax
9706 \ifpgfcirc@draw@leads
9707 %input leads
9708 \loop\ifnum\pgf@circ@res@count>0
9709 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
9710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
9711 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
9712 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9713 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
9714 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
9715 \advance\pgf@circ@res@count by -1
9716 \repeat
9717 \fi
9718
9719 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
9720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9721 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9722
9723 \pgfusepath{draw}
9724
9725 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9726
9727 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
9728 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
9729 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
9730 \advance\pgf@circ@res@other by -\pgf@circ@res@step
9731
9732 % main shape
9733 \ifpgfcirc@roundy@or@shapes
9734 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
9735 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
9736 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9737 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
9738 \pgfpathclose
9739 \else
9740 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
9741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9742 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
9743 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
9744 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
9745 \pgfpathclose
9746 \fi
9747
9748 \pgfpathellipse
9749 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
9750 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
9751 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
9752 \pgf@circ@draworfill
9753
9754 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
9755 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
9756
9757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
9758 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
9759
9760 \pgfusepath{draw}
9761 }
9762
9763 %%% Original one-input ports
9764
9765 \pgfdeclareshape{american not port}{
9766 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
9767 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9768 \anchor{center}{\pgfpointorigin}
9769 \savedanchor\northwest{%
9770 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9771 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
9772 \pgf@y=.5\pgf@y
9773 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
9774 \pgf@x=.5\pgf@x
9775 }
9776 \anchor{in}{
9777 \northwest
9778 \pgf@y=0pt
9779 }
9780 \anchor{in 1}{
9781 \northwest
9782 \pgf@y=0pt
9783 }
9784 \anchor{bin}{
9785 \northwest
9786 \pgf@y=0pt
9787 }
9788 \anchor{bin 1}{
9789 \northwest
9790 \pgf@y=0pt
9791 \pgf@x=0.7\pgf@x
9792 }
9793 \anchor{out}{
9794 \northwest
9795 \pgf@y=0pt
9796 \pgf@x=-\pgf@x
9797 }
9798 \anchor{bout}{
9799 \northwest
9800 \pgf@y=0pt
9801 \pgf@x=-0.7\pgf@x
9802 }
9803 \anchor{center}{
9804 \pgfpointorigin
9805 }
9806 \anchor{east}{
9807 \northwest
9808 \pgf@y=0pt
9809 \pgf@x=-\pgf@x
9810 }
9811 \anchor{west}{
9812 \northwest
9813 \pgf@y=0pt
9814 }
9815 \anchor{south}{
9816 \northwest
9817 \pgf@x=0pt
9818 \pgf@y=-\pgf@y
9819 }
9820 \anchor{north}{
9821 \northwest
9822 \pgf@x=0pt
9823 }
9824 \anchor{south west}{
9825 \northwest
9826 \pgf@y=-\pgf@y
9827 }
9828 \anchor{north east}{
9829 \northwest
9830 \pgf@x=-\pgf@x
9831 }
9832 \anchor{north west}{
9833 \northwest
9834 }
9835 \anchor{south east}{
9836 \northwest
9837 \pgf@x=-\pgf@x
9838 \pgf@y=-\pgf@y
9839 }
9840 \backgroundpath{
9841 \pgfsetcolor{\ctikzvalof{color}}
9842
9843 \northwest
9844 \pgf@circ@res@up = \pgf@y
9845 \pgf@circ@res@down = -\pgf@y
9846 \pgf@circ@res@right = -\pgf@x
9847 \pgf@circ@res@left = \pgf@x
9848
9849 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
9850
9851 \pgfscope
9852 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9853 \pgftransformxshift{.7\pgf@circ@res@left}
9854 \pgf@circ@res@step=\pgf@circ@res@right
9855 \advance\pgf@circ@res@step by -\pgf@circ@res@left
9856 \pgf@circ@res@step=.7\pgf@circ@res@step
9857
9858 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
9859 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
9860 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
9861 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
9862 \pgf@circ@draworfill
9863 \pgfpathellipse
9864 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
9865 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
9866 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
9867 \pgf@circ@draworfill
9868 \endpgfscope
9869
9870 \ifpgfcirc@draw@leads
9871 %input leads
9872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9873 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
9874 \fi
9875
9876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9877 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
9878
9879 \pgfusepath{draw}
9880 }
9881 }
9882
9883 \pgfdeclareshape{american buffer port}{
9884 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
9885 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9886 \anchor{center}{\pgfpointorigin}
9887 \savedanchor\northwest{%
9888 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9889 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
9890 \pgf@y=.5\pgf@y
9891 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
9892 \pgf@x=.5\pgf@x
9893 }
9894 \anchor{in}{
9895 \northwest
9896 \pgf@y=0pt
9897 }
9898 \anchor{in 1}{
9899 \northwest
9900 \pgf@y=0pt
9901 }
9902 \anchor{bin}{
9903 \northwest
9904 \pgf@y=0pt
9905 }
9906 \anchor{bin 1}{
9907 \northwest
9908 \pgf@y=0pt
9909 \pgf@x=0.7\pgf@x
9910 }
9911 \anchor{out}{
9912 \northwest
9913 \pgf@y=0pt
9914 \pgf@x=-\pgf@x
9915 }
9916 \anchor{bout}{
9917 \northwest
9918 \pgf@y=0pt
9919 \pgf@x=-0.7\pgf@x
9920 }
9921 \anchor{center}{
9922 \pgfpointorigin
9923 }
9924 \anchor{east}{
9925 \northwest
9926 \pgf@y=0pt
9927 \pgf@x=-\pgf@x
9928 }
9929 \anchor{west}{
9930 \northwest
9931 \pgf@y=0pt
9932 }
9933 \anchor{south}{
9934 \northwest
9935 \pgf@x=0pt
9936 \pgf@y=-\pgf@y
9937 }
9938 \anchor{north}{
9939 \northwest
9940 \pgf@x=0pt
9941 }
9942 \anchor{south west}{
9943 \northwest
9944 \pgf@y=-\pgf@y
9945 }
9946 \anchor{north east}{
9947 \northwest
9948 \pgf@x=-\pgf@x
9949 }
9950 \anchor{north west}{
9951 \northwest
9952 }
9953 \anchor{south east}{
9954 \northwest
9955 \pgf@x=-\pgf@x
9956 \pgf@y=-\pgf@y
9957 }
9958 \backgroundpath{
9959 \pgfsetcolor{\ctikzvalof{color}}
9960
9961 \northwest
9962 \pgf@circ@res@up = \pgf@y
9963 \pgf@circ@res@down = -\pgf@y
9964 \pgf@circ@res@right = -\pgf@x
9965 \pgf@circ@res@left = \pgf@x
9966
9967 \pgfscope
9968 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9969 \pgftransformxshift{.7\pgf@circ@res@left}
9970 \pgf@circ@res@step=\pgf@circ@res@right
9971 \advance\pgf@circ@res@step by -\pgf@circ@res@left
9972 \pgf@circ@res@step=.7\pgf@circ@res@step
9973
9974 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9975 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
9976 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
9977 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9978 \pgf@circ@draworfill
9979 \endpgfscope
9980
9981 \ifpgfcirc@draw@leads
9982 %input leads
9983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9984 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
9985 \fi
9986
9987 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9988 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
9989
9990 \pgfusepath{draw}
9991 }
9992 }
9993 \pgfdeclareshape{invschmitt}{
9994 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
9995 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9996 \anchor{center}{\pgfpointorigin}
9997 \savedanchor\northwest{%
9998 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9999 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10000 \pgf@y=.5\pgf@y
10001 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10002 \pgf@x=.5\pgf@x
10003 }
10004 \anchor{in}{
10005 \northwest
10006 \pgf@y=0pt
10007 }
10008 \anchor{in 1}{
10009 \northwest
10010 \pgf@y=0pt
10011 }
10012 \anchor{bin}{
10013 \northwest
10014 \pgf@y=0pt
10015 \pgf@x=0.7\pgf@x
10016 }
10017 \anchor{bin 1}{
10018 \northwest
10019 \pgf@y=0pt
10020 \pgf@x=0.7\pgf@x
10021 }
10022 \anchor{out}{
10023 \northwest
10024 \pgf@y=0pt
10025 \pgf@x=-\pgf@x
10026 }
10027 \anchor{bout}{
10028 \northwest
10029 \pgf@y=0pt
10030 \pgf@x=-0.7\pgf@x
10031 }
10032 \anchor{center}{
10033 \pgfpointorigin
10034 }
10035 \anchor{east}{
10036 \northwest
10037 \pgf@y=0pt
10038 \pgf@x=-\pgf@x
10039 }
10040 \anchor{west}{
10041 \northwest
10042 \pgf@y=0pt
10043 }
10044 \anchor{south}{
10045 \northwest
10046 \pgf@x=0pt
10047 \pgf@y=-\pgf@y
10048 }
10049 \anchor{north}{
10050 \northwest
10051 \pgf@x=0pt
10052 }
10053 \anchor{south west}{
10054 \northwest
10055 \pgf@y=-\pgf@y
10056 }
10057 \anchor{north east}{
10058 \northwest
10059 \pgf@x=-\pgf@x
10060 }
10061 \anchor{north west}{
10062 \northwest
10063 }
10064 \anchor{south east}{
10065 \northwest
10066 \pgf@x=-\pgf@x
10067 \pgf@y=-\pgf@y
10068 }
10069 \backgroundpath{
10070 \pgfsetcolor{\ctikzvalof{color}}
10071
10072 \northwest
10073 \pgf@circ@res@up = \pgf@y
10074 \pgf@circ@res@down = -\pgf@y
10075 \pgf@circ@res@right = -\pgf@x
10076 \pgf@circ@res@left = \pgf@x
10077
10078 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
10079
10080 \pgfscope
10081 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10082 \pgftransformxshift{.7\pgf@circ@res@left}
10083 \pgf@circ@res@step=\pgf@circ@res@right
10084 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10085 \pgf@circ@res@step=.7\pgf@circ@res@step
10086
10087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
10088 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10089 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10090 \pgfpathclose
10091 \pgf@circ@draworfill
10092 \pgfpathellipse
10093 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
10094 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
10095 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
10096 \pgf@circ@draworfill
10097 \endpgfscope
10098
10099 \ifpgfcirc@draw@leads
10100 %input leads
10101 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10102 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10103 \fi
10104
10105 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10106 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
10107 \pgfusepath{draw}
10108 %draw inner shape
10109
10110 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10111
10112 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10113 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10114 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10115 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10116 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10117 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10118 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10119 \pgfusepath{draw}
10120
10121 }
10122 }
10123
10124 \pgfdeclareshape{schmitt}{
10125 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10126 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10127 \anchor{center}{\pgfpointorigin}
10128 \savedanchor\northwest{%
10129 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10130 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10131 \pgf@y=.5\pgf@y
10132 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10133 \pgf@x=.5\pgf@x
10134 }
10135 \anchor{in}{
10136 \northwest
10137 \pgf@y=0pt
10138 }
10139 \anchor{in 1}{
10140 \northwest
10141 \pgf@y=0pt
10142 }
10143 \anchor{bin}{
10144 \northwest
10145 \pgf@y=0pt
10146 \pgf@x=0.7\pgf@x
10147 }
10148 \anchor{bin 1}{
10149 \northwest
10150 \pgf@y=0pt
10151 \pgf@x=0.7\pgf@x
10152 }
10153 \anchor{out}{
10154 \northwest
10155 \pgf@y=0pt
10156 \pgf@x=-\pgf@x
10157 }
10158 \anchor{bout}{
10159 \northwest
10160 \pgf@y=0pt
10161 \pgf@x=-.7\pgf@x
10162 }
10163 \anchor{center}{
10164 \pgfpointorigin
10165 }
10166 \anchor{east}{
10167 \northwest
10168 \pgf@y=0pt
10169 \pgf@x=-\pgf@x
10170 }
10171 \anchor{west}{
10172 \northwest
10173 \pgf@y=0pt
10174 }
10175 \anchor{south}{
10176 \northwest
10177 \pgf@x=0pt
10178 \pgf@y=-\pgf@y
10179 }
10180 \anchor{north}{
10181 \northwest
10182 \pgf@x=0pt
10183 }
10184 \anchor{south west}{
10185 \northwest
10186 \pgf@y=-\pgf@y
10187 }
10188 \anchor{north east}{
10189 \northwest
10190 \pgf@x=-\pgf@x
10191 }
10192 \anchor{north west}{
10193 \northwest
10194 }
10195 \anchor{south east}{
10196 \northwest
10197 \pgf@x=-\pgf@x
10198 \pgf@y=-\pgf@y
10199 }
10200 \backgroundpath{
10201 \pgfsetcolor{\ctikzvalof{color}}
10202
10203
10204 \northwest
10205 \pgf@circ@res@up = \pgf@y
10206 \pgf@circ@res@down = -\pgf@y
10207 \pgf@circ@res@right = -\pgf@x
10208 \pgf@circ@res@left = \pgf@x
10209
10210 \pgfscope
10211 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10212 \pgftransformxshift{.7\pgf@circ@res@left}
10213 \pgf@circ@res@step=\pgf@circ@res@right
10214 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10215 \pgf@circ@res@step=.7\pgf@circ@res@step
10216
10217 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
10218 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10219 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10220 \pgfpathclose
10221 \pgf@circ@draworfill
10222 \endpgfscope
10223
10224 \ifpgfcirc@draw@leads
10225 %input leads
10226 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10227 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10228 \fi
10229
10230 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10231 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
10232 \pgfusepath{draw}
10233 %draw inner shape
10234
10235 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10236
10237 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10238 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10239 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10240 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10241 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10242 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
10243 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
10244 \pgfusepath{draw}
10245
10246 }
10247 }
10248
10249
10250 %%% start european logic ports, from John Kormylo
10251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10252 %%
10253
10254 % #1 - name
10255 % #2 - text inside
10256 % #3 - number of inputs
10257 % #4 = is it a not?
10258
10259 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
10260 \pgfdeclareshape{european #1 port}
10261 {
10262 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10263 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10264 \savedmacro\resize{% automatic
10265 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10266 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
10267 \pgf@circ@res@up = .5\pgf@circ@res@up
10268 \pgf@circ@res@down = -\pgf@circ@res@up
10269 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
10270 \pgf@circ@res@right = .5\pgf@circ@res@right
10271 \pgf@circ@res@left = -\pgf@circ@res@right
10272 }%
10273 \savedmacro\inputs{% get number of inputs
10274 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10275 \ifnum\pgf@circ@res@count=0
10276 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
10277 \fi
10278 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10279 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10280 \def\inputs{\the\pgf@circ@res@count}%
10281 }%
10282 \savedanchor\step{% 1/2 gap at edges
10283 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10284 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
10285 \divide\pgf@circ@res@step by #3
10286 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10287 }%
10288 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
10289 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
10290 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
10291 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
10292 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
10293
10294 \anchor{center}{\origin}% for backwards compatibility
10295 % the text anchor overlaps the logic symbol
10296 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
10297 % create input anchors
10298 \ifnum#3=1\relax
10299 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
10300 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
10301 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
10302 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
10303 \else
10304 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
10305 \pgfmathloop%
10306 \ifnum\pgfmathcounter>#3%
10307 \else%
10308 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
10309 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
10310 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10311 }%
10312 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
10313 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
10314 }%
10315 %}{}%
10316 \repeatpgfmathloop%
10317 }
10318 \fi
10319 \anchor{out}{\northeast\pgf@y=0pt}
10320 \anchor{bout}{\right\pgf@y=0pt}
10321
10322 \anchor{left}{\left}% edges of component minus leads
10323 \anchor{right}{\right}
10324
10325 \anchor{north east}{\northeast}% see \Compass macro
10326 \anchor{south west}{\southwest}
10327 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10328 \pgfpoint{0cm}{\pgf@circ@res@up}}
10329 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10330 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10331 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10332 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10333 \pgfpoint{\pgf@circ@res@left}{0cm}}
10334 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10335 \pgfpoint{0cm}{\pgf@circ@res@down}}
10336 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10337 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10338 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10339 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10340 \pgfpoint{\pgf@circ@res@right}{0cm}}
10341
10342 \backgroundpath{
10343 \pgfsetcolor{\ctikzvalof{color}}
10344 \pgfscope
10345 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10346 \pgfpathrectanglecorners
10347 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
10348 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
10349 \pgf@circ@draworfill
10350 \endpgfscope
10351 \ifpgfcirc@draw@leads
10352 %input leads
10353 \ifnum#3=1\relax
10354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
10355 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
10356 \else
10357 \pgfextracty{\pgf@circ@res@temp}{\step}%
10358 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10359 %\pgf@circ@res@count = #3\relax% redundant
10360 \loop\ifnum\pgf@circ@res@count>0
10361 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10362 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10363 \pgfpathlineto{\pgfpoint
10364 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
10365 {\pgf@circ@res@temp}}
10366 \advance\pgf@circ@res@count by -1
10367 \repeat
10368 \fi
10369 \fi
10370 %
10371 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10372 \pgfpathlineto{%
10373 \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
10374 %
10375 \edef\pgf@temp{not}
10376 \edef\pgf@circ@temp{#4}
10377 \ifx\pgf@temp\pgf@circ@temp % is a not
10378 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
10379 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
10380 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
10381 \fi
10382 %
10383 \pgfusepath{draw}
10384 %
10385 \pgfpathmoveto{\pgfpointorigin}
10386 \pgftext{#2}
10387 }
10388 }
10389 }
10390 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
10391 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
10392 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
10393 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
10394 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
10395 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
10396 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
10397 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
10398
10399 %% end european logic ports
10400
10401 %%%%%%%%%%%%%%%%%%%%%%%%
10402 %% Transistors
10403 %%%%%%%%%%%%%%%%%%%%%%%%
10404
10405
10406 \long\def\pgfcircdeclaretransistor#1#2#3{
10407 \pgfdeclareshape{#1}
10408 {
10409 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
10410 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10411 \anchor{center}{
10412 \pgfpointorigin
10413 }
10414 \savedanchor\northeast{% upper right
10415 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10416 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
10417 \pgf@y=.5\pgf@y
10418 \pgf@x=0pt
10419 }
10420 \savedanchor\left{%center left
10421 \pgf@y=0pt
10422 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10423 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
10424 }
10425 \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
10426 \pgf@y=0pt
10427 \pgf@x=0pt
10428 }
10429 \anchor{text}{
10430 \northeast
10431 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10432 \ifpgf@circuit@transisors@fixlabels
10433 \ifpgf@circuit@fet@bodydiode
10434 % try to put the text to the right of the flyback diode
10435 \pgfmathsetlength{\pgf@circ@res@other}{(
10436 \ctikzvalof{tripoles/#1/bodydiode distance}*
10437 \ctikzvalof{tripoles/#1/width} +
10438 \ctikzvalof{tripoles/#1/bodydiode scale}*
10439 \ctikzvalof{bipoles/diode/height}/2
10440 )*\pgf@circ@scaled@Rlen}
10441 \advance\pgf@x by \pgf@circ@res@other
10442 \fi
10443 % add a bit of space to avoid central (substrate) terminal if drawn
10444 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
10445 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
10446 \else
10447 \pgf@y=.7\pgf@y
10448 \pgf@x= \pgf@circ@scaled@Rlen
10449 \pgf@x=0.1\pgf@x
10450 \fi
10451 }
10452 \anchor{pathstart}{ % south
10453 \northeast
10454 \pgf@y=-\pgf@y
10455 }
10456 \anchor{pathend}{
10457 \northeast
10458 }
10459 \anchor{north}{
10460 \northeast
10461 \pgf@circ@res@step=\pgf@y
10462 \left
10463 \pgf@y=\pgf@circ@res@step
10464 \pgf@x=.5\pgf@x
10465 }
10466 \anchor{west}{
10467 \left
10468 }
10469 \anchor{east}{
10470 \northeast
10471 \pgf@y=0pt
10472 }
10473 \anchor{south}{
10474 \northeast
10475 \pgf@circ@res@step=\pgf@y
10476 \left
10477 \pgf@y=-\pgf@circ@res@step
10478 \pgf@x=.5\pgf@x
10479 }
10480 \anchor{south west}{
10481 \northeast
10482 \pgf@circ@res@step=\pgf@y
10483 \left
10484 \pgf@y=-\pgf@circ@res@step
10485 }
10486 \anchor{north east}{
10487 \northeast
10488 }
10489 \anchor{north west}{
10490 \northeast
10491 \pgf@circ@res@step=\pgf@y
10492 \left
10493 \pgf@y=\pgf@circ@res@step
10494 }
10495 \anchor{south east}{
10496 \northeast
10497 \pgf@y=-\pgf@y
10498 }
10499 \anchor{B}{
10500 \northeast
10501 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
10502 \left
10503 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
10504 }
10505 \anchor{base}{
10506 \northeast
10507 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
10508 \left
10509 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
10510 }
10511 \anchor{bulk}{ %added by Burak Kelleci
10512 \northeast
10513 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
10514 \right
10515 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
10516 }
10517 \anchor{nobulk}{ %added by Burak Kelleci
10518 \left
10519 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
10520 }
10521 \anchor{G}{
10522 \northeast
10523 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
10524 \left
10525 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
10526 }
10527 \anchor{gate}{
10528 \northeast
10529 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
10530 \left
10531 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
10532 }
10533 \anchor{nobase}{
10534 \left
10535 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
10536 }
10537 \anchor{nogate}{
10538 \left
10539 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
10540 }
10541 \anchor{E}{
10542 \northeast
10543 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10544 }
10545 \anchor{emitter}{
10546 \northeast
10547 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10548 }
10549 \anchor{C}{
10550 \northeast
10551 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10552 }
10553 \anchor{collector}{
10554 \northeast
10555 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10556 }
10557 \anchor{S}{
10558 \northeast
10559 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10560 }
10561 \anchor{source}{
10562 \northeast
10563 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10564 }
10565 \anchor{D}{
10566 \northeast
10567 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10568 }
10569 \anchor{drain}{
10570 \northeast
10571 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10572 }
10573 \anchor{body C in}{
10574 \northeast
10575 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10576 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
10577 }
10578 \anchor{body E in}{
10579 \northeast
10580 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10581 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
10582 }
10583 \anchor{body C out}{
10584 \northeast
10585 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10586 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
10587 \pgf@y=\pgf@ya
10588 \left
10589 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
10590 \pgf@y=\pgf@ya
10591 }
10592 \anchor{body E out}{
10593 \northeast
10594 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
10595 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
10596 \pgf@y=\pgf@ya
10597 \left
10598 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
10599 \pgf@y=\pgf@ya
10600 }
10601 #2
10602 \backgroundpath{
10603 \pgftransformationadjustments
10604 \pgfsetcolor{\ctikzvalof{color}}
10605 %
10606 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
10607 \pgf@circuit@trans@ntypetrue
10608 \else
10609 \pgf@circuit@trans@ntypefalse
10610 \fi
10611 \northeast
10612 \pgf@circ@res@up = \pgf@y
10613 \pgf@circ@res@down = -\pgf@y
10614 \pgf@circ@res@right = \pgf@x
10615 \left
10616 \pgf@circ@res@left = \pgf@x
10617 \pgf@circ@scaled@Rlen=\scaledRlen
10618 %
10619 #3
10620 % BODY DIODE
10621 \ifpgf@circuit@fet@bodydiode
10622 \drawbodydiode{#1}
10623 \fi
10624 %
10625 }
10626 }
10627 }
10628
10629 \long\def\drawbodydiode#1{
10630 \pgfscope
10631 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
10632 \pgftransformrotate{90}
10633 % diode scale and bodydiode scale interacts. We want the size of the diode
10634 % proportional to the transistor, so we will:
10635 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
10636 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
10637 \pgftransformscale{\@@BDscale}
10638 \ifpgf@circuit@fulldiode
10639 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
10640 \else
10641 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
10642 \fi
10643 \endpgfscope
10644 % Draw stroke line
10645 \ifpgf@circuit@strokediode
10646 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
10647 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
10648 \pgfusepath{stroke}
10649 \fi
10650 %Draw upper connection to body diode
10651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
10652 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
10653 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
10654 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
10655 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
10656 \pgfusepath{draw}
10657 \pgfscope
10658 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
10659 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
10660 \pgftransformscale{0.5}
10661 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
10662 \endpgfscope{}
10663 %Draw lower connection to body diode
10664 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
10665 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
10666 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
10667 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
10668 \pgfusepath{draw}
10669 \pgfscope
10670 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
10671 \pgftransformscale{0.5}
10672 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
10673 \endpgfscope
10674 }
10675
10676 \long\def\declarebpt#1{
10677 \pgfcircdeclaretransistor{#1}{
10678 \anchor{inner up}{
10679 \northeast
10680 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
10681 }
10682 \anchor{inner down}{
10683 \northeast
10684 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
10685 }
10686 }{
10687 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
10688 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
10689 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
10690 \pgfpathlineto{\pgfpoint
10691 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10692 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
10693 \pgfusepath{draw}
10694
10695 \pgfscope
10696 \pgfpathmoveto{\pgfpoint
10697 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10698 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
10699 \pgfpathlineto{\pgfpoint
10700 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10701 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
10702 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10703 \pgfusepath{draw}
10704 \endpgfscope
10705
10706 \pgfpathmoveto{\pgfpoint
10707 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10708 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
10709 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
10710 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
10711 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
10712 \pgfusepath{draw}
10713 %draw arrow depending on type of transistor
10714 \pgfscope
10715 \pgfslopedattimetrue
10716 \pgfallowupsidedownattimetrue
10717 \pgfresetnontranslationattimefalse
10718 \edef\@@anchor{center}
10719 \ifpgf@circuit@trans@ntype
10720 \ifpgf@circuit@trans@arrowatend
10721 \edef\@@anchor{btip}
10722 \pgftransformlineattime{1.0}{%
10723 \pgfpoint%
10724 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
10725 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
10726 }{%
10727 \pgfpoint{\pgf@circ@res@right}%
10728 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
10729 }
10730 \else
10731 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
10732 \pgfpoint%
10733 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
10734 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
10735 }{%
10736 \pgfpoint{\pgf@circ@res@right}%
10737 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
10738 }
10739 \fi
10740 \else % p-type
10741 \ifpgf@circuit@trans@arrowatend
10742 \edef\@@anchor{tip}
10743 \pgftransformlineattime{1.0}{%
10744 \pgfpoint{\pgf@circ@res@right}%
10745 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
10746 }{%
10747 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
10748 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
10749 }
10750 \else
10751 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
10752 \pgfpoint{\pgf@circ@res@right}%
10753 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
10754 }{%
10755 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
10756 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
10757 }
10758 \fi
10759 \fi
10760 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
10761 \endpgfscope
10762
10763 \ifpgf@circuit@bpt@drawphoto
10764 \pgfscope
10765 \pgfsetarrowsstart{latexslim}
10766 \pgfpathmoveto{\pgfpointadd{\pgfpoint
10767 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10768 {\pgf@circ@res@up+\pgf@circ@res@down}}
10769 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
10770 \pgfpathlineto{\pgfpointadd{\pgfpoint
10771 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10772 {\pgf@circ@res@up+\pgf@circ@res@down}}
10773 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
10774 \pgfusepath{draw}
10775 \pgfpathmoveto{\pgfpointadd{\pgfpoint
10776 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10777 {\pgf@circ@res@up+\pgf@circ@res@down}}
10778 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
10779 \pgfpathlineto{\pgfpointadd{\pgfpoint
10780 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10781 {\pgf@circ@res@up+\pgf@circ@res@down}}
10782 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
10783 \pgfusepath{draw}
10784 \endpgfscope
10785 \else
10786 \ifpgf@circuit@bpt@drawbase
10787 \pgfpathmoveto{\pgfpoint
10788 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
10789 {\pgf@circ@res@up+\pgf@circ@res@down}}
10790 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
10791 \pgfusepath{draw}
10792 \fi
10793 \fi
10794 }
10795 }
10796
10797 \declarebpt{npn}
10798 \declarebpt{pnp}
10799 %
10800 % multi-emitter and multi-collector BJTs by Romano Giannetti
10801 %
10802 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
10803 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
10804 \pgfextracty{\pgf@circ@res@other}{\basedimension}
10805 \ifnum\cdir>0 % NPN, above
10806 \pgfpoint{\pgf@circ@res@temp}{%
10807 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
10808 \else % PNP, below
10809 \pgfpoint{\pgf@circ@res@temp}{%
10810 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
10811 \fi
10812 }
10813 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
10814 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
10815 \pgfextracty{\pgf@circ@res@other}{\basedimension}
10816 \ifnum\cdir<0 % PNP, above
10817 \pgfpoint{\pgf@circ@res@temp}{%
10818 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
10819 \else % PNP, below
10820 \pgfpoint{\pgf@circ@res@temp}{%
10821 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
10822 \fi
10823 }
10824
10825 \long\def\declarebjt#1{
10826 \pgfdeclareshape{bjt#1}{
10827 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
10828 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10829 % \cdir is 1 for npn, -1 for pnp
10830 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
10831 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
10832 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
10833 % step up or down for the additional C/Es
10834 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
10835 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
10836 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
10837 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
10838 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
10839 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
10840 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10841 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
10842 \pgf@y=.5\pgf@y
10843 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
10844 \pgf@x=.5\pgf@x
10845 }
10846 \savedanchor\northeast{% upper right
10847 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10848 \pgfmathsetlength{\pgf@circ@res@step}{%
10849 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
10850 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10851 \ifnum\cdir> 0
10852 \edef\numup{\numC}\edef\numdown{\numE}
10853 \else
10854 \edef\numup{\numE}\edef\numdown{\numC}
10855 \fi
10856 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
10857 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
10858 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10859 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
10860 \pgf@x=.5\pgf@x
10861 }
10862 \savedanchor\southeast{% lower right
10863 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10864 \pgfmathsetlength{\pgf@circ@res@step}{%
10865 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
10866 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10867 \ifnum\cdir> 0
10868 \edef\numup{\numC}\edef\numdown{\numE}
10869 \else
10870 \edef\numup{\numE}\edef\numdown{\numC}
10871 \fi
10872 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
10873 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
10874 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10875 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
10876 \pgf@x=.5\pgf@x
10877 }
10878 \savedanchor\southwest{% lower left
10879 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10880 \pgfmathsetlength{\pgf@circ@res@step}{%
10881 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
10882 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10883 \ifnum\cdir> 0
10884 \edef\numup{\numC}\edef\numdown{\numE}
10885 \else
10886 \edef\numup{\numE}\edef\numdown{\numC}
10887 \fi
10888 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
10889 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
10890 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10891 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
10892 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10893 }
10894 \anchor{center}{\pgfpointorigin}
10895 \anchor{north}{\northeast\pgf@x=0cm\relax}
10896 \anchor{east}{\northeast\pgf@y=0cm\relax}
10897 \anchor{south}{\southwest\pgf@x=0cm\relax}
10898 \anchor{west}{\southwest\pgf@y=0cm}
10899 \anchor{north east}{\northeast}
10900 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
10901 \anchor{south west}{\southwest}
10902 \anchor{south east}{\southeast}
10903
10904 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
10905 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
10906 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
10907 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
10908 % center of the base "bar"
10909 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
10910 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
10911 }
10912 % geometrical centers
10913 \anchor{vcenter}{\pgf@x=0cm\relax
10914 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
10915 }
10916 \anchor{gcenter}{%
10917 \northeast\pgf@xa=0.5\pgf@x
10918 \southwest\advance\pgf@xa by 0.5\pgf@x
10919 \pgf@x=\pgf@xa
10920 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
10921 }
10922 % external connections
10923 \anchor{E}{
10924 \ifnum\cdir>0% npn, emitter down
10925 \southeast
10926 \else
10927 \northeast
10928 \fi
10929 }% first emitter
10930 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
10931 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
10932 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
10933
10934 \backgroundpath{
10935 \pgftransformationadjustments
10936 \pgfsetcolor{\ctikzvalof{color}}
10937 %
10938 % set the type and up and down number of connections
10939 %
10940 \ifnum\cdir> 0
10941 \pgf@circuit@trans@ntypetrue
10942 \edef\numup{\numC}
10943 \edef\numdown{\numE}
10944 \else
10945 \pgf@circuit@trans@ntypefalse
10946 \edef\numup{\numE}
10947 \edef\numdown{\numC}
10948 \fi
10949 \basedimension
10950 \pgf@circ@res@up = \pgf@y
10951 \pgf@circ@res@down = -\pgf@y
10952 \pgf@circ@res@right = \pgf@x
10953 \pgf@circ@res@left = -\pgf@x
10954 \pgf@circ@scaled@Rlen=\scaledRlen
10955 \pgf@circ@res@step=\multistep
10956 %
10957 % set arrow positions options
10958 %
10959 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
10960 \ifpgf@circuit@trans@arrowatend
10961 \edef\@@pos{1.0}
10962 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
10963 \edef\@@anchor{btip}
10964 \else
10965 \edef\@@anchor{tip}
10966 \fi
10967 \fi
10968 %
10969 % Drawing upper connections
10970 %
10971 \pgfscope
10972 \pgf@circ@count@a=\numup\relax
10973 \pgfmathloop%
10974 \ifnum\pgf@circ@count@a>0
10975 \advance\pgf@circ@count@a-1\relax
10976 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
10977 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
10978 \pgfpathmoveto{\pgfpoint
10979 {\pgf@circ@res@right}%
10980 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
10981 \pgfpathlineto{\pgfpoint
10982 {\pgf@circ@res@right}%
10983 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
10984 \else
10985 \pgfpathmoveto{\pgfpoint
10986 {\pgf@circ@res@right}%
10987 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
10988 \fi
10989 \pgfpathlineto{\pgfpoint
10990 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
10991 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
10992 \pgfsetroundcap % better when connecting to sloped lines
10993 \pgfusepath{draw}
10994 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
10995 \pgfscope
10996 \pgfslopedattimetrue
10997 \pgfallowupsidedownattimetrue
10998 \pgfresetnontranslationattimefalse
10999 \pgftransformlineattime{\@@pos}{%
11000 \pgfpoint
11001 {\pgf@circ@res@right}%
11002 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
11003 }{\pgfpoint
11004 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
11005 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
11006 }
11007 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11008 \endpgfscope
11009 \fi
11010 \repeatpgfmathloop
11011 \endpgfscope
11012 %
11013 % Drawing base
11014 %
11015 \pgfscope
11016 \pgfpathmoveto{\pgfpoint
11017 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
11018 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
11019 \pgfpathlineto{\pgfpoint
11020 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
11021 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
11022 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11023 \pgfsetroundcap % I like it more...
11024 \pgfusepath{draw}
11025 \endpgfscope
11026 %
11027 % draw base external connection
11028 %
11029 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
11030 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
11031 \pgfusepath{draw}
11032 %
11033 % Drawing lower connections
11034 %
11035 \pgfscope
11036 \pgf@circ@count@a=\numdown\relax
11037 \pgfmathloop%
11038 \ifnum\pgf@circ@count@a>0
11039 \advance\pgf@circ@count@a-1\relax
11040 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
11041 \pgfpathmoveto{\pgfpoint
11042 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
11043 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
11044 \pgfpathlineto{\pgfpoint
11045 {\pgf@circ@res@right}
11046 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
11047 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
11048 \pgfpathlineto{\pgfpoint
11049 {\pgf@circ@res@right}
11050 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
11051 \fi
11052 \pgfsetroundcap % better when connecting to sloped lines
11053 \pgfusepath{draw}
11054 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
11055 \pgfscope
11056 \pgfslopedattimetrue
11057 \pgfallowupsidedownattimetrue
11058 \pgfresetnontranslationattimefalse
11059 \pgftransformlineattime{\@@pos}{%
11060 \pgfpoint
11061 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
11062 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
11063 }{\pgfpoint
11064 {\pgf@circ@res@right}%
11065 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
11066 }
11067 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11068 \endpgfscope
11069 \fi
11070 \repeatpgfmathloop
11071 \endpgfscope
11072 }
11073 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
11074 % and is executed just before a node is drawn.
11075 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
11076 % Start with the maximum collector number and go backwards.
11077 \pgf@circ@count@a=\numC\relax
11078 \pgfmathloop%
11079 \ifnum\pgf@circ@count@a>0
11080 % we will create two anchors per pin: the "normal one" like `pin 1` for the
11081 % electrical contact, and the "border one" like `bpin 1` for labels.
11082 % they will coincide if `external pins width` is set to 0.
11083 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
11084 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
11085 }
11086 \advance\pgf@circ@count@a by -1\relax%
11087 \repeatpgfmathloop%
11088 % and emitters
11089 \pgf@circ@count@a=\numE\relax
11090 \pgfmathloop%
11091 \ifnum\pgf@circ@count@a>0
11092 % we will create two anchors per pin: the "normal one" like `pin 1` for the
11093 % electrical contact, and the "border one" like `bpin 1` for labels.
11094 % they will coincide if `external pins width` is set to 0.
11095 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
11096 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
11097 }
11098 \advance\pgf@circ@count@a by -1\relax%
11099 \repeatpgfmathloop%
11100 }%
11101 }
11102 }
11103
11104 \declarebjt{npn}
11105 \declarebjt{pnp}
11106
11107 % end of multi-bjts
11108
11109 \long\def\declareigbt#1{
11110 \pgfcircdeclaretransistor{#1}{
11111 \anchor{inner up}{
11112 \northeast
11113 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
11114 }
11115 \anchor{inner down}{
11116 \northeast
11117 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
11118 }
11119 }
11120 {
11121 %draw upper connection
11122 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11124 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
11125 \pgfpathlineto{\pgfpoint
11126 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11127 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
11128 \pgfusepath{draw}
11129
11130 %draw thicker gate lines
11131 \pgfscope
11132 \pgfpathmoveto{\pgfpoint
11133 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11134 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
11135 \pgfpathlineto{\pgfpoint
11136 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11137 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
11138 \pgfpathmoveto{\pgfpoint
11139 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11140 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
11141 \pgfpathlineto{\pgfpoint
11142 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11143 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
11144 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11145 \pgfusepath{draw}
11146 \endpgfscope
11147 %draw lower connection
11148 \pgfpathmoveto{\pgfpoint
11149 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11150 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
11151 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11152 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
11153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11154 \pgfusepath{draw}
11155 %draw arrow depending on type of transistor
11156 \pgfscope
11157 \pgfslopedattimetrue
11158 \pgfallowupsidedownattimetrue
11159 \pgfresetnontranslationattimefalse
11160 \ifpgf@circuit@trans@arrowatend
11161 \ifpgf@circuit@trans@ntype
11162 \edef\@@anchor{btip}\edef\@@pos{1.0}
11163 \else
11164 \edef\@@anchor{tip}\edef\@@pos{1.0}
11165 \fi
11166 \else
11167 \edef\@@anchor{center}\edef\@@pos{0.5}
11168 \fi
11169 \ifpgf@circuit@trans@ntype
11170 \pgftransformlineattime{\@@pos}{%
11171 \pgfpoint%
11172 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11173 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
11174 }{%
11175 \pgfpoint{\pgf@circ@res@right}%
11176 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
11177 }
11178 \else
11179 \pgftransformlineattime{\@@pos}{%
11180 \pgfpoint{\pgf@circ@res@right}%
11181 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
11182 }{%
11183 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11184 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
11185 }
11186 \fi
11187 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11188 \endpgfscope
11189 %draw gate
11190 \ifpgf@circuit@trans@ntype
11191 \pgfpathmoveto{\pgfpoint
11192 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11193 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11194 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
11195 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11196 \else
11197 \pgfpathmoveto{\pgfpoint
11198 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11199 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
11200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
11201 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
11202 \fi
11203 \pgfusepath{draw}
11204 }
11205 }
11206
11207 \declareigbt{pigbt}
11208 \declareigbt{nigbt}
11209 \declareigbt{Lnigbt}
11210 \declareigbt{Lpigbt}
11211
11212 \pgfcircdeclaretransistor{nmos}{
11213 \anchor{inner up}{
11214 \northeast
11215 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
11216 }
11217 \anchor{inner down}{
11218 \northeast
11219 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
11220 }
11221 }{%
11222 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11223 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11224 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
11225 \pgfpathlineto{\pgfpoint
11226 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
11227 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
11228
11229 \pgfpathmoveto{\pgfpoint
11230 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
11231 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
11232 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11233 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
11234 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11235 \pgfusepath{draw}
11236
11237 \pgfscope
11238 \pgfpathmoveto{\pgfpoint
11239 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
11240 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
11241 \pgfpathlineto{\pgfpoint
11242 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
11243 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
11244 \pgfpathmoveto{\pgfpoint
11245 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
11246 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
11247 \pgfpathlineto{\pgfpoint
11248 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
11249 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
11250 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11251 \pgfusepath{draw}
11252 \endpgfscope
11253 \ifpgf@circuit@mos@arrows
11254 \pgfscope
11255 \ifpgf@circuit@trans@arrowatend
11256 \pgftransformshift{\pgfpoint
11257 {\pgf@circ@res@right}%
11258 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
11259 }
11260 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
11261 \else
11262 \pgfslopedattimetrue
11263 \pgfallowupsidedownattimetrue
11264 \pgfresetnontranslationattimefalse
11265 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
11266 \pgfpoint%
11267 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
11268 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
11269 }{%
11270 \pgfpoint
11271 {\pgf@circ@res@right}%
11272 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
11273 }
11274 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
11275 \fi
11276 \endpgfscope
11277 \fi
11278
11279 \ifpgf@circuit@bpt@drawgate
11280 \pgfpathmoveto{\pgfpoint
11281 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
11282 {\pgf@circ@res@up+\pgf@circ@res@down}}
11283 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
11284 \pgfusepath{draw}
11285 \fi
11286
11287 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
11288 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
11289 {\pgf@circ@res@up+\pgf@circ@res@down}}
11290 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
11291 {\pgf@circ@res@up+\pgf@circ@res@down}}
11292 \pgfusepath{draw}
11293 \fi
11294 }
11295
11296 \pgfcircdeclaretransistor{pmos}{
11297 \anchor{inner up}{
11298 \northeast
11299 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
11300 }
11301 \anchor{inner down}{
11302 \northeast
11303 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
11304 }
11305 }{%
11306 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11307 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11308 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
11309 \pgfpathlineto{\pgfpoint
11310 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
11311 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
11312 \pgfusepath{draw}
11313
11314 \ifpgf@circuit@mos@arrows
11315 \pgfscope
11316 \ifpgf@circuit@trans@arrowatend
11317 \pgftransformshift{\pgfpoint
11318 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
11319 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
11320 }
11321 \pgftransformrotate{180}
11322 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
11323 \else
11324 \pgfslopedattimetrue
11325 \pgfallowupsidedownattimetrue
11326 \pgfresetnontranslationattimefalse
11327 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
11328 \pgfpoint%
11329 {\pgf@circ@res@right}%
11330 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
11331 }{%
11332 \pgfpoint
11333 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
11334 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
11335 }
11336 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
11337 \fi
11338 \endpgfscope
11339 \fi
11340
11341 \pgfscope
11342 \pgfpathmoveto{\pgfpoint
11343 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
11344 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
11345 \pgfpathlineto{\pgfpoint
11346 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
11347 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
11348 \pgfpathmoveto{\pgfpoint
11349 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
11350 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
11351 \pgfpathlineto{\pgfpoint
11352 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
11353 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
11354 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11355 \pgfusepath{draw}
11356 \endpgfscope
11357
11358 \pgfpathmoveto{\pgfpoint
11359 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
11360 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
11361 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11362 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
11363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11364
11365
11366 \pgfusepath{draw}
11367 \ifpgf@circuit@bpt@drawgate
11368 \pgfpathmoveto{\pgfpoint
11369 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
11370 {\pgf@circ@res@up+\pgf@circ@res@down}}
11371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
11372 \pgfusepath{draw}
11373 \fi
11374
11375 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
11376 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
11377 {\pgf@circ@res@up+\pgf@circ@res@down}}
11378 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
11379 {\pgf@circ@res@up+\pgf@circ@res@down}}
11380 \pgfusepath{draw}
11381 \fi
11382
11383 \ifpgf@circuit@pmos@nocircle\else
11384 % we are not scaling the circle with the MOS --- I think it's better to have it
11385 % coherent with the poles/nodes of the rest of the circuit.
11386 \pgfpathcircle{\pgfpoint
11387 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
11388 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11389 \ifpgf@circuit@pmos@emptycircle
11390 \pgfsetfillcolor{white}
11391 \fi
11392 \pgfusepath{draw,fill}
11393 \fi
11394 }
11395
11396 %% HEMT FET Transistor
11397 \pgfcircdeclaretransistor{hemt}{
11398 \anchor{inner up}{
11399 \northeast
11400 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
11401 }
11402 \anchor{inner down}{
11403 \northeast
11404 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
11405 }
11406 }{%
11407 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11408 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11409 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
11410 \pgfpathlineto{\pgfpoint
11411 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
11412 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
11413
11414 \pgfpathmoveto{\pgfpoint
11415 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
11416 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
11417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11418 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
11419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11420 \pgfusepath{draw}
11421
11422 \pgfscope
11423 \pgfpathmoveto{\pgfpoint
11424 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
11425 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
11426 \pgfpathlineto{\pgfpoint
11427 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
11428 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
11429 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11430 \pgfusepath{draw}
11431 \endpgfscope
11432
11433 \pgfpathmoveto{\pgfpoint
11434 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
11435 {\pgf@circ@res@up+\pgf@circ@res@down}}
11436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
11437 \pgfusepath{draw}
11438 }
11439
11440 \long\def\drawfetcore#1{
11441 \pgftransformationadjustments
11442 %top connection
11443 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11444 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11445 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
11446 \pgfpathlineto{\pgfpoint
11447 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11448 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
11449 \pgfusepath{draw}
11450 \pgfscope
11451 \pgfpathmoveto{\pgfpoint
11452 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11453 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11454 \ifpgf@circuit@trans@depletiontype
11455 \pgfpathlineto{\pgfpoint
11456 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11457 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11458 \else
11459
11460 \pgfpathlineto{\pgfpoint
11461 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11462 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
11463 \pgfpathmoveto{\pgfpoint
11464 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11465 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
11466 \pgfpathlineto{\pgfpoint
11467 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11468 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
11469 \pgfpathmoveto{\pgfpoint
11470 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11471 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
11472 \pgfpathlineto{\pgfpoint
11473 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11474 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11475 \fi
11476 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11477 \pgfusepath{draw}
11478 \endpgfscope
11479 %Bulk connection line
11480 \pgfpathmoveto{\pgfpoint
11481 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11482 {\pgf@circ@res@up+\pgf@circ@res@down}}
11483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
11484 {\pgf@circ@res@up+\pgf@circ@res@down}}
11485
11486 %bottom connection
11487 \pgfpathmoveto{\pgfpoint
11488 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11489 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
11490 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11491 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
11492 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11493 \pgfusepath{draw}
11494
11495 %draw thick gate line
11496 \pgfscope
11497 \pgfpathmoveto{\pgfpoint
11498 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11499 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11500 \pgfpathlineto{\pgfpoint
11501 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11502 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11503 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11504 \pgfusepath{draw}
11505 \endpgfscope
11506
11507 % arrows
11508 \pgfscope
11509 \pgfslopedattimetrue
11510 \pgfallowupsidedownattimetrue
11511 \pgfresetnontranslationattimefalse
11512 \ifpgf@circuit@trans@arrowatend
11513 \ifpgf@circuit@trans@ntype
11514 \edef\@@anchor{tip}
11515 \edef\@@pos{1.0}
11516 \else
11517 \edef\@@anchor{btip}
11518 \edef\@@pos{0.0}
11519 \fi
11520 \else
11521 \edef\@@anchor{center}\edef\@@pos{0.6}
11522 \fi
11523 \pgftransformlineattime{\@@pos}{%
11524 \pgfpoint
11525 {\pgf@circ@res@right}%
11526 {\pgf@circ@res@up+\pgf@circ@res@down}%
11527 }{%
11528 \pgfpoint%
11529 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11530 {\pgf@circ@res@up+\pgf@circ@res@down}%
11531 }
11532 \ifpgf@circuit@trans@ntype
11533 \else
11534 \pgftransformrotate{180}
11535 \fi
11536 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11537 \endpgfscope
11538
11539 % GATE CONNECTION
11540 \ifpgf@circuit@bpt@drawgate
11541 \ifpgf@circuit@trans@ntype
11542 \pgfpathmoveto{\pgfpoint
11543 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11544 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11546 \else
11547 \pgfpathmoveto{\pgfpoint
11548 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
11549 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11550 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
11551 \fi
11552 \pgfusepath{draw}
11553 \fi
11554
11555 }
11556
11557 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
11558 {\pgfcircdeclaretransistor{#1}{
11559 \anchor{bulk}{\left\pgf@x=0pt}
11560 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
11561 \anchor{inner up}{
11562 \northeast
11563 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
11564 }
11565 \anchor{inner down}{
11566 \northeast
11567 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
11568 }
11569 #2
11570 }
11571 {#3}
11572 }
11573
11574 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
11575 \pgf@circuit@trans@depletiontypefalse
11576 \drawfetcore{nfet}
11577 }
11578
11579 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
11580 \pgf@circuit@trans@depletiontypefalse
11581 \drawfetcore{pfet}
11582 }
11583
11584 % N-CHANNEL IGFET ENHANCEMENT TYPE
11585 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
11586 \pgf@circuit@trans@depletiontypefalse
11587 \drawfetcore{nigfete}
11588
11589 % SOURCE CONNECTION
11590 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11591 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11592 \pgfusepath{draw}
11593
11594 % SOLDER DOT at source-bulk connection
11595 \ifpgf@circuit@fet@solderdot
11596 \pgfscope
11597 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11598 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
11599 \pgfnode{circ}{center}{}{}{}
11600 \endpgfscope{}
11601 \fi
11602 }
11603
11604 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
11605 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
11606 \pgf@circuit@trans@depletiontypefalse
11607 \drawfetcore{nigfetebulk}
11608 % SOLDER DOT at source-bulk connection
11609 \ifpgf@circuit@fet@solderdot
11610 \pgfscope
11611 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11612 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
11613 \pgfnode{circ}{center}{}{}{}
11614 \endpgfscope{}
11615 \fi
11616 }
11617
11618 % N-CHANNEL IGFET DEPLETION TYPE
11619 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
11620 \pgf@circuit@trans@depletiontypetrue
11621 \drawfetcore{nigfetd}
11622
11623 % SOURCE CONNECTION
11624 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11625 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11626 \pgfusepath{draw}
11627
11628 % SOLDER DOT at source-bulk connection
11629 \ifpgf@circuit@fet@solderdot
11630 \pgfscope
11631 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11632 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
11633 \pgfnode{circ}{center}{}{}{}
11634 \endpgfscope{}
11635 \fi
11636 }
11637
11638 % P-CHANNEL IGFET ENHANCEMENT TYPE
11639 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
11640 \pgf@circuit@trans@depletiontypefalse
11641 \drawfetcore{pigfete}
11642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11643
11644 % SOURCE CONNECTION
11645 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11646 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11647 \pgfusepath{draw}
11648
11649
11650 % SOLDER DOT at source-bulk connection
11651 \ifpgf@circuit@fet@solderdot
11652 \pgfscope
11653 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11654 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
11655 \pgfnode{circ}{center}{}{}{}
11656 \endpgfscope
11657 \fi
11658 }
11659
11660 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
11661 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
11662 \pgf@circuit@trans@depletiontypefalse
11663 \drawfetcore{pigfetebulk}
11664 }
11665
11666 % P-CHANNEL IGFET DEPLETION TYPE
11667 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
11668 \pgf@circuit@trans@depletiontypetrue
11669 \drawfetcore{pigfetd}
11670
11671 % SOURCE CONNECTION
11672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11674 \pgfusepath{draw}
11675
11676
11677 % SOLDER DOT at source-bulk connection
11678 \ifpgf@circuit@fet@solderdot
11679 \pgfscope
11680 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11681 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
11682 \pgfnode{circ}{center}{}{}{}
11683 \endpgfscope{}
11684 \fi
11685 }
11686
11687 \pgfcircdeclaretransistor{njfet}{
11688 \anchor{inner up}{
11689 \northeast
11690 \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
11691 }
11692 \anchor{inner down}{
11693 \northeast
11694 \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
11695 }
11696 }{%
11697 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11699 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
11700 \pgfpathlineto{\pgfpoint
11701 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
11702 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
11703
11704 \pgfpathmoveto{\pgfpoint
11705 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
11706 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
11707 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11708 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
11709 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11710 \pgfusepath{draw}
11711
11712 \pgfscope
11713 \pgfpathmoveto{\pgfpoint
11714 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
11715 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}}
11716 \pgfpathlineto{\pgfpoint
11717 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
11718 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}}
11719 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11720 \pgfusepath{draw}
11721 \endpgfscope
11722
11723 % arrow
11724 \pgfscope
11725 \pgfslopedattimetrue
11726 \pgfallowupsidedownattimetrue
11727 \pgfresetnontranslationattimefalse
11728 \ifpgf@circuit@trans@arrowatend
11729 \edef\@@anchor{tip}\edef\@@pos{1.0}
11730 \else
11731 \edef\@@anchor{center}\edef\@@pos{0.6}
11732 \fi
11733 \pgftransformlineattime{\@@pos}{%
11734 \pgfpoint{\pgf@circ@res@left}%
11735 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
11736 }{%
11737 \pgfpoint
11738 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
11739 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
11740 }
11741 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11742 \endpgfscope
11743
11744 \pgfpathmoveto{\pgfpoint
11745 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
11746 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
11747 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
11748 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
11749 \pgfusepath{draw}
11750 }
11751
11752 \pgfcircdeclaretransistor{pjfet}{
11753 \anchor{inner up}{
11754 \northeast
11755 \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
11756 }
11757 \anchor{inner down}{
11758 \northeast
11759 \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
11760 }
11761 }{%
11762 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11763 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11764 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
11765 \pgfpathlineto{\pgfpoint
11766 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
11767 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
11768
11769 \pgfpathmoveto{\pgfpoint
11770 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
11771 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
11772 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11773 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
11774 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11775 \pgfusepath{draw}
11776
11777 \pgfscope
11778 \pgfpathmoveto{\pgfpoint
11779 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
11780 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}}
11781 \pgfpathlineto{\pgfpoint
11782 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
11783 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}}
11784 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11785 \pgfusepath{draw}
11786 \endpgfscope
11787
11788 \pgfscope
11789 \pgfslopedattimetrue
11790 \pgfallowupsidedownattimetrue
11791 \pgfresetnontranslationattimefalse
11792 \ifpgf@circuit@trans@arrowatend
11793 \edef\@@anchor{btip}\edef\@@pos{1.0}
11794 \else
11795 \edef\@@anchor{center}\edef\@@pos{0.4}
11796 \fi
11797 \pgftransformlineattime{\@@pos}{%
11798 \pgfpoint%
11799 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}%
11800 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
11801 }{%
11802 \pgfpoint{\pgf@circ@res@left}%
11803 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
11804 }
11805 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11806 \endpgfscope
11807
11808 \pgfpathmoveto{\pgfpoint
11809 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
11810 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
11811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
11812 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
11813 \pgfusepath{draw}
11814 }
11815
11816 \pgfdeclaretransistorwrapperaddbulk{isfet}{}{%
11817 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11818 % DRAIN CONNECTION
11819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11820 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
11821 % DRAIN
11822 \pgfpathlineto{\pgfpoint
11823 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
11824 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
11825 \pgfusepath{draw}
11826
11827 % GATE, DEPLETION TYPE
11828 \pgfscope %% added
11829 \pgfpathmoveto{\pgfpoint
11830 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
11831 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
11832 \pgfpathlineto{\pgfpoint
11833 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
11834 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
11835 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
11836 \pgfusepath{draw} %% added
11837 \endpgfscope %% added
11838
11839 % BULK
11840 \pgfpathmoveto{\pgfpoint
11841 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
11842 {\pgf@circ@res@up+\pgf@circ@res@down}}
11843 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
11844 {\pgf@circ@res@up+\pgf@circ@res@down}}
11845
11846 % SOURCE
11847 \pgfpathmoveto{\pgfpoint
11848 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
11849 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
11850 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11851 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
11852 % SOURCE CONNECTION
11853 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11854 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11855 \pgfusepath{draw}
11856
11857 % SOLDER DOT at source-bulk connection
11858 \ifpgf@circuit@fet@solderdot
11859 \pgfscope
11860 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
11861 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
11862 \pgfnode{circ}{center}{}{}{}
11863 \endpgfscope{}
11864 \fi
11865 % ARROW
11866 \pgfscope
11867 \pgfslopedattimetrue
11868 \pgfallowupsidedownattimetrue
11869 \pgfresetnontranslationattimefalse
11870 \ifpgf@circuit@trans@arrowatend
11871 \edef\@@anchor{tip}\edef\@@pos{1.0}
11872 \else
11873 \edef\@@anchor{center}\edef\@@pos{0.6}
11874 \fi
11875 \pgftransformlineattime{\@@pos}{%
11876 \pgfpoint
11877 {\pgf@circ@res@right}%
11878 {\pgf@circ@res@up+\pgf@circ@res@down}%
11879 }{%
11880 \pgfpoint%
11881 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
11882 {\pgf@circ@res@up+\pgf@circ@res@down}%
11883 }
11884 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11885 \endpgfscope
11886 \pgfusepath{draw}
11887
11888 % Wavy lines
11889 \pgfscope
11890 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
11891 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11892 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11893 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11894 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11895 \pgfusepath{draw}
11896
11897 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
11898 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11899 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11900 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11901 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11902 \pgfusepath{draw}
11903
11904 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
11905 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11906 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11907 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11908 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
11909 \pgfusepath{draw}
11910 \endpgfscope
11911 }
11912
11913 % end of transistors
11914
11915 %%%%%%%%%%%%%
11916 %% Switches
11917 %%%%%%%%%%%%%
11918
11919 \pgfcircdeclarebipole{
11920 \anchor{out 1}{
11921 \northeast
11922 \pgf@y=0cm
11923 }
11924 \anchor{out 2}{
11925 \northeast
11926 \pgf@y=.8\pgf@y
11927 }
11928 }
11929 {\ctikzvalof{tripoles/toggleswitch/height 2}}
11930 {toggleswitch}
11931 {\ctikzvalof{tripoles/toggleswitch/height}}
11932 {\ctikzvalof{tripoles/toggleswitch/width}}
11933 {
11934
11935 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11936 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
11937 \pgfusepath{draw}
11938 \pgfscope
11939 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
11940 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11941 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
11942 \pgfusepath{draw}
11943 \endpgfscope
11944
11945 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11946 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
11947
11948 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
11949 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
11950 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
11951 \pgfusepath{draw}
11952
11953
11954 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
11955 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
11956 \pgfusepath{draw}
11957
11958 \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm}
11959 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
11960 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
11961 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
11962 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
11963 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
11964 \pgfusepath{draw}
11965 \pgfsetdash{}{0cm}
11966 }
11967
11968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11969 %% operational and instrumentation amplifiers
11970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11971
11972 \pgfdeclareshape{op amp}
11973 {
11974 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
11975 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11976 \anchor{center}{\pgfpointorigin}
11977 \savedanchor\northwest{%
11978 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11979 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
11980 \pgf@y=.5\pgf@y
11981 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
11982 \pgf@x=.5\pgf@x
11983 }
11984 \savedanchor\left{%
11985 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11986 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
11987 \pgf@x=.5\pgf@x
11988 \pgf@y=0pt
11989 }
11990 \anchor{south}{
11991 \northwest
11992 \pgf@y=-\pgf@y
11993 \pgf@x=0pt
11994 }
11995 \anchor{north}{
11996 \northwest
11997 \pgf@x=0pt
11998 }
11999 \savedanchor\left{%
12000 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12001 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
12002 \pgf@x=.5\pgf@x
12003 \pgf@y=0pt
12004 }
12005 \savedanchor\inOneFixed{%
12006 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12007 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
12008 \pgf@y=.5\pgf@y
12009 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
12010 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
12011 \pgf@x=.5\pgf@x
12012 }
12013 \anchor{in up}{
12014 \inOneFixed
12015 }
12016 \anchor{in down}{
12017 \inOneFixed
12018 \pgf@y=-\pgf@y
12019 }
12020 \savedanchor\inOne{%
12021 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12022 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
12023 \pgf@y=.5\pgf@y
12024 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
12025 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
12026 \pgf@x=.5\pgf@x
12027 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
12028 }
12029 \anchor{-}{
12030 \inOne
12031 }
12032 \anchor{+}{
12033 \inOne
12034 \pgf@y=-\pgf@y
12035 }
12036 \savedanchor\up{%
12037 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12038 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
12039 \pgf@y=.5\pgf@y
12040 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
12041 \pgf@x=.5\pgf@x
12042 \pgf@circ@res@up = \pgf@y
12043 \pgf@circ@res@right = -\pgf@x
12044 \pgf@circ@res@left = \pgf@x
12045 \pgfpointlineattime{
12046 \ctikzvalof{tripoles/op amp/up pos}}{
12047 \pgfpoint{
12048 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
12049 {\pgf@circ@res@up}}
12050 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
12051 }
12052 \anchor{up}{
12053 \up
12054 }
12055 \anchor{down}{
12056 \up
12057 \pgf@y=-\pgf@y
12058 }
12059 \anchor{out}{
12060 \northwest
12061 \pgf@y=0pt
12062 \pgf@x=-\pgf@x
12063 }
12064 \anchor{west}{
12065 \left
12066 }
12067 \anchor{east}{
12068 \left
12069 \pgf@x=-\pgf@x
12070 }
12071
12072 % support for border anchors
12073 \savedanchor\leftedge{%
12074 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12075 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
12076 \pgf@x=.5\pgf@x
12077 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
12078 \pgf@y=0pt
12079 }
12080 \anchor{leftedge}{\leftedge}
12081 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
12082 \anchor{bin up}{
12083 \inOneFixed
12084 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12085 }
12086 \anchor{bin down}{
12087 \inOneFixed
12088 \pgf@y=-\pgf@y
12089 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12090 }
12091 \anchor{b-}{
12092 \inOne
12093 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12094 }
12095 \anchor{b+}{
12096 \inOne
12097 \pgf@y=-\pgf@y
12098 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12099 }
12100 \anchor{bout}{
12101 \leftedge
12102 \pgf@y=0pt
12103 \pgf@x=-\pgf@x
12104 }
12105 % end border anchors
12106 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
12107 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
12108 \anchor{north west}{ \northwest }
12109 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
12110
12111 \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12112
12113 \backgroundpath{
12114 \pgfsetcolor{\ctikzvalof{color}}
12115
12116 \northwest
12117 \pgf@circ@res@up = \pgf@y
12118 \pgf@circ@res@down = -\pgf@y
12119 \pgf@circ@res@right = -\pgf@x
12120 \pgf@circ@res@left = \pgf@x
12121 \pgf@circ@scaled@Rlen=\scaledRlen
12122
12123 % Triangle
12124 \pgfscope
12125 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12126 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
12127 \pgf@circ@res@step=\pgf@circ@res@right
12128 \advance\pgf@circ@res@step by -\pgf@circ@res@left
12129 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
12130
12131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
12132 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12133 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12134 \pgfpathclose
12135 \pgf@circ@draworfill
12136 \endpgfscope
12137
12138 % Negative input terminal
12139 \pgfpathmoveto{\pgfpoint
12140 {\pgf@circ@res@left}
12141 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
12142 \pgfpathlineto{\pgfpoint
12143 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
12144 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
12145 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
12146
12147 % Positive input terminal
12148 \pgfpathmoveto{\pgfpoint
12149 {\pgf@circ@res@left}
12150 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
12151 \pgfpathlineto{\pgfpoint
12152 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
12153 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
12154 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
12155
12156 % Output terminal
12157 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12158 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
12159 \pgfsetrectcap
12160 \pgfusepath{draw}
12161 }
12162 }
12163
12164 % Op amp shape as in european standard EN 60617
12165 \pgfdeclareshape{en amp}
12166 {
12167 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
12168 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12169 \anchor{center}{\pgfpointorigin}
12170 \savedanchor\northwest{%
12171 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12172 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
12173 \pgf@y=.5\pgf@y
12174 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
12175 \pgf@x=.5\pgf@x
12176 }
12177 \savedanchor\left{%
12178 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12179 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
12180 \pgf@x=.5\pgf@x
12181 \pgf@y=0pt
12182 }
12183 \anchor{south}{
12184 \northwest
12185 \pgf@y=-\pgf@y
12186 \pgf@x=0pt
12187 }
12188 \anchor{north}{
12189 \northwest
12190 \pgf@x=0pt
12191 }
12192 \savedanchor\inOneFixed{%
12193 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12194 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
12195 \pgf@y=.5\pgf@y
12196 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
12197 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
12198 \pgf@x=.5\pgf@x
12199 }
12200 \anchor{in up}{
12201 \inOneFixed
12202 }
12203 \anchor{in down}{
12204 \inOneFixed
12205 \pgf@y=-\pgf@y
12206 }
12207 \savedanchor\inOne{%
12208 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12209 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
12210 \pgf@y=.5\pgf@y
12211 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
12212 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
12213 \pgf@x=.5\pgf@x
12214 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
12215 }
12216 \anchor{-}{
12217 \inOne
12218 }
12219 \anchor{+}{
12220 \inOne
12221 \pgf@y=-\pgf@y
12222 }
12223 \anchor{up}{
12224 \northwest
12225 \pgf@x=0pt
12226 }
12227 \anchor{down}{
12228 \northwest
12229 \pgf@x=0pt
12230 \pgf@y=-\pgf@y
12231 }
12232 \anchor{out}{
12233 \northwest
12234 \pgf@y=0pt
12235 \pgf@x=-\pgf@x
12236 }
12237 \anchor{west}{
12238 \left
12239 }
12240 \anchor{east}{
12241 \left
12242 \pgf@x=-\pgf@x
12243 }
12244 % support for border anchors
12245 \savedanchor\leftedge{%
12246 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12247 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
12248 \pgf@x=.5\pgf@x
12249 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
12250 \pgf@y=0pt
12251 }
12252 \anchor{leftedge}{\leftedge}
12253 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
12254 \anchor{bin up}{
12255 \inOneFixed
12256 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12257 }
12258 \anchor{bin down}{
12259 \inOneFixed
12260 \pgf@y=-\pgf@y
12261 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12262 }
12263 \anchor{b-}{
12264 \inOne
12265 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12266 }
12267 \anchor{b+}{
12268 \inOne
12269 \pgf@y=-\pgf@y
12270 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12271 }
12272 \anchor{bout}{
12273 \leftedge
12274 \pgf@y=0pt
12275 \pgf@x=-\pgf@x
12276 }
12277 % end border anchors
12278 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
12279 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
12280 \anchor{north west}{ \northwest }
12281 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
12282 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12283
12284 \backgroundpath{
12285 \pgfsetcolor{\ctikzvalof{color}}
12286 \northwest
12287 \pgf@circ@res@up = \pgf@y
12288 \pgf@circ@res@down = -\pgf@y
12289 \pgf@circ@res@right = -\pgf@x
12290 \pgf@circ@res@left = \pgf@x
12291 \pgf@circ@scaled@Rlen=\scaledRlen
12292
12293 \pgfscope
12294 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12295 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
12296 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
12297 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
12298 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
12299 \pgfpathclose
12300 \pgf@circ@draworfill
12301 \endpgfscope
12302
12303 \pgfpathmoveto{\pgfpoint
12304 {\pgf@circ@res@left}
12305 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
12306 \pgfpathlineto{\pgfpoint
12307 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
12308 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
12309 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
12310
12311 \pgfpathmoveto{\pgfpoint
12312 {\pgf@circ@res@left}
12313 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
12314 \pgfpathlineto{\pgfpoint
12315 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
12316 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
12317 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
12318
12319 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12320 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
12321 \pgfsetrectcap
12322 \pgfusepath{draw}
12323
12324
12325 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
12326 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
12327 }
12328 }
12329
12330 % Fully differential output op amp
12331 % Contributed by Kristofer M. Monisit
12332 \pgfdeclareshape{fd op amp}
12333 {
12334 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
12335 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12336 \anchor{center}{\pgfpointorigin}
12337 \savedanchor\northwest{%
12338 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12339 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
12340 \pgf@y=.5\pgf@y
12341 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12342 \pgf@x=.5\pgf@x
12343 }
12344 \savedanchor\outline{%
12345 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12346 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
12347 \pgf@y=.5\pgf@y
12348 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12349 \pgf@x=.5\pgf@x
12350 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
12351 }
12352 \anchor{south}{
12353 \northwest
12354 \pgf@y=-\pgf@y\pgf@x=0pt\relax
12355 }
12356 \anchor{north}{
12357 \northwest\pgf@x=0pt\relax
12358 }
12359 \savedanchor\left{%
12360 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12361 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12362 \pgf@x=.5\pgf@x
12363 \pgf@y=0pt
12364 }
12365 \savedanchor\inOneFixed{%
12366 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12367 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
12368 \pgf@y=.5\pgf@y
12369 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
12370 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12371 \pgf@x=.5\pgf@x
12372 }
12373 \anchor{in up}{
12374 \inOneFixed
12375 }
12376 \anchor{in down}{
12377 \inOneFixed
12378 \pgf@y=-\pgf@y
12379 }
12380 \savedanchor\inOne{%
12381 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12382 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
12383 \pgf@y=.5\pgf@y
12384 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
12385 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12386 \pgf@x=.5\pgf@x
12387 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
12388 }
12389 \anchor{-}{
12390 \inOne
12391 }
12392 \anchor{+}{
12393 \inOne
12394 \pgf@y=-\pgf@y
12395 }
12396 \savedanchor\up{%
12397 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12398 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
12399 \pgf@y=.5\pgf@y
12400 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12401 \pgf@x=.5\pgf@x
12402 \pgf@circ@res@up = \pgf@y
12403 \pgf@circ@res@right = -\pgf@x
12404 \pgf@circ@res@left = \pgf@x
12405 \pgfpointlineattime{
12406 \ctikzvalof{tripoles/fd op amp/up pos}}{
12407 \pgfpoint{
12408 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
12409 {\pgf@circ@res@up}}
12410 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
12411 }
12412 \anchor{up}{
12413 \up
12414 }
12415 \anchor{down}{
12416 \up
12417 \pgf@y=-\pgf@y
12418 }
12419 \anchor{out up}{
12420 \northwest
12421 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
12422 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12423 }
12424 \anchor{out down}{
12425 \northwest
12426 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
12427 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12428 }
12429 \anchor{out +}{
12430 \outline
12431 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
12432 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12433 }
12434 \anchor{out -}{
12435 \outline
12436 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
12437 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12438 }
12439 % support for border anchors
12440 \savedanchor\leftedge{%
12441 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12442 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
12443 \pgf@x=.5\pgf@x
12444 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12445 \pgf@y=0pt
12446 }
12447 \anchor{leftedge}{\leftedge}
12448 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
12449 \anchor{bin up}{
12450 \inOneFixed
12451 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12452 }
12453 \anchor{bin down}{
12454 \inOneFixed
12455 \pgf@y=-\pgf@y
12456 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12457 }
12458 \anchor{b-}{
12459 \inOne
12460 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12461 }
12462 \anchor{b+}{
12463 \inOne
12464 \pgf@y=-\pgf@y
12465 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12466 }
12467 \anchor{bout}{
12468 \leftedge
12469 \pgf@y=0pt
12470 \pgf@x=-\pgf@x
12471 }
12472 \anchor{bout +}{
12473 \outline
12474 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
12475 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
12476 {\pgfpoint{\pgf@xa}{0pt}}
12477 {\pgfpoint{0pt}{\pgf@ya}}
12478 }
12479 \anchor{bout -}{
12480 \outline
12481 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
12482 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
12483 {\pgfpoint{\pgf@xa}{0pt}}
12484 {\pgfpoint{0pt}{\pgf@ya}}
12485 \pgf@y=-\pgf@y
12486 }
12487 \anchor{bout up}{
12488 \northwest
12489 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
12490 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
12491 {\pgfpoint{\pgf@xa}{0pt}}
12492 {\pgfpoint{0pt}{\pgf@ya}}
12493 }
12494 \anchor{bout down}{
12495 \northwest
12496 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
12497 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
12498 {\pgfpoint{\pgf@xa}{0pt}}
12499 {\pgfpoint{0pt}{\pgf@ya}}
12500 \pgf@y=-\pgf@y
12501 }
12502 % end border anchors
12503 \anchor{west}{
12504 \left
12505 }
12506 \anchor{east}{
12507 \left
12508 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12509 }
12510 \anchor{out}{% should not be used
12511 \left
12512 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
12513 }
12514 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
12515 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
12516 \anchor{north west}{ \northwest }
12517 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
12518 \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12519 \backgroundpath{
12520 \pgfsetcolor{\ctikzvalof{color}}
12521
12522 \northwest
12523 \pgf@circ@res@up = \pgf@y
12524 \pgf@circ@res@down = -\pgf@y
12525 \pgf@circ@res@right = -\pgf@x
12526 \pgf@circ@res@left = \pgf@x
12527 \pgf@circ@scaled@Rlen=\scaledRlen
12528
12529 % Triangle
12530 % Includes output terminals in the traingular shape
12531 % to ensure that diagonal joins are properly displayed
12532 % we first draw the main triangle and the leads with normal thickness,
12533 % and the redraw the main triangle with the component shape
12534 \pgfscope
12535 % shift origin a bit to ease calculations
12536 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
12537 \pgf@circ@res@step=\pgf@circ@res@right
12538 \advance\pgf@circ@res@step by -\pgf@circ@res@left
12539 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
12540
12541 % Initial point (right vertex)
12542 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
12543
12544 % Negative output terminal
12545 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
12546 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
12547 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
12548
12549 % Top vertex
12550 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12551
12552 % Bottom vertex
12553 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12554
12555 % Positive output terminal
12556 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
12557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
12558 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
12559
12560 % Right vertex
12561 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
12562
12563 \pgfpathclose
12564 \pgfusepath{stroke}
12565
12566 % ok, now we'll redraw the triangle with the class specific
12567 % thickness and optionally fill
12568
12569 \pgfscope
12570 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
12571
12572 % Initial point (right vertex)
12573 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
12574 % Top vertex
12575 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12576 % Bottom vertex
12577 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12578
12579 \pgfpathclose
12580 \pgf@circ@draworfill
12581 \endpgfscope % thick and fill
12582 \endpgfscope % shift
12583
12584 % Negative input terminal
12585 \pgfpathmoveto{\pgfpoint
12586 {\pgf@circ@res@left}
12587 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
12588 \pgfpathlineto{\pgfpoint
12589 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
12590 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
12591 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
12592
12593 % Positive input terminal
12594 \pgfpathmoveto{\pgfpoint
12595 {\pgf@circ@res@left}
12596 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
12597 \pgfpathlineto{\pgfpoint
12598 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
12599 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
12600 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
12601
12602 % Negative output terminal label
12603 \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
12604
12605 % Positive output terminal label
12606 \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
12607
12608 \pgfsetrectcap
12609 \pgfusepath{draw}
12610 }
12611 }
12612
12613
12614 % Instrumentation amplifier with differential output
12615 \pgfdeclareshape{fd inst amp}
12616 {
12617 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
12618 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12619 % when tikz calls the anchor it wants the relative position in the lengths
12620 % \pgf@x \pgf@y
12621 % \pgfpoint* functions set that variables
12622 % anchors are visible outside and run on use
12623 \anchor{center}{\pgfpointorigin}
12624 % savedanchors are internals and run on node creation (not use)
12625 % bounding-box top left
12626 \savedanchor\northwest{%
12627 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12628 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12629 \pgf@y=.5\pgf@y
12630 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12631 \pgf@x=.5\pgf@x
12632 }
12633 \anchor{nw}{
12634 \northwest
12635 }
12636 \anchor{south}{
12637 \northwest
12638 \pgf@y=-\pgf@y\pgf@x=0pt\relax
12639 }
12640 \anchor{north}{
12641 \northwest\pgf@x=0pt\relax
12642 }
12643 \savedanchor\left{%
12644 \pgf@y=0pt
12645 }
12646 \anchor{leftedge}
12647 {\left
12648 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
12649 }
12650 \savedanchor\inOneFixed{%
12651 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12652 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12653 \pgf@y=.5\pgf@y
12654 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
12655 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12656 \pgf@x=.5\pgf@x
12657 }
12658 \anchor{in up}{
12659 \inOneFixed
12660 }
12661 \anchor{in down}{
12662 \inOneFixed
12663 \pgf@y=-\pgf@y
12664 }
12665 \savedanchor\inOne{%
12666 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12667 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12668 \pgf@y=.5\pgf@y
12669 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
12670 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12671 \pgf@x=.5\pgf@x
12672 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
12673 }
12674 \anchor{-}{
12675 \inOne
12676 }
12677 \anchor{+}{
12678 \inOne
12679 \pgf@y=-\pgf@y
12680 }
12681 \savedanchor\up{%
12682 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12683 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12684 \pgf@y=.5\pgf@y
12685 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12686 \pgf@x=.5\pgf@x
12687 \pgf@circ@res@up = \pgf@y
12688 \pgf@circ@res@right = -\pgf@x
12689 \pgf@circ@res@left = \pgf@x
12690 \pgfpointlineattime{
12691 \ctikzvalof{tripoles/fd inst amp/up pos}}{
12692 \pgfpoint{
12693 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
12694 {\pgf@circ@res@up}}
12695 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
12696 }
12697 \anchor{up}{
12698 \up
12699 }
12700 \anchor{down}{
12701 \up
12702 \pgf@y=-\pgf@y
12703 }
12704 % reference voltage input anchors.
12705 \savedanchor\refv{%
12706 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12707 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12708 \pgf@y=.5\pgf@y
12709 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12710 \pgf@x=.5\pgf@x
12711 \pgf@circ@res@up = \pgf@y
12712 \pgf@circ@res@right = -\pgf@x
12713 \pgf@circ@res@left = \pgf@x
12714 \pgfpointlineattime{
12715 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
12716 \pgfpoint{
12717 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
12718 {\pgf@circ@res@up}}
12719 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
12720 }
12721 % we need both because they are normally drawn under the amp, and if you
12722 % mirror it vertically you need them
12723 \anchor{refv up}{
12724 \refv
12725 }
12726 \anchor{refv down}{
12727 \refv
12728 \pgf@y=-\pgf@y
12729 }
12730 \savedanchor\outport{
12731 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12732 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12733 \pgf@y=.5\pgf@y
12734 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
12735 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12736 \pgf@x=-.5\pgf@x
12737 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
12738 }
12739 \anchor{out}{
12740 \outport
12741 \pgf@y=0pt
12742 }
12743 \anchor{out +}{
12744 \outport
12745 }
12746 \anchor{out -}{
12747 \outport
12748 \pgf@y=-\pgf@y
12749 }
12750 \savedanchor\outportfixed{
12751 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12752 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
12753 \pgf@y=.5\pgf@y
12754 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
12755 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12756 \pgf@x=-.5\pgf@x
12757 }
12758 \anchor{out up}{
12759 \outportfixed
12760 }
12761 \anchor{out down}{
12762 \outportfixed
12763 \pgf@y=-\pgf@y
12764 }
12765 % support for border anchors
12766 \savedanchor\leftedge{%
12767 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12768 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
12769 \pgf@x=.5\pgf@x
12770 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
12771 \pgf@y=0pt
12772 }
12773 \anchor{leftedge}{\leftedge}
12774 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
12775 \anchor{bin up}{
12776 \inOneFixed
12777 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12778 }
12779 \anchor{bin down}{
12780 \inOneFixed
12781 \pgf@y=-\pgf@y
12782 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12783 }
12784 \anchor{b-}{
12785 \inOne
12786 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12787 }
12788 \anchor{b+}{
12789 \inOne
12790 \pgf@y=-\pgf@y
12791 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12792 }
12793 \anchor{bout}{
12794 \leftedge
12795 \pgf@x=-\pgf@x \pgf@y=0pt
12796 }
12797 \anchor{bout +}{
12798 \outport
12799 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
12800 }
12801 \anchor{bout -}{
12802 \outport
12803 \pgf@y=-\pgf@y
12804 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
12805 }
12806 \anchor{bout up}{
12807 \outportfixed
12808 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
12809 }
12810 \anchor{bout down}{
12811 \outportfixed
12812 \pgf@y=-\pgf@y
12813 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
12814 }
12815 % end border anchors
12816 %
12817 \anchor{west}{
12818 \left
12819 }
12820 \anchor{east}{
12821 \left
12822 \pgf@x=-\pgf@x
12823 }
12824 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
12825 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
12826 \anchor{north west}{ \northwest }
12827 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
12828 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12829
12830 % let's start drawing the component
12831 \backgroundpath{
12832 \pgfsetcolor{\ctikzvalof{color}}
12833 %
12834 \northwest
12835 \pgf@circ@res@up = \pgf@y
12836 \pgf@circ@res@down = -\pgf@y
12837 \pgf@circ@res@right = -\pgf@x
12838 \pgf@circ@res@left = \pgf@x
12839 \pgf@circ@scaled@Rlen=\scaledRlen
12840 % main component, normally in thicker lines
12841 \pgfscope
12842 \newdimen\pgf@circ@res@right@double
12843 \pgf@circ@res@right@double=2\pgf@circ@res@right
12844
12845 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12846 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
12847 \pgf@circ@res@step=\pgf@circ@res@right
12848 \advance\pgf@circ@res@step by -\pgf@circ@res@left
12849 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
12850 %first point (near output)
12851 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
12852 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
12853 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
12854 % and then to the input "front up", "down", to the output short side "down"
12855 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12856 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12857 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@down}}
12858 % ...and close
12859 \pgfpathclose
12860 \pgf@circ@draworfill
12861 \endpgfscope
12862
12863 % input terminal up
12864 \pgfpathmoveto{\pgfpoint
12865 {\pgf@circ@res@left}
12866 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
12867 %
12868 \pgfpathlineto{\pgfpoint
12869 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
12870 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
12871 %
12872 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
12873
12874 % input terminal down
12875 \pgfpathmoveto{\pgfpoint
12876 {\pgf@circ@res@left}
12877 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
12878 %
12879 \pgfpathlineto{\pgfpoint
12880 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
12881 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
12882 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
12883
12884 % output leads down and up
12885 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
12886 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
12887 \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi}
12888
12889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
12890 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
12891 \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi}
12892 %
12893 \pgfsetrectcap
12894 \pgfusepath{draw}
12895 }
12896 }
12897
12898 % Transconductance amplifier (Transkonduktanzverstärker)
12899 \pgfdeclareshape{gm amp}
12900 {
12901 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
12902 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12903 \anchor{center}{\pgfpointorigin}
12904 \savedanchor\northwest{%
12905 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12906 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
12907 \pgf@y=.5\pgf@y
12908 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
12909 \pgf@x=.5\pgf@x
12910 }
12911 \anchor{south}{
12912 \northwest
12913 \pgf@y=-\pgf@y
12914 }
12915 \anchor{north}{
12916 \northwest
12917 }
12918 \savedanchor\left{%
12919 \pgf@y=0pt
12920 }
12921 \anchor{leftedge}
12922 {\left
12923 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
12924 }
12925 \savedanchor\inOneFixed{%
12926 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12927 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
12928 \pgf@y=.5\pgf@y
12929 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
12930 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
12931 \pgf@x=.5\pgf@x
12932 }
12933 \anchor{in up}{
12934 \inOneFixed
12935 }
12936 \anchor{in down}{
12937 \inOneFixed
12938 \pgf@y=-\pgf@y
12939 }
12940 \savedanchor\inOne{%
12941 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12942 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
12943 \pgf@y=.5\pgf@y
12944 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
12945 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
12946 \pgf@x=.5\pgf@x
12947 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
12948 }
12949 \anchor{-}{
12950 \inOne
12951 }
12952 \anchor{+}{
12953 \inOne
12954 \pgf@y=-\pgf@y
12955 }
12956 \savedanchor\up{%
12957 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12958 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
12959 \pgf@y=.5\pgf@y
12960 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
12961 \pgf@x=.5\pgf@x
12962 \pgf@circ@res@up = \pgf@y
12963 \pgf@circ@res@right = -\pgf@x
12964 \pgf@circ@res@left = \pgf@x
12965 \pgfpointlineattime{
12966 \ctikzvalof{tripoles/gm amp/up pos}}{
12967 \pgfpoint{
12968 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
12969 {\pgf@circ@res@up}}
12970 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
12971 }
12972 \anchor{up}{
12973 \up
12974 }
12975 \anchor{down}{
12976 \up
12977 \pgf@y=-\pgf@y
12978 }
12979 \anchor{out}{
12980 \northwest
12981 \pgf@y=0pt
12982 \pgf@x=-\pgf@x
12983 }
12984 % support for border anchors
12985 \savedanchor\leftedge{%
12986 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12987 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
12988 \pgf@x=.5\pgf@x
12989 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
12990 \pgf@y=0pt
12991 }
12992 \anchor{leftedge}{\leftedge}
12993 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
12994 \anchor{bin up}{
12995 \inOneFixed
12996 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
12997 }
12998 \anchor{bin down}{
12999 \inOneFixed
13000 \pgf@y=-\pgf@y
13001 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13002 }
13003 \anchor{b-}{
13004 \inOne
13005 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13006 }
13007 \anchor{b+}{
13008 \inOne
13009 \pgf@y=-\pgf@y
13010 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13011 }
13012 \anchor{bout}{
13013 \leftedge
13014 \pgf@y=0pt
13015 \pgf@x=-\pgf@x
13016 }
13017 % end border anchors
13018 \anchor{west}{
13019 \left
13020 }
13021 \anchor{east}{
13022 \left
13023 \pgf@x=-\pgf@x
13024 }
13025 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13026 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13027 \anchor{north west}{ \northwest }
13028 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13029
13030 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13031 \backgroundpath{
13032 \pgfsetcolor{\ctikzvalof{color}}
13033
13034 \northwest
13035 \pgf@circ@res@up = \pgf@y
13036 \pgf@circ@res@down = -\pgf@y
13037 \pgf@circ@res@right = -\pgf@x
13038 \pgf@circ@res@left = \pgf@x
13039 \pgf@circ@scaled@Rlen=\scaledRlen
13040
13041 \pgfscope
13042 \newdimen\pgf@circ@res@right@double
13043 \pgf@circ@res@right@double=2\pgf@circ@res@right
13044
13045 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13046 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
13047 \pgf@circ@res@step=\pgf@circ@res@right
13048 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13049 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
13050 %Umrandung:
13051 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
13052 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}%vom Ausgang nach oben
13053 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
13054 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
13055 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}}%ecke links unten nach rechts unten
13056 \pgfpathclose
13057 \pgf@circ@draworfill
13058 \endpgfscope
13059
13060 \pgfpathmoveto{\pgfpoint
13061 {\pgf@circ@res@left}
13062 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
13063 \pgfpathlineto{\pgfpoint
13064 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
13065 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
13066 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
13067
13068
13069 \pgfpathmoveto{\pgfpoint
13070 {\pgf@circ@res@left}
13071 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
13072 \pgfpathlineto{\pgfpoint
13073 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
13074 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
13075 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
13076
13077 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13078 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
13079 \pgfsetrectcap
13080 \pgfusepath{draw}
13081
13082 }
13083 }
13084
13085 % Instrumentation amplifier
13086 \pgfdeclareshape{inst amp}
13087 {
13088 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13089 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13090 % when tikz calls the anchor it wants the relative position in the lengths
13091 % \pgf@x \pgf@y
13092 % \pgfpoint* functions set that variables
13093 % anchors are visible outside and run on use
13094 \anchor{center}{\pgfpointorigin}
13095 % savedanchors are internals and run on node creation (not use)
13096 % bounding-box top left
13097 \savedanchor\northwest{%
13098 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13099 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
13100 \pgf@y=.5\pgf@y
13101 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13102 \pgf@x=.5\pgf@x
13103 }
13104 \anchor{nw}{
13105 \northwest
13106 }
13107 \anchor{south}{
13108 \northwest
13109 \pgf@y=-\pgf@y
13110 }
13111 \anchor{north}{
13112 \northwest
13113 }
13114 \savedanchor\left{%
13115 \pgf@y=0pt
13116 }
13117 \anchor{leftedge}
13118 {\left
13119 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
13120 }
13121 \savedanchor\inOneFixed{%
13122 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13123 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
13124 \pgf@y=.5\pgf@y
13125 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
13126 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13127 \pgf@x=.5\pgf@x
13128 }
13129 \anchor{in up}{
13130 \inOneFixed
13131 }
13132 \anchor{in down}{
13133 \inOneFixed
13134 \pgf@y=-\pgf@y
13135 }
13136 \savedanchor\inOne{%
13137 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13138 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
13139 \pgf@y=.5\pgf@y
13140 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
13141 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13142 \pgf@x=.5\pgf@x
13143 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13144 }
13145 \anchor{-}{
13146 \inOne
13147 }
13148 \anchor{+}{
13149 \inOne
13150 \pgf@y=-\pgf@y
13151 }
13152 \savedanchor\up{%
13153 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13154 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
13155 \pgf@y=.5\pgf@y
13156 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13157 \pgf@x=.5\pgf@x
13158 \pgf@circ@res@up = \pgf@y
13159 \pgf@circ@res@right = -\pgf@x
13160 \pgf@circ@res@left = \pgf@x
13161 \pgfpointlineattime{
13162 \ctikzvalof{tripoles/inst amp/up pos}}{
13163 \pgfpoint{
13164 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
13165 {\pgf@circ@res@up}}
13166 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
13167 }
13168 \anchor{up}{
13169 \up
13170 }
13171 \anchor{down}{
13172 \up
13173 \pgf@y=-\pgf@y
13174 }
13175 % reference voltage input anchors.
13176 \savedanchor\refv{%
13177 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13178 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
13179 \pgf@y=.5\pgf@y
13180 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13181 \pgf@x=.5\pgf@x
13182 \pgf@circ@res@up = \pgf@y
13183 \pgf@circ@res@right = -\pgf@x
13184 \pgf@circ@res@left = \pgf@x
13185 \pgfpointlineattime{
13186 \ctikzvalof{tripoles/inst amp/refv pos}}{
13187 \pgfpoint{
13188 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
13189 {\pgf@circ@res@up}}
13190 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
13191 }
13192 % we need both because they are normally drawn under the amp, and if you
13193 % mirror it vertically you need them
13194 \anchor{refv up}{
13195 \refv
13196 }
13197 \anchor{refv down}{
13198 \refv
13199 \pgf@y=-\pgf@y
13200 }
13201 \anchor{out}{
13202 \northwest
13203 \pgf@y=0pt
13204 \pgf@x=-\pgf@x
13205 }
13206 % support for border anchors
13207 \savedanchor\leftedge{%
13208 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13209 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
13210 \pgf@x=.5\pgf@x
13211 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
13212 \pgf@y=0pt
13213 }
13214 \anchor{leftedge}{\leftedge}
13215 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13216 \anchor{bin up}{
13217 \inOneFixed
13218 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13219 }
13220 \anchor{bin down}{
13221 \inOneFixed
13222 \pgf@y=-\pgf@y
13223 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13224 }
13225 \anchor{b-}{
13226 \inOne
13227 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13228 }
13229 \anchor{b+}{
13230 \inOne
13231 \pgf@y=-\pgf@y
13232 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13233 }
13234 \anchor{bout}{
13235 \leftedge
13236 \pgf@y=0pt
13237 \pgf@x=-\pgf@x
13238 }
13239 % end border anchors
13240 \anchor{west}{
13241 \left
13242 }
13243 \anchor{east}{
13244 \left
13245 \pgf@x=-\pgf@x
13246 }
13247 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13248 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13249 \anchor{north west}{ \northwest }
13250 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13251
13252 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13253
13254 % let's start drawing the component
13255 \backgroundpath{
13256 \pgfsetcolor{\ctikzvalof{color}}
13257 %
13258 \northwest
13259 \pgf@circ@res@up = \pgf@y
13260 \pgf@circ@res@down = -\pgf@y
13261 \pgf@circ@res@right = -\pgf@x
13262 \pgf@circ@res@left = \pgf@x
13263 \pgf@circ@scaled@Rlen=\scaledRlen
13264
13265 % main component, normally in thicker lines
13266 \pgfscope
13267 \newdimen\pgf@circ@res@right@double
13268 \pgf@circ@res@right@double=2\pgf@circ@res@right
13269
13270 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13271 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
13272 \pgf@circ@res@step=\pgf@circ@res@right
13273 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13274 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
13275 %first point (near output)
13276 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
13277 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
13278 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
13279 % and then to the input "front up", "down", to the output short side "down"
13280 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13281 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13282 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
13283 % ...and close
13284 \pgfpathclose
13285 \pgf@circ@draworfill
13286 \endpgfscope
13287
13288 % Negative input terminal
13289 \pgfpathmoveto{\pgfpoint
13290 {\pgf@circ@res@left}
13291 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
13292 %
13293 \pgfpathlineto{\pgfpoint
13294 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
13295 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
13296 %
13297 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
13298
13299 % Positive input terminal
13300 \pgfpathmoveto{\pgfpoint
13301 {\pgf@circ@res@left}
13302 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
13303 %
13304 \pgfpathlineto{\pgfpoint
13305 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
13306 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
13307 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
13308
13309 % Output terminal
13310 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13311 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
13312 %
13313 \pgfsetrectcap
13314 \pgfusepath{draw}
13315 }
13316 }
13317
13318 % Instrumentation amplifier with terminals for gain resistance between inputs
13319 \pgfdeclareshape{inst amp ra}
13320 {
13321 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13322 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13323 \anchor{center}{\pgfpointorigin}
13324 % bounding-box top left
13325 \savedanchor\northwest{%
13326 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13327 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
13328 \pgf@y=.5\pgf@y
13329 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13330 \pgf@x=.5\pgf@x
13331 }
13332 \anchor{nw}{
13333 \northwest
13334 }
13335 \anchor{south}{
13336 \northwest
13337 \pgf@y=-\pgf@y\pgf@x=0pt\relax
13338 }
13339 \anchor{north}{
13340 \northwest\pgf@x=0pt\relax
13341 }
13342 \savedanchor\left{%
13343 \pgf@y=0pt
13344 }
13345 \anchor{leftedge}
13346 {\left
13347 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
13348 }
13349 % inputs (+-)
13350 \savedanchor\inOneFixed{%
13351 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13352 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
13353 \pgf@y=.5\pgf@y
13354 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
13355 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13356 \pgf@x=.5\pgf@x
13357 }
13358 \anchor{in up}{
13359 \inOneFixed
13360 }
13361 \anchor{in down}{
13362 \inOneFixed
13363 \pgf@y=-\pgf@y
13364 }
13365 \savedanchor\inOne{%
13366 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13367 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
13368 \pgf@y=.5\pgf@y
13369 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
13370 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13371 \pgf@x=.5\pgf@x
13372 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13373 }
13374 \anchor{-}{
13375 \inOne
13376 }
13377 \anchor{+}{
13378 \inOne
13379 \pgf@y=-\pgf@y
13380 }
13381 % R ampli anchors. They are by default at 20% more than R-length distance
13382 % you can change that with the `ra pos` key (use 0.5 for one-R).
13383 \savedanchor\raOneFixed{%
13384 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13385 \pgf@y=\pgf@circ@scaled@Rlen
13386 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
13387 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13388 \pgf@x=.5\pgf@x
13389 }
13390 \anchor{ra up}{
13391 \raOneFixed
13392 }
13393 \anchor{ra down}{
13394 \raOneFixed
13395 \pgf@y=-\pgf@y
13396 }
13397 \savedanchor\raOne{%
13398 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13399 \pgf@y=\pgf@circ@scaled@Rlen
13400 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
13401 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13402 \pgf@x=.5\pgf@x
13403 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13404 }
13405 \anchor{ra-}{
13406 \raOne
13407 }
13408 \anchor{ra+}{
13409 \raOne
13410 \pgf@y=-\pgf@y
13411 }
13412 % power supplies
13413 \savedanchor\up{%
13414 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13415 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
13416 \pgf@y=.5\pgf@y
13417 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13418 \pgf@x=.5\pgf@x
13419 \pgf@circ@res@up = \pgf@y
13420 \pgf@circ@res@right = -\pgf@x
13421 \pgf@circ@res@left = \pgf@x
13422 \pgfpointlineattime{
13423 \ctikzvalof{tripoles/inst amp ra/up pos}}{
13424 \pgfpoint{
13425 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13426 {\pgf@circ@res@up}}
13427 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
13428 }
13429 \anchor{up}{
13430 \up
13431 }
13432 \anchor{down}{
13433 \up
13434 \pgf@y=-\pgf@y
13435 }
13436 % reference voltage input anchors.
13437 \savedanchor\refv{%
13438 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13439 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
13440 \pgf@y=0.5\pgf@y
13441 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13442 \pgf@x=0.5\pgf@x
13443 \pgf@circ@res@up = \pgf@y
13444 \pgf@circ@res@right = -\pgf@x
13445 \pgf@circ@res@left = \pgf@x
13446 \pgfpointlineattime{
13447 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
13448 \pgfpoint{
13449 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13450 {\pgf@circ@res@up}}
13451 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
13452 }
13453 % we need both because they are normally drawn under the amp, and if you
13454 % mirror it vertically you need them
13455 \anchor{refv up}{
13456 \refv
13457 }
13458 \anchor{refv down}{
13459 \refv
13460 \pgf@y=-\pgf@y
13461 }
13462 \anchor{out}{
13463 \northwest
13464 \pgf@y=0pt
13465 \pgf@x=-\pgf@x
13466 }
13467 % support for border anchors
13468 \savedanchor\leftedge{%
13469 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13470 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
13471 \pgf@x=.5\pgf@x
13472 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
13473 \pgf@y=0pt
13474 }
13475 \anchor{leftedge}{\leftedge}
13476 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13477 \anchor{bin up}{
13478 \inOneFixed
13479 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13480 }
13481 \anchor{bin down}{
13482 \inOneFixed
13483 \pgf@y=-\pgf@y
13484 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13485 }
13486 \anchor{b-}{
13487 \inOne
13488 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13489 }
13490 \anchor{b+}{
13491 \inOne
13492 \pgf@y=-\pgf@y
13493 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13494 }
13495 \anchor{bra up}{
13496 \raOneFixed
13497 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13498 }
13499 \anchor{bra down}{
13500 \raOneFixed
13501 \pgf@y=-\pgf@y
13502 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13503 }
13504 \anchor{bra-}{
13505 \raOne
13506 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13507 }
13508 \anchor{bra+}{
13509 \raOne
13510 \pgf@y=-\pgf@y
13511 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13512 }
13513 \anchor{bout}{
13514 \leftedge
13515 \pgf@y=0pt
13516 \pgf@x=-\pgf@x
13517 }
13518 % end border anchors
13519 \anchor{west}{
13520 \left
13521 }
13522 \anchor{east}{
13523 \left
13524 \pgf@x=-\pgf@x
13525 }
13526 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13527 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13528 \anchor{north west}{ \northwest }
13529 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13530
13531 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13532
13533 % drawing of the component
13534 \backgroundpath{
13535 \pgfsetcolor{\ctikzvalof{color}}
13536
13537 \northwest
13538 \pgf@circ@res@up = \pgf@y
13539 \pgf@circ@res@down = -\pgf@y
13540 \pgf@circ@res@right = -\pgf@x
13541 \pgf@circ@res@left = \pgf@x
13542 \pgf@circ@scaled@Rlen=\scaledRlen
13543
13544 \newdimen\pgf@circ@res@right@double
13545 \pgf@circ@res@right@double=2\pgf@circ@res@right
13546
13547 % main component, normally in thicker lines
13548 \pgfscope
13549 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13550 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13551 \pgf@circ@res@step=\pgf@circ@res@right
13552 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13553 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
13554 %primer punto: la linea de salida (lado componente)
13555 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
13556 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
13557 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
13558 % and then to the input "front up", "down", to the output short side "down"
13559 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13560 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13561 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@down}}
13562 % ...and close
13563 \pgfpathclose
13564 \pgf@circ@draworfill
13565 \endpgfscope
13566
13567 % ra terminal -
13568 \pgfpathmoveto{\pgfpoint
13569 {\pgf@circ@res@left}
13570 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
13571 %
13572 \pgfpathlineto{\pgfpoint
13573 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13574 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
13575 % ra terminal +
13576 \pgfpathmoveto{\pgfpoint
13577 {\pgf@circ@res@left}
13578 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
13579 %
13580 \pgfpathlineto{\pgfpoint
13581 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13582 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
13583
13584 % Negative input terminal
13585 \pgfpathmoveto{\pgfpoint
13586 {\pgf@circ@res@left}
13587 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
13588 %
13589 \pgfpathlineto{\pgfpoint
13590 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13591 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
13592 %
13593 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
13594
13595 % Positive input terminal
13596 \pgfpathmoveto{\pgfpoint
13597 {\pgf@circ@res@left}
13598 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
13599 %
13600 \pgfpathlineto{\pgfpoint
13601 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
13602 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
13603 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
13604
13605 % Output terminal
13606 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13607 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
13608 %
13609 \pgfsetrectcap
13610 \pgfusepath{draw}
13611 }
13612 }
13613
13614 % Buffer
13615 % Contributed by Danilo Piazzalunga
13616 \pgfdeclareshape{buffer}
13617 {
13618 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13619 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13620 \anchor{center}{\pgfpointorigin}
13621 \savedanchor\northwest{%
13622 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13623 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
13624 \pgf@y=.5\pgf@y
13625 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
13626 \pgf@x=.5\pgf@x
13627 }
13628 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
13629 \anchor{west}{ \northwest \pgf@y=0pt }
13630 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
13631 \anchor{north}{ \northwest \pgf@x=0pt }
13632 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13633 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13634 \anchor{north west}{ \northwest }
13635 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13636 \savedanchor\left{%
13637 \pgf@y=0pt
13638 }
13639 \anchor{in}{
13640 \northwest
13641 \pgf@y=0pt
13642 }
13643 \anchor{out}{
13644 \northwest
13645 \pgf@y=0pt
13646 \pgf@x=-\pgf@x
13647 }
13648 \anchor{bin}{
13649 \northwest
13650 \pgf@y=0pt
13651 \pgf@x=0.7\pgf@x
13652 }
13653 \anchor{bout}{
13654 \northwest
13655 \pgf@y=0pt
13656 \pgf@x=-0.7\pgf@x
13657 }
13658
13659 \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13660
13661 \backgroundpath{
13662 \pgfsetcolor{\ctikzvalof{color}}
13663
13664 \northwest
13665 \pgf@circ@res@up = \pgf@y
13666 \pgf@circ@res@down = -\pgf@y
13667 \pgf@circ@res@right = -\pgf@x
13668 \pgf@circ@res@left = \pgf@x
13669 \pgf@circ@scaled@Rlen=\scaledRlen
13670 \pgfscope
13671 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13672 \pgftransformxshift{.7\pgf@circ@res@left}
13673 \pgf@circ@res@step=\pgf@circ@res@right
13674 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13675 \pgf@circ@res@step=.7\pgf@circ@res@step
13676
13677 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13678 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13679 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13680 \pgfpathclose
13681 \pgf@circ@draworfill
13682 \endpgfscope
13683
13684 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13685 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13686
13687 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13688 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13689
13690 \pgfusepath{draw}
13691 }
13692 }
13693
13694 % plain amplifier, no symbols
13695 \pgfdeclareshape{plain amp}
13696 {
13697 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13698 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13699 \anchor{center}{\pgfpointorigin}
13700 \savedanchor\northwest{%
13701 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13702 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13703 \pgf@y=.5\pgf@y
13704 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13705 \pgf@x=.5\pgf@x
13706 }
13707 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
13708 \anchor{west}{ \northwest \pgf@y=0pt }
13709 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
13710 \anchor{north}{ \northwest \pgf@x=0pt }
13711 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13712 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13713 \anchor{north west}{ \northwest }
13714 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13715 \savedanchor\left{%
13716 \pgf@y=0pt
13717 }
13718 \savedanchor\inOne{%
13719 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13720 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13721 \pgf@y=.5\pgf@y
13722 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
13723 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13724 \pgf@x=.5\pgf@x
13725 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13726 }
13727 \savedanchor\inOneFixed{%
13728 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13729 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13730 \pgf@y=.5\pgf@y
13731 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
13732 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13733 \pgf@x=.5\pgf@x
13734 }
13735 \anchor{-}{
13736 \inOne
13737 }
13738 \anchor{+}{
13739 \inOne
13740 \pgf@y=-\pgf@y
13741 }
13742 \anchor{in up}{
13743 \inOneFixed
13744 }
13745 \anchor{in down}{
13746 \inOneFixed
13747 \pgf@y=-\pgf@y
13748 }
13749 % support for border anchors
13750 \savedanchor\leftedge{%
13751 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13752 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13753 \pgf@x=.5\pgf@x
13754 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
13755 \pgf@y=0pt
13756 }
13757 \anchor{leftedge}{\leftedge}
13758 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13759 \anchor{bin up}{
13760 \inOneFixed
13761 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13762 }
13763 \anchor{bin down}{
13764 \inOneFixed
13765 \pgf@y=-\pgf@y
13766 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13767 }
13768 \anchor{b-}{
13769 \inOne
13770 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13771 }
13772 \anchor{b+}{
13773 \inOne
13774 \pgf@y=-\pgf@y
13775 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13776 }
13777 \anchor{bout}{
13778 \leftedge
13779 \pgf@y=0pt
13780 \pgf@x=-\pgf@x
13781 }
13782 % end border anchors
13783 \savedanchor\up{%
13784 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13785 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13786 \pgf@y=.5\pgf@y
13787 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13788 \pgf@x=.5\pgf@x
13789 \pgf@circ@res@up = \pgf@y
13790 \pgf@circ@res@right = -\pgf@x
13791 \pgf@circ@res@left = \pgf@x
13792 \pgfpointlineattime{
13793 \ctikzvalof{tripoles/plain amp/up pos}}{
13794 \pgfpoint{
13795 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13796 {\pgf@circ@res@up}}
13797 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
13798 }
13799 \anchor{up}{
13800 \up
13801 }
13802 \anchor{down}{
13803 \up
13804 \pgf@y=-\pgf@y
13805 }
13806 \anchor{out}{
13807 \northwest
13808 \pgf@y=0pt
13809 \pgf@x=-\pgf@x
13810 }
13811
13812 \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13813
13814 \backgroundpath{
13815 \pgfsetcolor{\ctikzvalof{color}}
13816
13817 \northwest
13818 \pgf@circ@res@up = \pgf@y
13819 \pgf@circ@res@down = -\pgf@y
13820 \pgf@circ@res@right = -\pgf@x
13821 \pgf@circ@res@left = \pgf@x
13822
13823 \pgfscope
13824 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13825 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13826 \pgf@circ@res@step=\pgf@circ@res@right
13827 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13828 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
13829
13830 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13831 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13832 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13833 \pgfpathclose
13834 \pgf@circ@draworfill
13835 \endpgfscope
13836 \pgfpathmoveto{\pgfpoint
13837 {\pgf@circ@res@left}
13838 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
13839 \pgfpathlineto{\pgfpoint
13840 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13841 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
13842
13843
13844 \pgfpathmoveto{\pgfpoint
13845 {\pgf@circ@res@left}
13846 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
13847 \pgfpathlineto{\pgfpoint
13848 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13849 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
13850
13851 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13852 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
13853
13854 \pgfusepath{draw}
13855 }
13856 }
13857
13858 % plain amplifier, no symbols, one input
13859 \pgfdeclareshape{plain mono amp}
13860 {
13861 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13862 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13863 \anchor{center}{\pgfpointorigin}
13864 \savedanchor\northwest{%
13865 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13866 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13867 \pgf@y=.5\pgf@y
13868 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13869 \pgf@x=.5\pgf@x
13870 }
13871 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
13872 \anchor{west}{ \northwest \pgf@y=0pt }
13873 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
13874 \anchor{north}{ \northwest \pgf@x=0pt }
13875 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13876 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13877 \anchor{north west}{ \northwest }
13878 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13879 \savedanchor\left{%
13880 \pgf@y=0pt
13881 }
13882 \savedanchor\inOne{%
13883 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13884 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13885 \pgf@x=.5\pgf@x
13886 \pgf@y=0pt\relax
13887 }
13888 \anchor{in}{
13889 \inOne
13890 }
13891 % support for border anchors
13892 \savedanchor\leftedge{%
13893 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13894 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13895 \pgf@x=.5\pgf@x
13896 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
13897 \pgf@y=0pt
13898 }
13899 \anchor{leftedge}{\leftedge}
13900 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13901 \anchor{bin}{
13902 \inOne
13903 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13904 }
13905 \anchor{bout}{
13906 \leftedge
13907 \pgf@y=0pt
13908 \pgf@x=-\pgf@x
13909 }
13910 % end border anchors
13911 \savedanchor\up{%
13912 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13913 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
13914 \pgf@y=.5\pgf@y
13915 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
13916 \pgf@x=.5\pgf@x
13917 \pgf@circ@res@up = \pgf@y
13918 \pgf@circ@res@right = -\pgf@x
13919 \pgf@circ@res@left = \pgf@x
13920 \pgfpointlineattime{
13921 \ctikzvalof{tripoles/plain amp/up pos}}{
13922 \pgfpoint{
13923 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13924 {\pgf@circ@res@up}}
13925 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
13926 }
13927 \anchor{up}{
13928 \up
13929 }
13930 \anchor{down}{
13931 \up
13932 \pgf@y=-\pgf@y
13933 }
13934 \anchor{out}{
13935 \northwest
13936 \pgf@y=0pt
13937 \pgf@x=-\pgf@x
13938 }
13939
13940 \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
13941
13942 \backgroundpath{
13943 \pgfsetcolor{\ctikzvalof{color}}
13944
13945 \northwest
13946 \pgf@circ@res@up = \pgf@y
13947 \pgf@circ@res@down = -\pgf@y
13948 \pgf@circ@res@right = -\pgf@x
13949 \pgf@circ@res@left = \pgf@x
13950
13951 \pgfscope
13952 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13953 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13954 \pgf@circ@res@step=\pgf@circ@res@right
13955 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13956 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
13957
13958 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13959 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13960 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13961 \pgfpathclose
13962 \pgf@circ@draworfill
13963 \endpgfscope
13964 \pgfpathmoveto{\pgfpoint
13965 {\pgf@circ@res@left}
13966 {0pt}}
13967 \pgfpathlineto{\pgfpoint
13968 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
13969 {0pt}}
13970
13971 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13972 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
13973
13974 \pgfusepath{draw}
13975 }
13976 }
13977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13978 %% electromechanical device (motor/generator)
13979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13980
13981 \pgfdeclareshape{elmech}
13982 {
13983 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
13984 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13985 \savedanchor\northwest{
13986 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13987 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
13988 \pgf@y=.5\pgf@y
13989 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
13990 \pgf@x=.5\pgf@x
13991 }
13992 \anchor{center}{
13993 \pgfpointorigin
13994 }
13995 \anchor{text}{
13996 \pgfpointorigin
13997 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
13998 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
13999 }
14000 \anchor{left}{%
14001 \northwest
14002 \pgf@y=0pt
14003 }
14004 \anchor{right}{%
14005 \northwest
14006 \pgf@y=0pt
14007 \pgf@x=-\pgf@x
14008 }
14009 \anchor{top}{
14010 \northwest
14011 \pgf@x=0pt
14012 }
14013 \anchor{pathstart}{
14014 \northwest
14015 \pgf@x=0pt
14016 }
14017 \anchor{pathend}{
14018 \northwest
14019 \pgf@x=0pt
14020 \pgf@y=-\pgf@y
14021 }
14022 \anchor{bottom}{
14023 \northwest
14024 \pgf@x=0pt
14025 \pgf@y=-\pgf@y
14026 }
14027 \anchor{center}{
14028 \pgf@y=0pt
14029 \pgf@x=0pt
14030 }
14031 \anchor{east}{
14032 \northwest
14033 \pgf@y=0pt
14034 \pgf@x=-\pgf@x
14035 }
14036 \anchor{west}{
14037 \northwest
14038 \pgf@y=0pt
14039 }
14040 \anchor{south}{
14041 \northwest
14042 \pgf@x=0pt
14043 \pgf@y=-\pgf@y
14044 }
14045 \anchor{north}{
14046 \northwest
14047 \pgf@x=0pt
14048 }
14049 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14050 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14051 \anchor{north west}{ \northwest }
14052 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14053 \anchorborder{%
14054 \@tempdima=\pgf@x\@tempdimb=\pgf@y
14055 \northwest\pgf@circ@res@other=-\pgf@x
14056 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
14057 }
14058 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
14059 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
14060 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
14061 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
14062 \anchor{block up right}{
14063 \northwest
14064 % remember that pgf@x is negative
14065 % center of the block is at 0.5*H+W*cos(30)/2
14066 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
14067 \pgf@x=-0.5\pgf@x
14068 }
14069 \anchor{block up left}{
14070 \northwest
14071 % remember that pgf@x is negative
14072 % center of the block is at 0.5*H+W*cos(30)/2
14073 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
14074 \pgf@x=0.5\pgf@x
14075 }
14076 \anchor{block down right}{
14077 \northwest
14078 % remember that pgf@x is negative
14079 % center of the block is at 0.5*H+W*cos(30)/2
14080 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
14081 \pgf@y=-\pgf@y
14082 \pgf@x=-0.5\pgf@x
14083 }
14084 \anchor{block down left}{
14085 \northwest
14086 % remember that pgf@x is negative
14087 % center of the block is at 0.5*H+W*cos(30)/2
14088 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
14089 \pgf@y=-\pgf@y
14090 \pgf@x=0.5\pgf@x
14091 }
14092 \behindbackgroundpath{
14093 \pgfsetcolor{\ctikzvalof{color}}
14094 \pgf@circ@scaled@Rlen=\scaledRlen
14095 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
14096 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
14097 \pgfscope
14098 \pgfstartlinewidth=\pgflinewidth
14099 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
14100 \pgfscope % clip the bar: whole size minus the circle
14101 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
14102 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
14103 \pgfseteorule
14104 \pgfusepath{clip}
14105 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
14106 \pgfsetfillcolor{\ctikzvalof{color}}
14107 \pgfusepath{fill, draw}
14108 \endpgfscope
14109 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
14110 \ifx\tikz@fillcolor\pgfutil@empty
14111 % set the default fill color to white
14112 \pgfsetfillcolor{white}
14113 % ...but override it if the class is defined!
14114 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
14115 \else
14116 \pgfsetfillcolor{\tikz@fillcolor}
14117 \pgfusepath{draw, fill}
14118 \fi
14119 \endpgfscope
14120 }
14121 }
14122
14123 %%%%%%%%%%%%%%%%%%%
14124 %% Magnetron
14125 %%%%%%%%%%%%%%%%%%%
14126
14127 \pgfdeclareshape{magnetron}
14128 {
14129 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
14130 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14131 \savedanchor\northwest{
14132 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14133 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
14134 \pgf@y=.5\pgf@y
14135 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
14136 \pgf@x=.5\pgf@x
14137 }
14138 \anchor{center}{
14139 \pgfpointorigin
14140 }
14141 \anchor{anode}{
14142 \northwest
14143 \pgf@x=0pt
14144 \pgf@y=-\pgf@y
14145 }
14146 \anchor{cathode1}{
14147 \northwest
14148 \pgf@circ@res@step=\pgf@y
14149 \pgfmathparse{cos(105)}
14150 \pgf@x=\pgfmathresult\pgf@circ@res@step
14151 \pgfmathparse{sin(105)}
14152 \pgf@y=\pgfmathresult\pgf@circ@res@step
14153 %\pgfpointorigin
14154 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
14155 }
14156 \anchor{cathode2}{
14157 \northwest
14158 \pgf@circ@res@step=\pgf@y
14159 \pgfmathparse{cos(75)}
14160 \pgf@x=\pgfmathresult\pgf@circ@res@step
14161 \pgfmathparse{sin(75)}
14162 \pgf@y=\pgfmathresult\pgf@circ@res@step
14163 %\pgfpointorigin
14164 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
14165 }
14166 \anchor{text}{
14167 \pgfpointorigin
14168 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
14169 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
14170 }
14171 \anchor{left}{%
14172 \northwest
14173 \pgf@y=0pt
14174 }
14175 \anchor{right}{%
14176 \northwest
14177 \pgf@y=0pt
14178 \pgf@x=-\pgf@x
14179 }
14180 \anchor{top}{
14181 \northwest
14182 \pgf@x=0pt
14183 }
14184 \anchor{pathstart}{
14185 \northwest
14186 \pgf@x=0pt
14187 }
14188 \anchor{pathend}{
14189 \northwest
14190 \pgf@x=0pt
14191 \pgf@y=-\pgf@y
14192 }
14193 \anchor{bottom}{
14194 \northwest
14195 \pgf@x=0pt
14196 \pgf@y=-\pgf@y
14197 }
14198 \anchor{center}{
14199 \pgf@y=0pt
14200 \pgf@x=0pt
14201 }
14202 \anchor{east}{
14203 \northwest
14204 \pgf@y=0pt
14205 \pgf@x=-\pgf@x
14206 }
14207 \anchor{west}{
14208 \northwest
14209 \pgf@y=0pt
14210 }
14211 \anchor{south}{
14212 \northwest
14213 \pgf@x=0pt
14214 \pgf@y=-\pgf@y
14215 }
14216 \anchor{north}{
14217 \northwest
14218 \pgf@x=0pt
14219 }
14220 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14221 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14222 \anchor{north west}{ \northwest }
14223 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14224 \backgroundpath{
14225 \pgfsetcolor{\ctikzvalof{color}}
14226 \pgf@circ@scaled@Rlen=\scaledRlen
14227 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
14228 \northwest
14229 \pgf@circ@res@up = \pgf@y
14230 \pgf@circ@res@down = -\pgf@y
14231 \pgf@circ@res@right = -\pgf@x
14232 \pgf@circ@res@left = \pgf@x
14233 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
14234
14235 \pgfscope
14236 \pgfstartlinewidth=\pgflinewidth
14237 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
14238 %create outer circle
14239 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
14240 \pgf@circ@draworfill
14241 %create chambers
14242 \foreach \angle in {45,135,225,315}{
14243 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
14244 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
14245 }
14246 \pgfsetroundcap
14247 \pgfusepath{draw}
14248 \pgfscope
14249 %draw connection from outside
14250 %anode
14251 \pgfsetlinewidth{\pgfstartlinewidth}
14252 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
14253 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
14254 %cathodes
14255 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
14256 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
14257 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
14258 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
14259 \pgfsetbuttcap
14260 \pgfusepath{draw}
14261 \endpgfscope
14262 %create cathode
14263 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
14264 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
14265 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
14266 \pgfusepath{draw}
14267 %create anode
14268 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
14269 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
14270
14271 \pgfsetbuttcap
14272 \pgfusepath{draw}
14273 \endpgfscope
14274 }
14275 }
14276
14277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14278 % Electronic tubes, submitted by J. op den Brouw
14279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14280
14281 % Draw tube outline
14282 \def\pgf@circ@tubes@drawtube{%
14283 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
14284 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14285 \pgfutil@tempdima=\pgf@circ@res@right
14286 \advance\pgfutil@tempdima by -\pgf@circ@res@up
14287 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
14288 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
14289 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
14290 \pgfpatharc{270}{90}{\pgf@circ@res@up}
14291 \else
14292 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
14293 \pgfutil@tempdima=\pgf@circ@res@up
14294 \advance\pgfutil@tempdima by -\pgf@circ@res@right
14295 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
14296 \pgfpatharc{180}{0}{\pgf@circ@res@right}
14297 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
14298 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
14299 \fi
14300 \pgfpathclose
14301 }
14302
14303 %% The diode (tube), triode, tetrode and pentode only differ in the
14304 %% number of grids. So we construct a generic declare function in
14305 %% which we can put code for the grid anchors and grid drawing code
14306 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
14307 \long\def\pgfcircdeclaretube#1#2#3{%
14308 \pgfdeclareshape{#1}{
14309 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
14310 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14311 \anchor{center}{
14312 \pgfpointorigin
14313 }
14314 \savedanchor\northwest{%
14315 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14316 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
14317 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
14318 % x and y should be half the Rlen
14319 \pgf@y=\pgf@circ@res@up
14320 \pgf@y=.5\pgf@y
14321 \pgf@x=-\pgf@circ@res@right
14322 \pgf@x=.5\pgf@x
14323 }
14324 \anchor{north} {%
14325 \northwest
14326 \pgf@x=0pt
14327 }
14328 \anchor{east}{%
14329 \northwest
14330 \pgf@x=-\pgf@x
14331 \pgf@y=0pt
14332 }
14333 \anchor{south}{%
14334 \northwest
14335 \pgf@y=-\pgf@y
14336 \pgf@x=0pt
14337 }
14338 \anchor{west}{%
14339 \northwest
14340 \pgf@y=0pt
14341 }
14342 \anchor{north west}{%
14343 \northwest
14344 }
14345 \anchor{north east}{%
14346 \northwest
14347 \pgf@x=-\pgf@x
14348 }
14349 \anchor{south east}{
14350 \northwest
14351 \pgf@x=-\pgf@x
14352 \pgf@y=-\pgf@y
14353 }
14354 \anchor{south west}{
14355 \northwest
14356 \pgf@y=-\pgf@y
14357 }
14358 \anchor{anode} {%
14359 \northwest
14360 \pgf@x=0pt
14361 }
14362 \anchor{cathode}{%
14363 \northwest
14364 \pgf@y=-\pgf@y
14365 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
14366 }
14367 \anchor{cathode 1}{%
14368 \northwest
14369 \pgf@y=-\pgf@y
14370 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
14371 }
14372 \anchor{cathode 2}{%
14373 \northwest
14374 \pgf@y=-\pgf@y
14375 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
14376 }
14377 \anchor{filament 1}{%
14378 \northwest
14379 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
14380 \pgf@x=\pgfmathresult\pgf@x
14381 \pgf@y=-\pgf@y
14382 }
14383 \anchor{filament 2}{%
14384 \northwest
14385 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
14386 \pgf@x=-\pgfmathresult\pgf@x
14387 \pgf@y=-\pgf@y
14388 }
14389
14390 % Extra anchors
14391 #2
14392
14393 \backgroundpath{
14394 \pgfscope
14395 % Line width for tripoles
14396 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14397 \pgf@circ@scaled@Rlen=\scaledRlen
14398
14399 % Setup to draw tube
14400 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
14401 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
14402 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
14403 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
14404
14405 % Tube outline
14406 \pgf@circ@tubes@drawtube
14407
14408 % Setup to draw grid, filament, anode and cathode
14409 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
14410 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
14411 \pgf@circ@res@up=0.5\pgf@circ@res@up
14412 \pgf@circ@res@right=0.5\pgf@circ@res@right
14413
14414 % Tube fill color (if any)
14415 \pgf@circ@draworfill
14416
14417 % Grid drawing
14418 #3
14419
14420 % Filament (is not drawn by default)
14421 \ifpgf@circuit@tubes@filament
14422 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
14423 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
14424 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
14425 \pgf@xa=\pgfmathresult\pgf@circ@res@right
14426 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
14427 \pgf@ya=\pgfmathresult\pgf@circ@res@up
14428 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
14429 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
14430 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
14431 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
14432 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
14433 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
14434 \pgf@circuit@tubes@filamentfalse
14435 \fi
14436
14437 % Anode (or plate)
14438 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
14439 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
14440 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
14441 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
14442
14443 % Cathode
14444 \ifpgf@circuit@tubes@nocathode
14445 \pgf@circuit@tubes@nocathodefalse
14446 \else
14447 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
14448 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
14449 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
14450 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
14451 \ifpgf@circuit@tubes@fullcathode
14452 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
14453 \pgf@circuit@tubes@fullcathodefalse
14454 \else
14455 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}}
14456 \fi
14457 \fi
14458
14459 % Draw the background
14460 \pgfusepath{draw}
14461 \endpgfscope
14462 }
14463 }
14464 }
14465
14466 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
14467
14468 \pgfcircdeclaretube{triode}
14469 {
14470 \anchor{grid} {% should not be used
14471 \northwest
14472 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
14473 }
14474 \anchor{control} {%
14475 \northwest
14476 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
14477 }
14478 }
14479 {
14480 % Grid protrusion
14481 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
14482 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
14483 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
14484 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
14485 % Grid dashes: calculations
14486 \pgf@xb=2\pgf@circ@res@right
14487 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
14488 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
14489 \multiply\pgf@circ@count@a by 2\relax
14490 \advance\pgf@circ@count@a by 1\relax
14491 \advance\pgf@circ@res@step by -\pgf@xa
14492 \divide\pgf@circ@res@step by \pgf@circ@count@a
14493 % Grid dashes: draw
14494 \pgf@circ@res@temp=\pgf@xa
14495 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
14496 \loop
14497 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14498 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
14499 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14500 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
14501 \advance\pgf@circ@count@a by-1
14502 \ifnum\pgf@circ@count@a>0\relax
14503 \repeat
14504 }
14505
14506 \pgfcircdeclaretube{tetrode}
14507 {
14508 \anchor{grid} {% should not be used
14509 \northwest
14510 \pgfutil@tempdima=\pgf@y
14511 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14512 \pgf@y=0.5\pgf@y
14513 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14514 }
14515 \anchor{control} {%
14516 \northwest
14517 \pgfutil@tempdima=\pgf@y
14518 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14519 \pgf@y=0.5\pgf@y
14520 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14521 }
14522 \anchor{screen} {%
14523 \northwest
14524 \pgfutil@tempdima=\pgf@y
14525 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
14526 \pgf@y=0.5\pgf@y
14527 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14528 }
14529 }
14530 {
14531 % Grid x/y points
14532 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
14533 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
14534 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
14535 \pgfutil@tempdimb=-\pgfutil@tempdima
14536 \pgfutil@tempdima=0.5\pgfutil@tempdima
14537 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14538 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
14539 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14540 % Grid protrusion
14541 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
14542 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
14543 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
14544 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
14545 % Grid dashes: calculations
14546 \pgf@xb=2\pgf@circ@res@right
14547 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
14548 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
14549 \multiply\pgf@circ@count@a by 2\relax
14550 \advance\pgf@circ@count@a by 1\relax
14551 \advance\pgf@circ@res@step by -\pgf@xa
14552 \divide\pgf@circ@res@step by \pgf@circ@count@a
14553 % Grid dashes: draw
14554 \pgf@circ@res@temp=\pgf@xa
14555 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
14556 \loop
14557 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14558 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
14559 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
14560 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
14561 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
14562 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14563 \advance\pgf@circ@count@a by-1
14564 \ifnum\pgf@circ@count@a>0\relax
14565 \repeat
14566 }
14567
14568 \pgfcircdeclaretube{pentode}
14569 {
14570 \anchor{grid} {% should not be used
14571 \northwest
14572 \pgfutil@tempdima=\pgf@y
14573 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14574 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14575 }
14576 \anchor{control} {%
14577 \northwest
14578 \pgfutil@tempdima=\pgf@y
14579 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14580 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14581 }
14582 \anchor{screen} {%
14583 \northwest
14584 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
14585 }
14586 \anchor{suppressor} {%
14587 \northwest
14588 \pgfutil@tempdima=\pgf@y
14589 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
14590 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14591 }
14592 }
14593 {
14594 % Grid x/y points
14595 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
14596 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
14597 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
14598 \pgfutil@tempdimb=-\pgfutil@tempdima
14599 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14600 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14601 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14602 % Grid protrusion
14603 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
14604 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
14605 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
14606 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
14607 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
14608 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
14609 % Grid dashes: calculations
14610 \pgf@xb=2\pgf@circ@res@right
14611 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
14612 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
14613 \multiply\pgf@circ@count@a by 2\relax
14614 \advance\pgf@circ@count@a by 1\relax
14615 \advance\pgf@circ@res@step by -\pgf@xa
14616 \divide\pgf@circ@res@step by \pgf@circ@count@a
14617 % Grid dashes: draw
14618 \pgf@circ@res@temp=\pgf@xa
14619 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
14620 \loop
14621 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14622 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
14623 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
14624 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
14625 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
14626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
14627 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
14628 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14629 \advance\pgf@circ@count@a by-1
14630 \ifnum\pgf@circ@count@a>0\relax
14631 \repeat
14632 }
14633
14634 \pgfcircdeclaretube{pentode suppressor to cathode}
14635 {
14636 \anchor{grid} {% should not be used
14637 \northwest
14638 \pgfutil@tempdima=\pgf@y
14639 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14640 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14641 }
14642 \anchor{control} {%
14643 \northwest
14644 \pgfutil@tempdima=\pgf@y
14645 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
14646 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
14647 }
14648 \anchor{screen} {%
14649 \northwest
14650 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
14651 }
14652 }
14653 {
14654 % Grid x/y points
14655 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
14656 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
14657 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
14658 \pgfutil@tempdimb=-\pgfutil@tempdima
14659 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14660 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14661 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
14662 % Grid protrusion
14663 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
14664 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
14665 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
14666 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
14667 % Grid dashes: calculations
14668 \pgf@xb=2\pgf@circ@res@right
14669 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
14670 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
14671 \multiply\pgf@circ@count@a by 2\relax
14672 \advance\pgf@circ@count@a by 1\relax
14673 \advance\pgf@circ@res@step by -\pgf@xa
14674 \divide\pgf@circ@res@step by \pgf@circ@count@a
14675 % Grid dashes: draw
14676 \pgf@circ@res@temp=\pgf@xa
14677 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
14678 \loop
14679 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14680 \ifnum\pgf@circ@count@a>1\relax
14681 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
14682 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
14683 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
14684 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
14685 \fi
14686 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
14687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
14688 \advance\pgf@circ@res@temp by\pgf@circ@res@step
14689 \advance\pgf@circ@count@a by-1
14690 \ifnum\pgf@circ@count@a>0\relax
14691 \repeat
14692 % Grid: connection from suppressor to cathode
14693 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
14694 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
14695 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@[email protected]*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@[email protected]*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
14696
14697 }
14698
14699 %%%---------- close: tex/pgfcirctripoles
14700 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
14701 %%%---------- open: tex/pgfcircquadpoles.tex
14702 % Copyright 2018-2026 by Romano Giannetti
14703 % Copyright 2015-2026 by Stefan Lindner
14704 % Copyright 2013-2026 by Stefan Erhardt
14705 % Copyright 2007-2026 by Massimo Redaelli
14706 %
14707 % This file may be distributed and/or modified
14708 %
14709 % 1. under the LaTeX Project Public License and/or
14710 % 2. under the GNU Public License.
14711 %
14712 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
14713
14714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14715 %% Quadripoles
14716
14717 \long\def\pgfcircdeclarequadpole#1#2#3{
14718 \pgfdeclareshape{#1}
14719 {
14720 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
14721 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14722 % shapename
14723 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14724 \anchor{center}{
14725 \northwest
14726 \pgf@x=0pt
14727 \pgf@y=0pt
14728 }
14729 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
14730 \savedanchor\northwest{%
14731 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14732 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
14733 \pgf@y=.5\pgf@y
14734 \pgf@x=.5\pgf@circ@scaled@Rlen
14735 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
14736 }
14737 %% we define the upper right (positive coord) dot (which is B1)
14738 \savedanchor{\innerdot}{%
14739 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14740 \pgf@xa=.5\pgf@circ@scaled@Rlen
14741 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
14742 % by default use the cute inductor size
14743 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
14744 % check if it's american
14745 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
14746 \edef\pgf@temp{american}
14747 \ifx\pgf@circ@temp\pgf@temp
14748 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
14749 \fi
14750 % check if it's european
14751 \edef\pgf@temp{european}
14752 \ifx\pgf@circ@temp\pgf@temp
14753 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
14754 \fi
14755 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
14756 }
14757 \savedanchor{\outerdot}{%
14758 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14759 \pgf@xa=.5\pgf@circ@scaled@Rlen
14760 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
14761 % by default use the cute inductor size
14762 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
14763 % check if it's american
14764 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
14765 \edef\pgf@temp{american}
14766 \ifx\pgf@circ@temp\pgf@temp
14767 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
14768 \fi
14769 % check if it's european
14770 \edef\pgf@temp{european}
14771 \ifx\pgf@circ@temp\pgf@temp
14772 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
14773 \fi
14774 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
14775 }
14776 \anchor{A2}{
14777 \northwest
14778 \pgf@y=-\pgf@y
14779 }
14780 \anchor{B1}{
14781 \northwest
14782 \pgf@x=-\pgf@x
14783 }
14784 \anchor{A1}{
14785 \northwest
14786 }
14787 \anchor{B2}{
14788 \northwest
14789 \pgf@x=-\pgf@x
14790 \pgf@y=-\pgf@y
14791 }
14792 %% dot's anchors
14793 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
14794 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
14795 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
14796 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
14797 \anchor{inner dot B1}{\innerdot}
14798 \anchor{outer dot B1}{\outerdot}
14799 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
14800 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
14801 % geographical
14802 \anchor{north}{
14803 \northwest
14804 \pgf@x=0pt
14805 }
14806 \anchor{south}{
14807 \northwest
14808 \pgf@x=0pt
14809 \pgf@y=-\pgf@y
14810 }
14811 \anchor{west}{
14812 \northwest
14813 \pgf@y=0pt
14814 }
14815 \anchor{east}{
14816 \northwest
14817 \pgf@y=0pt
14818 \pgf@x=-\pgf@x
14819 }
14820 \anchor{south west}{
14821 \northwest
14822 \pgf@y=-\pgf@y
14823 }
14824 \anchor{north east}{
14825 \northwest
14826 \pgf@x=-\pgf@x
14827 }
14828 \anchor{north west}{
14829 \northwest
14830 }
14831 \anchor{south east}{
14832 \northwest
14833 \pgf@x=-\pgf@x
14834 \pgf@y=-\pgf@y
14835 }
14836 \anchor{base}{
14837 \northwest
14838 \pgf@x=0pt
14839 }
14840 #3
14841 \backgroundpath{
14842 \pgfsetcolor{\ctikzvalof{color}}
14843
14844 \northwest
14845 \pgf@circ@res@up = \pgf@y
14846 \pgf@circ@res@down = -\pgf@y
14847 \pgf@circ@res@right = -\pgf@x
14848 \pgf@circ@res@left = \pgf@x
14849 #2
14850 }
14851 }
14852 }
14853
14854
14855 \def\pgf@circ@drawtransformerbasicanchor{
14856 \ctikzvalof{quadpoles/trans/height}
14857 \anchor{AA2}{
14858 \northwest
14859 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
14860 \pgf@x=.7\pgf@x
14861 \pgf@y=-\pgf@y
14862 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
14863 }
14864 \anchor{BB1}{
14865 \northwest
14866 \pgf@x=-\pgf@x
14867 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
14868 \pgf@x=.7\pgf@x
14869 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
14870 }
14871 \anchor{AA1}{
14872 \northwest
14873 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
14874 \pgf@x=.7\pgf@x
14875 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
14876 }
14877 \anchor{BB2}{
14878 \northwest
14879 \pgf@x=-\pgf@x
14880 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
14881 \pgf@x=.7\pgf@x
14882 \pgf@y=-\pgf@y
14883 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
14884 }
14885 }
14886
14887 %% Null styles that can be used to change individually the L1 and L2
14888 %% inductors of the transformer.
14889
14890 \ctikzset{transformer L1/.style={}}
14891 \ctikzset{transformer L2/.style={}}
14892
14893 \def\pgf@circ@drawtransformerbasicbody{
14894 \pgfscope
14895 \pgfslopedattimetrue
14896 \pgfallowupsidedownattimetrue
14897 \pgftransformlineattime{.5}{%
14898 \pgfpoint%
14899 {\stretto\pgf@circ@res@left}%
14900 {\pgf@circ@res@up}%
14901 }{%
14902 \pgfpoint
14903 {\stretto\pgf@circ@res@left}%
14904 {\pgf@circ@res@down}%
14905 }
14906
14907 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
14908 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
14909 \def\pgf@temp{european}%
14910 \ifx\pgf@temp\pgf@circ@temp%
14911 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
14912 \else%
14913 \def\pgf@temp{cute}
14914 \ifx\pgf@temp\pgf@circ@temp%
14915 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
14916 \else%
14917 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
14918 \fi%
14919 \fi%
14920
14921
14922 \endpgfscope
14923 \pgfscope
14924 \pgfslopedattimetrue
14925 \pgfallowupsidedownattimetrue
14926 \pgftransformlineattime{.5}{%
14927 \pgfpoint%
14928 {\stretto\pgf@circ@res@right}%
14929 {\pgf@circ@res@down}%
14930 }{%
14931 \pgfpoint
14932 {\stretto\pgf@circ@res@right}%
14933 {\pgf@circ@res@up}%
14934 }
14935
14936 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
14937 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
14938 \def\pgf@temp{european}%
14939 \ifx\pgf@temp\pgf@circ@temp%
14940 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
14941 \else%
14942 \def\pgf@temp{cute}
14943 \ifx\pgf@temp\pgf@circ@temp%
14944 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
14945 \else%
14946 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
14947 \fi%
14948 \fi%
14949
14950 \endpgfscope
14951
14952 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14953 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
14954 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
14955
14956 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
14957 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
14958 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
14959
14960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14961 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
14962 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
14963
14964 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
14965 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
14966 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
14967
14968 \pgfusepath{draw}
14969
14970 }
14971
14972
14973 \pgfcircdeclarequadpole{transformer}{
14974 \pgf@circ@drawtransformerbasicbody
14975 }{\pgf@circ@drawtransformerbasicanchor}
14976
14977 \pgfcircdeclarequadpole{transformer core}{
14978
14979 \pgf@circ@drawtransformerbasicbody
14980
14981 % use the chocke line thickness
14982 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
14983
14984 % Find the distance from center for the lines representing the core
14985 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
14986 % of the whole component, now as a fraction of the distance between coils, to be
14987 % compatible with the quadpoles "inner" style.
14988 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
14989
14990 \pgfmoveto{\pgfpoint%
14991 {\pgf@circ@res@other}%
14992 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
14993 }
14994 \pgflineto{
14995 \pgfpoint%
14996 {\pgf@circ@res@other}%
14997 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
14998 }
14999
15000 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
15001 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
15002 \pgfmoveto{\pgfpoint%
15003 {\pgf@circ@res@other}%
15004 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
15005 }
15006 \pgflineto{
15007 \pgfpoint%
15008 {\pgf@circ@res@other}%
15009 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
15010 }
15011
15012 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
15013 \pgfusepath{draw}
15014 }{\pgf@circ@drawtransformerbasicanchor}
15015
15016
15017 \pgfcircdeclarequadpole{gyrator}{
15018
15019 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
15020 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
15021 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
15022 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
15023
15024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15025 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
15026 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
15027 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15028
15029 \pgfusepath{draw}
15030
15031 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
15032 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
15033 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
15034 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
15035 \pgfpathclose
15036 \pgf@circ@draworfill
15037
15038 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
15039 \pgfpatharc{90}{270}{\pgf@circ@res@other}
15040 \pgfpathclose
15041 \pgf@circ@draworfill
15042 }{}
15043
15044 %%%%%%%%%%%%%%%%%%%%
15045 %% Block elements
15046 %%%%%%%%%%%%%%%%%%%%
15047
15048 \pgfdeclareshape{mixer}
15049 {
15050 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15051 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15052 \savedanchor\northwest{
15053 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15054 \ifpgf@circuit@boxed
15055 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15056 \pgf@y=.5\pgf@y
15057 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15058 \pgf@x=.5\pgf@x
15059 \else
15060 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
15061 \pgf@y=.5\pgf@y
15062 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
15063 \pgf@x=.5\pgf@x
15064 \fi
15065 }
15066 \anchor{center}{
15067 \pgfpointorigin
15068 }
15069 \anchor{left}{%
15070 \northwest
15071 \pgf@y=0pt
15072 }
15073 \anchor{1}{
15074 \northwest
15075 \pgf@y=0pt
15076 }
15077 \anchor{2}{
15078 \northwest
15079 \pgf@y=-\pgf@y
15080 \pgf@x=0pt
15081 }
15082 \anchor{3}{
15083 \northwest
15084 \pgf@y=0pt
15085 \pgf@x=-\pgf@x
15086 }
15087 \anchor{4}{
15088 \northwest
15089 \pgf@y=\pgf@y
15090 \pgf@x=0pt
15091 }
15092 \anchor{in 1}{
15093 \northwest
15094 \pgf@y=0pt
15095 }
15096 \anchor{in1}{
15097 \northwest
15098 \pgf@y=0pt
15099 }
15100 \anchor{in}{
15101 \northwest
15102 \pgf@y=0pt
15103 }
15104 \anchor{in 2}{
15105 \northwest
15106 \pgf@y=-\pgf@y
15107 \pgf@x=0pt
15108 }
15109 \anchor{in2}{
15110 \northwest
15111 \pgf@y=-\pgf@y
15112 \pgf@x=0pt
15113 }
15114 \anchor{out}{
15115 \northwest
15116 \pgf@y=0pt
15117 \pgf@x=-\pgf@x
15118 }
15119 \anchor{center}{
15120 \pgf@y=0pt
15121 \pgf@x=0pt
15122 }
15123 \anchor{east}{
15124 \northwest
15125 \pgf@y=0pt
15126 \pgf@x=-\pgf@x
15127 }
15128 \anchor{west}{
15129 \northwest
15130 \pgf@y=0pt
15131 }
15132 \anchor{south}{
15133 \northwest
15134 \pgf@x=0pt
15135 \pgf@y=-\pgf@y
15136 }
15137 \anchor{north}{
15138 \northwest
15139 \pgf@x=0pt
15140 }
15141 \anchor{south west}{
15142 \northwest
15143 \pgf@y=-\pgf@y
15144 }
15145 \anchor{north east}{
15146 \northwest
15147 \pgf@x=-\pgf@x
15148 }
15149 \anchor{north west}{
15150 \northwest
15151 }
15152 \anchor{south east}{
15153 \northwest
15154 \pgf@x=-\pgf@x
15155 \pgf@y=-\pgf@y
15156 }
15157 \backgroundpath{
15158 \pgfsetcolor{\ctikzvalof{color}}
15159 \pgf@circ@scaled@Rlen=\scaledRlen
15160
15161 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
15162
15163 \pgfscope
15164 \pgfstartlinewidth=\pgflinewidth
15165
15166 % draw outer box
15167 \ifpgf@circuit@boxed
15168 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
15169 \fi
15170
15171 % draw outer circle
15172 \ifpgf@circuit@boxed
15173 \pgf@circ@res@step=.7\pgf@circ@res@step
15174 \pgfsetdash{}{0pt} % draw solid circle if boxed
15175 \else
15176 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15177 \fi
15178 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15179 \pgf@circ@draworfill
15180
15181 % draw inner stuff
15182 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15183 \pgfsetlinewidth{\pgfstartlinewidth}
15184 \pgfpathmoveto{\pgfpointorigin}
15185 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
15186 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
15187 \pgfpathmoveto{\pgfpointorigin}
15188 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
15189 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
15190 \pgfusepath{draw}
15191
15192 \endpgfscope
15193 }
15194 }
15195
15196 \pgfdeclareshape{adder}
15197 {
15198 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15199 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15200 \savedanchor\northwest{
15201 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15202 \ifpgf@circuit@boxed
15203 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15204 \pgf@y=.5\pgf@y
15205 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15206 \pgf@x=.5\pgf@x
15207 \else
15208 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
15209 \pgf@y=.5\pgf@y
15210 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
15211 \pgf@x=.5\pgf@x
15212 \fi
15213 }
15214 \anchor{center}{
15215 \pgfpointorigin
15216 }
15217 \anchor{left}{%
15218 \northwest
15219 \pgf@y=0pt
15220 }
15221 \anchor{1}{
15222 \northwest
15223 \pgf@y=0pt
15224 }
15225 \anchor{2}{
15226 \northwest
15227 \pgf@y=-\pgf@y
15228 \pgf@x=0pt
15229 }
15230 \anchor{3}{
15231 \northwest
15232 \pgf@y=0pt
15233 \pgf@x=-\pgf@x
15234 }
15235 \anchor{4}{
15236 \northwest
15237 \pgf@y=\pgf@y
15238 \pgf@x=0pt
15239 }
15240 \anchor{in 1}{
15241 \northwest
15242 \pgf@y=0pt
15243 }
15244 \anchor{in1}{
15245 \northwest
15246 \pgf@y=0pt
15247 }
15248 \anchor{in}{
15249 \northwest
15250 \pgf@y=0pt
15251 }
15252 \anchor{in 2}{
15253 \northwest
15254 \pgf@y=-\pgf@y
15255 \pgf@x=0pt
15256 }
15257 \anchor{in2}{
15258 \northwest
15259 \pgf@y=-\pgf@y
15260 \pgf@x=0pt
15261 }
15262 \anchor{out}{
15263 \northwest
15264 \pgf@y=0pt
15265 \pgf@x=-\pgf@x
15266 }
15267 \anchor{center}{
15268 \pgf@y=0pt
15269 \pgf@x=0pt
15270 }
15271 \anchor{east}{
15272 \northwest
15273 \pgf@y=0pt
15274 \pgf@x=-\pgf@x
15275 }
15276 \anchor{west}{
15277 \northwest
15278 \pgf@y=0pt
15279 }
15280 \anchor{south}{
15281 \northwest
15282 \pgf@x=0pt
15283 \pgf@y=-\pgf@y
15284 }
15285 \anchor{north}{
15286 \northwest
15287 \pgf@x=0pt
15288 }
15289 \anchor{south west}{
15290 \northwest
15291 \pgf@y=-\pgf@y
15292 }
15293 \anchor{north east}{
15294 \northwest
15295 \pgf@x=-\pgf@x
15296 }
15297 \anchor{north west}{
15298 \northwest
15299 }
15300 \anchor{south east}{
15301 \northwest
15302 \pgf@x=-\pgf@x
15303 \pgf@y=-\pgf@y
15304 }
15305 \backgroundpath{
15306 \pgfsetcolor{\ctikzvalof{color}}
15307 \pgf@circ@scaled@Rlen=\scaledRlen
15308
15309 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
15310
15311 \pgfscope
15312 \pgfstartlinewidth=\pgflinewidth
15313
15314 % draw outer box
15315 \ifpgf@circuit@boxed
15316 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
15317 \fi
15318
15319 % draw outer circle
15320 \ifpgf@circuit@boxed
15321 \pgf@circ@res@step=.7\pgf@circ@res@step{}
15322 \pgfsetdash{}{0pt} % draw solid circle if boxed
15323 \else
15324 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15325 \fi
15326 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15327 \pgf@circ@draworfill
15328
15329 % draw inner stuff
15330 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15331 \pgfsetlinewidth{\pgfstartlinewidth}
15332
15333 \pgfpathmoveto{\pgfpointorigin}
15334 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
15335 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
15336 \pgfpathmoveto{\pgfpointorigin}
15337 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
15338 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
15339 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15340 \pgfusepath{draw}
15341
15342 \endpgfscope
15343 }
15344 }
15345
15346 \pgfdeclareshape{oscillator}
15347 {
15348 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15349 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15350 \savedanchor\northwest{
15351 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15352 \ifpgf@circuit@boxed
15353 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15354 \pgf@y=.5\pgf@y
15355 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15356 \else
15357 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
15358 \pgf@y=.5\pgf@y
15359 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
15360 \fi
15361 }
15362 \anchor{center}{
15363 \pgfpointorigin
15364 }
15365 \anchor{north}{
15366 \northwest
15367 \pgf@x=.5\pgf@x
15368 }
15369 \anchor{south}{
15370 \northwest
15371 \pgf@x=.5\pgf@x
15372 \pgf@y=-\pgf@y
15373 }
15374 \anchor{east}{
15375 \northwest
15376 \pgf@y=0pt
15377 \pgf@x=0pt
15378 }
15379 \anchor{west}{
15380 \northwest
15381 \pgf@y=0pt
15382 }
15383 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
15384 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
15385 \anchor{north west}{ \northwest }
15386 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15387 \anchor{text}{
15388 \pgf@x=-2\pgf@x
15389 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
15390 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
15391 }
15392 \backgroundpath{
15393 \pgfsetcolor{\ctikzvalof{color}}
15394 \pgf@circ@scaled@Rlen=\scaledRlen
15395
15396 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
15397
15398 \pgfscope
15399 \pgfstartlinewidth=\pgflinewidth
15400
15401 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
15402
15403 % draw outer box
15404 \ifpgf@circuit@boxed{}
15405 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
15406 \fi
15407
15408 % draw outer circle
15409 \ifpgf@circuit@boxed
15410 \pgf@circ@res@step=.7\pgf@circ@res@step{}
15411 \pgfsetdash{}{0pt} % draw solid circle if boxed
15412 \else
15413 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15414 \fi
15415 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15416 \pgf@circ@draworfill
15417
15418 % draw inner sine waves
15419 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15420 \pgfsetlinewidth{\pgfstartlinewidth}
15421 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
15422 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
15423 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
15424 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
15425 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
15426 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
15427
15428 \pgfusepath{draw}
15429
15430 \endpgfscope
15431 }
15432 }
15433
15434 \pgfdeclareshape{circulator}
15435 {
15436 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15437 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15438 \savedanchor\northwest{
15439 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15440 \ifpgf@circuit@boxed
15441 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15442 \pgf@y=.5\pgf@y
15443 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
15444 \pgf@x=.5\pgf@x
15445 \else
15446 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
15447 \pgf@y=.5\pgf@y
15448 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
15449 \pgf@x=.5\pgf@x
15450 \fi
15451 }
15452 \anchor{center}{
15453 \pgfpointorigin
15454 }
15455 \anchor{left}{%
15456 \northwest
15457 \pgf@y=0pt
15458 }
15459 \anchor{1}{
15460 \northwest
15461 \pgf@y=0pt
15462 }
15463 \anchor{2}{
15464 \northwest
15465 \pgf@y=0pt
15466 \pgf@x=-\pgf@x
15467 }
15468 \anchor{3}{
15469 \northwest
15470 \pgf@y=-\pgf@y
15471 \pgf@x=0pt
15472 }
15473 \anchor{east}{
15474 \northwest
15475 \pgf@y=0pt
15476 \pgf@x=-\pgf@x
15477 }
15478 \anchor{west}{
15479 \northwest
15480 \pgf@y=0pt
15481 }
15482 \anchor{south}{
15483 \northwest
15484 \pgf@x=0pt
15485 \pgf@y=-\pgf@y
15486 }
15487 \anchor{north}{
15488 \northwest
15489 \pgf@x=0pt
15490 }
15491 \anchor{south west}{
15492 \northwest
15493 \pgf@y=-\pgf@y
15494 }
15495 \anchor{north east}{
15496 \northwest
15497 \pgf@x=-\pgf@x
15498 }
15499 \anchor{north west}{
15500 \northwest
15501 }
15502 \anchor{south east}{
15503 \northwest
15504 \pgf@x=-\pgf@x
15505 \pgf@y=-\pgf@y
15506 }
15507 \backgroundpath{
15508 \pgfsetcolor{\ctikzvalof{color}}
15509 \pgf@circ@scaled@Rlen=\scaledRlen
15510
15511 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
15512
15513 \pgfscope
15514 \pgfstartlinewidth=\pgflinewidth
15515
15516 % draw outer box
15517 \ifpgf@circuit@boxed
15518 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
15519 \fi
15520
15521 % draw outer circle
15522 \ifpgf@circuit@boxed{}
15523 \pgf@circ@res@step=.7\pgf@circ@res@step{}
15524 \pgfsetdash{}{0pt} % draw solid circle if boxed
15525 \else
15526 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15527 \fi
15528 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15529 \pgf@circ@draworfill
15530
15531 % inner arrow
15532 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15533 \pgfsetlinewidth{\pgfstartlinewidth}
15534
15535 \pgfsetarrowsend{latex}
15536 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
15537 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
15538 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
15539 \pgfusepath{draw}
15540
15541 \endpgfscope
15542 }
15543 }
15544
15545
15546 % Wilkinson divider
15547 \pgfdeclareshape{wilkinson}{
15548 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15549 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15550 \savedanchor\northwest{%
15551 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15552 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
15553 \pgf@y=.5\pgf@y
15554 \pgf@x= \pgf@circ@scaled@Rlen
15555 \pgf@x=.5\pgf@x
15556 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
15557 }
15558 \anchor{center}{
15559 \northwest
15560 \pgf@x=0pt
15561 \pgf@y=0pt
15562 }
15563 \anchor{north}{
15564 \northwest
15565 \pgf@x=0pt
15566 }
15567 \anchor{south}{
15568 \northwest
15569 \pgf@x=0pt
15570 \pgf@y=-\pgf@y
15571 }
15572 \anchor{west}{
15573 \northwest
15574 \pgf@y=0pt
15575 }
15576 \anchor{east}{
15577 \northwest
15578 \pgf@y=0pt
15579 \pgf@x=-\pgf@x
15580 }
15581 \anchor{south west}{
15582 \northwest
15583 \pgf@y=-\pgf@y
15584 }
15585 \anchor{north east}{
15586 \northwest
15587 \pgf@x=-\pgf@x
15588 }
15589 \anchor{north west}{
15590 \northwest
15591 }
15592 \anchor{south east}{
15593 \northwest
15594 \pgf@x=-\pgf@x
15595 \pgf@y=-\pgf@y
15596 }
15597 \anchor{in}{
15598 \northwest
15599 \pgf@y=0pt
15600 }
15601 \anchor{out1}{
15602 \northwest
15603 \pgf@x=-\pgf@x
15604 \pgf@y=-0.5\pgf@y
15605 }
15606 \anchor{out2}{
15607 \northwest
15608 \pgf@x=-\pgf@x
15609 \pgf@y=0.5\pgf@y
15610 }
15611 \anchor{text}{
15612 \northwest
15613 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
15614 \pgf@x=-.5\wd\pgfnodeparttextbox
15615 }
15616 \backgroundpath{
15617 \pgfsetcolor{\ctikzvalof{color}}
15618 \pgf@circ@scaled@Rlen=\scaledRlen
15619
15620 \northwest
15621 \pgf@circ@res@up = \pgf@y
15622 \pgf@circ@res@down = -\pgf@y
15623 \pgf@circ@res@right = -\pgf@x
15624 \pgf@circ@res@left = \pgf@x
15625
15626 \pgfstartlinewidth=\pgflinewidth
15627
15628 % draw outer box
15629 \pgf@circ@twoportbox
15630
15631 % draw inner stuff
15632 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15633 \pgfsetarrows{-} %never draw arrows
15634 \pgfsetlinewidth{\pgfstartlinewidth}
15635 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15636 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
15637 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
15638 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
15639 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
15640 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
15641 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
15642
15643 \pgfusepath{draw}
15644
15645 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
15646 % draw inner resisitor - european or american style is recognised
15647 {
15648 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
15649 \pgftransformrotate{90}
15650
15651 % calculate size of resistor
15652 \ifpgf@circuit@europeanresistor
15653 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
15654 \pgftransformscale{\pgfmathresult}
15655 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
15656 \else
15657 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
15658 \pgftransformscale{\pgfmathresult}
15659 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
15660 \fi
15661 }
15662
15663 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
15664 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
15665
15666 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
15667 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
15668 \pgfusepath{draw}
15669
15670 }
15671 }
15672
15673 %% couplers generics
15674 \long\def\pgfcircdeclarefourport#1#2{
15675
15676 \pgfdeclareshape{#1}{
15677 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
15678 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15679 \anchor{center}{
15680 \northwest
15681 \pgf@x=0pt
15682 \pgf@y=0pt
15683 }
15684 \savedanchor\northwest{%
15685 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15686 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
15687 \pgf@y=.5\pgf@y
15688 \pgf@x=.5\pgf@circ@scaled@Rlen
15689 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
15690 }
15691 \anchor{north}{
15692 \northwest
15693 \pgf@x=0pt
15694 }
15695 \anchor{south}{
15696 \northwest
15697 \pgf@x=0pt
15698 \pgf@y=-\pgf@y
15699 }
15700 \anchor{west}{
15701 \northwest
15702 \pgf@y=0pt
15703 }
15704 \anchor{east}{
15705 \northwest
15706 \pgf@y=0pt
15707 \pgf@x=-\pgf@x
15708 }
15709 \anchor{south west}{
15710 \northwest
15711 \pgf@y=-\pgf@y
15712 }
15713 \anchor{north east}{
15714 \northwest
15715 \pgf@x=-\pgf@x
15716 }
15717 \anchor{north west}{
15718 \northwest
15719 }
15720 \anchor{south east}{
15721 \northwest
15722 \pgf@x=-\pgf@x
15723 \pgf@y=-\pgf@y
15724 }
15725 \anchor{port1}{
15726 \northwest
15727 \pgf@y=-0.5\pgf@y
15728 }
15729 \anchor{port2}{
15730 \northwest
15731 \pgf@x=-\pgf@x
15732 \pgf@y=-0.5\pgf@y
15733 }
15734 \anchor{port3}{
15735 \northwest
15736 \pgf@x=-\pgf@x
15737 \pgf@y=0.5\pgf@y
15738 }
15739 \anchor{port4}{
15740 \northwest
15741 \pgf@y=0.5\pgf@y
15742 }
15743 \anchor{1}{
15744 \northwest
15745 \pgf@y=-0.5\pgf@y
15746 }
15747 \anchor{2}{
15748 \northwest
15749 \pgf@x=-\pgf@x
15750 \pgf@y=-0.5\pgf@y
15751 }
15752 \anchor{3}{
15753 \northwest
15754 \pgf@x=-\pgf@x
15755 \pgf@y=0.5\pgf@y
15756 }
15757 \anchor{4}{
15758 \northwest
15759 \pgf@y=0.5\pgf@y
15760 }
15761
15762 \anchor{text}{
15763 \northwest
15764 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
15765 \pgf@x=-.5\wd\pgfnodeparttextbox
15766 }
15767 \backgroundpath{
15768 \pgfsetcolor{\ctikzvalof{color}}
15769
15770 \northwest
15771 \pgf@circ@res@up = \pgf@y
15772 \pgf@circ@res@down = -\pgf@y
15773 \pgf@circ@res@right = -\pgf@x
15774 \pgf@circ@res@left = \pgf@x
15775 \pgf@circ@scaled@Rlen=\scaledRlen
15776
15777 \pgfstartlinewidth=\pgflinewidth
15778
15779 % draw outer box
15780 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15781 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15782 \pgf@circ@draworfill
15783
15784 % draw inner stuff
15785 #2
15786
15787 % draw inner text
15788 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
15789 }
15790 }
15791 }
15792
15793 % four-port
15794 \pgfcircdeclarefourport{fourport}{}
15795
15796 % straight coupler
15797 \pgfcircdeclarefourport{coupler}{
15798 \pgfsetlinewidth{\pgfstartlinewidth}
15799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
15800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
15801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
15802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
15803 \pgfusepath{draw}
15804
15805 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
15806 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
15807 \pgfsetarrows{latex-latex}
15808 \pgfusepath{draw}
15809 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
15810 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
15811 \pgfsetarrows{latex-latex}
15812 \pgfusepath{draw}
15813 }
15814
15815 % "bended" coupler
15816 \pgfcircdeclarefourport{coupler2}{
15817 \pgfsetlinewidth{\pgfstartlinewidth}
15818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
15819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
15820 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
15821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
15822 \pgfusepath{draw}
15823
15824 \pgfscope
15825 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
15826 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
15827 \pgfsetarrowsend{latex}
15828 \pgfusepath{draw}
15829 \endpgfscope
15830 \pgfscope
15831 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
15832 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
15833 \pgfsetarrowsend{latex}
15834 \pgfusepath{draw}
15835 \endpgfscope
15836 \pgfscope
15837 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
15838 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
15839 \pgfsetarrowsend{latex}
15840 \pgfusepath{draw}
15841 \endpgfscope
15842 \pgfscope
15843 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
15844 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
15845 \pgfsetarrowsend{latex}
15846 \pgfusepath{draw}
15847 \endpgfscope
15848 }
15849
15850 %%%---------- close: tex/pgfcircquadpoles
15851 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
15852 %%%---------- open: tex/pgfcircmultipoles.tex
15853 % Copyright 2018-2026 by Romano Giannetti
15854 % Copyright 2015-2026 by Stefan Lindner
15855 % Copyright 2013-2026 by Stefan Erhardt
15856 % Copyright 2007-2026 by Massimo Redaelli
15857 %
15858 % This file may be distributed and/or modified
15859 %
15860 % 1. under the LaTeX Project Public License and/or
15861 % 2. under the GNU Public License.
15862 %
15863 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
15864
15865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15866 %% Multipoles by Romano Giannetti
15867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15868
15869 %%%%%%%%%
15870 %% Chips
15871 %%%%%%%%%
15872
15873 % let's use the same shifts everywhere, no magic numbers
15874 \def\pgf@circ@dip@pin@shift{0.5}
15875 \def\pgf@circ@qfp@pin@shift{0.25}
15876
15877 % derived from https://tex.stackexchange.com/a/146753/38080
15878 % original author Mark Wibrow
15879 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
15880 % a lot of thanks to @marmot for the un-rotation hint
15881 % https://tex.stackexchange.com/a/473571/38080
15882
15883 % DIP (dual in line package) chips
15884
15885 \pgfdeclareshape{dipchip}{
15886 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
15887 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15888 \savedmacro\numpins{%
15889 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
15890 \def\numpins{\the\pgf@circ@count@a}
15891 }
15892 \savedanchor\centerpoint{%
15893 \pgf@x=-.5\wd\pgfnodeparttextbox%
15894 \pgf@y=-.5\ht\pgfnodeparttextbox%
15895 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
15896 }%
15897 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
15898 \anchor{center}{\origin}
15899 \anchor{text}{\centerpoint}% to adjust text
15900 \saveddimen\height{%
15901 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15902 \pgfmathsetlength\pgf@x{((\numpins)
15903 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
15904 }%
15905 \saveddimen{\chipspacing}{
15906 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15907 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
15908 \saveddimen{\width}{
15909 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15910 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
15911 \saveddimen{\extshift}{
15912 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15913 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
15914 % standard anchors
15915 \savedanchor\northwest{%
15916 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15917 \pgfmathsetlength\pgf@y{0.5*((\numpins)
15918 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
15919 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
15920 }
15921 \anchor{dot}{\northwest
15922 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
15923 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
15924 }
15925 \anchor{nw}{\northwest}
15926 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
15927 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
15928 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
15929 \anchor{north west}{\northwest}
15930 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
15931 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
15932 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
15933 \anchor{n}{\northwest\pgf@x=0pt }
15934 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
15935 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
15936 \anchor{w}{\northwest\pgf@y=0pt }
15937 \anchor{north}{\northwest\pgf@x=0pt }
15938 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
15939 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
15940 \anchor{west}{\northwest\pgf@y=0pt }
15941 % start drawing
15942 \backgroundpath{%
15943 \northwest
15944 \pgf@circ@res@up = \pgf@y
15945 \pgf@circ@res@down = -\pgf@y
15946 \pgf@circ@res@right = -\pgf@x
15947 \pgf@circ@res@left = \pgf@x
15948 \pgf@circ@scaled@Rlen=\scaledRlen
15949 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
15950 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
15951 \pgfscope% (for the line width)
15952 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
15953 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
15954 \pgf@circ@draworfill
15955 %% upside mark
15956 \ifpgf@circuit@chip@topmark
15957 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
15958 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
15959 \fi
15960 \pgfusepath{stroke}%
15961 \pgfsetcolor{\ctikzvalof{color}}
15962 % Adding the pin number
15963 \ifpgf@circuit@chip@shownumbers
15964 \pgf@circ@count@a=\numpins\relax
15965 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
15966 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
15967 \ifpgf@circuit@chip@straightnumbers
15968 \pgfgettransformentries\a\b\temp\temp\temp\temp
15969 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
15970 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
15971 \else
15972 \pgfmathsetmacro{\rot}{0}
15973 \pgfmathsetmacro{\quadrant}{0}
15974 \fi
15975 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
15976 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
15977 \pgfmathloop%
15978 \ifnum\pgf@circ@count@a>0
15979 \ifcase\quadrant % rotation 0
15980 % left
15981 \pgf@circ@count@c=\pgf@circ@count@a
15982 \pgftext[left,
15983 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
15984 rotate=\rot]{\mytext}
15985 % right
15986 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
15987 \pgftext[right,
15988 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
15989 rotate=\rot]{\mytext}
15990 \or % rotation -90
15991 % left
15992 \pgf@circ@count@c=\pgf@circ@count@a
15993 \pgftext[top,
15994 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
15995 rotate=\rot]{\mytext}
15996 % right
15997 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
15998 \pgftext[bottom,
15999 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16000 rotate=\rot]{\mytext}
16001 \or %rotation 180
16002 % left
16003 \pgf@circ@count@c=\pgf@circ@count@a
16004 \pgftext[right,
16005 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16006 rotate=\rot]{\mytext}
16007 % right
16008 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16009 \pgftext[left,
16010 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16011 rotate=\rot]{\mytext}
16012 \or % rotation +90
16013 % left
16014 \pgf@circ@count@c=\pgf@circ@count@a
16015 \pgftext[bottom,
16016 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16017 rotate=\rot]{\mytext}
16018 % right
16019 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16020 \pgftext[top,
16021 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16022 rotate=\rot]{\mytext}
16023 \fi
16024 \advance\pgf@circ@count@a-1\relax%
16025 \repeatpgfmathloop
16026 \fi
16027 \endpgfscope
16028 \ifdim\pgf@circ@res@other>0pt
16029 \pgfscope
16030 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
16031 \pgf@circ@count@a=\numpins\relax
16032 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
16033 \pgfmathloop%
16034 \ifnum\pgf@circ@count@a>0
16035 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
16036 \ifnum\padfrac>0
16037 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
16038 % left side pads
16039 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16040 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16041 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16042 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16043 % right side pads
16044 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16046 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16047 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16048 \else
16049 % left side pins
16050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16051 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16052 % right side pins
16053 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16054 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16055 \fi
16056 \advance\pgf@circ@count@a by -1\relax%
16057 \repeatpgfmathloop
16058 \pgfusepath{stroke}
16059 \endpgfscope
16060 \fi
16061 }%
16062 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
16063 % and is executed just before a node is drawn.
16064 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
16065 % Start with the maximum pin number and go backwards.
16066 \pgf@circ@count@a=\numpins\relax
16067 \pgfmathloop%
16068 \ifnum\pgf@circ@count@a>0
16069 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16070 % electrical contact, and the "border one" like `bpin 1` for labels.
16071 % they will coincide if `external pins width` is set to 0.
16072 \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
16073 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
16074 }
16075 \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
16076 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
16077 }
16078 \advance\pgf@circ@count@a by -1\relax%
16079 \repeatpgfmathloop%
16080 }%
16081 }
16082
16083 % QFP (quad flat package) chips
16084
16085 \pgfdeclareshape{qfpchip}{
16086 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
16087 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16088 \savedmacro\numpins{%
16089 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
16090 \def\numpins{\the\pgf@circ@count@a}
16091 }
16092 \savedanchor\centerpoint{%
16093 \pgf@x=-.5\wd\pgfnodeparttextbox%
16094 \pgf@y=-.5\ht\pgfnodeparttextbox%
16095 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
16096 }%
16097 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
16098 \anchor{center}{\origin}
16099 \anchor{text}{\centerpoint}% to adjust text
16100 \saveddimen\height{%
16101 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16102 \pgfmathsetlength\pgf@x{((\numpins+2)
16103 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
16104 }%
16105 \saveddimen\width{%
16106 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16107 \pgfmathsetlength\pgf@x{((\numpins+2)
16108 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
16109 }%
16110 \saveddimen{\chipspacing}{
16111 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16112 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
16113 \saveddimen{\extshift}{
16114 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16115 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
16116 % standard anchors
16117 \savedanchor\northwest{%
16118 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16119 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
16120 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
16121 \pgf@x=-\pgf@y
16122 }
16123 \anchor{dot}{\northwest
16124 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
16125 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
16126 }
16127 \anchor{nw}{\northwest}
16128 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
16129 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
16130 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
16131 \anchor{north west}{\northwest}
16132 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
16133 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
16134 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
16135 \anchor{n}{\northwest\pgf@x=0pt }
16136 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
16137 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
16138 \anchor{w}{\northwest\pgf@y=0pt }
16139 \anchor{north}{\northwest\pgf@x=0pt }
16140 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
16141 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
16142 \anchor{west}{\northwest\pgf@y=0pt }
16143 % start drawing
16144 \backgroundpath{%
16145 \northwest
16146 \pgf@circ@res@up = \pgf@y
16147 \pgf@circ@res@down = -\pgf@y
16148 \pgf@circ@res@right = -\pgf@x
16149 \pgf@circ@res@left = \pgf@x
16150 \pgf@circ@scaled@Rlen=\scaledRlen
16151 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
16152 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
16153 \pgfscope% (for the line width)
16154 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
16155 %% upside mark
16156 \ifpgf@circuit@chip@topmark
16157 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
16158 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
16159 \else
16160 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
16161 \fi
16162 %% rest of the shape
16163 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
16164 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
16165 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
16166 \pgfpathclose
16167 \pgf@circ@draworfill
16168 % Adding the pin number
16169 \pgfsetcolor{\ctikzvalof{color}}
16170 \ifpgf@circuit@chip@shownumbers
16171 \pgf@circ@count@a=\numpins%
16172 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
16173 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
16174 \ifpgf@circuit@chip@straightnumbers
16175 \pgfgettransformentries\a\b\temp\temp\temp\temp
16176 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
16177 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
16178 \else
16179 \pgfmathsetmacro{\rot}{0}
16180 \pgfmathsetmacro{\quadrant}{0}
16181 \fi
16182 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
16183 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
16184 \pgfmathloop%
16185 \ifnum\pgf@circ@count@a>0
16186 \ifcase\quadrant % rotation 0
16187 % left
16188 \pgf@circ@count@c=\pgf@circ@count@a
16189 \pgftext[left,
16190 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16191 rotate=\rot]{\mytext}
16192 % bottom
16193 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
16194 \pgftext[bottom,
16195 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
16196 rotate=\rot]{\mytext}
16197 % right
16198 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16199 \pgftext[right,
16200 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16201 rotate=\rot]{\mytext}
16202 % top
16203 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
16204 \pgftext[top,
16205 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
16206 rotate=\rot]{\mytext}
16207 \or % rotation -90
16208 % left
16209 \pgf@circ@count@c=\pgf@circ@count@a
16210 \pgftext[top,
16211 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16212 rotate=\rot]{\mytext}
16213 % bottom
16214 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
16215 \pgftext[left,
16216 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
16217 rotate=\rot]{\mytext}
16218 % right
16219 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16220 \pgftext[bottom,
16221 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16222 rotate=\rot]{\mytext}
16223 % top
16224 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
16225 \pgftext[right,
16226 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
16227 rotate=\rot]{\mytext}
16228 \or %rotation 180
16229 % left
16230 \pgf@circ@count@c=\pgf@circ@count@a
16231 \pgftext[right,
16232 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16233 rotate=\rot]{\mytext}
16234 % bottom
16235 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
16236 \pgftext[top,
16237 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
16238 rotate=\rot]{\mytext}
16239 % right
16240 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16241 \pgftext[left,
16242 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16243 rotate=\rot]{\mytext}
16244 % top
16245 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
16246 \pgftext[bottom,
16247 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
16248 rotate=\rot]{\mytext}
16249 \or % rotation +90
16250 % left
16251 \pgf@circ@count@c=\pgf@circ@count@a
16252 \pgftext[bottom,
16253 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16254 rotate=\rot]{\mytext}
16255 % bottom
16256 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
16257 \pgftext[right,
16258 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
16259 rotate=\rot]{\mytext}
16260 % right
16261 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16262 \pgftext[top,
16263 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16264 rotate=\rot]{\mytext}
16265 % top
16266 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
16267 \pgftext[left,
16268 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
16269 rotate=\rot]{\mytext}
16270 \fi
16271 \advance\pgf@circ@count@a-1\relax%
16272 \repeatpgfmathloop
16273 \fi
16274 \endpgfscope
16275 \ifdim\pgf@circ@res@other>0pt
16276 \pgfscope
16277 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
16278 \pgf@circ@count@a=\numpins%
16279 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
16280 \pgfmathloop%
16281 \ifnum\pgf@circ@count@a>0
16282 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
16283 \ifnum\padfrac>0
16284 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
16285 % left side pads
16286 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16287 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16288 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16289 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16290 % bottom side pads
16291 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
16292 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
16293 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
16294 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
16295 % right side pads
16296 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16297 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16298 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16299 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16300 % top side pads
16301 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
16302 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
16303 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
16304 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
16305 \else
16306 % left side pins
16307 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16308 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16309 % bottom side pins
16310 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
16311 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
16312 % right side pins
16313 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16314 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16315 % top side pins
16316 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
16317 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
16318 \fi
16319 \advance\pgf@circ@count@a-1\relax%
16320 \repeatpgfmathloop
16321 \pgfusepath{stroke}
16322 \endpgfscope
16323 \fi
16324 }%
16325 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
16326 % and is executed just before a node is drawn.
16327 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
16328 % Start with the maximum pin number and go backwards.
16329 \pgf@circ@count@a=\numpins%
16330 \pgfmathloop%
16331 \ifnum\pgf@circ@count@a>0
16332 \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
16333 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
16334 }
16335 \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
16336 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
16337 }
16338 \advance\pgf@circ@count@a-1\relax%
16339 \repeatpgfmathloop%
16340 }%
16341 }
16342
16343 %% anchors for DIP
16344 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
16345 \c@pgf@countc=\numpins\relax
16346 \divide\c@pgf@countc by 2
16347 \ifnum #1 > \the\c@pgf@countc
16348 % right side
16349 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
16350 \else
16351 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
16352 \fi
16353 }
16354
16355 %% anchors for QFP
16356 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
16357 \c@pgf@countc=\numpins\relax
16358 \divide\c@pgf@countc by 4
16359 \ifnum #1 > \the\c@pgf@countc
16360 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
16361 \ifnum #1 > \the\c@pgf@countb
16362 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
16363 \ifnum #1 > \the\c@pgf@countb
16364 % 3*npins/4 < pin, top side
16365 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
16366 \else
16367 % 2*npins/4 < pin <= 3*npins/4, right side
16368 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
16369 \fi
16370 \else
16371 % npins/4 < pin <= 2*npins/4, bottom side
16372 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
16373 \fi
16374 \else
16375 % <= npins/4, left side
16376 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
16377 \fi
16378 }
16379
16380 %%%%%%%%%%%%%%%%%
16381 %% Rotary Switch
16382 %%%%%%%%%%%%%%%%%
16383
16384 \pgfdeclareshape{rotaryswitch}
16385 {
16386 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
16387 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16388 \savedanchor\northeast{%
16389 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16390 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
16391 % the magic number is 0.25/cos(35)
16392 % try to recalculate it for the actual switch
16393 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
16394 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
16395 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
16396 \edef\r{\ctikzvalof{nodes width}}
16397 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
16398 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
16399 }
16400 \savedanchor\northwest{%
16401 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16402 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
16403 % the magic number is 0.25/cos(35)
16404 % try to recalculate it for the actual switch
16405 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
16406 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
16407 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
16408 \edef\r{\ctikzvalof{nodes width}}
16409 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
16410 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
16411 }
16412 \savedanchor\central{%
16413 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16414 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
16415 % the magic number is 0.25/cos(35)
16416 % try to recalculate it for the actual switch
16417 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
16418 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
16419 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
16420 \edef\r{\ctikzvalof{nodes width}}
16421 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
16422 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
16423 }
16424 % external square limits
16425 \savedanchor\extnorthwest{%
16426 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16427 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
16428 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
16429 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
16430 \pgf@x=2.5\pgf@x % external square size
16431 \pgf@y=-\pgf@x %square thing when angle=180?
16432 }
16433 \saveddimen{\width}{
16434 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16435 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
16436 % radius of the connector
16437 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
16438 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
16439 % shapename
16440 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
16441 % shape type
16442 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
16443 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
16444 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
16445 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
16446 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
16447 % mid of the lever, to stack switches
16448 %\anchor{mid}{\midlever}
16449 \anchor{mid}{\northwest
16450 \pgf@circ@res@temp=-\pgf@x
16451 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
16452 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
16453 }
16454 % center anchors
16455 \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
16456 % horizontal angles
16457 \anchor{in}{ \northwest \pgf@y=0pt}
16458 \anchor{ain}{ \northwest \pgf@y=0pt}
16459
16460 \anchor{center}{ \central \pgf@y=0pt }
16461 \anchor{east}{ \northeast \pgf@y=0pt }
16462 \anchor{west}{ \northwest \pgf@y=0pt }
16463 \anchor{south}{ \central \pgf@y=-\pgf@y }
16464 \anchor{north}{ \central }
16465 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16466 \anchor{north east}{ \northeast }
16467 \anchor{north west}{ \northwest }
16468 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
16469
16470 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
16471 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
16472 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
16473 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
16474 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
16475 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
16476 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
16477 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
16478 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
16479
16480 \backgroundpath{
16481 \pgfsetcolor{\ctikzvalof{color}}
16482 \pgf@circ@res@right = \width
16483 \pgf@circ@res@left = -\width
16484
16485 \pgfscope %wiper
16486 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
16487 \pgf@circ@res@temp=\radius\relax
16488 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
16489 \pgfsetlinewidth{2\pgf@circ@res@temp}
16490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
16491 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
16492 \pgfsetroundcap\pgfusepath{draw}
16493 \endpgfscope
16494
16495 \ifpgf@circ@rotaryarrow
16496 \pgfscope % arrow
16497 \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
16498 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
16499 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
16500 \pgftransformrotate{\wiper}
16501 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
16502 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
16503 \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
16504 \pgfusepath{draw}
16505 \endpgfscope
16506 \fi
16507
16508 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
16509 \pgf@circ@count@a=\channels\relax
16510 \pgfmathsetmacro{\currenta}{-\angle}
16511 \pgfmathloop%
16512 \ifnum\pgf@circ@count@a>0
16513 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
16514 \pgfscope
16515 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
16516 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
16517 \endpgfscope
16518 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
16519 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
16520 \advance\pgf@circ@count@a by -1\relax%
16521 \repeatpgfmathloop
16522
16523 \pgfscope % input
16524 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
16525 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
16526 \endpgfscope
16527 }
16528 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
16529 % and is executed just before a node is drawn.
16530 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
16531 % Start with the maximum pin number and go backwards.
16532 \pgf@circ@count@a=\channels\relax
16533 \pgfmathloop%
16534 \ifnum\pgf@circ@count@a>0
16535 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16536 % electrical contact, and the "border one" like `bpin 1` for labels.
16537 % they will coincide if `external pins width` is set to 0.
16538 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
16539 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
16540 }
16541 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
16542 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
16543 }
16544 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
16545 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
16546 }
16547 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
16548 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}%
16549 }
16550 \advance\pgf@circ@count@a by -1\relax%
16551 \repeatpgfmathloop%
16552 }%
16553 }
16554
16555 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
16556 \pgf@circ@res@temp=\width
16557 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
16558 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
16559 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
16560 \advance\pgf@x by -\pgf@circ@res@temp
16561 }
16562
16563 \def\pgf@circ@rotarysqanchor#1{% external square anchors
16564 \pgf@circ@res@temp=\width
16565 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
16566 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
16567 \advance\pgf@x by -\pgf@circ@res@temp
16568 }
16569
16570 %%%%%%%%%%%%%%%%%%%%%%%%%%
16571 % Seven segments displays
16572 %%%%%%%%%%%%%%%%%%%%%%%%%%
16573
16574 \pgfdeclareshape{bare7seg}{
16575 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
16576 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16577 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
16578 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
16579 \ifpgf@circ@sevenseg@dot
16580 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
16581 \else
16582 \pgf@x=0pt
16583 \fi
16584 }
16585 % The object extension is more or less (-width/2,-width) to (width/2,width)
16586 % and adjusted for line thickness (both sides) and eventually the dot
16587 \saveddimen{\width}{
16588 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16589 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
16590 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
16591 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
16592 \savedanchor{\southwest}{% both negative
16593 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16594 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
16595 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
16596 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
16597 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
16598 }
16599 \savedanchor{\northeast}{% both positive
16600 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16601 \ifpgf@circ@sevenseg@dot
16602 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
16603 \else
16604 \pgf@circ@res@other=0pt
16605 \fi
16606 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
16607 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
16608 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
16609 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
16610 }
16611 \savedanchor{\topright}{% anchor without the box sep and the thickness
16612 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16613 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
16614 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
16615 }
16616 \anchor{center}{\pgfpointorigin}
16617 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
16618 \anchor{north east}{\northeast}
16619 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
16620 \anchor{south west}{\southwest}
16621 \anchor{north}{\northeast\pgf@x=0pt}
16622 \anchor{east}{\northeast\pgf@y=0pt}
16623 \anchor{south}{\southwest\pgf@x=0pt}
16624 \anchor{west}{\southwest\pgf@y=0pt}
16625 \anchor{a}{\topright\pgf@x=0pt}
16626 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
16627 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
16628 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
16629 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
16630 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
16631 \anchor{g}{\pgfpointorigin}
16632 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
16633 \behindbackgroundpath{%
16634 \southwest % I do not want the dot here, it will stick out
16635 \pgf@circ@res@up = -\pgf@y
16636 \pgf@circ@res@down = \pgf@y
16637 \pgf@circ@res@right = \pgf@x
16638 \pgf@circ@res@left = -\pgf@x
16639 \pgfscope
16640 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
16641 \pgfsetcolor{\ctikzvalof{color}}
16642 \pgfpathrectanglecorners%
16643 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
16644 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
16645 \ifpgf@circ@sevenseg@box
16646 \pgf@circ@draworfill
16647 \else
16648 \pgf@circ@maybefill
16649 \fi
16650 \endpgfscope
16651 \edef\bits{\ctikzvalof{seven seg/bits}}
16652 \pgfscope
16653 \pfg@circ@sseg@drawbits{\bits}
16654 \endpgfscope
16655 \pgfscope
16656 \ifpgf@circ@sevenseg@dot
16657 \pgf@circ@sseg@drawdots
16658 \fi
16659 \endpgfscope
16660 }
16661 }
16662
16663 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
16664 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
16665 }
16666 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
16667 \ifnum #1 > 0\relax
16668 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
16669 \else
16670 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
16671 \fi
16672 \pgfpathmoveto{\pgfpoint{#2}{#3}}
16673 \pgfpathlineto{\pgfpoint{#4}{#5}}
16674 \pgfusepath{draw}
16675 }
16676 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
16677 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
16678 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
16679 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
16680 % \pgfsetroundcap
16681 \pgfsetarrowsstart{Triangle Cap[]}
16682 \pgfsetarrowsend{Triangle Cap[]}
16683 % segments
16684 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
16685 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
16686 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
16687 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
16688 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
16689 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
16690 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
16691 }
16692 \def\pgf@circ@sseg@drawdots{% dots
16693 \edef\what{empty}
16694 \ifx\what\pgf@circ@sevenseg@dotstate
16695 % do nothing
16696 \else
16697 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
16698 \edef\what{off}
16699 \ifx\what\pgf@circ@sevenseg@dotstate
16700 % dot off
16701 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
16702 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
16703 \else
16704 % dot on
16705 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
16706 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
16707 \fi
16708 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
16709 \pgfusepath{draw,fill}
16710 \fi
16711 }
16712
16713
16714 %%%%%%
16715 %%%%%% Flip-flops
16716 %%%%%%
16717
16718 % Flip flops are a specialized kind of dipchip.
16719 % they have a class by themselves
16720
16721 %% flip flop definitions --- by default empty
16722 %% pin texts
16723 \ctikzset{multipoles/flipflop/t1/.initial={}}
16724 \ctikzset{multipoles/flipflop/t2/.initial={}}
16725 \ctikzset{multipoles/flipflop/t3/.initial={}}
16726 \ctikzset{multipoles/flipflop/t4/.initial={}}
16727 \ctikzset{multipoles/flipflop/t5/.initial={}}
16728 \ctikzset{multipoles/flipflop/t6/.initial={}}
16729 \ctikzset{multipoles/flipflop/tu/.initial={}}
16730 \ctikzset{multipoles/flipflop/td/.initial={}}
16731 % pin clock wedge flags
16732 \ctikzset{multipoles/flipflop/c1/.initial={0}}
16733 \ctikzset{multipoles/flipflop/c2/.initial={0}}
16734 \ctikzset{multipoles/flipflop/c3/.initial={0}}
16735 \ctikzset{multipoles/flipflop/c4/.initial={0}}
16736 \ctikzset{multipoles/flipflop/c5/.initial={0}}
16737 \ctikzset{multipoles/flipflop/c6/.initial={0}}
16738 \ctikzset{multipoles/flipflop/cu/.initial={0}}
16739 \ctikzset{multipoles/flipflop/cd/.initial={0}}
16740 % pin negation circle flags
16741 \ctikzset{multipoles/flipflop/n1/.initial={0}}
16742 \ctikzset{multipoles/flipflop/n2/.initial={0}}
16743 \ctikzset{multipoles/flipflop/n3/.initial={0}}
16744 \ctikzset{multipoles/flipflop/n4/.initial={0}}
16745 \ctikzset{multipoles/flipflop/n5/.initial={0}}
16746 \ctikzset{multipoles/flipflop/n6/.initial={0}}
16747 \ctikzset{multipoles/flipflop/nu/.initial={0}}
16748 \ctikzset{multipoles/flipflop/nd/.initial={0}}
16749
16750
16751 % Thanks to @marmot
16752 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
16753
16754 % default set of flip flops
16755 \tikzset{
16756 % async
16757 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
16758 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
16759 % sync
16760 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
16761 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
16762 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
16763 % additional features
16764 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
16765 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
16766 }
16767
16768 %
16769 % commodity macro to draw the clock wedges. They leave the size of the
16770 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
16771 %
16772 \def\pgf@circ@do@wedge@left{
16773 \pgf@circ@res@temp=0pt\relax
16774 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
16775 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}}
16776 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16777 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}}
16778 \pgfusepath{stroke}
16779 \pgf@circ@res@temp=\wedge
16780 \fi
16781 }
16782 \def\pgf@circ@do@wedge@right{
16783 \pgf@circ@res@temp=0pt\relax
16784 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
16785 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}}
16786 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
16787 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}}
16788 \pgfusepath{stroke}
16789 \pgf@circ@res@temp=-\wedge
16790 \fi
16791 }
16792 \def\pgf@circ@do@wedge@up{
16793 \pgf@circ@res@temp=0pt\relax
16794 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
16795 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
16796 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
16797 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
16798 \pgfusepath{stroke}
16799 \pgf@circ@res@temp=-\wedge
16800 \fi
16801 }
16802 \def\pgf@circ@do@wedge@down{
16803 \pgf@circ@res@temp=0pt\relax
16804 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
16805 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
16806 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
16807 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
16808 \pgfusepath{stroke}
16809 \pgf@circ@res@temp=\wedge
16810 \fi
16811 }
16812 % generic flip-flop shape
16813 \pgfdeclareshape{flipflop}{
16814 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
16815 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16816 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
16817 \savedmacro\numpins{\def\numpins{6}}
16818 \savedanchor\centerpoint{%
16819 \pgf@x=-.5\wd\pgfnodeparttextbox%
16820 \pgf@y=-.5\ht\pgfnodeparttextbox%
16821 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
16822 }%
16823 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
16824 \anchor{center}{\origin}
16825 \anchor{text}{\centerpoint}% to adjust text
16826 \saveddimen\height{%
16827 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16828 \pgfmathsetlength\pgf@x{((\numpins)
16829 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
16830 }%
16831 \saveddimen{\chipspacing}{
16832 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16833 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
16834 \saveddimen{\width}{
16835 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16836 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
16837 \saveddimen{\extshift}{
16838 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16839 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
16840 % standard anchors
16841 \savedanchor\northwest{%
16842 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16843 \pgfmathsetlength\pgf@y{0.5*((\numpins)
16844 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
16845 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
16846 }
16847 \anchor{dot}{\northwest
16848 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
16849 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
16850 }
16851 \anchor{nw}{\northwest}
16852 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
16853 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
16854 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
16855 \anchor{north west}{\northwest}
16856 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
16857 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
16858 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
16859 \anchor{n}{\northwest\pgf@x=0pt }
16860 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
16861 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
16862 \anchor{w}{\northwest\pgf@y=0pt }
16863 \anchor{north}{\northwest\pgf@x=0pt }
16864 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
16865 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
16866 \anchor{west}{\northwest\pgf@y=0pt }
16867 % upper and lower pin
16868 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
16869 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
16870 \anchor{bup}{\northwest\pgf@x=0pt }
16871 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
16872 % start drawing
16873 \backgroundpath{%
16874 \northwest
16875 \pgf@circ@res@up = \pgf@y
16876 \pgf@circ@res@down = -\pgf@y
16877 \pgf@circ@res@right = -\pgf@x
16878 \pgf@circ@res@left = \pgf@x
16879 \pgf@circ@scaled@Rlen=\scaledRlen
16880 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
16881 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
16882 \pgfsetcolor{\ctikzvalof{color}}
16883 \pgfscope% (for the line width)
16884 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
16885 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
16886 \pgf@circ@draworfill
16887 \pgfusepath{stroke}%
16888 \endpgfscope
16889 % Adding the pin number
16890 \pgf@circ@count@a=\numpins\relax
16891 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
16892 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
16893 \ifpgf@circuit@chip@straightnumbers
16894 \pgfgettransformentries\a\b\temp\temp\temp\temp
16895 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
16896 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
16897 \else
16898 \pgfmathsetmacro{\rot}{0}
16899 \pgfmathsetmacro{\quadrant}{0}
16900 \fi
16901 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
16902 % text
16903 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
16904 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
16905 \pgf@circ@strut\space}
16906 % \typeout{TEXT\space\mytext}
16907 \pgfmathloop%
16908 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
16909 \pgf@circ@res@temp=0pt\relax
16910 \ifnum\pgf@circ@count@a>0
16911 \ifcase\quadrant % rotation 0
16912 % left
16913 \pgf@circ@count@c=\pgf@circ@count@a
16914 \pgf@circ@do@wedge@left
16915 % \typeout{TEXT Left Q1\space\mytext}
16916 \pgftext[left,
16917 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16918 rotate=\rot]{\mytext}
16919 % right
16920 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16921 \pgf@circ@do@wedge@right
16922 \pgftext[right,
16923 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16924 rotate=\rot]{\mytext}
16925 \or % rotation -90
16926 % left
16927 \pgf@circ@count@c=\pgf@circ@count@a
16928 \pgf@circ@do@wedge@left
16929 \pgftext[top,
16930 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16931 rotate=\rot]{\mytext}
16932 % right
16933 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16934 \pgf@circ@do@wedge@right
16935 \pgftext[bottom,
16936 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16937 rotate=\rot]{\mytext}
16938 \or %rotation 180
16939 % left
16940 \pgf@circ@count@c=\pgf@circ@count@a
16941 \pgf@circ@do@wedge@left
16942 \pgftext[right,
16943 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16944 rotate=\rot]{\mytext}
16945 % right
16946 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16947 \pgf@circ@do@wedge@right
16948 \pgftext[left,
16949 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16950 rotate=\rot]{\mytext}
16951 \or % rotation +90
16952 % left
16953 \pgf@circ@count@c=\pgf@circ@count@a
16954 \pgf@circ@do@wedge@left
16955 \pgftext[bottom,
16956 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16957 rotate=\rot]{\mytext}
16958 % right
16959 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
16960 \pgf@circ@do@wedge@right
16961 \pgftext[top,
16962 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
16963 rotate=\rot]{\mytext}
16964 \fi
16965 \advance\pgf@circ@count@a-1\relax%
16966 \repeatpgfmathloop
16967 % Now the up and down text
16968 % up
16969 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
16970 \pgf@circ@do@wedge@up
16971 \ifcase\quadrant % rotation 0
16972 \pgftext[top,
16973 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
16974 rotate=\rot]{\mytext}
16975 \or % rotation -90
16976 \pgftext[right,
16977 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
16978 rotate=\rot]{\mytext}
16979 \or %rotation 180
16980 \pgftext[bottom,
16981 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
16982 rotate=\rot]{\mytext}
16983 \or % rotation +90
16984 \pgftext[left,
16985 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
16986 rotate=\rot]{\mytext}
16987 \fi
16988 % down
16989 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
16990 \pgf@circ@do@wedge@down
16991 \ifcase\quadrant % rotation 0
16992 \pgftext[bottom,
16993 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
16994 rotate=\rot]{\mytext}
16995 \or % rotation -90
16996 \pgftext[left,
16997 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
16998 rotate=\rot]{\mytext}
16999 \or %rotation 180
17000 \pgftext[top,
17001 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
17002 rotate=\rot]{\mytext}
17003 \or % rotation +90
17004 \pgftext[right,
17005 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
17006 rotate=\rot]{\mytext}
17007 \fi
17008 % external pins
17009 \ifdim\pgf@circ@res@other>0pt
17010 \pgfscope
17011 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17012 \pgf@circ@count@a=\numpins\relax
17013 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17014 \pgfmathloop%
17015 \ifnum\pgf@circ@count@a>0
17016 % left side pins
17017 \pgf@circ@count@c=\pgf@circ@count@a
17018 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
17019 %% Or'ing tests in core TeX is tough
17020 \edef\@@or{0}
17021 % Just expand the key the minimum needed
17022 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
17023 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
17024 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
17025 \ifnum\@@tmp>0\edef\@@or{1}\fi
17026 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
17027 \ifnum\@@tmp>0\edef\@@or{1}\fi
17028 \ifnum\@@or>0
17029 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17030 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17031 \pgfusepath{stroke}
17032 \fi
17033 % right side pins
17034 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17035 \edef\@@or{0}
17036 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
17037 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
17038 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
17039 \ifnum\@@tmp>0\edef\@@or{1}\fi
17040 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
17041 \ifnum\@@tmp>0\edef\@@or{1}\fi
17042 % \typeout{TEST\space\@@tmp\space\@@x}
17043 \ifnum\@@or>0
17044 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17046 \pgfusepath{stroke}
17047 \fi
17048 \advance\pgf@circ@count@a by -1\relax%
17049 \repeatpgfmathloop
17050 % up side
17051 \edef\@@or{0}
17052 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
17053 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
17054 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
17055 \ifnum\@@tmp>0\edef\@@or{1}\fi
17056 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
17057 \ifnum\@@tmp>0\edef\@@or{1}\fi
17058 % \typeout{TEST\space\@@tmp\space\@@x}
17059 \ifnum\@@or>0
17060 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17061 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
17062 \pgfusepath{stroke}
17063 \fi
17064 % down side
17065 \edef\@@or{0}
17066 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
17067 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
17068 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
17069 \ifnum\@@tmp>0\edef\@@or{1}\fi
17070 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
17071 \ifnum\@@tmp>0\edef\@@or{1}\fi
17072 % \typeout{TEST\space\@@tmp\space\@@x}
17073 \ifnum\@@or>0
17074 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17075 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
17076 \pgfusepath{stroke}
17077 \fi
17078 \endpgfscope
17079 \fi % external pin width >0
17080 %
17081 % draw "inverting" circles on outputs, they must be last
17082 %
17083 \pgfscope
17084 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17085 \pgf@circ@count@a=\numpins\relax
17086 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17087 \pgfmathloop%
17088 \ifnum\pgf@circ@count@a>0
17089 % left side pins
17090 \pgf@circ@count@c=\pgf@circ@count@a
17091 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
17092 \ifnum\@@tmp>0\pgfscope
17093 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17094 \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
17095 \endpgfscope\fi
17096 % right side pins
17097 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17098 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
17099 \ifnum\@@tmp>0\pgfscope
17100 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17101 \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
17102 \endpgfscope\fi
17103 \advance\pgf@circ@count@a by -1\relax%
17104 \repeatpgfmathloop
17105 % up side
17106 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
17107 \ifnum\@@tmp>0\pgfscope
17108 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
17109 \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
17110 \endpgfscope\fi
17111 % down side
17112 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
17113 \ifnum\@@tmp>0\pgfscope
17114 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
17115 \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
17116 \endpgfscope\fi
17117 \endpgfscope
17118 }%
17119 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17120 % and is executed just before a node is drawn.
17121 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
17122 % Start with the maximum pin number and go backwards.
17123 \pgf@circ@count@a=\numpins\relax
17124 \pgfmathloop%
17125 \ifnum\pgf@circ@count@a>0
17126 % we will create two anchors per pin: the "normal one" like `pin 1` for the
17127 % electrical contact, and the "border one" like `bpin 1` for labels.
17128 % they will coincide if `external pins width` is set to 0.
17129 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
17130 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
17131 }
17132 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
17133 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
17134 }
17135 \advance\pgf@circ@count@a by -1\relax%
17136 \repeatpgfmathloop%
17137 }%
17138 }
17139
17140 %
17141 % MUX-DEMUXES
17142 %
17143 % Thanks to @marmot
17144 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
17145 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
17146 \tikzset{one bit adder/.style={muxdemux,
17147 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
17148 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
17149 \tikzset{ALU/.style={muxdemux,
17150 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
17151 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
17152 %generic mux-demux shape
17153 \pgfdeclareshape{muxdemux}{
17154 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
17155 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17156 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
17157 % pins on the four sides
17158 % \savedmacro\NL{%
17159 % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
17160 % \def\NL{\the\pgf@circ@count@a}
17161 % }
17162 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
17163 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
17164 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
17165 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
17166 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
17167 % topleft and topright sizes
17168 \savedanchor{\topleft}{%
17169 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17170 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
17171 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
17172 }
17173 \savedanchor{\topright}{%
17174 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17175 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
17176 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
17177 }
17178 \savedanchor{\insetnortheast}{%
17179 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17180 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
17181 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
17182 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
17183 }
17184 \saveddimen{\insethright}{
17185 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17186 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
17187 \saveddimen{\extshift}{
17188 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17189 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
17190 \savedanchor{\northwest}{%
17191 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17192 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
17193 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
17194 }
17195 \anchor{nw}{\northwest}
17196 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
17197 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17198 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
17199 \anchor{north west}{\northwest}
17200 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
17201 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
17202 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
17203 \anchor{n}{\northwest\pgf@x=0pt }
17204 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17205 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17206 \anchor{w}{\northwest\pgf@y=0pt }
17207 \anchor{north}{\northwest\pgf@x=0pt }
17208 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17209 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17210 \anchor{west}{\northwest\pgf@y=0pt }
17211 \anchor{center}{\pgfpointorigin}
17212 \anchor{top right}{\topright}
17213 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
17214 \anchor{right}{\topright\pgf@y=0pt\relax}
17215 \anchor{top left}{\topleft}
17216 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
17217 \anchor{left}{\topleft\pgf@y=0pt\relax}
17218 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
17219 \divide\pgf@y by 2 \pgf@x=0pt\relax}
17220 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
17221 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
17222 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
17223 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
17224 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
17225 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
17226 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
17227 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
17228 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
17229 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
17230 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
17231 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
17232 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
17233 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
17234 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
17235 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
17236 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
17237 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
17238 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
17239 \divide\pgf@y by 2
17240 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
17241 \divide\pgf@y by 2 \pgf@x=0pt\relax}
17242 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
17243 \divide\pgf@y by 2
17244 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
17245 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
17246 \anchor{text}{%
17247 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17248 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
17249 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
17250 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
17251 \pgf@y=-.5\ht\pgfnodeparttextbox%
17252 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
17253 }%
17254 \backgroundpath{%
17255 \topleft
17256 \pgf@circ@res@up = \pgf@y
17257 \pgf@circ@res@down = -\pgf@y
17258 \pgf@circ@res@left = \pgf@x
17259 \topright
17260 \pgf@circ@res@other = \pgf@y
17261 \pgf@circ@res@right = \pgf@x
17262 \insetnortheast
17263 \pgf@circ@res@step = \pgf@x
17264 \pgf@circ@res@temp = \pgf@y
17265 %
17266 % external block
17267 %
17268 \pgfscope% (for the line width)
17269 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17270 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
17271 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
17272 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
17273 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
17274 % inset, starting down
17275 \ifdim\pgf@circ@res@temp>0pt % inset
17276 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
17277 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
17278 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
17279 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
17280 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
17281 \fi
17282 \pgfpathclose
17283 \pgf@circ@draworfill
17284 \endpgfscope
17285 % now we have to draw the pins, if needed
17286 \ifdim\extshift>0pt\ifpgfcirc@draw@leads\pgfscope % let's avoid too much indent
17287 % Ok, we have to draw the leads (a.k.a. pins)
17288 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17289 % We mimic the anchors here --- probably there is a better way
17290 % left pins
17291 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
17292 \pgf@circ@count@a=\NL\relax
17293 \pgf@circ@count@b=\NL \divide\pgf@circ@count@b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
17294 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
17295 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
17296 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
17297 % we have to check oddity
17298 \ifodd\NL
17299 \ifnum\NL=1
17300 % only centerpin, step should not be used, but anyway...
17301 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
17302 \else
17303 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
17304 \fi
17305 \else
17306 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
17307 \fi
17308 \else % no inset
17309 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
17310 \fi
17311 \pgfmathloop%
17312 \ifnum\pgf@circ@count@a>0
17313 %%%%%
17314 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
17315 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
17316 % for lower pins we have to shift them down
17317 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
17318 \ifodd\NL
17319 % odd number of pins
17320 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
17321 % centerpin!
17322 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17323 \ifnum\squarepins>0
17324 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
17325 \else
17326 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
17327 \fi
17328 \else
17329 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
17330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
17331 \fi
17332 \else
17333 % even numer of pins: just go down
17334 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
17335 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
17336 \fi
17337 \else
17338 % nothing need for #1<=NL/2
17339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17340 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17341 \fi
17342 \else
17343 % no inset
17344 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17345 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17346 \fi
17347 %%%%%
17348 \advance\pgf@circ@count@a by -1\relax%
17349 \repeatpgfmathloop\fi%
17350 % right pins
17351 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
17352 \pgfmathloop%
17353 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
17354 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
17355 \ifnum\pgf@circ@count@a>0
17356 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17357 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
17358 \advance\pgf@circ@count@a by -1\relax%
17359 \repeatpgfmathloop\fi%
17360 % bottom pins
17361 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
17362 \pgfmathloop%
17363 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
17364 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
17365 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
17366 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
17367 \ifnum\pgf@circ@count@a>0
17368 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17369 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
17370 \ifnum\squarepins>0
17371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17372 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
17373 \else
17374 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17375 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
17376 \fi
17377 \advance\pgf@circ@count@a by -1\relax%
17378 \repeatpgfmathloop\fi%
17379 % top pins
17380 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
17381 \pgfmathloop%
17382 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
17383 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
17384 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
17385 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
17386 \ifnum\pgf@circ@count@a>0
17387 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17388 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
17389 \ifnum\squarepins>0
17390 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17391 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
17392 \else
17393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
17394 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
17395 \fi
17396 \advance\pgf@circ@count@a by -1\relax%
17397 \repeatpgfmathloop\fi%
17398 % end drawing pins; stroke them
17399 \pgfusepath{stroke}
17400 \endpgfscope\fi\fi
17401 }
17402 % let's start adding anchors
17403 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
17404 % left side anchors
17405 \pgf@circ@count@a=\NL\relax
17406 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
17407 \pgfmathloop%
17408 \ifnum\pgf@circ@count@a>0
17409 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
17410 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
17411 % external leads, and the "border one" like `blpin 1` for internal ones.
17412 % they will coincide if `external pins width` is set to 0.
17413 \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
17414 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
17415 }
17416 \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
17417 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
17418 }
17419 \advance\pgf@circ@count@a by -1\relax%
17420 \repeatpgfmathloop%
17421 % right anchors
17422 \pgf@circ@count@a=\NR\relax
17423 \pgfmathloop%
17424 \ifnum\pgf@circ@count@a>0
17425 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
17426 % external leads, and the "border one" like `brpin 1` for internal ones.
17427 % they will coincide if `external pins width` is set to 0.
17428 \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
17429 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
17430 }
17431 \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
17432 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
17433 }
17434 \advance\pgf@circ@count@a by -1\relax%
17435 \repeatpgfmathloop%
17436 % bottom anchors
17437 \pgf@circ@count@a=\NB\relax
17438 \pgfmathloop%
17439 \ifnum\pgf@circ@count@a>0
17440 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
17441 % external leads, and the "border one" like `bbpin 1` for internal ones.
17442 % they will coincide if `external pins width` is set to 0.
17443 \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
17444 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
17445 }
17446 \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
17447 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
17448 }
17449 \advance\pgf@circ@count@a by -1\relax%
17450 \repeatpgfmathloop%
17451 % top anchors
17452 \pgf@circ@count@a=\NT\relax
17453 \pgfmathloop%
17454 \ifnum\pgf@circ@count@a>0
17455 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
17456 % external leads, and the "border one" like `btpin 1` for internal ones.
17457 % they will coincide if `external pins width` is set to 0.
17458 \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
17459 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
17460 }
17461 \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
17462 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
17463 }
17464 \advance\pgf@circ@count@a by -1\relax%
17465 \repeatpgfmathloop%
17466 }%
17467 }
17468
17469 %% left anchors for muxdemux
17470
17471 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17472 \topleft
17473 \pgf@xa=\pgf@x
17474 \pgf@ya=\pgf@y
17475 \insetnortheast
17476 \pgf@xb=\pgf@x
17477 \pgf@yb=\pgf@y
17478 \ifnum#1>\NL
17479 \PackageError{circuitikz}{%
17480 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
17481 which has been defined with \NL\space left pins%
17482 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
17483 \fi
17484 \pgf@circ@count@a=\NL \divide\pgf@circ@count@a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
17485 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
17486 \ifnum\NL>1
17487 \ifdim\pgf@yb>0pt % check if we have an inset
17488 % we have to check oddity
17489 \ifodd\NL
17490 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
17491 \else
17492 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
17493 \fi
17494 \else % no inset
17495 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
17496 \fi
17497 \ifdim\pgf@yb>0pt % check if we have an inset
17498 \ifnum#1>\pgf@circ@count@a\relax
17499 % for lower pins we have to shift them down
17500 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
17501 \ifodd\NL
17502 % odd number of pins
17503 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
17504 % centerpin!
17505 \ifnum#2=0\relax
17506 \pgfpoint{\pgf@xb}{0pt}
17507 \else
17508 \ifnum\squarepins>0
17509 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
17510 \else
17511 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
17512 \fi
17513 \fi
17514 \else
17515 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
17516 \fi
17517 \else
17518 % even numer of pins: just go down
17519 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
17520 \fi
17521 \else
17522 % nothing need for #1<=NL/2
17523 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
17524 \fi
17525 \else
17526 % no inset
17527 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
17528 \fi
17529 \else
17530 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
17531 \fi
17532 }
17533
17534 % right anchors
17535 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17536 \topright
17537 \pgf@xa=\pgf@x
17538 \pgf@ya=\pgf@y
17539 \ifnum#1>\NR
17540 \PackageError{circuitikz}{%
17541 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
17542 which has been defined with \NR\space right pins%
17543 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
17544 \fi
17545 \ifnum\NR>1
17546 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
17547 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
17548 \else
17549 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
17550 \fi
17551 }
17552
17553 % bottom anchors
17554 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17555 \topleft
17556 \pgf@xa=\pgf@x
17557 \pgf@ya=\pgf@y
17558 \topright
17559 \pgf@xb=\pgf@x
17560 \pgf@yb=\pgf@y
17561 \ifnum#1>\NB
17562 \PackageError{circuitikz}{%
17563 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
17564 which has been defined with \NB\space bottom pins%
17565 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
17566 \fi
17567 \ifnum\NB>0
17568 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
17569 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
17570 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
17571 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
17572 \ifnum#2=0\relax
17573 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
17574 \else
17575 \ifnum\squarepins>0\relax
17576 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
17577 \else
17578 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
17579 \fi
17580 \fi
17581 \else
17582 % should not happen, give the same as pin 1 anyway
17583 \ifnum#2=0\relax
17584 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
17585 \else
17586 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
17587 \fi
17588 \fi
17589 }
17590
17591 % top anchors
17592 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17593 \topleft
17594 \pgf@xa=\pgf@x
17595 \pgf@ya=\pgf@y
17596 \topright
17597 \pgf@xb=\pgf@x
17598 \pgf@yb=\pgf@y
17599 \ifnum#1>\NT
17600 \PackageError{circuitikz}{%
17601 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
17602 which has been defined with \NT\space top pins%
17603 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
17604 \fi
17605 \ifnum\NT>0
17606 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
17607 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
17608 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
17609 \ifnum#2=0\relax
17610 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
17611 \else
17612 \ifnum\squarepins>0
17613 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
17614 \else
17615 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
17616 \fi
17617 \fi
17618 \else
17619 % should not happen, give the same as pin 1 anyway
17620 \ifnum#2=0\relax
17621 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
17622 \else
17623 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
17624 \fi
17625 \fi
17626 }
17627 %%%---------- close: tex/pgfcircmultipoles
17628
17629 %%%%%%%%%%% Springe nach tex/pgfcirclabel
17630 %%%---------- open: tex/pgfcirclabel.tex
17631 % Copyright 2018-2026 by Romano Giannetti
17632 % Copyright 2015-2026 by Stefan Lindner
17633 % Copyright 2013-2026 by Stefan Erhardt
17634 % Copyright 2007-2026 by Massimo Redaelli
17635 %
17636 % This file may be distributed and/or modified
17637 %
17638 % 1. under the LaTeX Project Public License and/or
17639 % 2. under the GNU Public License.
17640 %
17641 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
17642
17643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17644 %% Bipole label positioning
17645
17646 %% bipole labels and annotation extra style
17647
17648 \ctikzset{bipole label style/.style={}}
17649 \tikzset{bipole label style/.code={
17650 \ctikzset{bipole label style/.style={#1}}
17651 }}
17652 \tikzset{bipole label append style/.code={
17653 \ctikzset{bipole label style/.append style={#1}}
17654 }}
17655 \ctikzset{bipole annotation style/.style={}}
17656 \tikzset{bipole annotation style/.code={
17657 \ctikzset{bipole annotation style/.style={#1}}
17658 }}
17659 \tikzset{bipole annotation append style/.code={
17660 \ctikzset{bipole annotation style/.append style={#1}}
17661 }}
17662
17663 %% Options
17664 \ctikzset{label/.style = { l=#1 } }
17665 \ctikzset{l/.code = {
17666 \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
17667 \ctikzsetvalof{bipole/label/unit}{}
17668 \ifpgf@circ@siunitx
17669 \pgf@circ@handleSI{#1}
17670 \ifpgf@circ@siunitx@res
17671 \edef\pgf@temp{\pgf@circ@handleSI@val}
17672 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
17673 \edef\pgf@temp{\pgf@circ@handleSI@unit}
17674 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
17675 \else
17676 \fi
17677 \else
17678 \fi
17679 }}
17680
17681 \ctikzset{label above/.code = {
17682 l=#1,
17683 \circuitikzbasekey/bipole/label/position=90 }
17684 }
17685
17686 \ctikzset{l^/.style = {
17687 l=#1,
17688 \circuitikzbasekey/bipole/label/position=90 }
17689 }
17690
17691 \ctikzset{label below/.code = {
17692 l=#1,
17693 \circuitikzbasekey/bipole/label/position=-90 }
17694 }
17695
17696 \ctikzset{l_/.style = {
17697 l=#1,
17698 \circuitikzbasekey/bipole/label/position=-90 }
17699 }
17700
17701 \ctikzset{annotation/.style = { a=#1 } }
17702 \ctikzset{a/.code = {
17703 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
17704 \ctikzsetvalof{bipole/annotation/unit}{}
17705 \ifpgf@circ@siunitx
17706 \pgf@circ@handleSI{#1}
17707 \ifpgf@circ@siunitx@res
17708 \edef\pgf@temp{\pgf@circ@handleSI@val}
17709 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
17710 \edef\pgf@temp{\pgf@circ@handleSI@unit}
17711 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
17712 \else
17713 \fi
17714 \else
17715 \fi
17716 }}
17717
17718 \ctikzset{annotation above/.code = {
17719 a=#1,
17720 \circuitikzbasekey/bipole/annotation/position=90 }
17721 }
17722
17723 \ctikzset{a^/.style = {
17724 a=#1,
17725 \circuitikzbasekey/bipole/annotation/position=90 }
17726 }
17727
17728 \ctikzset{annotation below/.code = {
17729 a=#1,
17730 \circuitikzbasekey/bipole/annotation/position=-90 }
17731 }
17732 \ctikzset{a_/.style = {
17733 a=#1,
17734 \circuitikzbasekey/bipole/annotation/position=-90 }
17735 }
17736
17737 % This is to adjust spacing for the labels so that they are not cramped on components
17738 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
17739
17740 \def\pgf@circ@drawlabels#1{
17741 \pgfextra{
17742 % This function will be called with argument #1 equal
17743 % to "label" or "annotation" form pgfcircpath.tex.
17744 % pgf@circ@direction is the direction of the path,
17745 % its value is set in pgfcircpath.tex
17746 \pgfmathsubtract{\pgf@circ@direction}{90}
17747 \pgfmathround{\pgfmathresult} % avoid precision loss errors
17748 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17749
17750 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
17751 \ifnum \pgf@circ@temp < 0
17752 \pgfmathadd{\pgf@circ@labanc}{180}
17753 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17754 \fi
17755 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
17756 %
17757 % normalize the angle values
17758 %
17759 \pgfmathmod{\pgf@circ@labanc}{360}
17760 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17761 %
17762 \ifpgf@circuit@bipole@inverted
17763 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
17764 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17765 \fi
17766 %
17767 \ifnum \ctikzvalof{mirror value} = -1
17768 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
17769 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17770 \fi
17771 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
17772 }
17773 %Firstly, place a coordinate directly at the edge of the shape
17774 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor)
17775 %now decide, which labels should be drawn
17776 \pgfextra{
17777 \edef\pgf@temp{\ctikzvalof{label/align}}
17778 \def\pgf@circ@temp{straight}
17779 }
17780 \ifx\pgf@temp\pgf@circ@temp %straight
17781 \pgf@circ@drawreglabels{#1}
17782 \else
17783 \pgfextra{\def\pgf@circ@temp{rotate}}
17784 \ifx\pgf@temp\pgf@circ@temp %rotate
17785 \pgf@circ@drawrotlabels{#1}
17786 \else% smart
17787 \pgf@circ@drawsmartlabels{#1}
17788 \fi
17789 \fi
17790 }
17791
17792
17793 \def\pgf@circ@drawsmartlabels#1{
17794 \pgfextra{
17795 \pgfmathmod{\pgf@circ@direction}{90}
17796 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17797 }
17798 \ifnum \pgfcircmathresult > 20
17799 \ifnum \pgfcircmathresult < 70
17800 \pgf@circ@drawrotlabels{#1}
17801 \else
17802 \pgf@circ@drawreglabels{#1}
17803 \fi
17804 \else
17805 \pgf@circ@drawreglabels{#1}
17806 \fi
17807 }
17808
17809
17810 \def\pgf@circ@drawrotlabels#1{
17811 \pgfextra{
17812 % scale the distances in function of zoom, so that they are not
17813 % dependent on it but on font size. Thanks to @marmot
17814 % https://tex.stackexchange.com/a/476018/38080
17815 % the coeffcient is adjusted so that the distance is more or less
17816 % the same for rotated labels and straight ones (although it will
17817 % depend on the font, so it's not exact).
17818 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
17819 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
17820 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
17821 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale}
17822 \ifnum \ctikzvalof{bipole/#1/position}>0
17823 %we need some more space for placement below, due to mid-anchor
17824 \else % we do not have <= in \ifnum...
17825 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
17826 \fi
17827 %Calculate rotation of the label from direction and strip decimals
17828 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
17829 % rotate the label at second or third quadrant:
17830 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
17831 \pgfmathsubtract{\pgf@circ@direction}{180}
17832 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17833 %invert the space relationships due to rotated strings
17834 \ifnum \ctikzvalof{bipole/#1/position}>0
17835 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
17836 \fi
17837 \fi\fi
17838 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}
17839 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17840 }
17841 % reset cm is not working correctly here
17842 (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor)
17843 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
17844 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
17845 }
17846
17847 \def\pgf@circ@drawreglabels#1{
17848 %Now calculate all shape positions
17849 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
17850 %All points between will be addressed by angled-anchors:
17851 \pgfextra{
17852 % scale ex-distance to make it independent on scale
17853 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
17854 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
17855 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
17856 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
17857 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale}
17858 \pgfmathadd{\pgf@circ@labanc}{90}
17859 \pgfmathround{\pgfmathresult}
17860 \def\pgf@circ@labanctext{\pgf@circ@labanc}
17861 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17862 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
17863 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
17864 }
17865 %Values around 90 are at both y-axis
17866 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
17867 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
17868 \ifnum \pgf@circ@labpos > 180
17869 \ifnum \ctikzvalof{bipole/#1/position} > 0
17870 \pgfextra{\def\pgf@circ@labanctext{mid west}}
17871 \else
17872 \pgfextra{\def\pgf@circ@labanctext{mid east}}
17873 \fi
17874 \else
17875 \ifnum \ctikzvalof{bipole/#1/position} > 0
17876 \pgfextra{\def\pgf@circ@labanctext{mid east}}
17877 \else
17878 \pgfextra{\def\pgf@circ@labanctext{mid west}}
17879 \fi
17880 \fi
17881 \fi\fi
17882 %Values between -5 and 5 are at pos /neg x-axis
17883 \pgfextra{\def\uffa{}\newdimen\realshift\realshift=\dimexpr1pt\relax}
17884 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
17885 \ifnum \ctikzvalof{bipole/#1/position} < 0
17886 \ifnum \pgf@circ@labanc > 90
17887 % using base coordinate instead of south to naturally align
17888 % symbols with descendants; but this invalidate the effect of
17889 % the inner sep, so recover it by shifting the anchor
17890 % reset cm is not working sometime, use @marmot solution
17891 % see https://tex.stackexchange.com/a/476018/38080
17892 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
17893 \pgfextra{\def\pgf@circ@labanctext{base}}%base
17894 \else
17895 \pgfextra{\def\pgf@circ@labanctext{north}}%north
17896 \fi
17897 \else
17898 \ifnum \pgf@circ@labanc < 90
17899 % shift, as above
17900 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
17901 \pgfextra{\def\pgf@circ@labanctext{base}}%base
17902 \else
17903 \ifnum \pgf@circ@labanc > 180
17904 % this shouldn't happen, but somehow it does (270 degree anchors)
17905 % shift, as above
17906 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
17907 \pgfextra{\def\pgf@circ@labanctext{base}}%base
17908 \else
17909 \pgfextra{\def\pgf@circ@labanctext{north}}%north
17910 \fi
17911 \fi
17912 \fi
17913 \fi\fi
17914 (labelcoor) node[anchor=\pgf@circ@labanctext,
17915 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
17916 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
17917 }
17918 }
17919
17920 \def\pgf@circ@finallabels#1{%
17921 \edef\pgf@temp{}%
17922 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
17923 \ifx\pgf@temp\pgf@circ@temp%
17924 \ctikzvalof{bipole/#1/name}%
17925 \else%
17926 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
17927 \fi%
17928 }
17929
17930 \ctikzset{text/.style={t=#1}}
17931 \ctikzset{t/.code={%
17932 \ctikzsetvalof{bipoles/twoport/text}{#1}%
17933 }}
17934
17935 %%%% Stacked labels
17936 %
17937 % stacked labels by Romano Giannetti [email protected]
17938 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
17939 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
17940 %
17941 % labels are in a tabular, globally aligned:
17942 % vertically with key l2 valign (default c)
17943 % c: center t: top b: bottom
17944 % horizontally with key l2 align (default l)
17945 % l: left c: centered r: right
17946 % you can switch sides using l2_=... and l2^=...
17947 % syntax is l2_ = line1 and line2 (same for l2^)
17948 %
17949 \ctikzset{%
17950 l2 valign/.store in=\ltwo@valign, l2 valign=c,
17951 l2 halign/.store in=\ltwo@halign, l2 halign=l,
17952 }
17953 \ctikzset{l2base/.code n args={2}{
17954 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
17955 \bgroup
17956 \setlength{\tabcolsep}{2pt}%
17957 \def\ltwo@tabu{\tabular[\ltwo@valign]}%
17958 \expandafter\ltwo@tabu\expandafter{\ltwo@halign}%
17959 #1\\ #2%
17960 \endtabular
17961 \egroup
17962 }%
17963 \ctikzsetvalof{bipole/label/unit}{}
17964 \ifpgf@circ@siunitx
17965 \pgf@circ@handleSI{#2}
17966 \ifpgf@circ@siunitx@res
17967 \edef\pgf@temp{\pgf@circ@handleSI@val}
17968 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
17969 \edef\pgf@temp{\pgf@circ@handleSI@unit}
17970 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
17971 \else
17972 \fi
17973 \else
17974 \fi
17975 }}
17976 \ctikzset{l2/.style args={#1 and #2}{
17977 l2base={#1}{#2},
17978 \circuitikzbasekey/bipole/label/position=90 }
17979 }
17980 \ctikzset{l2 above/.style args={#1 and #2}{
17981 l2base={#1}{#2},
17982 \circuitikzbasekey/bipole/label/position=90 }
17983 }
17984 \ctikzset{l2^/.style args={#1 and #2}{
17985 l2base={#1}{#2},
17986 \circuitikzbasekey/bipole/label/position=90 }
17987 }
17988 \ctikzset{l2 below/.style args={#1 and #2}{
17989 l2base={#1}{#2},
17990 \circuitikzbasekey/bipole/label/position=-90 }
17991 }
17992 \ctikzset{l2_/.style args={#1 and #2}{
17993 l2base={#1}{#2},
17994 \circuitikzbasekey/bipole/label/position=-90 }
17995 }
17996
17997 %%%---------- close: tex/pgfcirclabel
17998 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
17999 %%%---------- open: tex/pgfcircvoltage.tex
18000 % Copyright 2018-2026 by Romano Giannetti
18001 % Copyright 2015-2026 by Stefan Lindner
18002 % Copyright 2013-2026 by Stefan Erhardt
18003 % Copyright 2007-2026 by Massimo Redaelli
18004 %
18005 % This file may be distributed and/or modified
18006 %
18007 % 1. under the LaTeX Project Public License and/or
18008 % 2. under the GNU Public License.
18009 %
18010 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18011
18012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18013 %% Voltage management
18014
18015 %% styles
18016 \ctikzset{bipole voltage style/.style={}}
18017 \tikzset{bipole voltage style/.code={
18018 \ctikzset{bipole voltage style/.style={#1}}
18019 }}
18020 \tikzset{bipole voltage append style/.code={
18021 \ctikzset{bipole voltage style/.append style={#1}}
18022 }}
18023
18024 \ctikzset{v^>/.style = {
18025 v = #1,
18026 \circuitikzbasekey/bipole/voltage/direction = forward,
18027 \circuitikzbasekey/bipole/voltage/position = above
18028 }
18029 }
18030
18031 \ctikzset{v^</.style = {
18032 v = #1,
18033 \circuitikzbasekey/bipole/voltage/direction = backward,
18034 \circuitikzbasekey/bipole/voltage/position = above
18035 }
18036 }
18037
18038 \ctikzset{v_>/.style = {
18039 v = #1,
18040 \circuitikzbasekey/bipole/voltage/direction = forward,
18041 \circuitikzbasekey/bipole/voltage/position = below
18042 }
18043 }
18044
18045 \ctikzset{v_</.style = {
18046 v = #1,
18047 \circuitikzbasekey/bipole/voltage/direction = backward,
18048 \circuitikzbasekey/bipole/voltage/position = below
18049 }
18050 }
18051
18052 \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
18053 \ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
18054 \ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
18055 \ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
18056
18057 % Default position varies whether the component is a voltage source
18058 % or not
18059 \ctikzset{v/.code = {
18060 \ifpgf@circuit@bipole@isvoltage
18061 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
18062 \circuitikzbasekey/bipole/voltage/direction=forward}
18063 \else
18064 \ifpgf@circ@oldvoltagedirection
18065 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
18066 \circuitikzbasekey/bipole/voltage/direction=backward}
18067 \else
18068 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
18069 \circuitikzbasekey/bipole/voltage/direction=forward}
18070 \fi
18071 \fi
18072 \ifpgf@circ@oldvoltagedirection
18073 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
18074 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
18075 \circuitikzbasekey/bipole/voltage/direction=forward}
18076 \fi\fi
18077 \else
18078 \ifpgf@circuit@bipole@iscurrent
18079 \ifpgf@circuit@bipole@current@backward
18080 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
18081 \circuitikzbasekey/bipole/voltage/direction=forward}
18082 \else
18083 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
18084 \circuitikzbasekey/bipole/voltage/direction=backward}
18085 \fi\fi\fi
18086 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
18087 \ctikzsetvalof{bipole/voltage/label/unit}{}
18088 \ifpgf@circ@siunitx
18089 \pgf@circ@handleSI{#1}
18090 \ifpgf@circ@siunitx@res
18091 \edef\pgf@temp{\pgf@circ@handleSI@val}
18092 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
18093 \edef\pgf@temp{\pgf@circ@handleSI@unit}
18094 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
18095 \else
18096 \fi
18097 \else
18098 \fi
18099 }
18100 }
18101
18102 % american voltage font selection and symbol definition
18103 % the default font command is {} --- nothing
18104 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
18105 %
18106 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
18107 %
18108 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
18109 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
18110
18111 %%
18112 \def\setscaledRlenforclass{%
18113 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
18114 \ifdefined\ctikzclass
18115 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
18116 \pgfkeysifdefined{\pgf@temp}
18117 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18118 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
18119 \else
18120 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
18121 \fi
18122 }
18123
18124 %% Output routine for generic bipoles
18125
18126 \def\pgf@circ@drawvoltagegeneric{
18127 \pgfextra{
18128 % \typeout{NAME:\ctikzvalof{bipole/name}}
18129 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
18130 \pgfkeysifdefined{\pgf@temp}
18131 {
18132 \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}
18133 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
18134 }
18135 {
18136 \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance}
18137 {
18138 \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}}
18139 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
18140 }
18141 {%calculate default value from part height
18142 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
18143 \pgfkeysifdefined{\pgf@temp}
18144 {
18145 \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
18146 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen+0.2\pgf@circ@scaled@Rlen)}
18147 }
18148 {
18149 \edef\tmpdistfromline{(.5\pgf@circ@scaled@Rlen)} %fallback to fixed value
18150 }
18151 }
18152 }
18153 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
18154 \ifnum \ctikzvalof{mirror value}=-1
18155 \ifpgf@circuit@bipole@inverted
18156 \ifpgf@circuit@bipole@voltage@straight
18157 \def\distfromline{\tmpdistfromline}
18158 \else
18159 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
18160 \fi
18161 \else
18162 \ifpgf@circuit@bipole@voltage@straight
18163 \def\distfromline{-\tmpdistfromline}
18164 \else
18165 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
18166 \fi
18167 \fi
18168 \else
18169 \ifpgf@circuit@bipole@inverted
18170 \ifpgf@circuit@bipole@voltage@straight
18171 \def\distfromline{-\tmpdistfromline}
18172 \else
18173 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
18174 \fi
18175 \else
18176 \ifpgf@circuit@bipole@voltage@straight
18177 \def\distfromline{\tmpdistfromline}
18178 \else
18179 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
18180 \fi
18181 \fi
18182 \fi
18183 \ifpgf@circuit@bipole@voltage@below
18184 \def\pgf@circ@voltage@angle{90}
18185 \else
18186 \def\pgf@circ@voltage@angle{-90}
18187 \fi
18188 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
18189 \pgfkeysifdefined{\pgf@temp}
18190 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
18191 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
18192 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
18193 \pgfkeysifdefined{\pgf@temp}
18194 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
18195 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
18196 \edef\shiftv{\ctikzvalof{voltage/shift}}
18197 % additional per-bipole voltage shift (internal)
18198 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}
18199 \pgfkeysifdefined{\pgf@temp}
18200 {
18201 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}}
18202 }
18203 {
18204 \edef\addvshift{0}
18205 }
18206 \newdimen{\absvshift}
18207 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
18208 % put this to true to see the voltage label coordinate anchors
18209 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
18210 }
18211 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
18212 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
18213 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorstartnode)$)
18214 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
18215 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$)
18216
18217 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
18218 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorendnode)$)
18219 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
18220 coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$)
18221
18222 \ifpgf@circuit@bipole@voltage@below
18223 \ifpgf@circ@debugv
18224 node [ocirc, fill=red] at (anchorstartnode) {}
18225 node [ocirc, fill=blue] at (anchorendnode) {}
18226 node [ocirc, fill=green] at (pgfcirc@Vto) {}
18227 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
18228 node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {}
18229 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {}
18230 \fi
18231 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$)
18232 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
18233 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
18234 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
18235 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
18236 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
18237 \ifpgf@circ@debugv
18238 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
18239 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
18240 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
18241 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
18242 \fi
18243 \else
18244 \ifpgf@circ@debugv
18245 node [ocirc, fill=red] at (anchorstartnode) {}
18246 node [ocirc, fill=blue] at (anchorendnode) {}
18247 node [ocirc, fill=green] at (pgfcirc@Vto) {}
18248 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
18249 node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {}
18250 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {}
18251 \fi
18252 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
18253 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
18254 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
18255 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
18256 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
18257 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
18258 \ifpgf@circ@debugv
18259 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
18260 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
18261 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
18262 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
18263 \fi
18264 \fi
18265
18266 \ifpgf@circuit@europeanvoltage
18267 \ifpgf@circuit@bipole@voltage@straight
18268 \ifpgf@circuit@bipole@voltage@backward
18269 (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
18270 \else
18271 (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
18272 \fi
18273 \else
18274 \ifpgf@circuit@bipole@voltage@backward
18275 (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) ..
18276 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
18277 (pgfcirc@Vfrom)
18278 \else
18279 (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) ..
18280 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
18281 (pgfcirc@Vto)
18282 \fi
18283 \fi
18284 \else
18285 \ifpgf@circuit@bipole@voltage@backward
18286 \ifpgf@circ@oldvoltagedirection
18287 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
18288 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
18289 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
18290 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
18291 \else
18292 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
18293 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
18294 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
18295 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
18296 \fi
18297 \else
18298 \ifpgf@circ@oldvoltagedirection
18299 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
18300 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
18301 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
18302 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
18303 \else
18304 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
18305 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
18306 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
18307 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
18308 \fi
18309 \fi
18310 \fi
18311 }
18312
18313 %% Output routine for voltage sources
18314 \def\pgf@circ@drawvoltagegenerator{
18315 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
18316 % it's not perfect, but I can't find the way to do it correctly...
18317 \pgfextra{
18318 \edef\shiftv{\ctikzvalof{voltage/shift}}
18319 \edef\bumpa{\ctikzvalof{voltage/bump a}}
18320 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
18321 }
18322 \ifpgf@circuit@bipole@voltage@below
18323 coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
18324 coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
18325 \else
18326 coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
18327 coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
18328 \fi
18329 % fix the (unused in this case) Vcont1/2 coords for label placement along the line
18330 coordinate (pgfcirc@Vcont1) at (pgfcirc@Vto)
18331 coordinate (pgfcirc@Vcont2) at (pgfcirc@Vfrom)
18332 \ifpgf@circuit@europeanvoltage
18333 \ifpgf@circuit@bipole@voltage@backward
18334 (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vfrom)
18335 \else
18336 (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vto)
18337 \fi
18338 \else% american voltage
18339 \ifpgf@circuit@bipole@voltageoutsideofsymbol
18340 % if it is a battery, must put + and -
18341
18342 \ifpgf@circ@fixbatteries
18343 \ifpgf@circuit@bipole@voltage@backward
18344 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
18345 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
18346 \else
18347 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
18348 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
18349 \fi
18350 \else
18351 \ifpgf@circuit@bipole@voltage@backward
18352 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
18353 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
18354 \else
18355 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
18356 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
18357 \fi
18358 \fi
18359 \fi
18360 \fi
18361 }
18362
18363 %% Output routine
18364 \def\pgf@circ@drawvoltage{% node name
18365 \pgfextra{ %WARNING: indentation is probably wrong
18366 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
18367 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
18368 \ifpgf@circuit@bipole@voltage@below
18369 \def\pgf@circ@bipole@voltage@label@anchor{north west}
18370 \else
18371 \def\pgf@circ@bipole@voltage@label@anchor{south east}
18372 \fi
18373 \fi\fi
18374 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
18375 \ifpgf@circuit@bipole@voltage@below
18376 \def\pgf@circ@bipole@voltage@label@anchor{west}
18377 \else
18378 \def\pgf@circ@bipole@voltage@label@anchor{east}
18379 \fi
18380 \fi\fi
18381 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
18382 \ifpgf@circuit@bipole@voltage@below
18383 \def\pgf@circ@bipole@voltage@label@anchor{south west}
18384 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
18385 \fi
18386 \fi\fi
18387 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
18388 \ifpgf@circuit@bipole@voltage@below
18389 \def\pgf@circ@bipole@voltage@label@anchor{south}
18390 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
18391 \fi
18392 \fi\fi
18393 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
18394 \ifpgf@circuit@bipole@voltage@below
18395 \def\pgf@circ@bipole@voltage@label@anchor{south east}
18396 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
18397 \fi
18398 \fi\fi
18399 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
18400 \ifpgf@circuit@bipole@voltage@below
18401 \def\pgf@circ@bipole@voltage@label@anchor{east}
18402 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
18403 \fi
18404 \fi\fi
18405 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
18406 \ifpgf@circuit@bipole@voltage@below
18407 \def\pgf@circ@bipole@voltage@label@anchor{north east}
18408 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
18409 \fi
18410 \fi\fi
18411 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
18412 \ifpgf@circuit@bipole@voltage@below
18413 \def\pgf@circ@bipole@voltage@label@anchor{north}
18414 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
18415 \fi
18416 \fi\fi
18417 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
18418 \ifpgf@circuit@bipole@voltage@below
18419 \def\pgf@circ@bipole@voltage@label@anchor{north}
18420 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
18421 \fi
18422 \fi\fi
18423
18424 % this must be set *before* changing for mirroring and inverting; in that case
18425 % the xscale/yscale parameters take it into account
18426 \ifpgf@circuit@bipole@voltage@below
18427 \def\pgf@circ@bipole@voltage@label@where{-90}
18428 \else
18429 \def\pgf@circ@bipole@voltage@label@where{90}
18430 \fi
18431
18432 % magic to counteract the scale and yscale effects (there should be a better way...)
18433 \ifnum \ctikzvalof{mirror value}=-1
18434 \ifpgf@circuit@bipole@voltage@below
18435 \pgf@circuit@bipole@voltage@belowfalse
18436 \else
18437 \pgf@circuit@bipole@voltage@belowtrue
18438 \fi
18439 \fi
18440
18441 \ifpgf@circuit@bipole@inverted
18442 \ifpgf@circuit@bipole@voltage@below
18443 \pgf@circuit@bipole@voltage@belowfalse
18444 \else
18445 \pgf@circuit@bipole@voltage@belowtrue
18446 \fi
18447 \fi
18448
18449 % take into account scaling
18450 \setscaledRlenforclass
18451
18452 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
18453 \pgfkeysifdefined{\pgf@temp}
18454 { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} }
18455 { \edef\eudist{\ctikzvalof{voltage/european label distance}} }
18456 % find the height of the bipole or use a default value
18457 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
18458 \pgfkeysifdefined{\pgf@temp}
18459 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
18460 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
18461 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
18462 \newdimen{\alshift}
18463 % this is more or less the same of the legacy code; we shift the american label a bit
18464 % outside the (+) -- (-) line
18465 \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight}
18466 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
18467 }%end pgfextra
18468
18469 \ifpgf@circuit@bipole@isvoltage
18470 \pgf@circ@drawvoltagegenerator
18471 \else
18472 \pgf@circ@drawvoltagegeneric
18473 \fi
18474
18475 \ifpgf@circuit@bipole@voltage@straight
18476 coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $)
18477 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
18478 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
18479 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
18480 \else
18481 \ifpgf@circuit@europeanvoltage
18482 coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$)
18483 \else
18484 coordinate (Vlab) at ($(pgfcirc@Vfrom)!0.5!(pgfcirc@Vto)$)
18485 \ifpgf@circuit@bipole@isvoltage\else
18486 % add a bit of space for american labels above their symbols in the normal case. You can avoid that
18487 % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights)
18488 coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vto)$)
18489 \fi
18490 \fi
18491 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
18492 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
18493 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
18494 \fi
18495 }%end drawvoltages
18496 %%%---------- close: tex/pgfcircvoltage
18497 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
18498 %%%---------- open: tex/pgfcirccurrent.tex
18499 % Copyright 2018-2026 by Romano Giannetti
18500 % Copyright 2015-2026 by Stefan Lindner
18501 % Copyright 2013-2026 by Stefan Erhardt
18502 % Copyright 2007-2026 by Massimo Redaelli
18503 %
18504 % This file may be distributed and/or modified
18505 %
18506 % 1. under the LaTeX Project Public License and/or
18507 % 2. under the GNU Public License.
18508 %
18509 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18510
18511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18512 %% Current handling
18513
18514 %% styles
18515 \ctikzset{bipole current style/.style={}}
18516 \tikzset{bipole current style/.code={
18517 \ctikzset{bipole current style/.style={#1}}
18518 }}
18519 \tikzset{bipole current append style/.code={
18520 \ctikzset{bipole current style/.append style={#1}}
18521 }}
18522
18523 %% Options
18524 \ctikzset{i^>/.style = {
18525 i = #1,
18526 \circuitikzbasekey/bipole/current/direction = forward,
18527 \circuitikzbasekey/bipole/current/x position = after,
18528 \circuitikzbasekey/bipole/current/y position = above
18529 }
18530 }
18531
18532 \ctikzset{i_>/.style = {
18533 i = #1,
18534 \circuitikzbasekey/bipole/current/direction = forward,
18535 \circuitikzbasekey/bipole/current/x position = after,
18536 \circuitikzbasekey/bipole/current/y position = below
18537 }
18538 }
18539
18540 \ctikzset{i>^/.style = {
18541 i = #1,
18542 \circuitikzbasekey/bipole/current/direction = forward,
18543 \circuitikzbasekey/bipole/current/x position = before,
18544 \circuitikzbasekey/bipole/current/y position = above
18545 }
18546 }
18547
18548 \ctikzset{i>_/.style = {
18549 i = #1,
18550 \circuitikzbasekey/bipole/current/direction = forward,
18551 \circuitikzbasekey/bipole/current/x position = before,
18552 \circuitikzbasekey/bipole/current/y position = below
18553 }
18554 }
18555
18556 \ctikzset{i^</.style = {
18557 i = #1,
18558 \circuitikzbasekey/bipole/current/direction = backward,
18559 \circuitikzbasekey/bipole/current/x position = after,
18560 \circuitikzbasekey/bipole/current/y position = above
18561 }
18562 }
18563
18564 \ctikzset{i_</.style = {
18565 i = #1,
18566 \circuitikzbasekey/bipole/current/direction = backward,
18567 \circuitikzbasekey/bipole/current/x position = after,
18568 \circuitikzbasekey/bipole/current/y position = below
18569 }
18570 }
18571
18572 \ctikzset{i<^/.style = {
18573 i = #1,
18574 \circuitikzbasekey/bipole/current/direction = backward,
18575 \circuitikzbasekey/bipole/current/x position = before,
18576 \circuitikzbasekey/bipole/current/y position = above
18577 }
18578 }
18579
18580 \ctikzset{i<_/.style = {
18581 i = #1,
18582 \circuitikzbasekey/bipole/current/direction = backward,
18583 \circuitikzbasekey/bipole/current/x position = before,
18584 \circuitikzbasekey/bipole/current/y position = below
18585 }
18586 }
18587
18588 \ctikzset{i/.code = {
18589 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
18590 \circuitikzbasekey/bipole/current/x position = after,
18591 \circuitikzbasekey/bipole/current/y position = above }
18592 \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
18593 \ctikzsetvalof{bipole/current/label/unit}{}
18594 \ifpgf@circ@siunitx
18595 \pgf@circ@handleSI{#1}
18596 \ifpgf@circ@siunitx@res
18597 \edef\pgf@temp{\pgf@circ@handleSI@val}
18598 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
18599 \edef\pgf@temp{\pgf@circ@handleSI@unit}
18600 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
18601 \else
18602 \fi
18603 \else
18604 \fi
18605 %reverse current direction for voltage sources
18606 \ifpgf@circ@oldvoltagedirection\else
18607 \ifpgf@circuit@bipole@isvoltage
18608 \ifpgf@circuit@bipole@voltage@backward
18609 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
18610 \circuitikzbasekey/bipole/current/x position = after,
18611 \circuitikzbasekey/bipole/current/y position = below }
18612 \else
18613 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
18614 \circuitikzbasekey/bipole/current/x position = before,
18615 \circuitikzbasekey/bipole/current/y position = above }
18616 \fi\fi\fi
18617 }
18618 }
18619
18620 \ifpgf@circ@oldvoltagedirection
18621 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
18622 \else
18623 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
18624 \fi
18625 \ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
18626 \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
18627 \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
18628
18629 %% Output routine
18630 \def\pgf@circ@drawcurrent{
18631 \pgfextra{
18632 \edef\pgf@circ@ffffff{\pgf@circ@direction}
18633 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
18634
18635 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
18636 \ifpgf@circuit@bipole@current@below
18637 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
18638 \fi
18639 \fi\fi
18640 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
18641 \ifpgf@circuit@bipole@current@below
18642 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
18643 \fi
18644 \fi\fi
18645 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
18646 \ifpgf@circuit@bipole@current@below
18647 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
18648 \fi
18649 \fi\fi
18650 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
18651 \ifpgf@circuit@bipole@current@below
18652 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
18653 \fi
18654 \fi\fi
18655 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
18656 \ifpgf@circuit@bipole@current@below
18657 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
18658 \fi
18659 \fi\fi
18660 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
18661 \ifpgf@circuit@bipole@current@below
18662 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
18663 \fi
18664 \fi\fi
18665 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
18666 \ifpgf@circuit@bipole@current@below
18667 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
18668 \fi
18669 \fi\fi
18670 \ifnum\pgfcircmathresult <5
18671 \ifpgf@circuit@bipole@current@below
18672 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
18673 \fi
18674 \fi
18675 \ifnum\pgfcircmathresult >355
18676 \ifpgf@circuit@bipole@current@below
18677 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
18678 \fi
18679 \fi
18680
18681 \ifpgf@circuit@bipole@current@below
18682 \def\pgf@circ@bipole@current@label@where{-90}
18683 \else
18684 \def\pgf@circ@bipole@current@label@where{+90}
18685 \fi
18686 }
18687
18688 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
18689 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
18690 (\tikztostart)--(\tikztotarget)
18691 \else% normal bipole or source
18692 \ifpgf@circuit@bipole@current@before
18693 (\tikztostart)--(anchorstartnode)
18694 \else
18695 (anchorendnode)--(\tikztotarget)
18696 \fi
18697 \fi
18698 \ifpgf@circuit@bipole@current@backward
18699 \pgfextra{
18700 \pgfmathsubtract{\pgf@circ@ffffff}{180}
18701 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
18702 }
18703 \fi
18704 coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff,
18705 anchor=center](Iarrow)
18706 (Iarrow.\pgf@circ@bipole@current@label@where)
18707 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
18708 (\ctikzvalof{bipole/name}current){\pgf@circ@finallabels{current/label}}
18709 }
18710
18711 %%%---------- close: tex/pgfcirccurrent
18712 %%%%%%%%%%% Springe nach tex/pgfcircflow
18713 %%%---------- open: tex/pgfcircflow.tex
18714 % Copyright 2018-2026 by Romano Giannetti
18715 % Copyright 2015-2026 by Stefan Lindner
18716 % Copyright 2013-2026 by Stefan Erhardt
18717 % Copyright 2007-2026 by Massimo Redaelli
18718 %
18719 % This file may be distributed and/or modified
18720 %
18721 % 1. under the LaTeX Project Public License and/or
18722 % 2. under the GNU Public License.
18723 %
18724 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18725
18726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18727 %% flow handling
18728
18729 %% styles
18730 \ctikzset{bipole flow style/.style={}}
18731 \tikzset{bipole flow style/.code={
18732 \ctikzset{bipole flow style/.style={#1}}
18733 }}
18734 \tikzset{bipole flow append style/.code={
18735 \ctikzset{bipole flow style/.append style={#1}}
18736 }}
18737
18738 %% Options
18739 \ctikzset{f^>/.style = {
18740 f = #1,
18741 \circuitikzbasekey/bipole/flow/direction = forward,
18742 \circuitikzbasekey/bipole/flow/x position = after,
18743 \circuitikzbasekey/bipole/curflowrent/y position = above
18744 }
18745 }
18746
18747 \ctikzset{f_>/.style = {
18748 f = #1,
18749 \circuitikzbasekey/bipole/flow/direction = forward,
18750 \circuitikzbasekey/bipole/flow/x position = after,
18751 \circuitikzbasekey/bipole/flow/y position = below
18752 }
18753 }
18754
18755 \ctikzset{f>^/.style = {
18756 f = #1,
18757 \circuitikzbasekey/bipole/flow/direction = forward,
18758 \circuitikzbasekey/bipole/flow/x position = before,
18759 \circuitikzbasekey/bipole/flow/y position = above
18760 }
18761 }
18762
18763 \ctikzset{f>_/.style = {
18764 f = #1,
18765 \circuitikzbasekey/bipole/flow/direction = forward,
18766 \circuitikzbasekey/bipole/flow/x position = before,
18767 \circuitikzbasekey/bipole/flow/y position = below
18768 }
18769 }
18770
18771 \ctikzset{f^</.style = {
18772 f = #1,
18773 \circuitikzbasekey/bipole/flow/direction = backward,
18774 \circuitikzbasekey/bipole/flow/x position = after,
18775 \circuitikzbasekey/bipole/flow/y position = above
18776 }
18777 }
18778
18779 \ctikzset{f_</.style = {
18780 f = #1,
18781 \circuitikzbasekey/bipole/flow/direction = backward,
18782 \circuitikzbasekey/bipole/flow/x position = after,
18783 \circuitikzbasekey/bipole/flow/y position = below
18784 }
18785 }
18786
18787 \ctikzset{f<^/.style = {
18788 f = #1,
18789 \circuitikzbasekey/bipole/flow/direction = backward,
18790 \circuitikzbasekey/bipole/flow/x position = before,
18791 \circuitikzbasekey/bipole/flow/y position = above
18792 }
18793 }
18794
18795 \ctikzset{f<_/.style = {
18796 f = #1,
18797 \circuitikzbasekey/bipole/flow/direction = backward,
18798 \circuitikzbasekey/bipole/flow/x position = before,
18799 \circuitikzbasekey/bipole/flow/y position = below
18800 }
18801 }
18802
18803 \ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
18804 \ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
18805 \ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
18806 \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
18807
18808 \ctikzset{f/.code = {
18809 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
18810 \circuitikzbasekey/bipole/flow/x position = after,
18811 \circuitikzbasekey/bipole/flow/y position = above }
18812 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
18813 \ctikzsetvalof{bipole/flow/label/unit}{}
18814 \ifpgf@circ@siunitx
18815 \pgf@circ@handleSI{#1}
18816 \ifpgf@circ@siunitx@res
18817 \edef\pgf@temp{\pgf@circ@handleSI@val}
18818 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
18819 \edef\pgf@temp{\pgf@circ@handleSI@unit}
18820 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
18821 \else
18822 \fi
18823 \else
18824 \fi
18825 }
18826 }
18827
18828 %% Output routine
18829 \def\pgf@circ@drawflow{
18830 \pgfextra{
18831 \edef\pgf@circ@ffffff{\pgf@circ@direction}
18832 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
18833
18834 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
18835 \ifpgf@circuit@bipole@flow@below
18836 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
18837 \fi
18838 \fi\fi
18839 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
18840 \ifpgf@circuit@bipole@flow@below
18841 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
18842 \fi
18843 \fi\fi
18844 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
18845 \ifpgf@circuit@bipole@flow@below
18846 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
18847 \fi
18848 \fi\fi
18849 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
18850 \ifpgf@circuit@bipole@flow@below
18851 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
18852 \fi
18853 \fi\fi
18854 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
18855 \ifpgf@circuit@bipole@flow@below
18856 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
18857 \fi
18858 \fi\fi
18859 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
18860 \ifpgf@circuit@bipole@flow@below
18861 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
18862 \fi
18863 \fi\fi
18864 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
18865 \ifpgf@circuit@bipole@flow@below
18866 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
18867 \fi
18868 \fi\fi
18869 \ifnum\pgfcircmathresult <5
18870 \ifpgf@circuit@bipole@flow@below
18871 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
18872 \fi
18873 \fi
18874 \ifnum\pgfcircmathresult >355
18875 \ifpgf@circuit@bipole@flow@below
18876 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
18877 \fi
18878 \fi
18879
18880 \ifpgf@circuit@bipole@flow@below
18881 \def\pgf@circ@bipole@flow@label@where{-90}
18882 \else
18883 \def\pgf@circ@bipole@flow@label@where{+90}
18884 \fi
18885 }
18886
18887 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
18888 \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line
18889 (\tikztostart)--(\tikztotarget)
18890 \else% normal bipole or source
18891 \ifpgf@circuit@bipole@flow@before
18892 (\tikztostart)--(anchorstartnode)
18893 \else
18894 (anchorendnode)--(\tikztotarget)
18895 \fi
18896 \fi
18897 \pgfextra{
18898 \ifpgf@circuit@bipole@flow@backward
18899 \ifpgf@circuit@bipole@flow@below
18900 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
18901 \else
18902 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
18903 \fi
18904 \pgfmathsubtract{\pgf@circ@ffffff}{180}
18905 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
18906 \else
18907 \ifpgf@circuit@bipole@flow@below
18908 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
18909 \else
18910 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
18911 \fi
18912 \fi
18913 }
18914 coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset, anchor=center](Farrowpos)
18915 (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
18916 (\ctikzvalof{bipole/name}flow){\pgf@circ@finallabels{flow/label}}
18917 }
18918
18919 %%%---------- close: tex/pgfcircflow
18920
18921 % defaults
18922
18923 \setupmodule
18924 [current=european,
18925 voltage=european,
18926 resistor=american,
18927 inductor=cute,
18928 logic=american,
18929 siunitx=true,
18930 arrowmos=false]
18931
18932 \processaction
18933 [\currentmoduleparameter{voltage}]
18934 [european=>\ctikzset{voltage=european},
18935 american=>\ctikzset{voltage=american}]
18936
18937 \processaction
18938 [\currentmoduleparameter{current}]
18939 [european=>\ctikzset{ current=european},
18940 american=>\ctikzset{ current=american}]
18941
18942 \processaction
18943 [\currentmoduleparameter{label}]
18944 [straight=>\ctikzset{label/align = straight},
18945 align=>\ctikzset{label/align = rotate},
18946 smart=>\ctikzset{label/align = smart}]
18947
18948 \processaction
18949 [\currentmoduleparameter{resistor}]
18950 [european=>\ctikzset{ resistor=european},
18951 american=>\ctikzset{ resistor=american}]
18952
18953 \processaction
18954 [\currentmoduleparameter{inductor}]
18955 [european=>\ctikzset{ inductor=european},
18956 american=>\ctikzset{ inductor=american},
18957 cute=>\ctikzset{ inductor=cute}]
18958
18959 \processaction
18960 [\currentmoduleparameter{diode}]
18961 [full=>\ctikzset{ diode=full},
18962 empty=>\ctikzset{ diode=empty}]
18963
18964 \processaction
18965 [\currentmoduleparameter{logic}]
18966 [european=>\ctikzset{ logic ports=european},
18967 american=>\ctikzset{ logic ports=american}]
18968
18969 \processaction
18970 [\currentmoduleparameter{siunitx}]
18971 [true=>\def\SI#1#2{#1\,#2}
18972 \def\ampere{\rm{A}}
18973 \def\volt{\rm{V}}
18974 \def\ohm{\Omega}
18975 \def\siemens{\rm{S}}
18976 \def\farad{\rm{F}}
18977 \def\henry{\rm{H}}
18978 \def\second{\rm{s}}
18979 \def\coulomb{\rm{C}}
18980 \def\siemens{\rm{S}}
18981 \def\radians{\rm{rad}}
18982 \def\milli{\rm{m}}
18983 \def\micro{\mu}
18984 \def\nano{\rm{n}}
18985 \def\pico{\rm{p}}
18986 \def\kilo{\rm{k}}
18987 \def\mega{\rm{M}}
18988 \def\giga{\rm{G}}
18989 \def\tera{\rm{T}},
18990 false=>]
18991 % \s!default=>\pgf@circ@siunitxtrue,
18992
18993 \processaction
18994 [\currentmoduleparameter{arrowmos}]
18995 [true=>\pgf@circuit@mos@arrowstrue,
18996 false=>\pgf@circuit@mos@arrowsfalse]
18997 % \s!default=>\pgf@circuit@mos@arrowstrue,
18998
18999
19000 \ifpgf@circ@siunitx
19001 % nothing! siunitx and xstrings don't work in context
19002 \fi
19003
19004
19005 % Context specific
19006
19007 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
19008
19009 %%%%%%%%%%% Springe nach tex/pgfcircpath
19010 %%%---------- open: tex/pgfcircpath.tex
19011 % Copyright 2018-2026 by Romano Giannetti
19012 % Copyright 2015-2026 by Stefan Lindner
19013 % Copyright 2013-2026 by Stefan Erhardt
19014 % Copyright 2007-2026 by Massimo Redaelli
19015 %
19016 % This file may be distributed and/or modified
19017 %
19018 % 1. under the LaTeX Project Public License and/or
19019 % 2. under the GNU Public License.
19020 %
19021 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
19022
19023
19024 \def\pgf@circ@direction{0.0}
19025
19026 % Names
19027 \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
19028 \ctikzset{n/.code = {
19029 \pgfkeys{/tikz/circuitikz/bipole/name=#1}
19030 }}
19031
19032 % Reflect the node along
19033 \ctikzset{mirrored/.is choice}
19034 \ctikzset{mirror value/.initial=1}
19035 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
19036 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
19037 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
19038
19039 % Invert node along path
19040 \ctikzset{inverted/.is choice}
19041 \ctikzset{invert value/.initial=1}
19042 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
19043 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
19044 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
19045 \newif\ifpgf@circuit@bipole@inverted
19046 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
19047
19048 \newif\ifpgf@circuit@bipole@voltage@backward
19049 \ctikzset{bipole/voltage/direction/.is choice}
19050 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
19051 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
19052
19053 % Initialize paths
19054 \def\pgfcircresetpath{
19055 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
19056 bipole/inverted=false, bipole/kind=,
19057 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
19058 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
19059 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
19060 bipole/current/y position=above, bipole/current/direction=forward,
19061 mirrored=false
19062 }
19063 }
19064
19065 %% Helper function for path-function to ensure using anchors between nodes
19066 \def\set@explicit@center@anchor#1{
19067 \pgfutil@ifundefined{pgf@sh@ns@#1}
19068 {
19069 %This coordinate is no node(but a relative position or a coordinate), no further handling needed
19070 }{
19071 \pgfutil@in@.{#1}
19072 \ifpgfutil@in@
19073 % Anchor is used, do nothing!
19074 \else%
19075 \let\tikz@moveto@waiting=\relax
19076 \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting
19077 \edef#1{#1.center}%ensure using center anchor
19078 \fi
19079 }
19080 }
19081
19082
19083 %% Generic bipole path
19084 %% I am not user what the second argument is needed for
19085 \def\pgf@circ@bipole@path#1#2{
19086
19087 \pgfextra{
19088 \set@explicit@center@anchor{\tikztostart}
19089 \set@explicit@center@anchor{\tikztotarget}
19090 \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
19091 \ctikzset{bipole/kind = #1}
19092 \edef\pgf@temp{\ctikzvalof{bipole/name}}
19093 \def\pgf@circ@temp{}
19094 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
19095 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
19096 \ctikzset{bipole/name = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...)
19097 \fi
19098 }
19099
19100 (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
19101 (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
19102 \pgfextra{
19103 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
19104 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
19105 \pgfmathround{\pgfmathresult}
19106 \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path
19107 \pgfsyssoftpath@setcurrentpath{\myp@th}
19108 }
19109 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
19110 \ifx\pgf@temp\pgf@circ@temp % if it is an open
19111 \else
19112 --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
19113 \fi
19114 ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
19115 node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
19116 (\ctikzvalof{bipole/name}) {}
19117 \ifpgf@circuit@bipole@inverted
19118 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
19119 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
19120 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
19121 \else
19122 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
19123 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
19124 \fi
19125 \else
19126 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
19127 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
19128 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
19129 \else
19130 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
19131 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
19132 \fi
19133 \fi
19134 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
19135 \ifx\pgf@temp\pgf@circ@temp % if it is an open
19136 \else
19137 (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
19138 (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
19139 \fi
19140
19141 \drawpoles
19142 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
19143 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
19144 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi
19145 \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
19146 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi
19147 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
19148 \ifx\pgf@temp\pgf@circ@temp % if it is an open
19149 (\ctikzvalof{bipole/name}end)%Move to end of path
19150 \else
19151 ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
19152 %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
19153
19154 \fi
19155 % reset
19156 \pgfextra{
19157 \pgfcircresetpath
19158 }
19159 \tikztonodes%draw pending nodes an path
19160 }
19161
19162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19163 %% Handling of terminals
19164
19165 \ctikzset{bipole/nodes/.is family}
19166 \ctikzset{bipole/nodes/left/.initial=none}
19167 \ctikzset{bipole/nodes/right/.initial=none}
19168 \tikzset{bipole nodes/.style n args={2}{%
19169 \circuitikzbasekey/bipole/nodes/left=#1,
19170 \circuitikzbasekey/bipole/nodes/right=#2
19171 }
19172 }
19173
19174 %% Easily usable styles
19175
19176 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
19177 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
19178 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
19179 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
19180 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
19181 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
19182 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
19183 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
19184 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
19185 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
19186 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
19187 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
19188 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
19189 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
19190 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
19191
19192 % rectjoinfill workarounds
19193
19194 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
19195 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
19196 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
19197 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
19198 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
19199 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
19200 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
19201 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
19202 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
19203
19204 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
19205
19206 \def\drawpoles{
19207 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
19208 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
19209 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
19210 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
19211 }
19212
19213 %% Path definitions
19214 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
19215 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
19216 \def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
19217 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
19218 \def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}}
19219 \def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}}
19220 \def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}}
19221 \def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}}
19222 \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
19223 \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}}
19224 \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}}
19225 %% polar capacitor is deprectaed, use curved capacitor instead
19226 \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}}
19227 \def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}}
19228 \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
19229 \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
19230 \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
19231 \def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
19232 \def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
19233 \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
19234 \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
19235 \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
19236 \def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}}
19237 \def\pgf@circ@inductor@path#1{%
19238 \pgfextra{
19239 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
19240 \def\pgf@temp{european}%
19241 }
19242 \ifx\pgf@temp\pgf@circ@temp%
19243 \pgf@circ@europeaninductor@path{#1}%
19244 \else%
19245 \pgfextra{ \def\pgf@temp{cute} }%
19246 \ifx\pgf@temp\pgf@circ@temp%
19247 \pgf@circ@cuteinductor@path{#1}%
19248 \else%
19249 \pgf@circ@americaninductor@path{#1}%
19250 \fi%
19251 \fi%
19252 }
19253 \def\pgf@circ@vinductor@path#1{
19254 \pgfextra{
19255 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
19256 \def\pgf@temp{european}%
19257 }
19258 \ifx\pgf@temp\pgf@circ@temp%
19259 \pgf@circ@veuropeaninductor@path{#1}%
19260 \else%
19261 \pgfextra{ \def\pgf@temp{cute} }%
19262 \ifx\pgf@temp\pgf@circ@temp%
19263 \pgf@circ@vcuteinductor@path{#1}%
19264 \else%
19265 \pgf@circ@vamericaninductor@path{#1}%
19266 \fi%
19267 \fi%
19268 }
19269 \def\pgf@circ@inductivesens@path#1{%
19270 \pgfextra{
19271 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
19272 \def\pgf@temp{european}%
19273 }
19274 \ifx\pgf@temp\pgf@circ@temp%
19275 \pgf@circ@europeaninductivesens@path{#1}%
19276 \else%
19277 \pgfextra{ \def\pgf@temp{cute} }%
19278 \ifx\pgf@temp\pgf@circ@temp%
19279 \pgf@circ@cuteinductivesens@path{#1}%
19280 \else%
19281 \pgf@circ@americaninductivesens@path{#1}%
19282 \fi%
19283 \fi%
19284 }
19285 \def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
19286 \def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}}
19287 \def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}}
19288 \def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}}
19289 \def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}}
19290 \def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}}
19291 \def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}}
19292 \def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}}
19293 \def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}}
19294 \def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}}
19295 \def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}}
19296 \def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}}
19297 \def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}}
19298 \def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}}
19299 \def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}}
19300 \def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}}
19301 \def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}}
19302 \def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}}
19303 \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}}
19304 \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}}
19305 \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}}
19306 \def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}}
19307 \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}}
19308 \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}}
19309 \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}}
19310 \def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}}
19311 \def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}}
19312 \def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}}
19313 \def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}}
19314 \def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}}
19315 \def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}}
19316 \def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}}
19317 \def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}}
19318 \def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}}
19319 \def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}}
19320 \def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}}
19321 \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}}
19322 \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}}
19323 \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}}
19324 \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
19325 \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
19326 \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}}
19327 \def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}}
19328 \def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}}
19329 \def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}}
19330 \def\pgf@circ@empty@path#1{}
19331 \def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}}
19332 \def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}}
19333 \def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}}
19334 \def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}}
19335 \def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}}
19336 \def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}}
19337 \def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}}
19338 \def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}}
19339 \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}}
19340 \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}}
19341 \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}}
19342 \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}}
19343 \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}}
19344 \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}}
19345
19346 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
19347 \def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}}
19348 \def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}}
19349
19350 \def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
19351 \def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
19352 \def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
19353 \def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
19354 \def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
19355 \def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
19356 \def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
19357 \def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}}
19358 \def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}}
19359 \def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}}
19360 \def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}}
19361 \def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}}
19362 \def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}}
19363 \def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}}
19364 \def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}}
19365 \def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}}
19366 \def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}}
19367 \def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}}
19368 \def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}}
19369
19370 %%Mechanical
19371 \def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
19372 \def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
19373 \def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
19374 \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
19375
19376 %% Styles
19377
19378 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
19379 \def\compattikzset#1{\tikzset{\comnpatname#1}}
19380
19381 %\def\ctikzsetbipole#1#2{%
19382 % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
19383 %}
19384
19385 \compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
19386 \compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
19387 \compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
19388 \compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
19389 \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}
19390 \compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}}
19391 \compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}}
19392 \compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}}
19393 \compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}}
19394 \compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}}
19395 \compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}}
19396 \compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}}
19397 \compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
19398 \compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}}
19399 \compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}}
19400 \compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}}
19401 \compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}}
19402 \compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}}
19403 \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}}
19404 \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
19405 \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
19406 % polar capacitor is deprecated, use curved capacitor instead
19407 \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}}
19408 \compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}}
19409 \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
19410 \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
19411 \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19412 \compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19413 \compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19414 \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
19415 \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
19416 \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
19417 \compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}}
19418 \compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
19419 \compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}}
19420 \compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}}
19421 \compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}}
19422 \compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}}
19423 \compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}}
19424 \compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}}
19425 \compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}}
19426 \compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}}
19427 \compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}}
19428 \compattikzset{transmission line/.style = {tline = #1}}
19429 \compattikzset{TL/.style = {tline = #1}}
19430 \compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}}
19431 \compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19432 \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
19433 \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19434 \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19435 \compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19436 \compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19437 \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
19438 \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19439 \compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19440 \compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
19441 \compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
19442 \compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
19443 \compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19444 \compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19445 \compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19446
19447 \compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
19448 \compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
19449 \compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
19450 \compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
19451
19452
19453 \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}}
19454 \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}}
19455 \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}}
19456 \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}}
19457 \compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}}
19458 \compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}}
19459 \compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}}
19460
19461 \compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}}
19462 \compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}}
19463
19464 \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}}
19465 \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}}
19466 \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}}
19467 \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}}
19468 \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}}
19469
19470 \compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
19471 \compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
19472 \compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
19473 \compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
19474 \compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
19475 \compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
19476 \compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}
19477 \compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}}
19478 \compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}}
19479 \compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}}
19480 \compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}}
19481 \compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}}
19482 \compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}}
19483 \compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}}
19484 \compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}}
19485 \compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}}
19486 \compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}}
19487 \compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}}
19488 \compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}}
19489
19490 % % % % % %
19491 % % Begin of Diodes
19492 % % % % % %
19493
19494 \def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}}
19495 \def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}}
19496 \def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}}
19497 \def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}}
19498 \def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}}
19499 \def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}}
19500 \def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}}
19501 \def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}}
19502 \def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}}
19503 \def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}}
19504 \def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}}
19505 \def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}}
19506 \def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}}
19507 \def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}}
19508 \def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}}
19509 \def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}}
19510 \def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}}
19511 \def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}}
19512
19513 \compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}}
19514 \compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}}
19515 \compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}}
19516 \compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}}
19517 \compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}}
19518 \compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}}
19519 \compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}}
19520 \compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}}
19521 \compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}}
19522 \compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}}
19523 \compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}}
19524
19525 \compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}}
19526 \compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}}
19527 \compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}}
19528 \compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
19529 \compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}}
19530 \compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}}
19531 \compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}}
19532 \compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}}
19533 \compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}}
19534 \compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}}
19535 \compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}}
19536
19537 \compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}}
19538 \compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}}
19539 \compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}}
19540 \compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
19541 \compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}}
19542 \compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}}
19543 \compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}}
19544 \compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}}
19545 \compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}}
19546 %\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}}
19547
19548 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
19549
19550 \compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
19551 \compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
19552 \compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
19553 \compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
19554 \compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
19555 \compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
19556 \compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
19557 \compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
19558 \compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
19559 \compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
19560 \compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
19561
19562 %% Define Shortcuts
19563 \compattikzset{Do/.style = {\comnpatname empty diode}}
19564 \compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
19565 \compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
19566 \compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
19567 \compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
19568 \compattikzset{pDo/.style = {\comnpatname empty photodiode}}
19569 \compattikzset{leDo/.style = {\comnpatname empty led}}
19570 \compattikzset{VCo/.style = {\comnpatname empty varcap}}
19571 \compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
19572 \compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
19573 \compattikzset{Tro/.style = {\comnpatname empty triac}}
19574
19575 \compattikzset{D*/.style = {\comnpatname full diode}}
19576 \compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
19577 \compattikzset{zD*/.style = {\comnpatname full Zener diode}}
19578 \compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
19579 \compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
19580 \compattikzset{pD*/.style = {\comnpatname full photodiode}}
19581 \compattikzset{leD*/.style = {\comnpatname full led}}
19582 \compattikzset{VC*/.style = {\comnpatname full varcap}}
19583 \compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
19584 \compattikzset{Ty*/.style = {\comnpatname full thyristor}}
19585 \compattikzset{Tr*/.style = {\comnpatname full triac}}
19586
19587 \compattikzset{D/.style = {\comnpatname diode}}
19588 \compattikzset{tD/.style = {\comnpatname tunnel diode}}
19589 \compattikzset{zD/.style = {\comnpatname Zener diode}}
19590 \compattikzset{zzD/.style = {\comnpatname ZZener diode}}
19591 \compattikzset{sD/.style = {\comnpatname Schottky diode}}
19592 \compattikzset{pD/.style = {\comnpatname photodiode}}
19593 \compattikzset{leD/.style = {\comnpatname led}}
19594 \compattikzset{VC/.style = {\comnpatname varcap}}
19595 \compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
19596 \compattikzset{Ty/.style = {\comnpatname thyristor}}
19597 \compattikzset{Tr/.style = {\comnpatname triac}}
19598
19599 \compattikzset{D-/.style = {\comnpatname stroke diode}}
19600 \compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
19601 \compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
19602 \compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
19603 \compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
19604 \compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
19605 \compattikzset{leD-/.style = {\comnpatname stroke led}}
19606 \compattikzset{VC-/.style = {\comnpatname stroke varcap}}
19607 \compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
19608 \compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
19609 \compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
19610
19611 % % % % % %
19612 % % End of Diodes
19613 % % % % % %
19614
19615
19616 \compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}}
19617 \compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
19618 \compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}}
19619 \compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
19620 \compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
19621 \compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
19622 \compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
19623 \compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
19624 \compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
19625 \compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
19626 \compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
19627 \compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
19628 \compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
19629 \compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}}
19630
19631 \compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}}
19632 \compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}}
19633 \compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}}
19634 \tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}}
19635
19636 % cute switches
19637 %% closed cute switch
19638 \def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}}
19639 \compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}}
19640 \compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
19641
19642 %% open cute switch
19643 \def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}}
19644 \compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}}
19645 \compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
19646
19647 %% closing cute switch
19648 \def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}}
19649 \compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}}
19650 \compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
19651
19652 %% opening cute switch
19653 \def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}}
19654 \compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}}
19655 \compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
19656
19657
19658 % short forms
19659 \compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19660 \compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19661 \compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19662 \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}}
19663
19664 \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}}
19665 \compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@path, v=#1}}
19666
19667 \compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
19668 \compattikzset{isource/.style = {\comnpatname current source = #1}}
19669 \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
19670 \compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
19671 \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
19672 \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
19673 \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
19674 \compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
19675 \compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
19676 \compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
19677 \compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
19678
19679 \compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
19680 \compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
19681 \compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
19682 \compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
19683
19684 \compattikzset{R/.style= {\comnpatname resistor = #1}}
19685 \compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
19686 \compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
19687 \compattikzset{thR/.style= {\comnpatname thermistor = #1}}
19688 \compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
19689 \compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
19690 \compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
19691 \compattikzset{C/.style = {\comnpatname capacitor = #1}}
19692 \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
19693 %% pC is deprecated, use cC instead
19694 \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
19695 \compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
19696 \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
19697 \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
19698 \compattikzset{L/.style = {\comnpatname inductor = #1}}
19699 \compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
19700 \compattikzset{V/.style = {\comnpatname voltage source = #1}}
19701 \compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
19702 \compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
19703 \compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
19704 \compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
19705 \compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
19706 \def\pgf@temp#1{
19707 \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
19708 \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
19709 \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
19710 \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
19711 }
19712 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
19713 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
19714
19715 %current sources
19716 \compattikzset{I/.style = {\comnpatname current source = #1}}
19717 \compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
19718 \compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
19719 \compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
19720 \def\pgf@temp#1{
19721 \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
19722 \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
19723 \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
19724 \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
19725 }
19726 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
19727 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
19728 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
19729
19730 % cute sources
19731 \def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}}
19732 \compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19733 \compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
19734 \compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
19735
19736 \def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}}
19737 \compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19738 \compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
19739 \compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
19740
19741 \def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}}
19742 \compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19743 \compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
19744 \compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
19745
19746 \def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}}
19747 \compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19748 \compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
19749 \compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
19750
19751 % noise sources
19752 \def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}}
19753 \compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
19754 \compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
19755 \compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
19756
19757 \def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}}
19758 \compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
19759 \compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
19760 \compattikzset{nI/.style= {\comnpatname noise current source= #1}}
19761
19762 % resistive sensor american style
19763 \def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}}
19764 \compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}}
19765 \compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
19766 \compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}}
19767 \compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
19768
19769 \compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}}
19770 \compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
19771
19772 \compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}}
19773 \compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}}
19774 \compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}}
19775 \compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}}
19776 \compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
19777
19778 \compattikzset{Mr/.style = {\comnpatname memristor}}
19779
19780 \compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
19781 \compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
19782 \compattikzset{spst/.style = {\comnpatname switch = #1}}
19783
19784 \compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
19785
19786 \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
19787 \compattikzset{vss/.style = {\comnpatname vee = #1}}
19788
19789 % activate the to-style crossing
19790 \def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}}
19791 \compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}}
19792 \compattikzset{xing/.style= {\comnpatname crossing= #1}}
19793
19794 %% loudspeaker and microphone
19795
19796 \def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}}
19797 \compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}}
19798
19799 \def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}}
19800 \compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}}
19801
19802 % more instrument
19803 \def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}}
19804 \compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}}
19805 \def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}}
19806 \compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}}
19807 \def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}}
19808 \compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}}
19809 % current loop probes
19810 \def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}}
19811 \compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}}
19812 \def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}}
19813 \compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}}
19814 % qucs-style probes
19815 \def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}}
19816 \compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}}
19817 \def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}}
19818 \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}}
19819 \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}}
19820 \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}}
19821 % multiwire(s)
19822 \def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}}
19823 \compattikzset{bmultiwire/.style = {\circuitikzbasekey,
19824 /tikz/to path=\pgf@circ@bmultiwire@path, l=#1}}
19825 \def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}}
19826 \compattikzset{multiwire/.style = {\circuitikzbasekey,
19827 /tikz/to path=\pgf@circ@multiwire@path, l=#1}}
19828
19829 % reed switches
19830 \def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}}
19831 \compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}}
19832
19833 % Transistor like bipoles
19834
19835 \def\pgf@circ@trans@path#1#2{
19836 \pgfextra{
19837 \edef\pgf@temp{\ctikzvalof{bipole/name}}
19838 \def\pgf@circ@temp{#2}
19839 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
19840 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
19841 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
19842 \fi
19843 }
19844 \ifpgf@circuit@bipole@inverted
19845 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
19846 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
19847 \else
19848 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
19849 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
19850 \fi
19851 \pgfextra{
19852 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
19853 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
19854 \pgfmathadd{\pgfmathresult}{-90}
19855 \pgfmathround{\pgfmathresult}
19856 \edef\pgf@circ@direction{\pgfmathresult}
19857 }
19858 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
19859 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
19860 (\ctikzvalof{bipole/name}) {}
19861 node {\ctikzvalof{bipole/label/name}}
19862 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
19863 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
19864 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
19865 \else
19866 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
19867 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
19868 \fi
19869 \drawpoles
19870 \pgfextra{
19871 \pgfcircresetpath
19872 }
19873 (\tikztotarget) \tikztonodes % e si continua
19874 }
19875
19876
19877 \def\pgf@circ@definetranspath#1{
19878 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
19879 }
19880
19881 \pgf@circ@definetranspath{elmech}
19882 \pgf@circ@definetranspath{nmos}
19883 \pgf@circ@definetranspath{pmos}
19884 \pgf@circ@definetranspath{hemt}
19885 \pgf@circ@definetranspath{npn}
19886 \pgf@circ@definetranspath{pnp}
19887 \pgf@circ@definetranspath{nfet}
19888 \pgf@circ@definetranspath{nigfete}
19889 \pgf@circ@definetranspath{nigfetd}
19890 \pgf@circ@definetranspath{nigfetebulk}
19891 \pgf@circ@definetranspath{pfet}
19892 \pgf@circ@definetranspath{pigfete}
19893 \pgf@circ@definetranspath{pigfetd}
19894 \pgf@circ@definetranspath{pigfetebulk}
19895 \pgf@circ@definetranspath{njfet}
19896 \pgf@circ@definetranspath{pjfet}
19897 \pgf@circ@definetranspath{pigbt}
19898 \pgf@circ@definetranspath{nigbt}
19899 \pgf@circ@definetranspath{Lpigbt}
19900 \pgf@circ@definetranspath{Lnigbt}
19901 %%%---------- close: tex/pgfcircpath
19902
19903 \catcode`\@=\tikzatcode
19904 \catcode`\|=\tikzbarcode
19905 \catcode`\!=\tikzexclaimcode
19906
19907 % define the environment
19908 \long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}
19909
19910 \protect
19911
19912 \stopmodule
19913
19914 \endinput