Debian Codegraph @

texmf-dist/tex/latex/circuitikz/circuitikz-1.2.7-body.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 \NeedsTeXFormat{LaTeX2e}
14
15 \def\pgfcircversion{1.2.7}
16 \def\pgfcircversiondate{2020/12/27}
17
18 %% Version 3.0 of pgf/TikZ is required
19 \RequirePackage{tikz}
20 \usetikzlibrary{calc}
21 %
22 % "arrows" library is deprecated, and behave badly with
23 % arrows on short paths. Change to the new arrows.meta
24 % In pfgcirc.define, we will add the old definition of
25 % latex' which we have lost in the transition
26 %
27 \usetikzlibrary{arrows.meta, bending}
28 \usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
29 %
30 % global of options (better use styles!)
31 %
32 \DeclareOption{european}{
33 \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
34 \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}
35 }
36 \DeclareOption{american}{
37 \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
38 \ctikzset{logic ports = american}
39 }
40 \DeclareOption{siunitx}{
41 \pgf@circ@siunitxtrue
42 }
43 \DeclareOption{nosiunitx}{
44 \pgf@circ@siunitxfalse
45 }
46 \DeclareOption{compatibility}{
47 \pgf@circuit@compattrue
48 }
49 %
50 % voltages
51 %
52 \DeclareOption{europeanvoltage}{
53 \ctikzset{voltage=european}
54 }
55 \DeclareOption{straightvoltages}{
56 \ctikzset{voltage=straight}
57 }
58 \DeclareOption{americanvoltage}{
59 \ctikzset{voltage=american}
60 }
61 \DeclareOption{europeanvoltages}{
62 \ctikzset{voltage=european}
63 }
64 \DeclareOption{americanvoltages}{
65 \ctikzset{voltage=american}
66 }
67 % Voltage directions
68 \DeclareOption{oldvoltagedirection}{
69 \pgf@circ@oldvoltagedirectiontrue
70 \pgf@circ@explicitvdirtrue
71 \pgf@circ@fixbatteriesfalse
72 }
73 \DeclareOption{nooldvoltagedirection}{
74 \pgf@circ@oldvoltagedirectionfalse
75 \pgf@circ@explicitvdirtrue
76 \pgf@circ@fixbatteriesfalse
77 }
78 \DeclareOption{RPvoltages}{
79 \pgf@circ@oldvoltagedirectiontrue
80 \pgf@circ@explicitvdirtrue
81 \pgf@circ@fixbatteriestrue
82 }
83 \DeclareOption{EFvoltages}{
84 \pgf@circ@oldvoltagedirectionfalse
85 \pgf@circ@explicitvdirtrue
86 \pgf@circ@fixbatteriestrue
87 }
88 %
89 % currents
90 %
91 \DeclareOption{europeancurrent}{
92 \ctikzset{current = european}
93 }
94 \DeclareOption{americancurrent}{
95 \ctikzset{current = american}
96 }
97 \DeclareOption{europeancurrents}{
98 \ctikzset{current = european}
99 }
100 \DeclareOption{americancurrents}{
101 \ctikzset{current = american}
102 }
103 %
104 % resistors
105 %
106 \DeclareOption{americanresistor}{
107 \ctikzset{resistor = american}
108 }
109 \DeclareOption{europeanresistor}{
110 \ctikzset{resistor = european}
111 }
112 \DeclareOption{americanresistors}{
113 \ctikzset{resistor = american}
114 }
115 \DeclareOption{europeanresistors}{
116 \ctikzset{resistor = european}
117 }
118 %
119 % inductors
120 %
121 \DeclareOption{americaninductor}{
122 \ctikzset{inductor = american}
123 }
124 \DeclareOption{europeaninductor}{
125 \ctikzset{inductor = european}
126 }
127 \DeclareOption{cuteinductor}{
128 \ctikzset{inductor = cute}
129 }
130 \DeclareOption{americaninductors}{
131 \ctikzset{inductor = american}
132 }
133 \DeclareOption{europeaninductors}{
134 \ctikzset{inductor = european}
135 }
136 \DeclareOption{cuteinductors}{
137 \ctikzset{inductor = cute}
138 }
139 %
140 % logic ports
141 %
142 \DeclareOption{americanport}{
143 \ctikzset{logic ports = american}
144 }
145 \DeclareOption{europeanport}{
146 \ctikzset{logic ports = european}
147 }
148 \DeclareOption{americanports}{
149 \ctikzset{logic ports = american}
150 }
151 \DeclareOption{europeanports}{
152 \ctikzset{logic ports = european}
153 }
154 %
155 % surge arresters (really?)
156 %
157 \DeclareOption{americangfsurgearrester}{
158 \ctikzset{gas filled surge arrester choice = american}
159 }
160 \DeclareOption{europeangfsurgearrester}{
161 \ctikzset{gas filled surge arrester choice = european}
162 }
163 %
164 % diodes
165 %
166 \DeclareOption{fulldiodes}{
167 \ctikzset{diode = full}
168 }
169 \DeclareOption{emptydiodes}{
170 \ctikzset{diode = empty}
171 }
172 \DeclareOption{strokediodes}{
173 \ctikzset{diode = stroke}
174 }
175 \DeclareOption{fulldiode}{
176 \ctikzset{diode = full}
177 }
178 \DeclareOption{emptydiode}{
179 \ctikzset{diode = empty}
180 }
181 \DeclareOption{strokediode}{
182 \ctikzset{diode = stroke}
183 }
184 %
185 % MOSes and FETs
186 %
187 \DeclareOption{arrowmos}{
188 \pgf@circuit@mos@arrowstrue
189 }
190 \DeclareOption{noarrowmos}{
191 \pgf@circuit@mos@arrowsfalse
192 }
193 \DeclareOption{fetbodydiode}{
194 \pgf@circuit@fet@bodydiodetrue
195 }
196 \DeclareOption{nofetbodydiode}{
197 \pgf@circuit@fet@bodydiodefalse
198 }
199 \DeclareOption{fetsolderdot}{
200 \pgf@circuit@fet@solderdottrue
201 }
202 \DeclareOption{nofetsolderdot}{
203 \pgf@circuit@fet@solderdotfalse
204 }
205 \DeclareOption{emptypmoscircle}{
206 \pgf@circuit@pmos@emptycircletrue
207 }
208 \DeclareOption{lazymos}{
209 \ctikzset{tripoles/nmos/width=.5}
210 \ctikzset{tripoles/nmos/gate height=.35}
211 \ctikzset{tripoles/nmos/base height=.35}
212 \ctikzset{tripoles/nmos/height/.initial=1.2}
213 \ctikzset{tripoles/nmos/base width=.5}
214 \ctikzset{tripoles/nmos/gate width=.65}
215 \ctikzset{tripoles/pmos/width=.5}
216 \ctikzset{tripoles/pmos/gate height=.35}
217 \ctikzset{tripoles/pmos/base height=.35}
218 \ctikzset{tripoles/pmos/height/.initial=1.2}
219 \ctikzset{tripoles/pmos/base width=.5}
220 \ctikzset{tripoles/pmos/gate width=.65}
221 \pgf@circuit@pmos@emptycircletrue
222 }
223 %
224 % BJTs labels
225 %
226 \DeclareOption{legacytransistorstext}{
227 \pgf@circuit@transisors@fixlabelsfalse
228 }
229 \DeclareOption{nolegacytransistorstext}{
230 \pgf@circuit@transisors@fixlabelstrue
231 }
232 \DeclareOption{centertransistorstext}{
233 \pgf@circuit@transisors@fixlabelstrue
234 }
235 %
236 % labels
237 %
238 \DeclareOption{straightlabels}{
239 \ctikzset{label/align = straight}
240 }
241 \DeclareOption{rotatelabels}{
242 \ctikzset{label/align = rotate}
243 }
244 \DeclareOption{smartlabels}{
245 \ctikzset{label/align = smart}
246 }
247 %
248 % Several options (better use styles)
249 %
250 \DeclareOption{betterproportions}{
251 \ctikzset{monopoles/ground/width/.initial=.15}
252 \ctikzset{bipoles/resistor/height/.initial=.23}
253 \ctikzset{bipoles/resistor/width/.initial=.6}
254 \ctikzset{bipoles/capacitor/height/.initial=.4}
255 \ctikzset{bipoles/capacitor/width/.initial=.1}
256 \ctikzset{bipoles/potentiometer/height/.initial=.6}
257 \ctikzset{bipoles/potentiometer/height 2/.initial=.23}
258 \ctikzset{bipoles/potentiometer/width/.initial=.6}
259 \ctikzset{bipoles/photoresistor/height/.initial=.6}
260 \ctikzset{bipoles/photoresistor/height 2/.initial=.23}
261 \ctikzset{bipoles/photoresistor/width/.initial=.6}
262 \ctikzset{bipoles/thermistor/main/.initial=.7}
263 \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
264 \ctikzset{bipoles/thermistor/width/.initial=.6}
265 \ctikzset{bipoles/thermistorntc/width/.initial=.6}
266 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
267 \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
268 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
269 \ctikzset{bipoles/thermistorptc/width/.initial=.6}
270 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
271 \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
272 \ctikzset{bipoles/varistor/main/.initial=.7}
273 \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
274 \ctikzset{bipoles/varistor/width/.initial=.6}
275 \ctikzset{bipoles/vresistor/height/.initial=.45}
276 \ctikzset{bipoles/vresistor/width/.initial=.6}
277 \ctikzset{bipoles/generic/height/.initial=.23}
278 \ctikzset{bipoles/generic/width/.initial=.6}
279 \ctikzset{bipoles/generic potentiometer/height/.initial=.6}
280 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
281 \ctikzset{bipoles/generic potentiometer/width/.initial=.6}
282 \ctikzset{bipoles/ageneric/height/.initial=.23}
283 \ctikzset{bipoles/ageneric/width/.initial=.6}
284 \ctikzset{bipoles/memristor/height/.initial=.23}
285 \ctikzset{bipoles/memristor/wave height/.initial=.375}
286 \ctikzset{bipoles/memristor/width/.initial=.60}
287 \ctikzset{bipoles/tgeneric/height/.initial=.525}
288 \ctikzset{bipoles/tgeneric/width/.initial=.6}
289 \ctikzset{bipoles/tfullgeneric/height/.initial=.525}
290 \ctikzset{bipoles/tfullgeneric/width/.initial=.60}
291 \ctikzset{bipoles/fullgeneric/height/.initial=.23}
292 \ctikzset{bipoles/fullgeneric/width/.initial=.6}
293 \ctikzset{bipoles/diode/height/.initial=.3}
294 \ctikzset{bipoles/diode/width/.initial=.25}
295 \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
296 \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
297 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
298 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
299 \ctikzset{tripoles/thyristor/height/.initial=.66}
300 \ctikzset{tripoles/thyristor/height 2/.initial=.3}
301 \ctikzset{tripoles/thyristor/width/.initial=.6}
302 \ctikzset{tripoles/thyristor/diode height/.initial=.3}
303 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
304 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
305 \ctikzset{tripoles/triac/height/.initial=.66}
306 \ctikzset{tripoles/triac/width/.initial=.6}
307 \ctikzset{tripoles/triac/diode width left/.initial=.3}
308 \ctikzset{tripoles/triac/diode width right/.initial=.3}
309 }
310 % This is a nice hack that prints all the shapes declared
311 % by the package. Very useful for coverage testing and debugging.
312 %
313 % \let\origpgfdeclareshape=\pgfdeclareshape
314 % \def\pgfdeclareshape#1{%
315 % \typeout{SHAPE:\space"#1"}%
316 % \origpgfdeclareshape{#1}
317 % }
318 %
319 %
320 %%%%%%%%%
321 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
322 %%%---------- open: tex/pgfcirc.defines.tex
323 % Copyright 2018-2026 by Romano Giannetti
324 % Copyright 2015-2026 by Stefan Lindner
325 % Copyright 2013-2026 by Stefan Erhardt
326 % Copyright 2007-2026 by Massimo Redaelli
327 %
328 % This file may be distributed and/or modified
329 %
330 % 1. under the LaTeX Project Public License and/or
331 % 2. under the GNU Public License.
332 %
333 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
334 %
335 % This file has folding marks for vim (See last line).
336 %
337 %% Key managements%<<<1
338
339 \long\def\pgf@circ@comment#1{}
340
341 \def\circuitikzbasekey{/tikz/circuitikz}
342
343 \pgfkeys{\circuitikzbasekey/.is family}
344
345 \def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
346 \let\ctikzset\circuitikzset
347 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
348 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
349
350 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
351 %%>>>
352
353 %% Temporary Counters and dimensions%<<<1
354 %% Temporary Counters
355 \newcount\pgf@circ@count@a
356 \newcount\pgf@circ@count@b
357 \newcount\pgf@circ@count@c
358 %%%%%%%%%%%%
359 %% Dimensions
360 % coordinate
361 \newdimen\pgf@circ@res@up
362 \newdimen\pgf@circ@res@down
363 \newdimen\pgf@circ@res@zero
364 \newdimen\pgf@circ@res@left
365 \newdimen\pgf@circ@res@right
366 \newdimen\pgf@circ@res@other
367 \newdimen\pgf@circ@res@step
368 \newdimen\pgf@circ@res@temp
369 % Base len for all circuitikz
370 \newdimen\pgf@circ@Rlen
371 % scaled length for internal use in scalable shapes
372 \newdimen\pgf@circ@scaled@Rlen
373 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
374 \pgf@circ@Rlen = 1.4cm
375 % by default scale is 1.0
376 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
377 % inital thickness
378 \newdimen \pgfstartlinewidth
379 %%>>>
380
381 % arrow tips, ported over old arrows library (deprecated)%<<<1
382 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
383 % this was the original definition of latex' tips, renamed to avoid clashes
384 %
385 \pgfarrowsdeclare{latexslim}{latexslim}
386 {
387 \pgfutil@tempdima=0.28pt%
388 \advance\pgfutil@tempdima by.3\pgflinewidth%
389 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
390 \pgfarrowsrightextend{+6\pgfutil@tempdima}
391 }
392 {
393 \pgfutil@tempdima=0.28pt%
394 \advance\pgfutil@tempdima by.3\pgflinewidth%
395 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
396 \pgfpathcurveto
397 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
398 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
399 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
400 \pgfpathcurveto
401 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
402 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
403 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
404 \pgfpathcurveto
405 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
406 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
407 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
408 \pgfpathclose
409 \pgfusepathqfill
410 }
411
412 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
413 %%>>>
414
415 %% Macros to do things depending on the class%<<<1
416
417 \def\pgf@circ@setifdefinedfill#1#2{%
418 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
419 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
420 \ifdefined\ctikzclass
421 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
422 {% yes, it's defined
423 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
424 \ifx\@@tmp\@@none % but it's none
425 \pgfusepath{#2}%
426 \else
427 \pgfsetfillcolor{\@@tmp}%
428 \pgfusepath{#1}%
429 \fi
430 }{% the class is defined but the fill key not; use #2
431 \pgfusepath{#2}%
432 }
433 \else
434 \pgfusepath{#2}%
435 \fi
436 }
437
438 %% Macro to fill or draw
439
440 \def\pgf@circ@draworfill{%
441 \ifx\tikz@fillcolor\pgfutil@empty
442 \pgf@circ@setifdefinedfill{draw,fill}{draw}
443 \else
444 \pgfsetfillcolor{\tikz@fillcolor}
445 \pgfusepath{draw, fill}
446 \fi
447 }
448
449 \def\pgf@circ@draworfillandclip{%
450 \ifx\tikz@fillcolor\pgfutil@empty
451 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
452 \pgfusepath{draw, clip}
453 \else
454 \pgfsetfillcolor{\tikz@fillcolor}
455 \pgfusepath{draw, clip, fill}
456 \fi
457 }
458
459 \def\pgf@circ@maybefill{%
460 \ifx\tikz@fillcolor\pgfutil@empty
461 \pgf@circ@setifdefinedfill{fill}{discard}
462 \else
463 \pgfsetfillcolor{\tikz@fillcolor}
464 \pgfusepath{fill}
465 \fi
466 }
467
468 %% Macros for setting linewidth
469 % #1 is the legacy class (bipoles, tripoles) etc
470 % #2 is the reference linewidth
471 \def\pgf@circ@setlinewidth#1#2{%
472 \ifdefined\ctikzclass
473 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
474 {% yes, it's defined
475 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
476 \ifx\@@tmp\@@none % but it's none
477 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
478 \else
479 \pgfsetlinewidth{\@@tmp #2}%
480 \fi
481 }{ % key not defined, do the legacy thing
482 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
483 }% Ok, do nothing
484 \else % no class
485 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
486 \fi
487 }
488 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
489 \ctikzset{none/thickness/.initial=1.0} % do not touch
490 %%>>>
491
492 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
493 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
494
495 \ifpgfutil@format@is@latex
496 \long\def\pgf@circ@font@tiny{\tiny}
497 \long\def\pgf@circ@font@small{\small}
498 \long\def\pgf@circ@font@bold{\textbf}
499 \long\def\pgf@circ@font@boldmath{\boldmath}
500 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
501 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
502 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
503 \else\ifpgfutil@format@is@plain
504 \long\def\pgf@circ@font@tiny{\fiverm}
505 \long\def\pgf@circ@font@small{\sevenrm}
506 \long\def\pgf@circ@font@bold#1{{\bf#1}}
507 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
508 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
509 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
510 \long\def\pgf@circ@font@twelve{\twelverm} %
511 \else\ifpgfutil@format@is@context
512 \long\def\pgf@circ@font@tiny{\tfxx}
513 \long\def\pgf@circ@font@small{\tfx}
514 \long\def\pgf@circ@font@bold{\bold}
515 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
516 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
517 \long\def\pgf@circ@font@tenbm{\normal\bold}%
518 \long\def\pgf@circ@font@twelve{\tfa} %
519 \fi\fi\fi
520
521
522 %
523 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
524 %
525 % this is needed to avoid problems with \ConTeXt
526 \ifcsname normalunexpanded\endcsname
527 \let\pgfcircutil@unexpanded\normalunexpanded
528 \else
529 \let\pgfcircutil@unexpanded\unexpanded
530 \fi
531 % minimally expand a pgfkey to check if it's {}/undefined or filled.
532 \def\unexpandedvalueof#1{%
533 \pgfcircutil@unexpanded\expandafter\expandafter
534 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
535 \def\pgf@circ@valueof@chk#1{%
536 \ifx\relax#1%
537 \expandafter\pgfutil@firstoftwo
538 \else
539 \expandafter\pgfutil@secondoftwo
540 \fi
541 {{}}% #1 is \relax, so consider empty
542 {\expandafter{#1}}% otherwise, leave the key after one more expansion
543 }%
544 %>>>
545
546 % text position in some component.%<<<1
547 % (added with ieeestd logic ports. Maybe to be extended to other components,
548 % like amplifiers)
549 %
550 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
551 \tikzset{component text/.is choice}%
552 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
553 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
554 \ctikzset{component text/.is choice}%
555 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
556 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
557 \ctikzset{left text distance/.initial=0.3em}%
558 %>>>
559
560 % voltage direction options%<<<1
561
562 \newif\ifpgf@circ@siunitx
563 \newif\ifpgf@circuit@compat
564 \newif\ifpgf@circ@oldvoltagedirection % default false
565 \newif\ifpgf@circ@explicitvdir
566 \newif\ifpgf@circ@fixbatteries
567
568 \ctikzset{voltage dir/.is choice}
569 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
570 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
571 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
572 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
573 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
574 %>>>
575
576 % bipole definitions for path component and text decorations%%<<<1
577 %
578 % Option "t=*" for nodes
579 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
580 %
581 \ctikzset{bipole/.is family}
582 \ctikzset{bipole/kind/.initial=}
583 \ctikzset{bipole/name/.initial=}
584 \newif\ifpgf@circuit@bipole@isvoltage
585 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
586 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
587 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
588 \newif\ifpgf@circuit@bipole@strokedsymbol
589 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
590 \newif\ifpgf@circuit@bipole@iscurrent
591 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
592
593 \ctikzset{bipole/voltage/.is family}
594 \newif\ifpgf@circuit@bipole@voltage@backward
595 \ctikzset{bipole/voltage/direction/.is choice}
596 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
597 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
598 \newif\ifpgf@circuit@bipole@voltage@below
599 \ctikzset{bipole/voltage/position/.is choice}
600 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
601 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
602
603 \ctikzset{bipole/voltage/label/unit/.initial=}
604 \ctikzset{bipole/voltage/label/name/.initial=}
605
606 \ctikzset{bipole/current/.is family}
607 \newif\ifpgf@circuit@bipole@current@backward
608 \ctikzset{bipole/current/direction/.is choice}
609 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
610 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
611 \newif\ifpgf@circuit@bipole@current@before
612 \ctikzset{bipole/current/x position/.is choice}
613 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
614 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
615 \newif\ifpgf@circuit@bipole@current@below
616 \ctikzset{bipole/current/y position/.is choice}
617 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
618 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
619 \ctikzset{bipole/current/label/unit/.initial=}
620 \ctikzset{bipole/current/label/name/.initial=}
621
622 \ctikzset{bipole/flow/.is family}
623 \newif\ifpgf@circuit@bipole@flow@backward
624 \ctikzset{bipole/flow/direction/.is choice}
625 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
626 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
627 \newif\ifpgf@circuit@bipole@flow@before
628 \ctikzset{bipole/flow/x position/.is choice}
629 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
630 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
631 \newif\ifpgf@circuit@bipole@flow@below
632 \ctikzset{bipole/flow/y position/.is choice}
633 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
634 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
635 \ctikzset{bipole/flow/label/unit/.initial=}
636 \ctikzset{bipole/flow/label/name/.initial=}
637 \ctikzset{flow/distance/.initial = .5}
638 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
639
640 \ctikzset{bipole/label/.is family}
641 \ctikzset{bipole/label/position/.initial=90}
642 \ctikzset{bipole/label/unit/.initial=}
643 \ctikzset{bipole/label/name/.initial=}
644 \ctikzset{bipole/annotation/.is family}
645 \ctikzset{bipole/annotation/position/.initial=-90}
646 \ctikzset{bipole/annotation/unit/.initial=}
647 \ctikzset{bipole/annotation/name/.initial=}
648
649 \newif\ifpgf@circ@siunitx
650 \newif\ifpgf@circ@siunitx@res
651
652 \ctikzset{label/align/.is choice}
653 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
654 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
655 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
656 %%>>>
657
658 % traditional styles %<<<1
659 %
660 \ctikzset{thickness/.initial=2}
661 \ctikzset{color/.initial=black}
662 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
663 \ctikzset{bipoles/border margin/.initial=1.1}
664 \ctikzset{bipoles/thickness/.initial=2}
665 \ctikzset{tripoles/thickness/.initial=2}
666 \ctikzset{quadpoles/thickness/.initial=2}
667 \ctikzset{nodes width/.initial=.04}
668 %%>>>
669
670 % Styles definitions and macros%<<<1
671
672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
673 %% main style definitions
674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
675
676 % load a style file: search ctikzstyle-NAME.tex in path
677 \def\ctikzloadstyle#1{%
678 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
679 \tikzerror{I did not find the circuitikz style #1}}%
680 }
681
682 % load and enact a style
683 \def\ctikzsetstyle#1{%
684 \ctikzloadstyle{#1}%
685 \tikzset{#1 circuit style}%
686 }
687
688 % global style parameters
689 \ctikzset{default/scale/.initial=1.0} % do not touch
690 \ctikzset{default/fill/.initial=none} % do not touch
691 \ctikzset{default/thickness/.initial=none} % do not touch
692 % default is use as the generic default style for bipoles
693
694 % mostly bipoles:
695
696 \ctikzset{resistors/scale/.initial=1.0}
697 \ctikzset{resistors/fill/.initial=none}
698 \ctikzset{resistors/thickness/.initial=none}
699
700 \ctikzset{capacitors/scale/.initial=1.0}
701 \ctikzset{capacitors/fill/.initial=none}
702 \ctikzset{capacitors/thickness/.initial=none}
703
704 \ctikzset{inductors/scale/.initial=1.0}
705 \ctikzset{inductors/fill/.initial=none}
706 \ctikzset{inductors/thickness/.initial=none}
707
708 \ctikzset{diodes/scale/.initial=1.0}
709 \ctikzset{diodes/fill/.initial=none}
710 \ctikzset{diodes/thickness/.initial=none}
711
712 \ctikzset{batteries/scale/.initial=1.0}
713 \ctikzset{batteries/fill/.initial=none}
714 \ctikzset{batteries/thickness/.initial=none}
715
716 \ctikzset{sources/scale/.initial=1.0}
717 \ctikzset{sources/fill/.initial=none}
718 \ctikzset{sources/thickness/.initial=none}
719
720 \ctikzset{csources/scale/.initial=1.0}
721 \ctikzset{csources/fill/.initial=none}
722 \ctikzset{csources/thickness/.initial=none}
723
724 \ctikzset{instruments/scale/.initial=1.0}
725 \ctikzset{instruments/fill/.initial=none}
726 \ctikzset{instruments/thickness/.initial=none}
727
728 \ctikzset{mechanicals/scale/.initial=1.0}
729 \ctikzset{mechanicals/fill/.initial=none}
730 \ctikzset{mechanicals/thickness/.initial=none}
731
732 \ctikzset{misc/scale/.initial=1.0}
733 \ctikzset{misc/fill/.initial=none}
734 \ctikzset{misc/thickness/.initial=none}
735
736 \ctikzset{blocks/scale/.initial=1.0}
737 \ctikzset{blocks/fill/.initial=none}
738 \ctikzset{blocks/thickness/.initial=none}
739
740 % mostly nodes
741
742 \ctikzset{grounds/scale/.initial=1.0}
743 \ctikzset{grounds/fill/.initial=none}
744 \ctikzset{grounds/thickness/.initial=none}
745
746 \ctikzset{power supplies/scale/.initial=1.0}
747 \ctikzset{power supplies/fill/.initial=none}
748 \ctikzset{power supplies/thickness/.initial=none}
749
750 \ctikzset{transistors/scale/.initial=1.0}
751 \ctikzset{transistors/fill/.initial=none}
752 \ctikzset{transistors/thickness/.initial=none}
753
754 \ctikzset{tubes/scale/.initial=1.0}
755 \ctikzset{tubes/fill/.initial=none}
756 \ctikzset{tubes/thickness/.initial=none}
757
758 \ctikzset{RF/scale/.initial=1.0}
759 \ctikzset{RF/fill/.initial=none}
760 \ctikzset{RF/thickness/.initial=none}
761
762 \ctikzset{electromechanicals/scale/.initial=1.0}
763 \ctikzset{electromechanicals/fill/.initial=none}
764 \ctikzset{electromechanicals/thickness/.initial=none}
765
766 % transformers go with inductors
767 \ctikzset{amplifiers/scale/.initial=1.0}
768 \ctikzset{amplifiers/fill/.initial=none}
769 \ctikzset{amplifiers/thickness/.initial=none}
770
771 \ctikzset{switches/scale/.initial=1.0}
772 \ctikzset{switches/fill/.initial=none}
773 \ctikzset{switches/thickness/.initial=none}
774
775 \ctikzset{logic ports/scale/.initial=1.0}
776 \ctikzset{logic ports/fill/.initial=none}
777 \ctikzset{logic ports/thickness/.initial=none}
778
779 \ctikzset{flipflops/scale/.initial=1.0}
780 \ctikzset{flipflops/fill/.initial=none}
781 \ctikzset{flipflops/thickness/.initial=none}
782
783 \ctikzset{muxdemuxes/scale/.initial=1.0}
784 \ctikzset{muxdemuxes/fill/.initial=none}
785 \ctikzset{muxdemuxes/thickness/.initial=none}
786
787 \ctikzset{chips/scale/.initial=1.0}
788 \ctikzset{chips/fill/.initial=none}
789 \ctikzset{chips/thickness/.initial=none}
790
791 \ctikzset{displays/scale/.initial=1.0}
792 \ctikzset{displays/fill/.initial=none}
793 \ctikzset{displays/thickness/.initial=none}
794 %
795 % general styles
796 %
797 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
798 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
799 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
800 %%>>>
801
802 % grounds and power supplies%<<<1
803
804 \ctikzset{monopoles/.is family}
805 \ctikzset{monopoles/ground/width/.initial=.25}
806 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
807 \ctikzset{monopoles/ground/thickness/.initial=2}
808 \ctikzset{monopoles/rground/thickness/.initial=2}
809 \ctikzset{monopoles/tground/thickness/.initial=3}
810 \ctikzset{monopoles/vcc/width/.initial=.2}
811 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
812 \ctikzset{monopoles/vee/arrow/.initial=legacy}
813 \ctikzset{monopoles/match/width/.initial=.4}
814 \ctikzset{monopoles/chassis/width/.initial=.25}
815 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
816 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
817 \ctikzset{monopoles/antenna/width/.initial=.25}
818 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
819 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
820 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
821 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
822 \ctikzset{monopoles/txantenna/width/.initial=.25}
823 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
824 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
825 \ctikzset{monopoles/rxantenna/width/.initial=.25}
826 \ctikzset{monopoles/bareantenna/width/.initial=.25}
827 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
828 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
829 \ctikzset{monopoles/waves/width/.initial=0.5}%
830 %>>>
831
832 % microstrips %<<<1
833 \ctikzset{bipoles/mstline/height/.initial=0.3}
834 \ctikzset{bipoles/mstline/width/.initial=1.2}
835 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
836 \ctikzset{monopoles/msport/width/.initial=.5}
837 \ctikzset{monopoles/msrstub/height/.initial=1.0}
838 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
839 %>>>
840
841 % microphone and loudspeaker%<<<1
842 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
843 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
844 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
845 \ctikzset{bipoles/mic/height/.initial=1.2}
846 \ctikzset{bipoles/mic/depth/.initial=.1}
847 \ctikzset{bipoles/mic/width/.initial=.8}%
848 %>>>
849
850 % resistors%<<<1
851 % Zig Zag resistors
852 \ctikzset{resistors/zigs/.initial=3}
853 \ctikzset{resistors/width/.code={%
854 \ctikzset{bipoles/resistor/width=#1}%
855 \ctikzset{bipoles/vresistor/width=#1}%
856 \ctikzset{bipoles/potentiometer/width=#1}%
857 \ctikzset{bipoles/resistivesens/width=#1}%
858 \ctikzset{bipoles/photoresistor/width=#1}%
859 \ctikzset{bipoles/thermistor/width=#1}%
860 \ctikzset{bipoles/thermistorntc/width=#1}%
861 \ctikzset{bipoles/thermistorptc/width=#1}%
862 \ctikzset{bipoles/varistor/width=#1}%
863 \ctikzset{bipoles/generic/width=#1}%
864 \ctikzset{bipoles/generic potentiometer/width=#1}%
865 \ctikzset{bipoles/ageneric/width=#1}%
866 \ctikzset{bipoles/tgeneric/width=#1}%
867 }}
868 \ctikzset{wiper pos/.code={%
869 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
870 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
871 }}
872 % zigzag resistor
873 \ctikzset{bipoles/resistor/height/.initial=.3}
874 \ctikzset{bipoles/resistor/width/.initial=.8}
875 \ctikzset{bipoles/potentiometer/height/.initial=.8}
876 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
877 \ctikzset{bipoles/potentiometer/width/.initial=.8}
878 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
879 \ctikzset{bipoles/vresistor/height/.initial=.6}
880 \ctikzset{bipoles/vresistor/width/.initial=.8}
881 \ctikzset{bipoles/resistivesens/height/.initial=.6}
882 \ctikzset{bipoles/resistivesens/width/.initial=.8}
883 % square resistors
884 \ctikzset{bipoles/photoresistor/height/.initial=.6}
885 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
886 \ctikzset{bipoles/photoresistor/width/.initial=.8}
887 \ctikzset{bipoles/thermistor/main/.initial=.7}
888 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
889 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
890 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
891 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
892 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
893 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
894 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
895 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
896 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
897 \ctikzset{bipoles/thermistor/width/.initial=.8}
898 \ctikzset{bipoles/varistor/main/.initial=.7}
899 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
900 \ctikzset{bipoles/varistor/width/.initial=.8}
901 \ctikzset{bipoles/generic/height/.initial=.30}
902 \ctikzset{bipoles/generic/width/.initial=.80}
903 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
904 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
905 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
906 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
907 \ctikzset{bipoles/ageneric/height/.initial=.30}
908 \ctikzset{bipoles/tgeneric/height/.initial=.70}
909 \ctikzset{bipoles/tgeneric/width/.initial=.80}
910 \ctikzset{bipoles/ageneric/width/.initial=.80}
911 \ctikzset{bipoles/memristor/height/.initial=.30}
912 \ctikzset{bipoles/memristor/wave height/.initial=.5}
913 \ctikzset{bipoles/memristor/width/.initial=.80}
914
915 \newif\ifpgf@circuit@europeanresistor
916 \ctikzset{resistor/.is choice}
917 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
918 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
919 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
920 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
921 %%>>>
922
923 %% Capacitors%<<<1
924 \ctikzset{bipoles/capacitor/height/.initial=.6}
925 \ctikzset{bipoles/capacitor/width/.initial=.2}
926 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
927 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
928 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
929 %%% pcapacitor is deprecated
930 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
931 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
932 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
933 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
934 \ctikzset{bipoles/ccapacitor/width/.initial=.12}
935 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
936 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
937 \ctikzset{bipoles/vcapacitor/width/.initial=.5}
938 \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
939 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
940 \ctikzset{bipoles/piezoelectric/width/.initial=.5}%
941 %>>>
942
943 % Inductors%<<<1
944 \ctikzset{inductors/coils/.code={%
945 \ctikzset{bipoles/cuteinductor/coils=#1}%
946 \ctikzset{bipoles/cutechoke/coils=#1}%
947 \ctikzset{bipoles/americaninductor/coils=#1}%
948 \ctikzset{bipoles/vcuteinductor/coils=#1}%
949 \ctikzset{bipoles/vamericaninductor/coils=#1}%
950 }}
951 \ctikzset{inductors/width/.code={%
952 \ctikzset{bipoles/cuteinductor/width=#1}%
953 \ctikzset{bipoles/cutechoke/width=#1}%
954 \ctikzset{bipoles/americaninductor/width=#1}%
955 \ctikzset{bipoles/vcuteinductor/width=#1}%
956 \ctikzset{bipoles/vamericaninductor/width=#1}%
957 \ctikzset{bipoles/fullgeneric/width=#1}%
958 \ctikzset{bipoles/tfullgeneric/width=#1}%
959 }}
960 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
961 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
962 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
963 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
964 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
965 %% Cute choke settings
966 \ctikzset{bipoles/cutechoke/height/.initial=.3}
967 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
968 \ctikzset{bipoles/cutechoke/width/.initial=.6}
969 \ctikzset{bipoles/cutechoke/coils/.initial=5}
970 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
971 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
972 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
973 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
974 \newif\ifpgf@circuit@bipole@twolineschoke
975 \pgf@circuit@bipole@twolineschokefalse
976 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
977 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
978 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
979 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
980 %
981 \ctikzset{bipoles/americaninductor/height/.initial=.3}
982 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
983 \ctikzset{bipoles/americaninductor/width/.initial=.8}
984 \ctikzset{bipoles/americaninductor/coils/.initial=4}
985 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
986 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
987 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
988 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
989 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
990 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
991 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
992 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
993 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
994 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
995 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
996 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
997 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
998 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
999 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
1000 \ctikzset{inductor/.is choice}
1001 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
1002 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
1003 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
1004
1005 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
1006 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
1007 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
1008 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
1009 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
1010
1011 %%>>>
1012
1013 % Sources%<<<1
1014
1015 \ctikzset{bipoles/esource/height/.initial=.60}
1016 \ctikzset{bipoles/esource/width/.initial=.60}
1017 \ctikzset{bipoles/pvsource/height/.initial=.60}
1018 \ctikzset{bipoles/pvsource/width/.initial=.60}
1019 \ctikzset{bipoles/isource/height/.initial=.60}
1020 \ctikzset{bipoles/isource/width/.initial=.60}
1021 \ctikzset{bipoles/oosource/height/.initial=.60}
1022 \ctikzset{bipoles/oosource/width/.initial=.60}
1023 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
1024 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
1025 \ctikzset{bipoles/dcisource/angle/.initial=80}
1026 \ctikzset{bipoles/dcisource/height/.initial=.60}
1027 \ctikzset{bipoles/dcisource/width/.initial=.60}
1028 \ctikzset{bipoles/dcvsource/height/.initial=.60}
1029 \ctikzset{bipoles/dcvsource/width/.initial=.60}
1030 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
1031 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
1032 \ctikzset{bipoles/isourceam/height/.initial=.60}
1033 \ctikzset{bipoles/isourceam/width/.initial=.60}
1034 \ctikzset{bipoles/vsource/height/.initial=.60}
1035 \ctikzset{bipoles/vsource/width/.initial=.60}
1036 \ctikzset{bipoles/vsourceam/height/.initial=.60}
1037 \ctikzset{bipoles/vsourceam/width/.initial=.60}
1038 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
1039 \ctikzset{bipoles/isourcesin/height/.initial=.60}
1040 \ctikzset{bipoles/isourcesin/width/.initial=.60}
1041 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
1042 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
1043 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
1044 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
1045 \ctikzset{bipoles/cisource/height/.initial=.7}
1046 \ctikzset{bipoles/cisource/width/.initial=.7}
1047 \ctikzset{bipoles/cisourceam/height/.initial=.7}
1048 \ctikzset{bipoles/cisourceam/width/.initial=.7}
1049 \ctikzset{bipoles/ecsource/height/.initial=.7}
1050 \ctikzset{bipoles/ecsource/width/.initial=.7}
1051 \ctikzset{bipoles/cvsource/height/.initial=.7}
1052 \ctikzset{bipoles/cvsource/width/.initial=.7}
1053 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
1054 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
1055 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
1056 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
1057 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
1058 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
1059 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
1060 \ctikzset{bipoles/battery/height/.initial=.6}
1061 \ctikzset{bipoles/battery/width/.initial=.3}
1062 \ctikzset{bipoles/battery1/height/.initial=.6}
1063 \ctikzset{bipoles/battery1/width/.initial=.3}
1064 \ctikzset{bipoles/battery2/height/.initial=.6}
1065 \ctikzset{bipoles/battery2/width/.initial=.3}
1066 % noise sources
1067 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
1068
1069 %%>>>
1070
1071 % "oo" style transformers and power grid diagrams%<<<1
1072 % % % ootransformer
1073 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
1074 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
1075 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
1076 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
1077 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
1078
1079 % % % oootransformer
1080 \ctikzset{bipoles/ooosource/height/.initial=.6}
1081 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
1082 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
1083 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
1084
1085 % % % primary windings
1086 \newif\ifpgf@circ@prim@delta
1087 \newif\ifpgf@circ@prim@wye
1088 \newif\ifpgf@circ@prim@zig
1089 \pgfkeys{tikz/prim/.is choice}
1090 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
1091 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
1092 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
1093
1094 % % % secondary windings
1095 \newif\ifpgf@circ@sec@delta
1096 \newif\ifpgf@circ@sec@wye
1097 \newif\ifpgf@circ@sec@zig
1098 \pgfkeys{tikz/sec/.is choice}
1099 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
1100 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
1101 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
1102
1103 % % % tertiary windings (ooosource)
1104 \newif\ifpgf@circ@tert@delta
1105 \newif\ifpgf@circ@tert@wye
1106 \newif\ifpgf@circ@tert@zig
1107 \pgfkeys{tikz/tert/.is choice}
1108 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
1109 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
1110 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
1111 %>>>
1112
1113 % diodes%<<<1
1114
1115 \ctikzset{bipoles/diode/height/.initial=.50}
1116 \ctikzset{bipoles/diode/width/.initial=.40}
1117 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
1118 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
1119 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
1120 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
1121 \ctikzset{bipoles/varcap/height/.initial=.50}
1122 \ctikzset{bipoles/varcap/width/.initial=.45}
1123 \ctikzset{tripoles/thyristor/height/.initial=1.10}
1124 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
1125 \ctikzset{tripoles/thyristor/width/.initial=1.0}
1126 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
1127 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
1128 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
1129
1130 \ctikzset{tripoles/triac/height/.initial=1.1}
1131 \ctikzset{tripoles/triac/width/.initial=1}
1132 \ctikzset{tripoles/triac/diode width left/.initial=.3}
1133 \ctikzset{tripoles/triac/diode width right/.initial=.3}
1134 %
1135 % Flipping arrows in LED and photodiodes
1136 %
1137 \newif\ifpgf@led@fliparrows
1138 \newif\ifpgf@pd@fliparrows
1139 \pgf@led@fliparrowsfalse
1140 \pgf@pd@fliparrowsfalse
1141 %
1142 % by default the arrows start (LED) and go (PD) to the anode.
1143 %
1144 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
1145 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
1146 %
1147 % but they can start form the cathode (LED) or go to it (PD)
1148 %
1149 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
1150 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
1151
1152 \newif\ifpgf@circuit@strokediode
1153 \newif\ifpgf@circuit@fulldiode
1154 \pgf@circuit@strokediodefalse
1155 \pgf@circuit@fulldiodefalse
1156
1157 \ctikzset{diode/.is choice}
1158 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
1159 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
1160 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
1161
1162 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
1163 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
1164 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
1165
1166 %%>>>
1167
1168 % switches%<<<1
1169
1170 \ctikzset{bipoles/spst/height/.initial=.35}
1171 \ctikzset{bipoles/spst/width/.initial=.35}
1172 \ctikzset{bipoles/spst/depth/.initial=.2}
1173 \ctikzset{bipoles/nos/height/.initial=.3}
1174 \ctikzset{bipoles/nos/width/.initial=.35}
1175 \ctikzset{bipoles/nos/depth/.initial=.2}
1176 \ctikzset{bipoles/ncs/height/.initial=.35}
1177 \ctikzset{bipoles/ncs/width/.initial=.35}
1178 \ctikzset{bipoles/ncs/depth/.initial=.2}
1179 \ctikzset{bipoles/pushbutton/height/.initial=.5}
1180 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
1181 \ctikzset{bipoles/pushbutton/width/.initial=.50}
1182 %%% reed switch
1183 \ctikzset{bipoles/reed/height/.initial=.4}
1184 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
1185 \ctikzset{bipoles/reed/depth/.initial=.4}
1186 %% Cute switches
1187 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
1188 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
1189 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
1190 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
1191 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
1192
1193 \ctikzset{tripoles/spdt/width/.initial=.85}
1194 \ctikzset{tripoles/spdt/height/.initial=.45}
1195 \ctikzset{tripoles/spdt/margin/.initial=.45}
1196
1197 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
1198 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
1199 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
1200 %%>>>
1201
1202 % arresters, fuses, lamps, etc%<<<1
1203
1204 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
1205 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
1206 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
1207 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
1208 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
1209 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
1210 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
1211 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
1212 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
1213 \ctikzset{bipoles/fuse/height/.initial=.20}
1214 \ctikzset{bipoles/fuse/width/.initial=.50}
1215 \ctikzset{bipoles/afuse/height/.initial=.20}
1216 \ctikzset{bipoles/afuse/width/.initial=.50}
1217 \ctikzset{bipoles/lamp/height/.initial=.60}
1218 \ctikzset{bipoles/lamp/width/.initial=.60}
1219 \ctikzset{bipoles/bulb/height/.initial=.8}
1220 \ctikzset{bipoles/bulb/width/.initial=.8}
1221 \ctikzset{bipoles/tline/height/.initial=.3}
1222 \ctikzset{bipoles/tline/width/.initial=.6}
1223 \ctikzset{bipoles/squid/height/.initial=.60}
1224 \ctikzset{bipoles/squid/width/.initial=.60}
1225 \ctikzset{bipoles/barrier/height/.initial=.60}
1226 \ctikzset{bipoles/barrier/width/.initial=.60}
1227 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
1228 \ctikzset{bipoles/thermocouple/height/.initial=.250}
1229 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
1230 \ctikzset{bipoles/thermocouple/width/.initial=.140}
1231 \newif\ifpgf@circuit@europeangfsurgearrester
1232 \ctikzset{gas filled surge arrester choice/.is choice}
1233 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
1234 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
1235
1236 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
1237 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
1238 %%>>>
1239
1240 % wires (open, shorts, ...)%<<<1
1241
1242 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
1243 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
1244 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
1245 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
1246 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
1247 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
1248 % multiwire
1249 \ctikzset{bipoles/multiwire/height/.initial=0.4}
1250 \ctikzset{bipoles/multiwire/width/.initial=0.2}
1251 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
1252 % crossing wires
1253 \ctikzset{bipoles/crossing/size/.initial=.2}
1254 %%>>>
1255
1256 % Instruments %<<<1
1257 \ctikzset{bipoles/ammeter/height/.initial=.60}
1258 \ctikzset{bipoles/ammeter/width/.initial=.60}
1259 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
1260 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
1261 \ctikzset{bipoles/voltmeter/height/.initial=.60}
1262 \ctikzset{bipoles/voltmeter/width/.initial=.60}
1263 \ctikzset{bipoles/smeter/height/.initial=.60}
1264 \ctikzset{bipoles/smeter/width/.initial=.60}
1265 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
1266 \ctikzset{bipoles/qmeter/depth/.initial=.40}
1267 \ctikzset{bipoles/qmeter/height/.initial=.80}
1268 \ctikzset{bipoles/qmeter/width/.initial=.60}
1269 % this must be specified for each one
1270 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
1271 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
1272 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
1273 \ctikzset{bipoles/iloop/width/.initial=.40}
1274 \ctikzset{bipoles/iloop/height/.initial=.60}
1275
1276 \ctikzset{bipoles/oscope/height/.initial=.60}
1277 \ctikzset{bipoles/oscope/width/.initial=.60}
1278 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
1279
1280
1281 % option to not rotate the new (Romano's) instruments
1282 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
1283 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
1284 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
1285 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
1286 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
1287 %%>>>
1288
1289 % blocks (twoports and so)%<<<1
1290
1291 \ctikzset{bipoles/twoport/width/.initial=.7}
1292 \ctikzset{bipoles/twoport/height/.initial=.7}
1293 \ctikzset{bipoles/twoport/text/.initial=}
1294 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
1295 \ctikzset{bipoles/twoport/text in/.initial=}
1296 \ctikzset{bipoles/twoport/text out/.initial=}
1297 \ctikzset{text/.style={t=#1}}
1298 \ctikzset{t/.code={%
1299 \ctikzsetvalof{bipoles/twoport/text}{#1}%
1300 }}
1301 \ctikzset{text in/.style={t1=#1}}
1302 \ctikzset{t1/.code={%
1303 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
1304 }}
1305 \ctikzset{text out/.style={t2=#1}}
1306 \ctikzset{t2/.code={%
1307 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
1308 }}
1309 \ctikzset{bipoles/vco/width/.initial=.7}
1310 \ctikzset{bipoles/bandpass/width/.initial=.7}
1311 \ctikzset{bipoles/bandstop/width/.initial=.7}
1312 \ctikzset{bipoles/highpass/width/.initial=.7}
1313 \ctikzset{bipoles/lowpass/width/.initial=.7}
1314 \ctikzset{bipoles/allpass/width/.initial=.7}
1315 \ctikzset{bipoles/adc/width/.initial=.7}
1316 \ctikzset{bipoles/dac/width/.initial=.7}
1317 \ctikzset{bipoles/dsp/width/.initial=.7}
1318 \ctikzset{bipoles/fft/width/.initial=.7}
1319 \ctikzset{bipoles/amp/width/.initial=.7}
1320 \ctikzset{bipoles/vamp/width/.initial=.7}
1321 \ctikzset{bipoles/piattenuator/width/.initial=.7}
1322 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
1323 \ctikzset{bipoles/tattenuator/width/.initial=.7}
1324 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
1325 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
1326 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
1327 \ctikzset{bipoles/detector/width/.initial=.7}
1328 \ctikzset{tripoles/mixer/width/.initial=0.7}
1329 \ctikzset{tripoles/adder/width/.initial=0.7}
1330 \ctikzset{tripoles/circulator/width/.initial=.7}
1331 \ctikzset{tripoles/oscillator/width/.initial=.7}
1332
1333 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
1334 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
1335
1336 \ctikzset{tripoles/splitter/height/.initial=1.3}
1337 \ctikzset{tripoles/splitter/width/.initial=1.3}
1338
1339 \ctikzset{tripoles/mzm/height/.initial=1.3}
1340 \ctikzset{tripoles/mzm/width/.initial=1.3}
1341 %%>>>
1342
1343 % Transistors %<<<1
1344
1345 \newif\ifpgf@circuit@trans@depletiontype
1346 \pgf@circuit@trans@depletiontypefalse
1347
1348 \newif\ifpgf@circuit@mos@arrows
1349 \ctikzset{tripoles/mos style/.is choice}
1350 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
1351 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
1352 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
1353 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
1354
1355 % Fixed label positions
1356 \newif\ifpgf@circuit@transisors@fixlabels
1357 \pgf@circuit@transisors@fixlabelstrue
1358 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1359 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1360 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1361 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1362
1363 % Option solderdot for fet
1364 \newif\ifpgf@circuit@fet@solderdot
1365 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1366 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1367 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1368 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1369
1370 % Option bodydiode for fet
1371 \newif\ifpgf@circuit@fet@bodydiode
1372 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1373 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1374 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1375 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1376
1377 % Option draw fet without gate connection
1378 \newif\ifpgf@circuit@bpt@drawgate
1379 \pgf@circuit@bpt@drawgatetrue
1380 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1381 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1382 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1383 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1384
1385 % Option draw bpt with schottky base
1386 \newif\ifpgf@circuit@bpt@schottky
1387 \pgf@circuit@bpt@schottkyfalse
1388 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1389 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1390 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1391 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1392 \ctikzset{tripoles/schottky base size/.initial=0.05}
1393
1394 % Option draw bpt without base connection
1395 \newif\ifpgf@circuit@bpt@drawbase
1396 \pgf@circuit@bpt@drawbasetrue
1397 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1398 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1399 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1400 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1401
1402 % Option draw bpt with optical input
1403 \newif\ifpgf@circuit@bpt@drawphoto
1404 \pgf@circuit@bpt@drawphotofalse
1405 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1406 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1407 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1408 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1409
1410 % Option draw fet without bulk connection -- Added by Burak Kelleci
1411 \newif\ifpgf@circuit@bpt@drawbulk
1412 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1413 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1414 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1415 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1416
1417 % Option draw pmos with empty circle
1418 \newif\ifpgf@circuit@pmos@emptycircle
1419 \pgf@circuit@pmos@emptycirclefalse
1420 \ctikzset{tripoles/pmos style/.is choice}
1421 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1422 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1423 % Option draw pmos with no circle
1424 \newif\ifpgf@circuit@pmos@nocircle
1425 \pgf@circuit@pmos@nocirclefalse
1426 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1427 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1428 % back to normal
1429 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1430 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1431 % arrows at the end, the correct way
1432 \newif\ifpgf@circuit@trans@arrowatend
1433 \pgf@circuit@trans@arrowatendfalse
1434 \ctikzset{transistors/arrow pos/.is choice}
1435 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
1436 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
1437
1438 \newif\ifpgf@circuit@trans@ntype
1439 \pgf@circuit@trans@ntypetrue %default true
1440 %\newif\ifpgf@circuit@trans@ptype
1441 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
1442 \ctikzset{tripoles/nmos/width/.initial=.7}
1443 \ctikzset{tripoles/nmos/gate height/.initial=.35}
1444 \ctikzset{tripoles/nmos/base height/.initial=.5}
1445 \ctikzset{tripoles/nmos/conn height/.initial=0}
1446 \ctikzset{tripoles/nmos/height/.initial=1.1}
1447 \ctikzset{tripoles/nmos/base width/.initial=.5}
1448 \ctikzset{tripoles/nmos/gate width/.initial=.62}
1449 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
1450 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
1451 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
1452 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
1453 \ctikzset{tripoles/nmos/curr direction/.initial=1}
1454
1455 \ctikzset{tripoles/pmos/width/.initial=.7}
1456 \ctikzset{tripoles/pmos/gate height/.initial=.35}
1457 \ctikzset{tripoles/pmos/base height/.initial=.5}
1458 \ctikzset{tripoles/pmos/conn height/.initial=0}
1459 \ctikzset{tripoles/pmos/height/.initial=1.1}
1460 \ctikzset{tripoles/pmos/base width/.initial=.5}
1461 \ctikzset{tripoles/pmos/gate width/.initial=.62}
1462 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
1463 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
1464 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
1465 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
1466 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
1467
1468 \ctikzset{tripoles/nmosd/width/.initial=.7}
1469 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
1470 \ctikzset{tripoles/nmosd/base height/.initial=.5}
1471 \ctikzset{tripoles/nmosd/conn height/.initial=0}
1472 \ctikzset{tripoles/nmosd/height/.initial=1.1}
1473 \ctikzset{tripoles/nmosd/base width/.initial=.5}
1474 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
1475 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
1476 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
1477 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
1478 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
1479 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
1480 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
1481 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
1482
1483 \ctikzset{tripoles/pmosd/width/.initial=.7}
1484 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
1485 \ctikzset{tripoles/pmosd/base height/.initial=.5}
1486 \ctikzset{tripoles/pmosd/conn height/.initial=0}
1487 \ctikzset{tripoles/pmosd/height/.initial=1.1}
1488 \ctikzset{tripoles/pmosd/base width/.initial=.5}
1489 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
1490 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
1491 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
1492 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
1493 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
1494 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
1495 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
1496 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
1497 \ctikzset{tripoles/hemt/width/.initial=.7}
1498 \ctikzset{tripoles/hemt/gate height/.initial=.35}
1499 \ctikzset{tripoles/hemt/base height/.initial=.5}
1500 \ctikzset{tripoles/hemt/conn height/.initial=0}
1501 \ctikzset{tripoles/hemt/height/.initial=1.1}
1502 \ctikzset{tripoles/hemt/base width/.initial=.5}
1503 \ctikzset{tripoles/hemt/gate width/.initial=.62}
1504 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
1505 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
1506 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
1507 \ctikzset{tripoles/hemt/curr direction/.initial=1}
1508
1509 \ctikzset{tripoles/nfet/width/.initial=.7}
1510 \ctikzset{tripoles/nfet/gate height/.initial=.35}
1511 \ctikzset{tripoles/nfet/base height/.initial=.5}
1512 \ctikzset{tripoles/nfet/conn height/.initial=0}
1513 \ctikzset{tripoles/nfet/height/.initial=1.1}
1514 \ctikzset{tripoles/nfet/base width/.initial=.5}
1515 \ctikzset{tripoles/nfet/gate width/.initial=.62}
1516 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
1517 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
1518 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
1519 \ctikzset{tripoles/nfet/curr direction/.initial=1}
1520
1521 \ctikzset{tripoles/pfet/width/.initial=.7}
1522 \ctikzset{tripoles/pfet/gate height/.initial=.35}
1523 \ctikzset{tripoles/pfet/base height/.initial=.5}
1524 \ctikzset{tripoles/pfet/conn height/.initial=0}
1525 \ctikzset{tripoles/pfet/height/.initial=1.1}
1526 \ctikzset{tripoles/pfet/base width/.initial=.5}
1527 \ctikzset{tripoles/pfet/gate width/.initial=.62}
1528 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
1529 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
1530 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
1531 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
1532
1533 \ctikzset{tripoles/nfetd/width/.initial=.7}
1534 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
1535 \ctikzset{tripoles/nfetd/base height/.initial=.5}
1536 \ctikzset{tripoles/nfetd/conn height/.initial=0}
1537 \ctikzset{tripoles/nfetd/height/.initial=1.1}
1538 \ctikzset{tripoles/nfetd/base width/.initial=.5}
1539 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
1540 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
1541 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
1542 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
1543 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
1544
1545 \ctikzset{tripoles/pfetd/width/.initial=.7}
1546 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
1547 \ctikzset{tripoles/pfetd/base height/.initial=.5}
1548 \ctikzset{tripoles/pfetd/conn height/.initial=0}
1549 \ctikzset{tripoles/pfetd/height/.initial=1.1}
1550 \ctikzset{tripoles/pfetd/base width/.initial=.5}
1551 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
1552 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
1553 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
1554 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
1555 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
1556
1557 \ctikzset{tripoles/nigfete/width/.initial=.7}
1558 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
1559 \ctikzset{tripoles/nigfete/base height/.initial=.5}
1560 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
1561 \ctikzset{tripoles/nigfete/height/.initial=1.1}
1562 \ctikzset{tripoles/nigfete/base width/.initial=.5}
1563 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
1564 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
1565 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
1566 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
1567 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
1568
1569 \ctikzset{tripoles/nigfetd/width/.initial=.7}
1570 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
1571 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
1572 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
1573 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
1574 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
1575 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
1576 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
1577 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
1578 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
1579 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
1580
1581 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
1582 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
1583 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
1584 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
1585 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
1586 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
1587 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
1588 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
1589 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
1590 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
1591 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
1592
1593 \ctikzset{tripoles/pigfete/width/.initial=.7}
1594 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
1595 \ctikzset{tripoles/pigfete/base height/.initial=.5}
1596 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
1597 \ctikzset{tripoles/pigfete/height/.initial=1.1}
1598 \ctikzset{tripoles/pigfete/base width/.initial=.5}
1599 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
1600 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
1601 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
1602 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
1603 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
1604
1605 \ctikzset{tripoles/pigfetd/width/.initial=.7}
1606 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
1607 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
1608 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
1609 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
1610 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
1611 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
1612 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
1613 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
1614 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
1615 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
1616
1617 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
1618 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
1619 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
1620 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
1621 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
1622 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
1623 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
1624 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
1625 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
1626 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
1627 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
1628
1629 \ctikzset{tripoles/npn/width/.initial=.6}
1630 \ctikzset{tripoles/npn/base height/.initial=.45}
1631 \ctikzset{tripoles/npn/base height 2/.initial=.15}
1632 \ctikzset{tripoles/npn/base height/.initial=.4}
1633 \ctikzset{tripoles/npn/conn height/.initial=0}
1634 \ctikzset{tripoles/npn/height/.initial=1.1}
1635 \ctikzset{tripoles/npn/base width/.initial=.5}
1636 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
1637 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
1638 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
1639 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
1640 \ctikzset{tripoles/npn/curr direction/.initial=1}
1641
1642 \ctikzset{tripoles/pnp/width/.initial=.6}
1643 \ctikzset{tripoles/pnp/base height/.initial=.45}
1644 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
1645 \ctikzset{tripoles/pnp/base height/.initial=.4}
1646 \ctikzset{tripoles/pnp/conn height/.initial=0}
1647 \ctikzset{tripoles/pnp/height/.initial=1.1}
1648 \ctikzset{tripoles/pnp/base width/.initial=.5}
1649 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
1650 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
1651 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
1652 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
1653 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
1654
1655 \ctikzset{tripoles/pigbt/width/.initial=.6}
1656 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
1657 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
1658 \ctikzset{tripoles/pigbt/base height/.initial=.4}
1659 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
1660 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
1661 \ctikzset{tripoles/pigbt/conn height/.initial=0}
1662 \ctikzset{tripoles/pigbt/height/.initial=1.1}
1663 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
1664 \ctikzset{tripoles/pigbt/base width/.initial=.5}
1665 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
1666 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
1667 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
1668 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
1669
1670 \ctikzset{tripoles/nigbt/width/.initial=.6}
1671 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
1672 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
1673 \ctikzset{tripoles/nigbt/base height/.initial=.4}
1674 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
1675 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
1676 \ctikzset{tripoles/nigbt/conn height/.initial=0}
1677 \ctikzset{tripoles/nigbt/height/.initial=1.1}
1678 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
1679 \ctikzset{tripoles/nigbt/base width/.initial=.5}
1680 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
1681 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
1682 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
1683 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
1684
1685 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
1686 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
1687 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
1688 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
1689 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
1690 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
1691 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
1692 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
1693 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
1694 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
1695 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
1696 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
1697 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
1698 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
1699
1700 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
1701 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
1702 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
1703 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
1704 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
1705 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
1706 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
1707 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
1708 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
1709 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
1710 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
1711 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
1712 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
1713 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
1714
1715 \ctikzset{tripoles/igbt/outer base height/.code={
1716 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
1717 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
1718 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
1719 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
1720 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
1721 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
1722 }}
1723 \ctikzset{tripoles/igbt/outer base thickness/.code={
1724 \ctikzset{tripoles/nigbt/outer base thickness=#1}
1725 \ctikzset{tripoles/pigbt/outer base thickness=#1}
1726 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
1727 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
1728 }}
1729
1730 \ctikzset{tripoles/njfet/width/.initial=.7}
1731 \ctikzset{tripoles/njfet/gate height/.initial=.5}
1732 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
1733 \ctikzset{tripoles/njfet/gate width/.initial=.5}
1734 \ctikzset{tripoles/njfet/conn height/.initial=.35}
1735 \ctikzset{tripoles/njfet/height/.initial=1.1}
1736 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
1737 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
1738 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
1739 \ctikzset{tripoles/njfet/curr direction/.initial=1}
1740
1741 \ctikzset{tripoles/pjfet/width/.initial=.7}
1742 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
1743 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
1744 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
1745 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
1746 \ctikzset{tripoles/pjfet/height/.initial=1.1}
1747 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
1748 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
1749 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
1750 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
1751
1752 \ctikzset{tripoles/isfet/width/.initial=1}
1753 \ctikzset{tripoles/isfet/gate height/.initial=.35}
1754 \ctikzset{tripoles/isfet/base height/.initial=.5}
1755 \ctikzset{tripoles/isfet/height/.initial=1.1}
1756 \ctikzset{tripoles/isfet/base width/.initial=.3}
1757 \ctikzset{tripoles/isfet/gate width/.initial=.5}
1758 \ctikzset{tripoles/isfet/conn height/.initial=0}
1759 \ctikzset{tripoles/isfet/wave width/.initial=.16}
1760 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
1761 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
1762 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
1763 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
1764 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
1765 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
1766 \ctikzset{tripoles/isfet/curr direction/.initial=1}
1767 %
1768 % multi-emitter and multi-collector BJTs by Romano Giannetti
1769 %
1770 \ctikzset{tripoles/bjt/emitters/.initial=1}
1771 \ctikzset{tripoles/bjt/collectors/.initial=1}
1772 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
1773 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
1774 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
1775 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
1776 \ctikzset{tripoles/bjt/multi height/.initial=.5}
1777 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
1778 %
1779 \ctikzset{tripoles/bjt/width/.initial=.3}
1780 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
1781 \ctikzset{tripoles/bjt/base height/.initial=1.1}
1782 \ctikzset{tripoles/bjt/height/.initial=.4}
1783 \ctikzset{tripoles/bjt/base width/.initial=1}
1784 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
1785 % do NOT touch these two!
1786 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
1787 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
1788
1789 %% transistors stop here
1790 %%>>>
1791
1792 % Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
1793 \ctikzset{tubes/width/.initial=1} % relative width
1794 \ctikzset{tubes/height/.initial=1.4} % relative height
1795 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
1796 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
1797 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
1798 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
1799 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
1800 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
1801 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
1802 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
1803 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
1804 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
1805 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
1806 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
1807 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
1808
1809 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
1810 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1811 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1812 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
1813 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1814 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1815 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
1816 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
1817 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
1818 %>>>
1819
1820 %% Logic ports%<<<1
1821 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
1822
1823 % switches for logic gates
1824 %
1825 \pgfkeys{/tikz/number inputs/.initial=0}
1826 \pgfkeys{/tikz/number inputs/.default=0}
1827
1828 \newif\ifpgf@circuit@europeanlogicport
1829 \ctikzset{logic ports/.is choice}
1830 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
1831 \tikzset{and port/.style={shape=european and port}}%
1832 \tikzset{or port/.style={shape=european or port}}%
1833 \tikzset{xor port/.style={shape=european xor port}}%
1834 \tikzset{buffer port/.style={shape=european buffer port}}%
1835 \tikzset{not port/.style={shape=european not port}}%
1836 \tikzset{nand port/.style={shape=european nand port}}%
1837 \tikzset{nor port/.style={shape=european nor port}}%
1838 \tikzset{xnor port/.style={shape=european xnor port}}%
1839 % there is no Schmitt ports in european style (yet)
1840 \tikzset{schmitt port/.style={shape=schmitt}}%
1841 \tikzset{invschmitt port/.style={shape=invschmitt}}%
1842 }}
1843 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
1844 \tikzset{and port/.style={shape=american and port}}%
1845 \tikzset{or port/.style={shape=american or port}}%
1846 \tikzset{xor port/.style={shape=american xor port}}%
1847 \tikzset{buffer port/.style={shape=american buffer port}}%
1848 \tikzset{not port/.style={shape=american not port}}%
1849 \tikzset{nand port/.style={shape=american nand port}}%
1850 \tikzset{nor port/.style={shape=american nor port}}%
1851 \tikzset{xnor port/.style={shape=american xnor port}}%
1852 \tikzset{schmitt port/.style={shape=schmitt}}%
1853 \tikzset{invschmitt port/.style={shape=invschmitt}}%
1854 }}
1855
1856 \ctikzset{logic ports origin/.is choice}
1857 \ctikzset{logic ports origin/legacy/.code={
1858 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
1859 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
1860 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
1861 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
1862 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
1863 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
1864 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
1865 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
1866 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
1867 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
1868 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
1869 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
1870 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
1871 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
1872 }%
1873 }
1874 \ctikzset{logic ports origin/center/.code={%
1875 \ctikzset{tripoles/american and port/origin/.initial=0}%
1876 \ctikzset{tripoles/american nand port/origin/.initial=0}%
1877 \ctikzset{tripoles/american nor port/origin/.initial=0}%
1878 \ctikzset{tripoles/american or port/origin/.initial=0}%
1879 \ctikzset{tripoles/american xor port/origin/.initial=0}%
1880 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
1881 \ctikzset{tripoles/european and port/origin/.initial=0}%
1882 \ctikzset{tripoles/european nand port/origin/.initial=0}%
1883 \ctikzset{tripoles/european or port/origin/.initial=0}%
1884 \ctikzset{tripoles/european nor port/origin/.initial=0}%
1885 \ctikzset{tripoles/european xor port/origin/.initial=0}%
1886 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
1887 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
1888 \ctikzset{tripoles/european not port/origin/.initial=0}%
1889 }%
1890 }
1891
1892 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
1893 \ctikzset{american or shape/.is choice}
1894 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
1895 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
1896
1897 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
1898 \ctikzset{logic ports draw input leads/.is choice}
1899 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
1900 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
1901 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
1902 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
1903
1904 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
1905 \ctikzset{logic ports draw output leads/.is choice}
1906 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
1907 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
1908 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
1909 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
1910
1911 \ctikzset{logic ports draw leads/.is choice}
1912 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
1913 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
1914 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
1915 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
1916
1917 % adding a different style of xnor port
1918 % see https://github.com/circuitikz/circuitikz/issues/467
1919 \ctikzset{european xnor style/.is choice}
1920 \ctikzset{european xnor style/default/.code={%
1921 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
1922 }
1923 \ctikzset{european xnor style/direct/.code={%
1924 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
1925 }
1926
1927
1928 % old, legacy keys that should be killed over
1929 \ctikzset{bipoles/buffer/height/.initial=1}
1930 \ctikzset{bipoles/buffer/width/.initial=1}
1931 \ctikzset{bipoles/not port/width/.initial=1}
1932 \ctikzset{bipoles/not port/height/.initial=.8}
1933 \ctikzset{bipoles/not port/circle width/.initial=.15}
1934
1935 \ctikzset{tripoles/american and port/width/.initial=1.1}
1936 \ctikzset{tripoles/american and port/height/.initial=.8}
1937 \ctikzset{tripoles/american and port/port width/.initial=.7}
1938 \ctikzset{tripoles/american and port/input height/.initial=.5}
1939 \ctikzset{tripoles/american nand port/width/.initial=1.1}
1940 \ctikzset{tripoles/american nand port/height/.initial=.8}
1941 \ctikzset{tripoles/american nand port/port width/.initial=.7}
1942 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
1943 \ctikzset{tripoles/american nand port/input height/.initial=.5}
1944 \ctikzset{tripoles/american or port/width/.initial=1.1}
1945 \ctikzset{tripoles/american or port/height/.initial=.8}
1946 \ctikzset{tripoles/american or port/port width/.initial=.7}
1947 \ctikzset{tripoles/american or port/input height/.initial=.5}
1948 \ctikzset{tripoles/american or port/input skip/.initial=.25}
1949 \ctikzset{tripoles/american or port/aaa/.initial=.6}
1950 \ctikzset{tripoles/american or port/bbb/.initial=.4}
1951 \ctikzset{tripoles/american or port/ccc/.initial=.5}
1952 \ctikzset{tripoles/american or port/ddd/.initial=.0}
1953 \ctikzset{tripoles/american nor port/width/.initial=1.1}
1954 \ctikzset{tripoles/american nor port/height/.initial=.8}
1955 \ctikzset{tripoles/american nor port/port width/.initial=.7}
1956 \ctikzset{tripoles/american nor port/input height/.initial=.5}
1957 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
1958 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
1959 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
1960 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
1961 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
1962 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
1963 \ctikzset{tripoles/american xor port/width/.initial=1.1}
1964 \ctikzset{tripoles/american xor port/height/.initial=.8}
1965 \ctikzset{tripoles/american xor port/port width/.initial=.7}
1966 \ctikzset{tripoles/american xor port/input height/.initial=.5}
1967 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
1968 \ctikzset{tripoles/american xor port/distance/.initial=.1}
1969 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
1970 \ctikzset{tripoles/american xnor port/height/.initial=.8}
1971 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
1972 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
1973 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
1974 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
1975 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
1976 \ctikzset{tripoles/american and port/origin/.initial=0.8}
1977 \ctikzset{tripoles/american and port/inputs/.initial=2}
1978 % variable number of inputs
1979 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
1980 \ctikzset{tripoles/american nand port/inputs/.initial=2}
1981 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
1982 \ctikzset{tripoles/american nor port/inputs/.initial=2}
1983 \ctikzset{tripoles/american nor port/angle/.initial=70}
1984 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
1985 \ctikzset{tripoles/american or port/origin/.initial=0.8}
1986 \ctikzset{tripoles/american or port/inputs/.initial=2}
1987 \ctikzset{tripoles/american or port/angle/.initial=70}
1988 \ctikzset{tripoles/american or port/inner/.initial=0.3}
1989 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
1990 \ctikzset{tripoles/american xor port/inputs/.initial=2}
1991 \ctikzset{tripoles/american xor port/angle/.initial=70}
1992 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
1993 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
1994 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
1995 \ctikzset{tripoles/american xnor port/angle/.initial=70}
1996 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
1997
1998 \ctikzset{tripoles/european and port/width/.initial=1.4}
1999 \ctikzset{tripoles/european and port/height/.initial=.65}
2000 \ctikzset{tripoles/european and port/reserved/.initial=.6}
2001 \ctikzset{tripoles/european and port/input height/.initial=.6}
2002 \ctikzset{tripoles/european or port/width/.initial=1.4}
2003 \ctikzset{tripoles/european or port/height/.initial=.65}
2004 \ctikzset{tripoles/european or port/reserved/.initial=.6}
2005 \ctikzset{tripoles/european or port/input height/.initial=.6}
2006 \ctikzset{tripoles/european xor port/width/.initial=1.4}
2007 \ctikzset{tripoles/european xor port/height/.initial=.65}
2008 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
2009 \ctikzset{tripoles/european xor port/input height/.initial=.6}
2010 \ctikzset{tripoles/european nand port/width/.initial=1.4}
2011 \ctikzset{tripoles/european nand port/not height/.initial=.3}
2012 \ctikzset{tripoles/european nand port/not width/.initial=.8}
2013 \ctikzset{tripoles/european nand port/height/.initial=.65}
2014 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
2015 \ctikzset{tripoles/european nand port/input height/.initial=.6}
2016 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
2017 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
2018 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
2019 \ctikzset{tripoles/european buffer port/height/.initial=.65}
2020 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
2021 \ctikzset{tripoles/european buffer port/input height/.initial=0}
2022 \ctikzset{tripoles/european not port/width/.initial=1.4}
2023 \ctikzset{tripoles/european not port/not height/.initial=.3}
2024 \ctikzset{tripoles/european not port/not width/.initial=.8}
2025 \ctikzset{tripoles/european not port/height/.initial=.65}
2026 \ctikzset{tripoles/european not port/reserved/.initial=.6}
2027 \ctikzset{tripoles/european not port/input height/.initial=0}
2028 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
2029 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
2030 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
2031 \ctikzset{tripoles/european xnor port/height/.initial=.65}
2032 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
2033 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
2034 \ctikzset{tripoles/european nor port/width/.initial=1.4}
2035 \ctikzset{tripoles/european nor port/not height/.initial=.3}
2036 \ctikzset{tripoles/european nor port/not width/.initial=.8}
2037 \ctikzset{tripoles/european nor port/height/.initial=.65}
2038 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
2039 \ctikzset{tripoles/european nor port/input height/.initial=.6}
2040 % variable number of inputs
2041 \ctikzset{tripoles/european and port/origin/.initial=0.8}
2042 \ctikzset{tripoles/european and port/inputs/.initial=2}
2043 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
2044 \ctikzset{tripoles/european nand port/inputs/.initial=2}
2045 \ctikzset{tripoles/european or port/origin/.initial=0.8}
2046 \ctikzset{tripoles/european or port/inputs/.initial=2}
2047 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
2048 \ctikzset{tripoles/european nor port/inputs/.initial=2}
2049 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
2050 \ctikzset{tripoles/european xor port/inputs/.initial=2}
2051 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
2052 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
2053 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
2054 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
2055 \ctikzset{tripoles/european not port/origin/.initial=0.8}
2056 \ctikzset{tripoles/european not port/inputs/.initial=1}%
2057 %%% parameters that are not used anymore after multi-input
2058 %%% gates --- left for compatibility of source code.
2059 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
2060 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
2061 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
2062 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
2063 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
2064 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
2065 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
2066 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
2067 %%>>>
2068
2069 % flip flops and muxdemxes%<<<1
2070
2071 %% flip-flop specific keys (most others are the same as chips)
2072
2073 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
2074 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
2075 \ctikzset{multipoles/flipflop/width/.initial=1.2}
2076 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
2077 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
2078
2079 %% muxdemuxes keys
2080
2081 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
2082 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
2083 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
2084 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
2085 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
2086 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
2087 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
2088 \ctikzset{multipoles/muxdemux/NL/.initial=8}
2089 \ctikzset{multipoles/muxdemux/NR/.initial=1}
2090 \ctikzset{multipoles/muxdemux/NB/.initial=3}
2091 \ctikzset{multipoles/muxdemux/NT/.initial=0}
2092 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
2093 %>>>
2094
2095 % Amplifiers%<<<1
2096 %
2097 % switches for op amps
2098 % changing input polarity
2099 %
2100 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
2101 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
2102 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
2103 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
2104 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
2105 %
2106 % changing output polarity (for fully diff objects)
2107 %
2108 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
2109 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
2110 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
2111 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
2112 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
2113
2114 % Operational amplifier
2115 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
2116 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
2117 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
2118 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
2119 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
2120 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2121
2122 % Fully differential operational amplifier
2123 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
2124 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
2125 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
2126 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
2127 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
2128 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
2129 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2130
2131 \ctikzset{tripoles/en amp/width/.initial=1.7}
2132 \ctikzset{tripoles/en amp/port width/.initial=.7}
2133 \ctikzset{tripoles/en amp/height/.initial=1.6}
2134 \ctikzset{tripoles/en amp/input height/.initial=.3}
2135 \ctikzset{tripoles/en amp/up pos/.initial=.45}
2136 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2137 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
2138 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
2139 \tikzset{
2140 en amp text/.code = {%
2141 \ctikzsetvalof{tripoles/en amp/text}{#1}%
2142 },
2143 en amp text A/.code = {%
2144 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
2145 },
2146 }
2147
2148 % Transconductance amplifier
2149 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
2150 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
2151 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
2152 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
2153 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
2154 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
2155 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2156
2157 % Instrumentation amplifier
2158 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
2159 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
2160 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
2161 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
2162 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
2163 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
2164 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
2165 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2166
2167 % Instrumentation amplifier with differential output
2168 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
2169 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
2170 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
2171 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
2172 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
2173 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
2174 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
2175 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
2176 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2177
2178 % Instrumentation amplifier with gain resistor terminals
2179 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
2180 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
2181 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
2182 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
2183 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
2184 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
2185 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
2186 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
2187 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
2188
2189 % Plain amplifier
2190 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
2191 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
2192 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
2193 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
2194 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
2195
2196 % changing fonts and symbols of amplifiers
2197 \ctikzset{amplifiers/symbol font/.code={%
2198 \ctikzset{tripoles/inst amp ra/font=#1}%
2199 \ctikzset{tripoles/fd inst amp/font=#1}%
2200 \ctikzset{tripoles/inst amp/font=#1}%
2201 \ctikzset{tripoles/gm amp/font=#1}%
2202 \ctikzset{tripoles/en amp/font=#1}%
2203 \ctikzset{tripoles/fd op amp/font=#1}%
2204 \ctikzset{tripoles/op amp/font=#1}%
2205 }}
2206 \ctikzset{amplifiers/plus/.initial={$+$}}
2207 \ctikzset{amplifiers/minus/.initial={$-$}}
2208 \tikzset{amp symbol font/.code={%
2209 \ctikzset{amplifiers/symbol font={#1}}%
2210 }
2211 }
2212 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
2213 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
2214 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
2215 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
2216 %%>>>
2217
2218 % Transformers%<<<1
2219
2220 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
2221 \ctikzset{quadpoles/transformer/width/.initial=1.5}
2222 \ctikzset{quadpoles/transformer/width1/.initial=.4}
2223 \ctikzset{quadpoles/transformer/height/.initial=1.5}
2224 \ctikzset{quadpoles/transformer/height1/.initial=.8}
2225 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
2226 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
2227 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
2228 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
2229 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
2230 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
2231 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
2232 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
2233 \ctikzset{quadpoles/fourport/width/.initial=1.3}
2234 \ctikzset{quadpoles/fourport/height/.initial=1.3}
2235 \ctikzset{quadpoles/coupler/width/.initial=1.3}
2236 \ctikzset{quadpoles/coupler/height/.initial=1.3}
2237 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
2238 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
2239
2240 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
2241
2242 \ctikzset{quadpoles style/.is choice}
2243 \ctikzset{quadpoles style/inward/.code={% default value
2244 \ctikzset{quadpoles/transformer/inner=0.4}%
2245 \ctikzset{quadpoles/transformer/width=1.5}%
2246 \ctikzset{quadpoles/transformer core/inner=0.4}%
2247 \ctikzset{quadpoles/transformer core/width=1.5}%
2248 \ctikzset{quadpoles/gyrator/inner=0.4}%
2249 \ctikzset{quadpoles/gyrator/width=1.5}%
2250 }%
2251 }
2252 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
2253 \ctikzset{quadpoles/transformer/inner=1}%
2254 \ctikzset{quadpoles/transformer/width=0.6}%
2255 \ctikzset{quadpoles/transformer core/inner=1}%
2256 \ctikzset{quadpoles/transformer core/width=0.6}%
2257 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
2258 \ctikzset{quadpoles/gyrator/width=0.6}%
2259 }%
2260 }
2261 %%>>>
2262
2263 % seven segment displays by RGtti%<<<1
2264
2265 \newif\ifpgf@circ@sevenseg@dot
2266 \newif\ifpgf@circ@sevenseg@box
2267 \def\pgf@circ@sevenseg@dotstate{empty}
2268 \ctikzset{seven seg/.is family}
2269 \ctikzset{seven seg/dot/.is choice}
2270 % none means no dot, not space for it. Empty means no dot, but space
2271 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
2272 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
2273 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
2274 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
2275 %
2276 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
2277 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
2278 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
2279 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
2280 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
2281 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
2282 \ctikzset{seven seg/box/.is choice}
2283 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
2284 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
2285
2286 \ctikzset{seven seg/bits/.initial=0000000}
2287
2288 \ctikzset{seven seg/value/.code={%
2289 \edef\@@tmp{#1}%
2290 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
2291 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
2292 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
2293 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
2294 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
2295 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
2296 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
2297 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
2298 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
2299 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
2300 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2301 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2302 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2303 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2304 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2305 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2306 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2307 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2308 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2309 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2310 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2311 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2312 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2313 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2314 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2315 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2316 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2317 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2318 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
2319 }}
2320
2321 \tikzset{%
2322 seven segment val/.style args={#1dot#2box#3}{%
2323 shape=bare7seg,
2324 /tikz/circuitikz/seven seg/value=#1,
2325 /tikz/circuitikz/seven seg/dot=#2,
2326 /tikz/circuitikz/seven seg/box=#3,
2327 },
2328 seven segment bits/.style args={#1dot#2box#3}{%
2329 shape=bare7seg,
2330 /tikz/circuitikz/seven seg/bits=#1,
2331 /tikz/circuitikz/seven seg/dot=#2,
2332 /tikz/circuitikz/seven seg/box=#3,
2333 },
2334 }
2335 %%>>>
2336
2337 % Options for twoports and blocks%<<<1
2338
2339 % Option ">" for twoports
2340 \newif\ifpgf@circuit@inputarrow
2341 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
2342 \ctikzset{inputarrow/.is choice}
2343 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
2344 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
2345
2346 % Option "boxed" for nodes and twoports
2347 \newif\ifpgf@circuit@boxed
2348 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
2349 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
2350 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
2351 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
2352
2353 % Option "dashed" for nodes and twoports
2354 \newif\ifpgf@circuit@dashed
2355 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
2356 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
2357 %>>>
2358
2359 % Chips and Rotary switches (multipoles) %<<<1
2360 %
2361 \ctikzset{multipoles/thickness/.initial=2}
2362 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
2363 % DIP (dual in line package) chips
2364 \ctikzset{multipoles/dipchip/width/.initial=1.2}
2365 \ctikzset{multipoles/dipchip/num pins/.initial=8}
2366 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
2367 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
2368 % QFP (quad flat package) chips
2369 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
2370 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
2371 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
2372 % chip numbers
2373 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
2374 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2375 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2376 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2377 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2378 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
2379 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2380 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2381 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2382 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2383 % external chip pins
2384 \ctikzset{multipoles/external pins thickness/.initial=1}
2385 \ctikzset{multipoles/external pins width/.initial=0.2}
2386 \ctikzset{multipoles/external pad fraction/.initial=0}
2387 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
2388 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
2389 % topmarks
2390 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
2391 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2392 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2393 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2394 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2395
2396 % rotary switch by Romano
2397 \ctikzset{multipoles/rotary/thickness/.initial=1}
2398 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
2399 \ctikzset{multipoles/rotary/channels/.initial=5}
2400 \ctikzset{multipoles/rotary/angle/.initial=60}
2401 \ctikzset{multipoles/rotary/wiper/.initial=20}
2402 \ctikzset{multipoles/rotary/arrow/.is choice}
2403 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
2404 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
2405 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
2406 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
2407 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
2408 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
2409 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
2410
2411 \tikzset{%
2412 rotary switch/.style args={#1in#2wiper#3}{%
2413 shape=rotaryswitch,
2414 /tikz/circuitikz/multipoles/rotary/channels=#1,
2415 /tikz/circuitikz/multipoles/rotary/angle=#2,
2416 /tikz/circuitikz/multipoles/rotary/wiper=#3,
2417 },
2418 rotary switch -/.style args={#1in#2wiper#3}{
2419 rotary switch=#1 in #2 wiper #3,
2420 /tikz/circuitikz/multipoles/rotary/arrow=none,
2421 },
2422 rotary switch <-/.style args={#1in#2wiper#3}{
2423 rotary switch=#1 in #2 wiper #3,
2424 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
2425 },
2426 rotary switch ->/.style args={#1in#2wiper#3}{
2427 rotary switch=#1 in #2 wiper #3,
2428 /tikz/circuitikz/multipoles/rotary/arrow=cw,
2429 },
2430 rotary switch <->/.style args={#1in#2wiper#3}{
2431 rotary switch=#1 in #2 wiper #3,
2432 /tikz/circuitikz/multipoles/rotary/arrow=both,
2433 },
2434 % Notice that these should be the same as the initial values of the keys
2435 rotary switch/.default={5 in 60 wiper 20},
2436 rotary switch -/.default={5 in 60 wiper 20},
2437 rotary switch <-/.default={5 in 60 wiper 20},
2438 rotary switch ->/.default={5 in 60 wiper 20},
2439 rotary switch <->/.default={5 in 60 wiper 20},
2440 }
2441 %%>>>
2442
2443 % %Mechanical section%<<<1
2444 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
2445 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
2446 \ctikzset{bipoles/spring/height/.initial=.5}
2447 \ctikzset{bipoles/spring/width/.initial=.5}
2448 \ctikzset{bipoles/inerter/height/.initial=.7}
2449 \ctikzset{bipoles/inerter/width/.initial=.175}
2450 \ctikzset{bipoles/mass/height/.initial=.55}
2451 \ctikzset{bipoles/mass/box height/.initial=.4}
2452 \ctikzset{bipoles/mass/width/.initial=.5}
2453
2454 \ctikzset{bipoles/damper/height/.initial=.35}
2455 \ctikzset{bipoles/damper/length/.initial=.3}
2456 \ctikzset{bipoles/damper/width/.initial=.4}
2457 %%>>>
2458
2459 % powerelectronic blocks%<<<1
2460 \ctikzset{bipoles/sacdc/width/.initial=.7}
2461 \ctikzset{bipoles/sdcac/width/.initial=.7}
2462 \ctikzset{bipoles/tacdc/width/.initial=.7}
2463 \ctikzset{bipoles/tdcac/width/.initial=.7}
2464 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
2465 %>>>
2466
2467 % voltage and current options%<<<1
2468 %
2469 \ctikzset{current arrow scale/.initial=16}
2470 \ctikzset{current/distance/.initial = .5}
2471
2472 \newif\ifpgf@circuit@europeancurrent
2473 \newif\ifpgf@circuit@europeanvoltage
2474 \newif\ifpgf@circuit@bipole@voltage@straight
2475 \newif\ifpgf@circuit@bipole@voltage@raised
2476
2477 \ctikzset{voltage/.is choice}
2478 %
2479 % straight is expected to be a subset of european, so disable it in american style
2480 %
2481 \ctikzset{voltage/american/.code = {%
2482 \pgf@circuit@europeanvoltagefalse
2483 \pgf@circuit@bipole@voltage@straightfalse
2484 \pgf@circuit@bipole@voltage@raisedfalse
2485 }}
2486 \ctikzset{voltage/raised/.code = {%
2487 \pgf@circuit@europeanvoltagefalse
2488 \pgf@circuit@bipole@voltage@straightfalse
2489 \pgf@circuit@bipole@voltage@raisedtrue
2490 }}
2491 \ctikzset{voltage/european/.code = {%
2492 \pgf@circuit@europeanvoltagetrue
2493 \pgf@circuit@bipole@voltage@straightfalse
2494 \pgf@circuit@bipole@voltage@raisedfalse
2495 }}
2496 \ctikzset{voltage/straight/.code = {%
2497 \pgf@circuit@europeanvoltagetrue
2498 \pgf@circuit@bipole@voltage@straighttrue
2499 \pgf@circuit@bipole@voltage@raisedfalse
2500 }}
2501 \ctikzset{voltage/curved/.code = {%
2502 \pgf@circuit@europeanvoltagetrue
2503 \pgf@circuit@bipole@voltage@straightfalse
2504 \pgf@circuit@bipole@voltage@raisedfalse
2505 }}
2506 % are these used?
2507 \ctikzset{current/.is choice}
2508 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
2509 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
2510
2511 % this is left for backward compatibility...
2512 \ctikzset{straight/.is choice}
2513 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
2514 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
2515 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
2516 %
2517 % voltage is used also to set parameters, apart for the /.is choice
2518 % above. I hope it is ok --- would be a mess otherwise
2519 %
2520 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
2521 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
2522 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
2523 %
2524 % keys for exporting voltage, current, flow anchors
2525 %
2526 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
2527 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
2528 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
2529 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
2530 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
2531 %
2532 % shaping the +/- sign, see pgfcircvoltage.tex
2533 \ctikzset{voltage/american font/.initial={}}
2534 \ctikzset{voltage/american plus/.initial={$+$}}
2535 \ctikzset{voltage/american minus/.initial={$-$}}
2536 % here we start the voltage adjustments for special components.
2537 % default values:
2538 %
2539 % this is the distance of the "point" marking the voltage along the line
2540 % 0.0 is on the external nodes of the to path
2541 % 1.0 is cramped on the object
2542 % this can be overriden component by component
2543 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
2544 %
2545 % this is the distance from the line (perpendicular to) where the voltage is drawn.
2546 % It is global, and not adjustable by component (use the "label distance" or locally
2547 % if you need it)
2548 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
2549 %
2550 % bend paramenters for european arc. You can override them component-based
2551 \ctikzset{voltage/bump b/.initial=1.5}
2552 %
2553 % generator voltages symbols or arrows (always straight) are put along the
2554 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
2555 % center..angle line. It's called bump a because I don't know...
2556 %
2557 \ctikzset{voltage/bump a/.initial=1.2}
2558 %
2559 % these are the label distances FROM the drawings.
2560 % You can override them component by component.
2561 \ctikzset{voltage/european label distance/.initial=1.4}
2562 \ctikzset{voltage/straight label distance/.initial=1.4}
2563 \ctikzset{voltage/american label distance/.initial=1.4}
2564 % american open voltage adjusting
2565 %
2566 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
2567 \ctikzset{open voltage position/.is choice}
2568 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
2569 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
2570 % bad names, kept for compatibility, don't use
2571 \ctikzset{american open voltage/.is choice}
2572 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
2573 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
2574 %
2575 % voltage and current styles
2576 %
2577 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
2578 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
2579 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
2580 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
2581 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
2582 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
2583 %%>>>
2584
2585 % special cases for voltage positions%<<<1
2586 % the KIND is the node name without SHAPE
2587 % See the definition above for meaning
2588 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
2589 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
2590 %
2591 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
2592 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
2593 %
2594 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
2595 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
2596 %
2597 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
2598 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
2599 %
2600 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
2601 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
2602 %
2603 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
2604 %
2605 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
2606 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
2607 %
2608 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
2609 %
2610 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
2611 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
2612 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
2613 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
2614 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
2615 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
2616 %
2617 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
2618 %
2619 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
2620 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
2621 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
2622 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
2623 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
2624 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
2625 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
2626 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
2627 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
2628 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
2629 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
2630 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
2631 %
2632 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
2633 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
2634 %
2635 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
2636 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
2637 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
2638 %%>>>
2639
2640 % vim: set fdm=marker fmr=%<<<,%>>>:
2641 %%%---------- close: tex/pgfcirc.defines
2642 %%%%%%%%%%% Springe nach tex/pgfcircutils
2643 %%%---------- open: tex/pgfcircutils.tex
2644 % Copyright 2018-2026 by Romano Giannetti
2645 % Copyright 2015-2026 by Stefan Lindner
2646 % Copyright 2013-2026 by Stefan Erhardt
2647 % Copyright 2007-2026 by Massimo Redaelli
2648 %
2649 % This file may be distributed and/or modified
2650 %
2651 % 1. under the LaTeX Project Public License and/or
2652 % 2. under the GNU Public License.
2653 %
2654 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2655
2656 \def\pgf@circ@handleSI#1{
2657 \noexpandarg
2658 \def\pgf@temp{}
2659 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
2660 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
2661
2662 \ifnum\pgf@circ@handleSI@unit@len=0
2663 \pgf@circ@siunitx@resfalse
2664 \else
2665 \IfEndWith{#1}{>}{
2666 \pgf@circ@siunitx@restrue
2667 \noexpandarg
2668 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
2669 %\typeout{si |#1|}
2670 }{
2671 \pgf@circ@siunitx@resfalse
2672 %\typeout{no si |#1|}
2673 }
2674 \fi
2675 }
2676
2677 \def\pgf@circ@ifkeyempty#1{
2678 \pgfextra{
2679 \ctikzset{#1/.get=\pgf@circ@temp}
2680 \edef\pgf@temp{}
2681 }
2682 \ifx\pgf@circ@temp\pgf@temp
2683 }
2684
2685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2686 %% Math routines
2687
2688 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
2689
2690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2691 %% useful commands
2692
2693 \ifpgfutil@format@is@latex
2694 %% flipping text
2695 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
2696 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
2697 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
2698 % text mode overbar
2699 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2700 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
2701 \else\ifpgfutil@format@is@plain
2702 % text mode overbar
2703 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2704 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2705 \else\ifpgfutil@format@is@context
2706 % text mode overbar
2707 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2708 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2709 \fi\fi\fi
2710
2711 %%%%%%%%%%%%%%%%%%%%%%%%%%%
2712 %% switch to use fpu in reciprocal scale transformations
2713 %%
2714 %% this code has been contributed by Schrödinger's cat
2715 %% https://tex.stackexchange.com/a/529159/38080
2716 %%
2717 %% Use the official key to use the fpu if installed, see
2718 %% https://github.com/pgf-tikz/pgf/issues/861
2719 %%
2720 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
2721 %%
2722 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
2723 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
2724 }{%
2725 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
2726 \def\pgfmathreciprocal@##1{%
2727 \begingroup
2728 \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
2729 \pgfmathparse{1/##1}%
2730 \pgfmath@smuggleone\pgfmathresult
2731 \endgroup
2732 }}}%
2733 }
2734
2735 %%%---------- close: tex/pgfcircutils
2736
2737 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2738 %%%---------- open: tex/pgfcircshapes.tex
2739 % Copyright 2018-2026 by Romano Giannetti
2740 % Copyright 2015-2026 by Stefan Lindner
2741 % Copyright 2013-2026 by Stefan Erhardt
2742 % Copyright 2007-2026 by Massimo Redaelli
2743 %
2744 % This file may be distributed and/or modified
2745 %
2746 % 1. under the LaTeX Project Public License and/or
2747 % 2. under the GNU Public License.
2748 %
2749 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2750
2751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2752 %% Other shapes
2753
2754 %% Nothing
2755
2756 \pgfdeclareshape{emptyshape}{
2757 \savedanchor{\northeast}{%
2758 \pgf@x=.5\wd\pgfnodeparttextbox%
2759 \pgf@y=.5\ht\pgfnodeparttextbox%
2760 }
2761 \anchor{north}{\northeast\pgf@x=0cm\relax}
2762 \anchor{east}{\northeast\pgf@y=0cm\relax}
2763 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2764 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2765 \anchor{north east}{\northeast}
2766 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2767 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2768 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2769 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2770 \anchor{center}{
2771 \pgfpointorigin
2772 }
2773 }
2774 %
2775 % Provision for changing opacity. Only expert use, see the manual.
2776 %
2777 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2778 \tikzset{open poles opacity/.code={%
2779 \ctikzset{poles/open fill opacity=#1}%
2780 }}
2781 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2782 \tikzset{full poles opacity/.code={%
2783 \ctikzset{poles/full fill opacity=#1}%
2784 }}
2785
2786 %
2787 % Provision for changing default background
2788 %
2789
2790 \ctikzset{open poles fill/.initial={white}}
2791
2792 %% Full terminal
2793
2794 \pgfdeclareshape{circ}{
2795 \anchor{center}{
2796 \pgfpointorigin
2797 }
2798 \savedanchor\northwest{%
2799 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2800 \pgf@x=-\pgf@y
2801 }
2802 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2803 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2804 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2805 \anchor{west}{ \northwest \pgf@y=0pt }
2806 \anchor{w}{ \northwest \pgf@y=0pt }
2807 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2808 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2809 \anchor{north}{ \northwest \pgf@x=0pt }
2810 \anchor{n}{ \northwest \pgf@x=0pt }
2811 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2812 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2813 \anchor{north west}{ \northwest }
2814 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2815 \anchorborder{
2816 \pgf@circ@res@left=\pgf@x
2817 \pgf@circ@res@up=\pgf@y
2818 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2819 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2820 }
2821 \behindforegroundpath{
2822
2823 \pgfscope
2824 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2825 \pgfsetcolor{\ctikzvalof{color}}
2826 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2827 \pgfusepath{draw,fill}
2828 \endpgfscope
2829
2830 }
2831 }
2832
2833 %% Empty round terminal
2834
2835 \pgfdeclareshape{ocirc}{
2836 \anchor{center}{
2837 \pgfpointorigin
2838 }
2839 \savedanchor\northwest{%
2840 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2841 \pgf@x=-\pgf@y
2842 }
2843 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2844 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2845 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2846 \anchor{west}{ \northwest \pgf@y=0pt }
2847 \anchor{w}{ \northwest \pgf@y=0pt }
2848 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2849 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2850 \anchor{north}{ \northwest \pgf@x=0pt }
2851 \anchor{n}{ \northwest \pgf@x=0pt }
2852 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2853 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2854 \anchor{north west}{ \northwest }
2855 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2856 \anchorborder{
2857 \pgf@circ@res@left=\pgf@x
2858 \pgf@circ@res@up=\pgf@y
2859 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2860 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2861 }
2862
2863 \behindforegroundpath{
2864
2865 \pgfscope
2866 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2867 \pgfsetcolor{\ctikzvalof{color}}
2868 \ifx\tikz@fillcolor\pgfutil@empty
2869 % set the default fill color to white
2870 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2871 % ...but override it if the class is defined!
2872 % note that this element has no class, but will inherit it when used
2873 % into another component
2874 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2875 \else
2876 \pgfsetfillcolor{\tikz@fillcolor}
2877 \fi
2878 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2879 \pgfusepath{draw,fill}
2880 \endpgfscope
2881
2882 }
2883 }
2884
2885 %% Diamond terminal
2886
2887 \pgfdeclareshape{diamondpole}{
2888 \anchor{center}{
2889 \pgfpointorigin
2890 }
2891 \savedanchor\northwest{%
2892 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2893 \pgf@x=-\pgf@y
2894 }
2895 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2896 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2897 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2898 \anchor{west}{ \northwest \pgf@y=0pt }
2899 \anchor{w}{ \northwest \pgf@y=0pt }
2900 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2901 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2902 \anchor{north}{ \northwest \pgf@x=0pt }
2903 \anchor{n}{ \northwest \pgf@x=0pt }
2904 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2905 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2906 \anchor{north west}{ \northwest }
2907 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2908 \anchorborder{
2909 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2910 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2911 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2912 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2913 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2914 \pgfextracty{\pgf@circ@res@up}{\northwest}
2915 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2916 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2917 \pgfpointintersectionoflines
2918 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2919 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2920 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2921 \pgf@x=\@@switchx\pgf@x
2922 \pgf@y=\@@switchy\pgf@y
2923 }
2924 \behindforegroundpath{
2925 \pgfscope
2926 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2927 \pgftransformrotate{45}
2928 \pgfpathrectanglecorners
2929 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2930 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2931 \pgfsetcolor{\ctikzvalof{color}}
2932 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2933 \pgfusepath{draw,fill}
2934 \endpgfscope
2935 }
2936 }
2937
2938 %% Diamond terminal, unfilled
2939
2940 \pgfdeclareshape{odiamondpole}{
2941 \anchor{center}{
2942 \pgfpointorigin
2943 }
2944 \savedanchor\northwest{%
2945 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2946 \pgf@x=-\pgf@y
2947 }
2948 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2949 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2950 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2951 \anchor{west}{ \northwest \pgf@y=0pt }
2952 \anchor{w}{ \northwest \pgf@y=0pt }
2953 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2954 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2955 \anchor{north}{ \northwest \pgf@x=0pt }
2956 \anchor{n}{ \northwest \pgf@x=0pt }
2957 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2958 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2959 \anchor{north west}{ \northwest }
2960 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2961 \anchorborder{
2962 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2963 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2964 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2965 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2966 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2967 \pgfextracty{\pgf@circ@res@up}{\northwest}
2968 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2969 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2970 \pgfpointintersectionoflines
2971 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2972 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2973 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2974 \pgf@x=\@@switchx\pgf@x
2975 \pgf@y=\@@switchy\pgf@y
2976 }
2977 \behindforegroundpath{
2978 \pgfscope
2979 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2980 \pgftransformrotate{45}
2981 \pgfpathrectanglecorners
2982 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2983 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2984 \pgfsetcolor{\ctikzvalof{color}}
2985 \ifx\tikz@fillcolor\pgfutil@empty
2986 % set the default fill color to white
2987 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2988 % ...but override it if the class is defined!
2989 % note that this element has no class, but will inherit it when used
2990 % into another component
2991 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2992 \else
2993 \pgfsetfillcolor{\tikz@fillcolor}
2994 \fi
2995 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2996 \pgfusepath{draw,fill}
2997 \endpgfscope
2998 }
2999 }
3000
3001 %% square terminal, filled
3002
3003 \pgfdeclareshape{squarepole}{
3004 \anchor{center}{
3005 \pgfpointorigin
3006 }
3007 \savedanchor\northwest{%
3008 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
3009 \pgf@x=-\pgf@y
3010 }
3011 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3012 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3013 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3014 \anchor{west}{ \northwest \pgf@y=0pt }
3015 \anchor{w}{ \northwest \pgf@y=0pt }
3016 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3017 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3018 \anchor{north}{ \northwest \pgf@x=0pt }
3019 \anchor{n}{ \northwest \pgf@x=0pt }
3020 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3021 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3022 \anchor{north west}{ \northwest }
3023 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3024 \anchorborder{
3025 \pgf@xa=\pgf@x
3026 \pgf@ya=\pgf@y
3027 \pgfextracty{\pgf@circ@res@up}{\northwest}
3028 \pgfpointborderrectangle
3029 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
3030 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
3031 }
3032 \behindforegroundpath{
3033 \pgfscope
3034 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
3035 \pgfpathrectanglecorners
3036 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
3037 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
3038 \pgfsetcolor{\ctikzvalof{color}}
3039 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
3040 \pgfusepath{draw,fill}
3041 \endpgfscope
3042 }
3043 }
3044 %% square terminal, unfilled
3045
3046 \pgfdeclareshape{osquarepole}{
3047 \anchor{center}{
3048 \pgfpointorigin
3049 }
3050 \savedanchor\northwest{%
3051 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
3052 \pgf@x=-\pgf@y
3053 }
3054 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3055 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3056 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3057 \anchor{west}{ \northwest \pgf@y=0pt }
3058 \anchor{w}{ \northwest \pgf@y=0pt }
3059 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3060 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3061 \anchor{north}{ \northwest \pgf@x=0pt }
3062 \anchor{n}{ \northwest \pgf@x=0pt }
3063 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3064 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3065 \anchor{north west}{ \northwest }
3066 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3067 \anchorborder{
3068 \pgf@xa=\pgf@x
3069 \pgf@ya=\pgf@y
3070 \pgfextracty{\pgf@circ@res@up}{\northwest}
3071 \pgfpointborderrectangle
3072 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
3073 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
3074 }
3075 \behindforegroundpath{
3076 \pgfscope
3077 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
3078 \pgfpathrectanglecorners
3079 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
3080 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
3081 \pgfsetcolor{\ctikzvalof{color}}
3082 \ifx\tikz@fillcolor\pgfutil@empty
3083 % set the default fill color to white
3084 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
3085 % ...but override it if the class is defined!
3086 % note that this element has no class, but will inherit it when used
3087 % into another component
3088 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
3089 \else
3090 \pgfsetfillcolor{\tikz@fillcolor}
3091 \fi
3092 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
3093 \pgfusepath{draw,fill}
3094 \endpgfscope
3095 }
3096 }
3097 % BNC connector
3098
3099 \pgfdeclareshape{bnc}{
3100 \anchor{center}{
3101 \pgfpointorigin
3102 }
3103 % BNC size is 2.5 times the size of the internal "ocirc"
3104 \savedanchor\northwest{%
3105 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
3106 \pgf@y=2.5\pgf@y
3107 \pgf@x=-\pgf@y
3108 }
3109 % center is on the opening
3110 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3111 \anchor{zero}{ \pgfpointorigin }
3112 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3113 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3114 % geo-anchors
3115 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3116 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3117 \anchor{west}{ \northwest \pgf@y=0pt }
3118 \anchor{left}{ \northwest \pgf@y=0pt }
3119 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3120 \anchor{north}{ \northwest \pgf@x=0pt }
3121 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3122 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3123 \anchor{north west}{ \northwest }
3124 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3125 % put the node text above and centered
3126 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3127 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3128 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3129 }
3130 }
3131 \anchorborder{
3132 \pgf@circ@res@left=\pgf@x
3133 \pgf@circ@res@up=\pgf@y
3134 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
3135 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
3136 }
3137 \behindforegroundpath{
3138 \pgfextracty{\pgf@circ@res@other}{\northwest}
3139 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
3140 \pgfscope
3141 \pgfstartlinewidth=\pgflinewidth
3142 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
3143 \pgfsetcolor{\ctikzvalof{color}}
3144 % external circle
3145 \pgfscope
3146 % clipping path: first a rectangle bigger then the shape
3147 % to avoid problems with the line thickness
3148 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
3149 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
3150 % next the opening to the right
3151 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
3152 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
3153 % do the difference and clip before drawing
3154 \pgfseteorule
3155 \pgfusepath{clip}
3156 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
3157 \pgfusepath{draw}
3158 \endpgfscope
3159 % internal circle
3160 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
3161 \pgf@circ@draworfill
3162 % and the contact line to the right
3163 \pgfsetlinewidth{\pgfstartlinewidth}
3164 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3165 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
3166 \pgfusepath{draw}
3167 \endpgfscope
3168 }
3169 }
3170
3171 %% Fill for correct rectangular joins
3172
3173 \pgfdeclareshape{rectjoinfill}{
3174 \savedanchor{\northeast}{%
3175 \pgf@x=.5\pgflinewidth%
3176 \pgf@y=.5\pgflinewidth%
3177 }
3178 \anchor{north}{\northeast\pgf@x=0cm\relax}
3179 \anchor{east}{\northeast\pgf@y=0cm\relax}
3180 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3181 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3182 \anchor{north east}{\northeast}
3183 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3184 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3185 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3186 \anchor{center}{
3187 \pgfpointorigin
3188 }
3189 \anchorborder{
3190 \pgf@circ@res@left=\pgf@x
3191 \pgf@circ@res@up=\pgf@y
3192 }
3193 \behindforegroundpath{
3194 \pgfscope
3195 \pgfpathrectanglecorners
3196 {\pgfpoint{0}{.5\pgflinewidth}}
3197 {\pgfpoint{0}{-.5\pgflinewidth}}
3198 \pgfsetcolor{\ctikzvalof{color}}
3199 \pgfusepath{draw,fill}
3200 \endpgfscope
3201 }
3202 }
3203
3204 %% transistor arrow
3205
3206 \def\pgf@circ@find@linescale{
3207 % find the scale inverse of the scale factor: line width do not scale
3208 % with scale=..., transform shape so we have to counteract it.
3209 \iftikz@fullytransformed % this is true if `transform shape` is active
3210 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
3211 % Note that this trick is not working inside a `spy` environment...
3212 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
3213 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
3214 \else
3215 \pgfmathsetmacro{\@@factor}{1.0}
3216 \fi
3217 }
3218
3219 \pgfdeclareshape{trarrow}{%
3220 % this arrow is only filled but grows with the linewidth, more or less
3221 % like currarrow do
3222 \savedanchor{\northeast}{%
3223 \pgf@circ@res@step = \pgf@circ@Rlen
3224 \pgf@circ@find@linescale
3225 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3226 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
3227 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
3228 }
3229 % The arrow size should be more or less the same of a currarrow, which is
3230 % both filled and stroke, for backward output compatibility (more or less)
3231 %
3232 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
3233 % |-\__ currarrow as the tip at (W,0)
3234 % | | and the upper tail at (-0.7*W, 0.8*W)
3235 % | \__ it then "overshoot" do to the linew width L
3236 % | \__ xangle \alpha
3237 % ---0------->
3238 %
3239 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
3240 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
3241 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
3242 %
3243 \savedanchor{\northwest}{%
3244 \pgf@circ@res@step = \pgf@circ@Rlen
3245 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3246 \pgf@circ@find@linescale
3247 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
3248 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
3249 }
3250 \savedanchor{\tip}{%
3251 \pgf@circ@res@step = \pgf@circ@Rlen
3252 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3253 \pgf@circ@find@linescale
3254 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
3255 }
3256 \anchor{north}{\northeast\pgf@x=0cm\relax}
3257 \anchor{east}{\northeast\pgf@y=0cm\relax}
3258 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3259 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3260 \anchor{north east}{\northeast}
3261 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3262 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3263 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3264 \anchor{center}{
3265 \pgfpointorigin
3266 }
3267 \anchor{tip}{
3268 \tip
3269 }
3270 \anchor{btip}{% this anchor is behind the tip of half a linewidth
3271 \tip
3272 \pgf@circ@find@linescale
3273 \pgf@circ@res@temp=\@@factor\pgflinewidth
3274 \advance\pgf@x by -.5\pgf@circ@res@temp
3275 }
3276 \behindforegroundpath{
3277 \pgfscope
3278 \northwest
3279 \pgf@circ@res@up=\pgf@y
3280 \pgf@circ@res@left=\pgf@x
3281 \tip
3282 \pgf@circ@res@step = \pgf@x
3283 %
3284 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3285 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3286 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
3287 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
3288 \pgfpathclose
3289 \pgfsetcolor{\ctikzvalof{color}}
3290 \pgfusepath{fill} % just fill
3291 \endpgfscope
3292 }
3293 }
3294
3295 %% Current arrow
3296
3297 \pgfdeclareshape{currarrow}{
3298 \savedanchor{\northeast}{%
3299 \pgf@circ@res@step = \pgf@circ@Rlen
3300 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3301 \pgf@x=.5\pgf@circ@res@step
3302 \pgf@y=\pgf@x%
3303 }
3304 \anchor{north}{\northeast\pgf@x=0cm\relax}
3305 \anchor{east}{\northeast\pgf@y=0cm\relax}
3306 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3307 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3308 \anchor{north east}{\northeast}
3309 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3310 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3311 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3312 \anchor{center}{
3313 \pgfpointorigin
3314 }
3315 \anchor{tip}{
3316 \pgfpointorigin
3317 \pgf@circ@res@step = \pgf@circ@Rlen
3318 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3319 \pgf@x =\pgf@circ@res@step
3320 }
3321 \behindforegroundpath{
3322 \pgfscope
3323 \pgf@circ@res@step = \pgf@circ@Rlen
3324 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3325
3326 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3327 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3328 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
3329 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3330 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3331 \pgfsetcolor{\ctikzvalof{color}}
3332 \pgfusepath{draw,fill}
3333
3334 \endpgfscope
3335 }
3336 }
3337
3338 %% Flow arrow
3339
3340 \pgfdeclareshape{flowarrow}{
3341 \savedanchor{\northeast}{%
3342 \pgf@circ@res@step = \pgf@circ@Rlen
3343 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3344 \pgf@y=.5\pgf@circ@res@step
3345 \pgf@circ@res@step = \pgf@circ@Rlen
3346 \divide \pgf@circ@res@step by 4
3347 \pgf@x=\pgf@circ@res@step%
3348 }
3349 \anchor{north}{\northeast\pgf@x=0cm\relax}
3350 \anchor{east}{\northeast\pgf@y=0cm\relax}
3351 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3352 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3353 \anchor{north east}{\northeast}
3354 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3355 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3356 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3357 \anchor{text}{% text centered above
3358 \pgfpointorigin
3359 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
3360 }
3361 \anchor{center}{
3362 \pgfpointorigin
3363 }
3364 \anchor{tip}{
3365 \pgfpointorigin
3366 \pgf@circ@res@step = \pgf@circ@Rlen
3367 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3368 \pgf@x =\pgf@circ@res@step
3369 }
3370 \behindforegroundpath{
3371 \pgfscope
3372 \pgf@circ@res@step = \pgf@circ@Rlen
3373 \divide \pgf@circ@res@step by 4
3374 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
3375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3376 \pgfsetcolor{\ctikzvalof{color}}
3377 \pgfusepath{draw}
3378 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
3379 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
3380 \endpgfscope
3381 }
3382 }
3383
3384 %% Input arrow
3385
3386 \pgfdeclareshape{inputarrow}{
3387 \savedanchor{\northeast}{% this is really not northeast, really -northwest
3388 \pgf@circ@res@step = \pgf@circ@Rlen
3389 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3390 \pgf@y=.5\pgf@circ@res@step
3391 \pgf@x=1.7\pgf@circ@res@step
3392 }
3393 \anchor{north}{\northeast\pgf@x=0cm\relax}
3394 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
3395 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3396 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3397 \anchor{north east}{\northeast\pgf@x=0cm\relax}
3398 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3399 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
3400 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3401 \savedanchor{\tip}{
3402 \pgfpointorigin
3403 }
3404 \anchor{center}{
3405 \tip
3406 }
3407 \anchor{tip}{
3408 \tip
3409 }
3410 \behindforegroundpath{
3411
3412 \pgfscope
3413 \pgf@circ@res@step = \pgf@circ@Rlen
3414 \divide \pgf@circ@res@step by 16
3415
3416 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3417 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3418 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
3419 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3420 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3421 \pgfsetcolor{\ctikzvalof{color}}
3422 \pgfusepath{fill}
3423
3424 \endpgfscope
3425 }
3426 }
3427
3428
3429 %% box
3430
3431 \pgfdeclareshape{box}{
3432 \anchor{center}{
3433 \pgfpointorigin
3434 }
3435 \behindforegroundpath{
3436
3437 \pgfscope
3438 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
3439 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3440 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3441 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3442 \pgf@circ@draworfill
3443 \endpgfscope
3444 }
3445 }
3446
3447 %% box scaled with blocks
3448
3449 \pgfdeclareshape{blockbox}{
3450 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
3451 \anchor{center}{
3452 \pgfpointorigin
3453 }
3454 \behindforegroundpath{
3455 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
3456 \pgfscope
3457 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
3458 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3459 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3460 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3461 \pgf@circ@draworfill
3462 \endpgfscope
3463 }
3464 }
3465
3466 % full nodes for wire crossing
3467
3468 \pgfdeclareshape{jump crossing}
3469 {
3470 \savedanchor\northwest{%
3471 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3472 \pgf@y=.5\pgf@y
3473 \pgf@x=-\pgf@y
3474 }
3475 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3476 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3477 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3478 \anchor{west}{ \northwest \pgf@y=0pt }
3479 \anchor{w}{ \northwest \pgf@y=0pt }
3480 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3481 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3482 \anchor{north}{ \northwest \pgf@x=0pt }
3483 \anchor{n}{ \northwest \pgf@x=0pt }
3484 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3485 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3486 \anchor{north west}{ \northwest }
3487 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3488 \behindbackgroundpath{
3489 \northwest
3490 \pgf@circ@res@up = \pgf@y
3491 \pgf@circ@res@down = -\pgf@y
3492 \pgf@circ@res@right = -\pgf@x
3493 \pgf@circ@res@left = \pgf@x
3494 % horizontal jumper
3495 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3496 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
3497 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
3498 \pgfsetbeveljoin
3499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3500 % vertical, broken path
3501 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3502 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3503 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
3504 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3505 \pgfusepath{draw}
3506
3507 }
3508 }
3509 \pgfdeclareshape{plain crossing}
3510 {
3511 \savedanchor\northwest{%
3512 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3513 \pgf@y=.5\pgf@y
3514 \pgf@x=-\pgf@y
3515 }
3516 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3517 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3518 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3519 \anchor{west}{ \northwest \pgf@y=0pt }
3520 \anchor{w}{ \northwest \pgf@y=0pt }
3521 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3522 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3523 \anchor{north}{ \northwest \pgf@x=0pt }
3524 \anchor{n}{ \northwest \pgf@x=0pt }
3525 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3526 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3527 \anchor{north west}{ \northwest }
3528 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3529 \behindbackgroundpath{
3530 \northwest
3531 \pgf@circ@res@up = \pgf@y
3532 \pgf@circ@res@down = -\pgf@y
3533 \pgf@circ@res@right = -\pgf@x
3534 \pgf@circ@res@left = \pgf@x
3535 % horizontal jumper
3536 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3537 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3538 % vertical, broken path
3539 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3540 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
3541 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
3542 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3543 \pgfusepath{draw}
3544
3545 }
3546 }
3547
3548 %%%---------- close: tex/pgfcircshapes
3549 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
3550 %%%---------- open: tex/pgfcircmonopoles.tex
3551 % Copyright 2018-2026 by Romano Giannetti
3552 % Copyright 2015-2026 by Stefan Lindner
3553 % Copyright 2013-2026 by Stefan Erhardt
3554 % Copyright 2007-2026 by Massimo Redaelli
3555 %
3556 % This file may be distributed and/or modified
3557 %
3558 % 1. under the LaTeX Project Public License and/or
3559 % 2. under the GNU Public License.
3560 %
3561 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3562
3563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3564 %% Monopoles
3565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3566
3567 %%%%%%%%%%%%%
3568 %% Grounds
3569 %%%%%%%%%%%%%
3570
3571
3572 %% Ground symbol
3573 % #1 -> name
3574 % #2 -> width
3575 % #3 -> depth
3576 % #4 -> code
3577 \long\def\pgf@circ@declareground#1#2#3#4{
3578 \pgfdeclareshape{#1}{
3579 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3580 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3581 \savedanchor{\southeast}{
3582 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3583 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3584 \pgf@x=#2\pgf@x
3585 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3586 \pgf@y=-#3\pgf@y
3587 }
3588 \anchor{north}{\pgfpointorigin}
3589 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3590 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3591 \anchor{south east}{\southeast}
3592 \anchor{south}{\southeast\pgf@x=0pt\relax}
3593 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3594 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3595 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3596 \anchor{left}{\pgfpointorigin}
3597 \anchor{right}{\pgfpointorigin}
3598 \anchor{center}{\pgfpointorigin}
3599 \behindforegroundpath{
3600 \pgf@circ@scaled@Rlen=\scaledRlen
3601 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3602 \pgfscope
3603 \pgfstartlinewidth=\pgflinewidth
3604 #4
3605 \endpgfscope
3606 }
3607 }
3608 }
3609
3610
3611 \pgf@circ@declareground{ground}{0.6}{1.6}{
3612 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3613 \pgfpathmoveto{\pgfpointorigin}
3614 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3615 \pgfusepath{draw}
3616 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3617 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3618 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3619 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3620 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3621 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3622 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3623 \pgfusepath{draw}
3624 }
3625
3626 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3627 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3628 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3629 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3630 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3631 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3632 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3633 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3634 \pgfusepath{draw}
3635 }
3636
3637
3638 \pgf@circ@declareground{rground}{0.6}{1}{
3639 \pgfpathmoveto{\pgfpointorigin}
3640 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3641 \pgfusepath{draw}
3642
3643 \pgfstartlinewidth=\pgflinewidth
3644 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3645
3646 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3647 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3648 \pgfsetroundcap\pgfusepath{draw}
3649 }
3650
3651 \pgf@circ@declareground{tground}{0.6}{0}{
3652 \pgfpathmoveto{\pgfpointorigin}
3653 \pgfusepath{draw}
3654
3655 \pgfstartlinewidth=\pgflinewidth
3656 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3657
3658 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3659 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3660 \pgfusepath{draw}
3661 }
3662
3663 \pgf@circ@declareground{sground}{0.6}{1.8}{
3664 \pgfpathmoveto{\pgfpointorigin}
3665 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3666 \pgfusepath{draw}
3667
3668 \pgfstartlinewidth=\pgflinewidth
3669 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3670
3671 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3672 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3673 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3674 \pgfpathclose
3675 \pgf@circ@draworfill
3676 }
3677
3678 % noiseless ground
3679 \pgf@circ@declareground{nground}{0.9}{1.6}{
3680 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3681 \pgfpathmoveto{\pgfpointorigin}
3682 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3683 \pgfusepath{draw}
3684 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3685 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3686 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3687 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3688 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3689 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3690 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3691 \pgfusepath{draw}
3692 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3693 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3694 \pgfusepath{draw}
3695 }
3696
3697 % protective ground
3698 \pgf@circ@declareground{pground}{0.9}{1.8}{
3699 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3700 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3701 \pgf@circ@draworfill
3702 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3703 \pgfpathmoveto{\pgfpointorigin}
3704 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3705 \pgfusepath{draw}
3706 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3707 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3708 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3709 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3710 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3711 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3712 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3713 \pgfusepath{draw}
3714 }
3715
3716 % chassis ground
3717 \pgf@circ@declareground{cground}{1}{2}{
3718 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3719 \pgfpathmoveto{\pgfpointorigin}
3720 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3721 \pgfusepath{draw}
3722 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3723 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3724 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3725 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3726 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3727 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3728 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3729 \pgfusepath{draw}
3730 }
3731
3732 % Contributed by @fotesan https://github.com/fotesan
3733 % european ground
3734 \pgf@circ@declareground{eground}{1.1}{1.7}{
3735 \pgfpathmoveto{\pgfpointorigin}
3736 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3737 \pgfusepath{draw}
3738
3739 \pgfstartlinewidth=\pgflinewidth
3740 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3741
3742 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3743 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3744 \pgfusepath{draw}
3745
3746 \pgfsetlinewidth{\pgfstartlinewidth}
3747 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3748 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3749 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3750 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3751 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3752 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3753 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3754 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3755 \pgfusepath{draw}
3756 }
3757
3758 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3759 \pgfpathmoveto{\pgfpointorigin}
3760 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3761 \pgfusepath{draw}
3762
3763 \pgfstartlinewidth=\pgflinewidth
3764 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3765
3766 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3767 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3768 \pgfusepath{draw}
3769
3770 \pgfsetlinewidth{\pgfstartlinewidth}
3771 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3772 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3773 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3774 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3775 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3776 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3777 \pgfusepath{draw}
3778 }
3779
3780 %%%%%%%%%%%%%%%%%%
3781 %% Power supplies
3782 %%%%%%%%%%%%%%%%%%
3783
3784 % Vcc
3785 \pgfdeclareshape{vcc}{
3786 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3787 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3788 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3789 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3790 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3791 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3792 }
3793 \savedanchor{\northeast}{%
3794 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3795 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3796 \pgf@x=.5\pgf@circ@res@step
3797 \pgf@y=3\pgf@x%
3798 }
3799 \anchor{north}{\northeast\pgf@x=0cm\relax}
3800 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3801 \anchor{south}{\pgfpointorigin}
3802 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3803 \anchor{north east}{\northeast}
3804 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3805 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3806 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3807 \anchor{center}{\pgfpointorigin}
3808 \anchor{left}{\pgfpointorigin}
3809 \anchor{right}{\pgfpointorigin}
3810 \anchor{text}{
3811 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3812 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3813 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3814 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3815 \pgf@x=0pt
3816 \pgf@y=2\pgf@circ@res@step
3817 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3818 \pgf@x=-.5\wd\pgfnodeparttextbox
3819 }
3820 \behindforegroundpath{
3821 \pgf@circ@scaled@Rlen=\scaledRlen
3822 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3823 \pgfscope
3824 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3825 \ifx\pgf@temp\pgf@circ@temp
3826 \pgfstartlinewidth=\pgflinewidth
3827 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3828
3829 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3830 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3831 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3832 \pgfusepath{draw}
3833
3834 \pgfsetlinewidth{\pgfstartlinewidth}
3835 \else
3836 \pgfsetarrowsend{\pgf@circ@temp}
3837 \fi
3838 \pgfpathmoveto{\pgfpointorigin}
3839 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3840 \pgfusepath{draw}
3841 \endpgfscope
3842 }
3843 }
3844
3845 % Vee
3846 \pgfdeclareshape{vee}{
3847 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3848 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3849 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3850 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3851 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3852 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3853 }
3854 \savedanchor{\northeast}{%
3855 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3856 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3857 \pgf@x=.5\pgf@circ@res@step
3858 \pgf@y=-3\pgf@x%
3859 }
3860 \anchor{south}{\northeast\pgf@x=0cm\relax}
3861 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3862 \anchor{north}{\pgfpointorigin}
3863 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3864 \anchor{south east}{\northeast}
3865 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3866 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3867 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3868 \anchor{center}{\pgfpointorigin}
3869 \anchor{left}{\pgfpointorigin}
3870 \anchor{right}{\pgfpointorigin}
3871 \anchor{text}{
3872 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3873 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3874 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3875 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3876 \pgf@x=0pt
3877 \pgf@y=-2\pgf@circ@res@step
3878 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3879 \pgf@x=-.5\wd\pgfnodeparttextbox
3880 }
3881
3882 \behindforegroundpath{
3883 \pgf@circ@scaled@Rlen=\scaledRlen
3884 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3885 \pgfscope
3886 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3887 \ifx\pgf@temp\pgf@circ@temp
3888
3889 \pgfstartlinewidth=\pgflinewidth
3890 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3891
3892 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3893 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3894 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3895 \pgfusepath{draw}
3896 \pgfsetlinewidth{\pgfstartlinewidth}
3897 \else
3898 \pgfsetarrowsend{\pgf@circ@temp}
3899 \fi
3900 \pgfpathmoveto{\pgfpointorigin}
3901 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3902 \pgfusepath{draw}
3903 \endpgfscope
3904 }
3905 }
3906
3907 %%%%%%%%%%%%%%%%
3908 %% RF elements
3909 %%%%%%%%%%%%%%%%
3910
3911 % Legacy tlinestub
3912 % Contributed by Leonardo Azzinnari
3913 \pgfdeclareshape{tlinestub}{
3914 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3915 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3916 \savedanchor{\northeast}{%
3917 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3918 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3919 \pgf@x=1.2\pgf@circ@res@step
3920 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3921 \pgf@y=.2\pgf@circ@res@step%
3922 }
3923 % the center is on the left side of the shape for facility of usage
3924 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3925 \anchor{east}{\northeast\pgf@y=0cm\relax}
3926 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3927 \anchor{west}{\pgfpointorigin}
3928 \anchor{north east}{\northeast}
3929 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3930 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3931 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3932 \anchor{center}{\pgfpointorigin}
3933 % this is not exact, but it's better than nothing
3934 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3935 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3936 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3937 \behindforegroundpath{
3938 \pgfstartlinewidth=\pgflinewidth
3939
3940 \pgf@circ@scaled@Rlen=\scaledRlen
3941 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3942
3943 \pgfscope\begin{pgftransparencygroup}
3944 \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}}
3945 \pgf@circ@maybefill
3946 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3947 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3948 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3949 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3950 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3951 \pgf@circ@draworfill
3952 \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}}
3953 \pgfusepath{draw}
3954 \end{pgftransparencygroup} \endpgfscope
3955 \pgfpathmoveto{\pgfpointorigin}
3956 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3957 \pgfusepath{draw}
3958 }
3959 }
3960
3961 %% New antennas without tails
3962
3963 % main body of antennas
3964 \def\pgf@circ@antennabody{%
3965 \pgfstartlinewidth=\pgflinewidth
3966 \pgf@circ@scaled@Rlen=\scaledRlen
3967 \pgfsetcolor{\ctikzvalof{color}}
3968 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3969 \pgfscope
3970 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3971 \pgfpathmoveto{\pgfpointorigin}
3972 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3973 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3974 \pgfsetbeveljoin
3975 \pgfpathclose
3976 \pgf@circ@draworfill
3977 \endpgfscope
3978 \pgfsetlinewidth{\pgfstartlinewidth}
3979 \pgfpathmoveto{\pgfpointorigin}
3980 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3981 \pgfusepath{draw}
3982 }
3983
3984 % Waves for the antennas.
3985 \def\pgf@circ@antennawaves{%
3986 \pgfscope
3987 % define a triangle for clipping the waves
3988 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3989 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3990 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3991 \pgfpathclose
3992 \pgfusepath{clip}
3993 % ...and build the waves as clipped circles
3994 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3995 \pgfmathloop%
3996 \ifnum\pgf@circ@count@a>2
3997 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3998 \advance\pgf@circ@count@a-1\relax%
3999 \repeatpgfmathloop
4000 \pgfusepath{draw}
4001 \endpgfscope
4002 }
4003
4004 % additional shape with the waves
4005 \pgfdeclareshape{waves}{
4006 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4007 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4008 \anchor{center}{\pgfpointorigin}
4009 \savedanchor{\northeast}{
4010 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4011 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
4012 \pgf@x=\pgf@circ@res@step
4013 \pgf@y=\pgf@circ@res@step
4014 }
4015 \anchor{text}{
4016 \northeast
4017 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4018 }
4019 \anchor{top}{\northeast\pgf@x=0pt}
4020 \anchor{right}{\northeast\pgf@y=0pt}
4021 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
4022 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
4023 \anchor{north}{\northeast\pgf@x=0pt}
4024 \anchor{north east}{\northeast}
4025 \anchor{east}{\northeast\pgf@y=0pt}
4026 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
4027 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
4028 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
4029 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
4030 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4031 \behindforegroundpath{
4032 \pgf@circ@scaled@Rlen=\scaledRlen
4033 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
4034 \pgf@circ@res@step=0.5\pgf@circ@res@step
4035 \pgfsetcolor{\ctikzvalof{color}}
4036 \pgfscope
4037 % define a triangle for clipping the waves
4038 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
4039 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
4040 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
4041 \pgfpathclose
4042 \pgfusepath{clip}
4043 % ...and build the waves as clipped circles
4044 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
4045 \pgfmathloop%
4046 \ifnum\c@pgf@counta>1
4047 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
4048 \advance\c@pgf@counta-1\relax%
4049 \repeatpgfmathloop
4050 \pgfusepath{draw}
4051 \endpgfscope
4052 }
4053 }
4054
4055 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
4056
4057 \pgfdeclareshape{bareantenna}{
4058 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4059 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4060 \anchor{center}{\pgfpointorigin}
4061 \savedanchor{\northeast}{
4062 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4063 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4064 \pgf@x=\pgf@circ@res@step
4065 \pgf@y=2\pgf@circ@res@step
4066 }
4067 \anchor{text}{
4068 \northeast
4069 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
4070 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
4071 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4072 }
4073 \anchor{top}{\northeast\pgf@x=0pt}
4074 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4075 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4076 \anchor{bottom}{\pgfpointorigin}
4077 \anchor{north}{\northeast\pgf@x=0pt}
4078 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4079 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4080 \anchor{south}{\pgfpointorigin}
4081 \anchor{north east}{\northeast}
4082 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4083 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4084 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4085 \behindforegroundpath{
4086 \pgf@circ@antennabody
4087 }
4088 }
4089
4090 \pgfdeclareshape{bareTXantenna}{
4091 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4092 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4093 \anchor{center}{\pgfpointorigin}
4094 \savedanchor{\northeast}{
4095 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4096 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4097 \pgf@x=\pgf@circ@res@step
4098 \pgf@y=2\pgf@circ@res@step
4099 }
4100 \savedanchor{\savedwaves}{
4101 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4102 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4103 \pgf@x=4.2\pgf@circ@res@step
4104 \pgf@y=\pgf@circ@res@step
4105 }
4106 \anchor{text}{
4107 \northeast
4108 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
4109 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
4110 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
4111 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4112 }
4113 \anchor{waves}{\savedwaves}
4114 \anchor{top}{\northeast\pgf@x=0pt}
4115 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4116 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4117 \anchor{bottom}{\pgfpointorigin}
4118 \anchor{north}{\northeast\pgf@x=0pt}
4119 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4120 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4121 \anchor{south}{\pgfpointorigin}
4122 \anchor{north east}{\northeast}
4123 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4124 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4125 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4126 \behindforegroundpath{
4127 \pgf@circ@antennabody
4128 \pgf@circ@antennawaves
4129 }
4130 }
4131
4132 \pgfdeclareshape{bareRXantenna}{
4133 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4134 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4135 \anchor{center}{\pgfpointorigin}
4136 \savedanchor{\northeast}{
4137 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4138 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4139 \pgf@x=\pgf@circ@res@step
4140 \pgf@y=2\pgf@circ@res@step
4141 }
4142 \savedanchor{\savedwaves}{
4143 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4144 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4145 \pgf@x=-4.2\pgf@circ@res@step
4146 \pgf@y=\pgf@circ@res@step
4147 }
4148 \anchor{text}{
4149 \northeast
4150 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
4151 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
4152 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4153 }
4154 \anchor{waves}{\savedwaves}
4155 \anchor{top}{\northeast\pgf@x=0pt}
4156 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4157 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4158 \anchor{bottom}{\pgfpointorigin}
4159 \anchor{north}{\northeast\pgf@x=0pt}
4160 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4161 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4162 \anchor{south}{\pgfpointorigin}
4163 \anchor{north east}{\northeast}
4164 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4165 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4166 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4167 \behindforegroundpath{
4168 \pgf@circ@antennabody
4169 \pgftransformxshift{-5.2\pgf@circ@res@step}
4170 \pgf@circ@antennawaves
4171 }
4172 }
4173
4174 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
4175 \ctikzset{monopoles/dynode/width/.initial=0.4}
4176 \ctikzset{monopoles/dynode/height/.initial=0.8}
4177 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
4178 \ctikzset{monopoles/dynode/arc angle/.initial=30}
4179 \ctikzset{monopoles/dynode/top width/.initial=1.0}
4180
4181 \pgfdeclareshape{dynode}{
4182 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
4183 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4184 \anchor{center}{\pgfpointorigin}
4185 \savedanchor{\northeast}{
4186 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4187 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
4188 \pgf@x=0.5\pgf@x
4189 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4190 }
4191 \savedanchor{\arcpos}{% bottom part of the arc pos
4192 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4193 \pgf@x=0pt
4194 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4195 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
4196 }
4197 \savedanchor{\topright}{%
4198 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4199 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
4200 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
4201 \pgf@x=0.5\pgf@x
4202 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4203 }
4204 \anchor{arc}{\arcpos}
4205 \anchor{top right}{\topright}
4206 \anchor{top left}{\topright\pgf@x=-\pgf@x}
4207 \anchor{text}{
4208 \northeast
4209 \advance\pgf@x by 4pt\relax
4210 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4211 }
4212 \anchor{top}{\northeast\pgf@x=0pt}
4213 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4214 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4215 \anchor{bottom}{\pgfpointorigin}
4216 \anchor{north}{\northeast\pgf@x=0pt}
4217 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4218 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4219 \anchor{south}{\pgfpointorigin}
4220 \anchor{north east}{\northeast}
4221 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4222 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4223 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4224 \behindforegroundpath{
4225 \pgfstartlinewidth=\pgflinewidth
4226 \pgf@circ@scaled@Rlen=\scaledRlen
4227 \pgfsetcolor{\ctikzvalof{color}}
4228 \northeast
4229 \pgf@circ@res@right=\pgf@x
4230 \pgf@circ@res@up=\pgf@y
4231 \arcpos
4232 \pgf@circ@res@step=\pgf@y
4233 % top
4234 \pgfscope
4235 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4236 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
4237 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
4238 \pgfusepath{draw}
4239 \endpgfscope
4240 % arc
4241 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
4242 \ifnum90=\@@angle\else % avoid divisions by zero
4243 % radius
4244 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
4245 % start angle y position
4246 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
4247 \pgfsetlinewidth{\pgfstartlinewidth}
4248 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
4249 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
4250 \fi
4251 % tail
4252 \pgfpathmoveto{\pgfpointorigin}
4253 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4254 \pgfusepath{draw}
4255 }
4256 }
4257 % Microstrip monopoles
4258
4259 \pgfdeclareshape{mslstub}{
4260 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4261 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4262 \savedanchor{\southeast}{
4263 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4264 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
4265 \pgf@x=.5\pgf@x
4266 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4267 \pgf@y=-.5\pgf@y
4268 }
4269 \savedanchor{\northwest}{
4270 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4271 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
4272 \pgf@x=-.5\pgf@x
4273 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4274 \pgf@y=.5\pgf@y
4275 }
4276 \anchor{north}{\northwest\pgf@x=0pt\relax}
4277 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4278 \anchor{east}{\southeast\pgf@y=0pt\relax}
4279 \anchor{south east}{\southeast}
4280 \anchor{south}{\southeast\pgf@x=0pt\relax}
4281 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4282 \anchor{west}{\northwest\pgf@y=0pt\relax}
4283 \anchor{north west}{\northwest}
4284 %
4285 \anchor{center}{\northwest\pgf@y=0pt\relax}
4286 \anchor{left}{\northwest\pgf@y=0pt\relax}
4287 \anchor{right}{\southeast\pgf@y=0pt\relax}
4288 % put the node text above and centered
4289 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4290 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4291 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4292 }
4293 }
4294 \behindbackgroundpath{
4295 \pgfextracty{\pgf@circ@res@up}{\northwest}
4296 \pgfextractx{\pgf@circ@res@right}{\southeast}
4297 \pgfextractx{\pgf@circ@res@left}{\northwest}
4298 \pgfextracty{\pgf@circ@res@down}{\southeast}
4299 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4300 \pgfstartlinewidth=\pgflinewidth
4301 \pgfscope
4302 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4303 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4304 \pgf@circ@draworfill
4305 \endpgfscope
4306 }
4307 }
4308
4309 \pgfdeclareshape{msrstub}{
4310 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4311 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4312 \savedanchor{\southeast}{
4313 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4314 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4315 \pgf@x=.5\pgf@x
4316 \pgf@y=0pt\relax
4317 }
4318 \savedanchor{\northwest}{
4319 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4320 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4321 \pgf@x=-.5\pgf@x
4322 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
4323 \pgf@y=.5\pgf@y
4324 }
4325 \anchor{north}{\northwest\pgf@x=0pt\relax}
4326 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4327 \anchor{east}{\southeast\pgf@y=0pt\relax}
4328 \anchor{south east}{\southeast}
4329 \anchor{south}{\southeast\pgf@x=0pt\relax}
4330 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4331 \anchor{west}{\northwest\pgf@y=0pt\relax}
4332 \anchor{north west}{\northwest}
4333 %
4334 \anchor{center}{\pgfpointorigin}
4335 \anchor{left}{\pgfpointorigin}
4336 \anchor{right}{\pgfpointorigin}
4337 % put the node text above and centered
4338 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4339 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4340 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4341 }
4342 }
4343 \behindbackgroundpath{
4344 \pgfextracty{\pgf@circ@res@up}{\northwest}
4345 \pgfextractx{\pgf@circ@res@right}{\southeast}
4346 \pgfextractx{\pgf@circ@res@left}{\northwest}
4347 \pgfextracty{\pgf@circ@res@down}{\southeast}
4348 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4349 \pgfstartlinewidth=\pgflinewidth
4350 \pgfscope
4351 \pgfpathmoveto{\pgfpointorigin}
4352 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
4353 \pgfusepath{draw}
4354 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4355 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
4356 \pgfpatharc{135}{45}{\pgf@circ@res@step}
4357 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
4358 \pgfpatharc{45}{135}{\pgf@circ@res@up}
4359 \pgfclosepath
4360 \pgf@circ@draworfill
4361 \endpgfscope
4362 }
4363 }
4364
4365 \pgfdeclareshape{msport}{
4366 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4367 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4368 \savedanchor{\southeast}{
4369 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4370 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4371 \pgf@x=.5\pgf@x
4372 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4373 \pgf@y=-.5\pgf@y
4374 }
4375 \savedanchor{\northwest}{
4376 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4377 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4378 \pgf@x=-.5\pgf@x
4379 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4380 \pgf@y=.5\pgf@y
4381 }
4382 \anchor{north}{\northwest\pgf@x=0pt\relax}
4383 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4384 \anchor{east}{\southeast\pgf@y=0pt\relax}
4385 \anchor{south east}{\southeast}
4386 \anchor{south}{\southeast\pgf@x=0pt\relax}
4387 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4388 \anchor{west}{\northwest\pgf@y=0pt\relax}
4389 \anchor{north west}{\northwest}
4390 %
4391 \anchor{center}{\northwest\pgf@y=0pt\relax}
4392 \anchor{left}{\northwest\pgf@y=0pt\relax}
4393 \anchor{right}{\southeast\pgf@y=0pt\relax}
4394 % put the node text above and centered
4395 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4396 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4397 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4398 }
4399 }
4400 \behindbackgroundpath{
4401 \pgfextracty{\pgf@circ@res@up}{\northwest}
4402 \pgfextractx{\pgf@circ@res@right}{\southeast}
4403 \pgfextractx{\pgf@circ@res@left}{\northwest}
4404 \pgfextracty{\pgf@circ@res@down}{\southeast}
4405 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
4406 \pgfstartlinewidth=\pgflinewidth
4407 \pgfscope
4408 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4410 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
4411 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4412 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4413 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
4414 \pgfpathclose
4415 \pgf@circ@draworfill
4416 \endpgfscope
4417 }
4418 }
4419
4420 % Legacy antennas (with tails)
4421 \def\pgf@circ@shift@antenna@xy#1#2{%
4422 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
4423 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
4424 \relax}
4425
4426 % Legacy antenna
4427 \pgfdeclareshape{antenna}{
4428 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4429 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4430 \anchor{center}{\pgfpointorigin}
4431 \savedanchor{\northeast}{
4432 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4433 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4434 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4435 \pgf@y=4\pgf@circ@res@step
4436 }
4437 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
4438 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
4439 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
4440 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
4441 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4442 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4443 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
4444 \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}}
4445 \anchor{text}{
4446 \northeast
4447 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
4448 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
4449 }
4450 \behindforegroundpath{
4451 \pgfstartlinewidth=\pgflinewidth
4452 \pgf@circ@scaled@Rlen=\scaledRlen
4453 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4454
4455 \pgftransformxshift{ -4\pgf@circ@res@step }
4456
4457 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4458 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4459
4460 \pgfusepath{draw}
4461
4462 \pgfscope
4463 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4464 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4465 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4466 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4467 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4468 \pgfsetcolor{\ctikzvalof{color}}
4469 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4470 \pgfusepath{draw}
4471 \endpgfscope
4472 \pgfsetlinewidth{\pgfstartlinewidth}
4473
4474 }
4475 }
4476
4477 % Legacy TX antenna
4478 \pgfdeclareshape{txantenna}{
4479 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4480 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4481 \anchor{center}{\pgfpointorigin}
4482 \savedanchor{\northeast}{
4483 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4484 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4485 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4486 \pgf@y=4\pgf@circ@res@step
4487 }
4488 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4489 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4490 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4491 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4492 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4493 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4494 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4495 \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}}
4496 \anchor{text}{
4497 \northeast
4498 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
4499 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
4500 }
4501 \behindforegroundpath{
4502 \pgfstartlinewidth=\pgflinewidth
4503 \pgf@circ@scaled@Rlen=\scaledRlen
4504 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
4505
4506 \pgfpathmoveto{\pgfpointorigin}
4507 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4508 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4509 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4510
4511 \pgfusepath{draw}
4512
4513 \pgfscope
4514 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4515 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4516 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4517 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4518 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4519 \pgfsetcolor{\ctikzvalof{color}}
4520 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4521 \pgfusepath{draw}
4522 \endpgfscope
4523 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
4524 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4525 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4526 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
4527 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4528 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
4529 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4530 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
4531 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
4532 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
4533 \pgfusepath{draw}
4534 \pgfsetlinewidth{\pgfstartlinewidth}
4535
4536 }
4537 }
4538
4539 % Legacy RX antenna
4540 \pgfdeclareshape{rxantenna}{
4541 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4542 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4543 \anchor{center}{\pgfpointorigin}
4544 \savedanchor{\northeast}{
4545 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4546 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4547 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4548 \pgf@y=4\pgf@circ@res@step
4549 }
4550 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4551 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4552 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4553 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4554 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4555 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4556 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4557 \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}}
4558 \anchor{text}{
4559 \northeast
4560 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
4561 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
4562 }
4563 \behindforegroundpath{
4564 \pgfstartlinewidth=\pgflinewidth
4565 \pgf@circ@scaled@Rlen=\scaledRlen
4566 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
4567
4568 \pgfpathmoveto{\pgfpointorigin}
4569 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4570 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4571 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4572
4573 \pgfusepath{draw}
4574
4575 \pgfscope
4576 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4577 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4578 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4579 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4580 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4581 \pgfsetcolor{\ctikzvalof{color}}
4582 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4583 \pgfusepath{draw}
4584 \endpgfscope
4585
4586 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
4587 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4588 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4589 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
4590 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4591 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
4592 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4593 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
4594 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
4595 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
4596 \pgfusepath{draw}
4597 \pgfsetlinewidth{\pgfstartlinewidth}
4598 }
4599 }
4600
4601 % Legacy match
4602 \pgfdeclareshape{match}{
4603 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4604 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4605 \savedanchor{\northeast}{%
4606 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4607 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4608 \pgf@x=2\pgf@circ@res@step
4609 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4610 \pgf@y=.5\pgf@circ@res@step%
4611 }
4612 % the center is on the left side of the shape for facility of usage
4613 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4614 \anchor{east}{\northeast\pgf@y=0cm\relax}
4615 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4616 \anchor{west}{\pgfpointorigin}
4617 \anchor{north east}{\northeast}
4618 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4619 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4620 \anchor{south west}{\pgfpointorigin}
4621 \anchor{center}{
4622 \pgfpointorigin
4623 }
4624 \anchor{text}{
4625 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4626 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4627 \pgf@x=1.5\pgf@x
4628 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4629 \pgf@y=-1.5\ht\pgfnodeparttextbox
4630 }
4631 \behindforegroundpath{
4632 \pgf@circ@scaled@Rlen=\scaledRlen
4633 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4634
4635 \pgfscope
4636 \pgfpathmoveto{\pgfpointorigin}
4637 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4638 \pgfusepath{draw}
4639
4640 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4641 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4642 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4643 \pgfusepath{fill}
4644
4645 \pgfsetlinewidth{\pgfstartlinewidth}
4646 \endpgfscope
4647 }
4648 }
4649
4650 %%%---------- close: tex/pgfcircmonopoles
4651 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4652 %%%---------- open: tex/pgfcircbipoles.tex
4653 % Copyright 2018-2026 by Romano Giannetti
4654 % Copyright 2015-2026 by Stefan Lindner
4655 % Copyright 2013-2026 by Stefan Erhardt
4656 % Copyright 2007-2026 by Massimo Redaelli
4657 %
4658 % This file may be distributed and/or modified
4659 %
4660 % 1. under the LaTeX Project Public License and/or
4661 % 2. under the GNU Public License.
4662 %
4663 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4664
4665 %% Generic macro for defining a bipole shape
4666 % #1 - additional anchors
4667 % #2 - lower y-size of the bipole (from the center).
4668 % #3 - #shape is the name of the shape
4669 % #4 - upper y-size of the bipole (from the center)
4670 % #5 - width of the bipole
4671 % #6 - macros drawing the bipole
4672 %
4673 \long\def\pgfcircdeclarebipole{%
4674 \pgfcircdeclarebipolescaled{default}}
4675
4676 %% Generic macro for defining a bipole shape
4677 % #1 - scale factor
4678 % #2 - additional anchors
4679 % #3 - lower y-size of the bipole (from the center).
4680 % #4 - #shape is the name of the shape
4681 % #5 - upper y-size of the bipole (from the center)
4682 % #6 - width of the bipole
4683 % #7 - macros drawing the bipole
4684 %
4685 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
4686 \pgfdeclareshape{#4shape}{
4687 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
4688 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4689 \savedanchor{\northeast}{
4690 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4691 \pgf@y=#5\pgf@circ@scaled@Rlen
4692 \pgf@y=.5\pgf@y
4693 \pgf@x=#6\pgf@circ@scaled@Rlen
4694 \pgf@x=.5\pgf@x
4695 }
4696 \savedanchor{\northeastborder}{
4697 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4698 \pgf@y=#5\pgf@circ@scaled@Rlen
4699 \pgf@y=.5\pgf@y
4700 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4701 \pgf@x=#6\pgf@circ@scaled@Rlen
4702 \pgf@x=.5\pgf@x
4703 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4704 }
4705 \savedanchor{\southwestborder}{
4706 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4707 \pgf@y=-#3\pgf@circ@scaled@Rlen
4708 \pgf@y=.5\pgf@y
4709 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4710 \pgf@x=-#6\pgf@circ@scaled@Rlen
4711 \pgf@x=.5\pgf@x
4712 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4713 }
4714 \savedanchor{\southwest}{
4715 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4716 \pgf@y=-#3\pgf@circ@scaled@Rlen
4717 \pgf@y=.5\pgf@y
4718 \pgf@x=-#6\pgf@circ@scaled@Rlen
4719 \pgf@x=.5\pgf@x
4720 }
4721 \savedanchor{\centerpoint}{
4722 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4723 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
4724 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
4725 \pgfpointorigin
4726 \pgf@y=\pgf@circ@res@up
4727 \advance\pgf@y by\pgf@circ@res@down
4728 \pgf@y=.5\pgf@y
4729 }
4730 \anchor{center}{\pgfpointorigin}
4731 \anchor{n}{
4732 \northeast
4733 \pgf@x=0cm
4734 }
4735 \anchor{north east}{
4736 \northeast
4737 }
4738 \anchor{north west}{
4739 \northeast
4740 \pgf@x=-\pgf@x
4741 }
4742 \anchor{ne}{
4743 \northeast
4744 }
4745 \anchor{nw}{
4746 \northeast
4747 \pgf@x=-\pgf@x
4748 }
4749 \anchor{e}{
4750 \northeast
4751 \pgf@y=0cm
4752 }
4753 \anchor{s}{
4754 \southwest
4755 \pgf@x=0cm
4756 }
4757 \anchor{south east}{
4758 \southwest
4759 \pgf@x=-\pgf@x
4760 }
4761 \anchor{south west}{
4762 \southwest
4763 }
4764 \anchor{se}{
4765 \southwest
4766 \pgf@x=-\pgf@x
4767 }
4768 \anchor{sw}{
4769 \southwest
4770 }
4771 \anchor{w}{
4772 \southwest
4773 \pgf@y=0cm
4774 }
4775 \anchor{north}{
4776 \northeast
4777 \pgf@x=0cm
4778 }
4779 \anchor{east}{
4780 \northeast
4781 \pgf@y=0cm
4782 }
4783 \anchor{south}{
4784 \southwest
4785 \pgf@x=0cm
4786 }
4787 \anchor{west}{
4788 \southwest
4789 \pgf@y=0cm
4790 }
4791 \anchor{right}{
4792 \northeast
4793 \pgf@y=0cm
4794 }
4795 \anchor{above}{
4796 \northeast
4797 \pgf@x=0cm
4798 }
4799 \anchor{left}{
4800 \southwest
4801 \pgf@y=0cm
4802 }
4803 \anchor{below}{
4804 \southwest
4805 \pgf@x=0cm
4806 }
4807 \anchor{a}{
4808 \northeast
4809 \pgf@y=0cm
4810 }
4811 \anchor{b}{
4812 \southwest
4813 \pgf@y=0cm
4814 }
4815 \savedanchor{\textanchor}{%
4816 \pgf@y=\ht\pgfnodeparttextbox
4817 \pgf@x=-.5\wd\pgfnodeparttextbox
4818 }
4819 \anchor{text}{
4820 \textanchor
4821 }
4822 \anchorborder{%
4823 \ifpgf@circuit@bipole@inverted
4824 \pgf@circ@res@left=-\pgf@x
4825 \pgf@circ@res@up=-\pgf@y
4826 \else
4827 \pgf@circ@res@left=\pgf@x
4828 \pgf@circ@res@up=\pgf@y
4829 \fi
4830 \ifdim\pgf@circ@res@up>0cm
4831 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
4832 \else
4833 \southwestborder
4834 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
4835 \fi
4836 }
4837
4838 #2
4839
4840 \backgroundpath{
4841 \pgfsetcolor{\ctikzvalof{color}}
4842
4843 \northeast
4844 \pgf@circ@res@up = \pgf@y
4845 \pgf@circ@res@zero = 0cm
4846 \pgf@circ@res@left = -\pgf@x
4847 \pgf@circ@res@right = \pgf@x
4848 \southwest
4849 \pgf@circ@res@down = \pgf@y
4850 \pgf@circ@scaled@Rlen=\scaledRlen
4851 \pgfstartlinewidth=\pgflinewidth
4852 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
4853 #7
4854
4855 \pgfsetlinewidth{\pgfstartlinewidth}
4856 }
4857 }
4858 }
4859
4860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861 %% anchor adjustment macros
4862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4863
4864 % Extend the border anchor position by the specified factors on the right-top (north east corner)
4865 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
4866
4867 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
4868 \anchorborder{%
4869 \ifpgf@circuit@bipole@inverted
4870 \pgf@circ@res@left=-\pgf@x
4871 \pgf@circ@res@up=-\pgf@y
4872 \else
4873 \pgf@circ@res@left=\pgf@x
4874 \pgf@circ@res@up=\pgf@y
4875 \fi
4876 \ifdim\pgf@circ@res@up>0cm
4877 \northeastborder
4878 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
4879 \else
4880 \southwestborder
4881 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
4882 \fi
4883 }
4884 }
4885
4886 % Just up and down (very common)
4887 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}
4888
4889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4890 %% Standard bipole shapes declarations
4891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892
4893 %%%%%%%%%%%%%%%%%%%%%%%%
4894 % Resistive components
4895 %%%%%%%%%%%%%%%%%%%%%%%%
4896
4897 %% Short circuit
4898
4899 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4900 %%% natural length is zero.
4901 \pgfcircdeclarebipole
4902 {% fix the anchor border to add a bit of space for voltage and labels
4903 % it uses the dummy width and height
4904 \anchorborder{%
4905 \ifpgf@circuit@bipole@inverted
4906 \pgf@circ@res@left=-\pgf@x
4907 \pgf@circ@res@up=-\pgf@y
4908 \else
4909 \pgf@circ@res@left=\pgf@x
4910 \pgf@circ@res@up=\pgf@y
4911 \fi
4912 \ifdim\pgf@circ@res@up>0cm
4913 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4914 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4915 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4916 {\pgfpoint{\pgf@x}{\pgf@y}}
4917 \else
4918 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4919 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4920 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4921 {\pgfpoint{-\pgf@x}{-\pgf@y}}
4922 \fi
4923 }
4924 }
4925 {0}
4926 {short}
4927 {0}
4928 {0}
4929 {}
4930
4931 %% Open circuit
4932 \pgfcircdeclarebipole
4933 {}
4934 {\ctikzvalof{bipoles/open/height}}
4935 {open}
4936 {\ctikzvalof{bipoles/open/height}}
4937 {\ctikzvalof{bipoles/open/width}}
4938 {}
4939
4940 % multiwire(s)
4941 \pgfcircdeclarebipole
4942 {}
4943 {\ctikzvalof{bipoles/multiwire/height}}
4944 {multiwire}
4945 {\ctikzvalof{bipoles/multiwire/height}}
4946 {\ctikzvalof{bipoles/multiwire/width}}
4947 {
4948 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4949 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4950 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4951 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4952 \pgfusepath{draw}
4953 }
4954
4955 \pgfcircdeclarebipole
4956 {}
4957 {\ctikzvalof{bipoles/multiwire/height}}
4958 {bmultiwire}
4959 {\ctikzvalof{bipoles/multiwire/height}}
4960 {\ctikzvalof{bipoles/multiwire/width}}
4961 {
4962 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4963 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4964 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4965 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4966 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4968 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4969 \pgfusepath{draw}
4970 }
4971
4972 \pgfcircdeclarebipole
4973 {}
4974 {\ctikzvalof{bipoles/multiwire/height}}
4975 {tmultiwire}
4976 {\ctikzvalof{bipoles/multiwire/height}}
4977 {\ctikzvalof{bipoles/multiwire/width}}
4978 {
4979 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4980 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4981 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4982 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4983 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4984 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4985 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4988 \pgfusepath{draw}
4989 }
4990
4991 %
4992 %
4993 %% Generic bipole - used as resistor by some (bleah)
4994 \pgfcircdeclarebipolescaled{resistors}
4995 {}
4996 {\ctikzvalof{bipoles/generic/height}}
4997 {generic}
4998 {\ctikzvalof{bipoles/generic/height}}
4999 {\ctikzvalof{bipoles/generic/width}}
5000 {
5001 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5002 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5003 \pgf@circ@draworfill
5004 }
5005
5006 %
5007 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
5008 % inherit "generic" properties
5009 %
5010 \pgfcircdeclarebipolescaled{resistors}
5011 {}
5012 {\ctikzvalof{bipoles/generic/height}}
5013 {xgeneric}
5014 {\ctikzvalof{bipoles/generic/height}}
5015 {\ctikzvalof{bipoles/generic/width}}
5016 {
5017 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5018 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5019 \pgf@circ@draworfill
5020 % cross it
5021 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5022 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5023 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5024 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5025 \pgfusepath{draw}
5026 }
5027 %% Generic empty tunable
5028 \pgfcircdeclarebipolescaled{resistors}
5029 {}
5030 {\ctikzvalof{bipoles/tgeneric/height}}
5031 {tgeneric}
5032 {\ctikzvalof{bipoles/tgeneric/height}}
5033 {\ctikzvalof{bipoles/tgeneric/width}}
5034 {
5035 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5036 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5037 \pgf@circ@draworfill
5038 \pgfscope
5039 \pgfsetarrowsend{latexslim}
5040 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5041 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5042 \pgfusepath{draw}
5043 \endpgfscope
5044 }
5045
5046 %% Generic asymmetric bipole
5047 \pgfcircdeclarebipolescaled{resistors}
5048 {}
5049 {\ctikzvalof{bipoles/ageneric/height}}
5050 {ageneric}
5051 {\ctikzvalof{bipoles/ageneric/height}}
5052 {\ctikzvalof{bipoles/ageneric/width}}
5053 {
5054 \pgfscope
5055 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5056 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5057 \pgf@circ@draworfill
5058 \endpgfscope
5059
5060 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5061 \pgfusepath{stroke,fill}
5062 }
5063
5064 %% Memristor
5065 \pgfcircdeclarebipolescaled{resistors}
5066 {}
5067 {\ctikzvalof{bipoles/memristor/height}}
5068 {memristor}
5069 {\ctikzvalof{bipoles/memristor/height}}
5070 {\ctikzvalof{bipoles/memristor/width}}
5071 {
5072 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
5073 \divide \pgf@circ@res@step by 14
5074
5075 \pgfscope
5076 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5077 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5078 \pgf@circ@draworfill
5079 \endpgfscope
5080 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5081 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
5082 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5083 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5084 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5085 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5086 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5087 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
5088 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
5089 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
5090
5091 \pgfusepath{draw}
5092
5093 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5094 \pgfusepath{stroke,fill}
5095 }
5096
5097 %% Photoresistor
5098 \pgfcircdeclarebipolescaled{resistors}
5099 {}
5100 {\ctikzvalof{bipoles/photoresistor/height 2}}
5101 {photoresistor}
5102 {\ctikzvalof{bipoles/photoresistor/height}}
5103 {\ctikzvalof{bipoles/photoresistor/width}}
5104 {
5105 \pgfscope
5106 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
5107 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5108 \pgf@circ@draworfill
5109 \endpgfscope
5110
5111 \pgfscope
5112 \pgfsetarrowsend{latexslim}
5113 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
5114 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
5115 \pgfusepath{draw}
5116 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
5117 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
5118 \pgfusepath{draw}
5119 \endpgfscope
5120 }
5121
5122 %% Thermistor
5123 \pgfcircdeclarebipolescaled{resistors}
5124 {% anchor for labelling the type of dependency
5125 \anchor{label}{%
5126 \southwest
5127 \pgf@x=0.4\pgf@x
5128 \pgf@y=1.2\pgf@y
5129 }%
5130 \pgfcirc@border@extend@updown{1}{1.2}
5131 }
5132 {\ctikzvalof{bipoles/thermistor/height}}
5133 {thermistor}
5134 {\ctikzvalof{bipoles/thermistor/height}}
5135 {\ctikzvalof{bipoles/thermistor/width}}
5136 {
5137 \pgfscope
5138 \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}}
5139 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5140 \pgf@circ@draworfill
5141 \endpgfscope
5142
5143 %\pgfscope
5144 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
5145 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
5146 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
5147 \pgfusepath{draw}
5148 %\endpgfscope
5149 }
5150
5151 %% Thermistor PTC
5152 \pgfcircdeclarebipolescaled{resistors}
5153 {}
5154 {\ctikzvalof{bipoles/thermistorptc/height 2}}
5155 {thermistorptc}
5156 {\ctikzvalof{bipoles/thermistorptc/height}}
5157 {\ctikzvalof{bipoles/thermistorptc/width}}
5158 {
5159 \pgfscope
5160 \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}}
5161 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5162 \pgf@circ@draworfill
5163 \endpgfscope
5164 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
5165 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
5166 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
5167 \pgfusepath{draw}
5168
5169 \pgfsetlinewidth{\pgfstartlinewidth}
5170 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
5171 \pgfsetarrowsend{latexslim}
5172 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
5173 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5174 \pgfusepath{draw}
5175 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
5176 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5177 \pgfusepath{draw}
5178 }
5179
5180 %% Thermistor NTC
5181 \pgfcircdeclarebipolescaled{resistors}
5182 {}
5183 {\ctikzvalof{bipoles/thermistorntc/height 2}}
5184 {thermistorntc}
5185 {\ctikzvalof{bipoles/thermistorntc/height}}
5186 {\ctikzvalof{bipoles/thermistorntc/width}}
5187 {
5188 \pgfscope
5189 \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}}
5190 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5191 \pgf@circ@draworfill
5192 \endpgfscope
5193
5194 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
5195 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
5196 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
5197 \pgfusepath{draw}
5198
5199 \pgfsetlinewidth{\pgfstartlinewidth}
5200 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
5201 \pgfsetarrowsend{latexslim}
5202 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
5203 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5204 \pgfusepath{draw}
5205 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5206 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
5207 \pgfusepath{draw}
5208 }
5209
5210 %% Generic tunable
5211 \pgfcircdeclarebipolescaled{resistors}
5212 {
5213 \savedanchor{\wiper}{
5214 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5215 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
5216 \pgf@y=.5\pgf@ya
5217 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
5218 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
5219 }
5220 \anchor{wiper}{\wiper}
5221 \anchor{W}{\wiper}
5222 }
5223 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
5224 {genericpotentiometer}
5225 {\ctikzvalof{bipoles/generic potentiometer/height}}
5226 {\ctikzvalof{bipoles/generic potentiometer/width}}
5227 {
5228
5229 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
5230 \divide \pgf@circ@res@step by 14
5231
5232 \pgfscope
5233 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5234 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5235 \pgf@circ@draworfill
5236 \endpgfscope
5237 \pgfscope
5238 %\pgfsetlinewidth{\pgfstartlinewidth}
5239 \pgfsetarrowsend{latexslim}
5240 \pgfextractx{\pgf@circ@res@other}{\wiper}
5241 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5242 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5243 \pgfusepath{draw}
5244 \endpgfscope
5245 }
5246
5247 %% Zig zag resistores
5248 \def\pgf@circ@zigzag#1{%
5249 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
5250
5251 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
5252 \pgf@circ@res@other = \pgf@circ@res@left
5253 \pgf@circ@count@a=\zigs\relax
5254 % first half zig
5255 \advance\pgf@circ@res@other by \pgf@circ@res@step
5256 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
5257 \pgfmathloop%
5258 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
5259 \ifnum\pgf@circ@count@a>0
5260 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5261 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
5262 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5263 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
5264 \repeatpgfmathloop%
5265 % last zig and a half
5266 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5267 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
5268 \advance\pgf@circ@res@other by \pgf@circ@res@step
5269 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
5270 \pgfsetbeveljoin
5271 \pgfusepath{draw}
5272 }
5273
5274 %% Resistor
5275 \pgfcircdeclarebipolescaled{resistors}
5276 {
5277 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5278 }
5279 {\ctikzvalof{bipoles/resistor/height}}
5280 {resistor}
5281 {\ctikzvalof{bipoles/resistor/height}}
5282 {\ctikzvalof{bipoles/resistor/width}}
5283 {
5284 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5285 \pgftransformationadjustments
5286 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5287 \pgf@circ@zigzag{1}
5288 }
5289
5290
5291 %% Variable resistor
5292 \pgfcircdeclarebipolescaled{resistors}
5293 {
5294 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5295 }
5296 {\ctikzvalof{bipoles/vresistor/height}}
5297 {vresistor}
5298 {\ctikzvalof{bipoles/vresistor/height}}
5299 {\ctikzvalof{bipoles/vresistor/width}}
5300 {
5301 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5302 \pgftransformationadjustments
5303 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5304 \pgf@circ@zigzag{.5}
5305
5306 \pgfscope
5307 \pgfsetarrowsend{latexslim}
5308 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
5309 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
5310 \pgfusepath{draw}
5311 \endpgfscope
5312 }
5313
5314 %% Potentiometer
5315 \pgfcircdeclarebipolescaled{resistors}
5316 {
5317 \savedanchor{\wiper}{
5318 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5319 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
5320 \pgf@y=.5\pgf@ya
5321 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
5322 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
5323 }
5324 \anchor{wiper}{\wiper}
5325 \anchor{W}{\wiper}
5326 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5327 }
5328 {\ctikzvalof{bipoles/potentiometer/height 2}}
5329 {potentiometer}
5330 {\ctikzvalof{bipoles/potentiometer/height}}
5331 {\ctikzvalof{bipoles/potentiometer/width}}
5332 {
5333 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5334 \pgftransformationadjustments
5335 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5336 \pgf@circ@zigzag{1}
5337
5338 \pgfscope
5339 %\pgfsetlinewidth{\pgfstartlinewidth}
5340 \pgfsetarrowsend{latexslim}
5341 \pgfextractx{\pgf@circ@res@other}{\wiper}
5342 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5343 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5344 \pgfusepath{draw}
5345 \endpgfscope
5346 }
5347
5348 %% Resistive sensor
5349 \pgfcircdeclarebipolescaled{resistors}
5350 {% anchor for labelling the type of dependency
5351 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
5352 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5353 }
5354 {\ctikzvalof{bipoles/resistivesens/height}}
5355 {resistivesens}
5356 {\ctikzvalof{bipoles/resistivesens/height}}
5357 {\ctikzvalof{bipoles/resistivesens/width}}
5358 {%
5359 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5360 \pgftransformationadjustments
5361 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5362 \pgf@circ@zigzag{.5}
5363
5364 \pgfscope
5365 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
5366 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
5367 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
5368 \pgfusepath{draw}
5369 \endpgfscope
5370 }
5371
5372 %%%%%%%%%%%%%%
5373 %% Capacitors
5374 %%%%%%%%%%%%%
5375
5376 %% Plain Capacitor
5377 \pgfcircdeclarebipolescaled{capacitors}
5378 {}
5379 {\ctikzvalof{bipoles/capacitor/height}}
5380 {capacitor}
5381 {\ctikzvalof{bipoles/capacitor/height}}
5382 {\ctikzvalof{bipoles/capacitor/width}}
5383 {
5384 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5387
5388 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5389 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5390 \pgfusepath{draw}
5391
5392 }
5393
5394 %% Capacitive sensor
5395 \pgfcircdeclarebipolescaled{capacitors}
5396 {
5397 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
5398 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
5399 }
5400 {\ctikzvalof{bipoles/capacitor/height}}
5401 {capacitivesens}
5402 {\ctikzvalof{bipoles/capacitor/height}}
5403 {\ctikzvalof{bipoles/capacitor/width}}
5404 {
5405 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5406 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5407 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5408
5409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5410 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5411 \pgfusepath{draw}
5412 \pgfscope
5413 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
5414 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5415 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5416 \pgfusepath{draw}
5417 \endpgfscope
5418 }
5419
5420 %% Polar Capacitor (DEPRECATED)
5421 \pgfcircdeclarebipolescaled{capacitors}
5422 {}
5423 {\ctikzvalof{bipoles/pcapacitor/height}}
5424 {polarcapacitor}
5425 {\ctikzvalof{bipoles/pcapacitor/height}}
5426 {\ctikzvalof{bipoles/pcapacitor/width}}
5427 {
5428 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5429
5430 \pgfscope
5431 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
5432 \pgftransformrotate{-90}
5433 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5434 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5435 \pgfusepath{draw}
5436 \endpgfscope
5437
5438 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5439 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5440 \pgfusepath{draw}
5441 }
5442
5443
5444 %% Curved capacitor
5445 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
5446 % for a rationale
5447 %
5448 \pgfcircdeclarebipolescaled{capacitors}
5449 {}
5450 {\ctikzvalof{bipoles/ccapacitor/height}}
5451 {ccapacitor}
5452 {\ctikzvalof{bipoles/ccapacitor/height}}
5453 {\ctikzvalof{bipoles/ccapacitor/width}}
5454 {
5455 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5456
5457 \pgfscope
5458 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}}
5459 \pgftransformrotate{-90}
5460 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5461 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5462 \pgfusepath{draw}
5463 \endpgfscope
5464
5465 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5466 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5467 \pgfusepath{draw}
5468 }
5469
5470
5471
5472
5473 %% Electrolytic Capacitor
5474 \pgfcircdeclarebipolescaled{capacitors}
5475 {}
5476 {\ctikzvalof{bipoles/ecapacitor/height}}
5477 {ecapacitor}
5478 {\ctikzvalof{bipoles/ecapacitor/height}}
5479 {\ctikzvalof{bipoles/ecapacitor/width}}
5480 {
5481 \pgfsetrectcap
5482 % % % Draw plus pole
5483 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5485 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5486 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5488 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5489 \pgf@circ@draworfill
5490 % % Draw minus pole
5491 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5492 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5493 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5494 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5496 \pgfsetfillcolor{\ctikzvalof{color}}
5497 \pgfusepath{draw,fill}
5498 \pgfsetfillcolor{\ctikzvalof{color}}
5499 % % plus pole annotation
5500 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
5501 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
5502 }
5503
5504 %% Variable Capacitor
5505 \pgfcircdeclarebipolescaled{capacitors}
5506 {}
5507 {\ctikzvalof{bipoles/vcapacitor/height}}
5508 {vcapacitor}
5509 {\ctikzvalof{bipoles/vcapacitor/height}}
5510 {\ctikzvalof{bipoles/vcapacitor/width}}
5511 {
5512 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right
5513
5514 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5515 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5516 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5517
5518 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5519 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5520 \pgfusepath{draw}
5521
5522 \pgfscope
5523 \pgfsetarrowsend{latexslim}
5524 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5526 \pgfusepath{draw}
5527 \endpgfscope
5528
5529 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5530 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
5531 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
5533 \pgfsetlinewidth{\pgfstartlinewidth}
5534 \pgfusepath{draw}
5535 }
5536
5537
5538 %% Piezoelectric Element
5539
5540 \pgfcircdeclarebipolescaled{capacitors}
5541 {}
5542 {\ctikzvalof{bipoles/piezoelectric/height}}
5543 {piezoelectric}
5544 {\ctikzvalof{bipoles/piezoelectric/height}}
5545 {\ctikzvalof{bipoles/piezoelectric/width}}
5546 {
5547 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
5548 % \divide \pgf@circ@res@step by 5
5549
5550 %% Outer markings
5551 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5552 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5553 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5554
5555 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5556 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5557 \pgfusepath{draw}
5558
5559 %% Inner Box
5560 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5561 \pgfscope
5562 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5563 \pgfpathrectanglecorners
5564 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5565 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5566 \pgf@circ@draworfill
5567 \endpgfscope
5568 }
5569
5570 %%%%%%%%%%%%%%%
5571 %% Inductors
5572 %%%%%%%%%%%%%%%
5573
5574 %% cute inductor
5575 \pgfcircdeclarebipolescaled{inductors}
5576 {
5577 \savedanchor{\midtap}{%
5578 \pgf@x=0pt\relax
5579 \pgfmathsetlength{\pgf@y}{%
5580 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5581 \ctikzvalof{bipoles/cuteinductor/height} :% even
5582 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5583 *\pgf@circ@scaled@Rlen/2
5584 }
5585 }
5586 \anchor{midtap}{\midtap}
5587 }
5588 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5589 {cuteinductor}
5590 {\ctikzvalof{bipoles/cuteinductor/height}}
5591 {\ctikzvalof{bipoles/cuteinductor/width}}
5592 {
5593 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5594 \pgftransformationadjustments
5595
5596 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5597 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5598
5599
5600 \pgfmathsetlength{\pgf@circ@res@step}
5601 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5602
5603 \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
5604 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5605 {
5606 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5607 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5608 }
5609 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5610 \pgfsetbuttcap
5611 \pgfsetbeveljoin
5612 \pgfusepath{stroke}
5613 }
5614
5615 %% cute inductive sensor
5616 \pgfcircdeclarebipolescaled{inductors}
5617 {% anchor for labelling the type of dependency
5618 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5619 \savedanchor{\midtap}{%
5620 \pgf@x=0pt\relax
5621 \pgfmathsetlength{\pgf@y}{%
5622 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5623 \ctikzvalof{bipoles/cuteinductor/height} :% even
5624 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5625 *\pgf@circ@scaled@Rlen/2
5626 }
5627 }
5628 \anchor{midtap}{\midtap}
5629 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5630 }
5631 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5632 {scuteinductor}
5633 {\ctikzvalof{bipoles/cuteinductor/height}}
5634 {\ctikzvalof{bipoles/cuteinductor/width}}
5635 {
5636 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5637 \pgftransformationadjustments
5638
5639 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5640 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5641
5642
5643 \pgfmathsetlength{\pgf@circ@res@step}
5644 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5645
5646 \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
5647 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5648 {
5649 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5650 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5651 }
5652 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5653 \pgfsetbuttcap
5654 \pgfsetbeveljoin
5655 \pgfusepath{stroke}
5656 \pgfscope
5657 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5658 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5659 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5660 \pgfusepath{draw}
5661 \endpgfscope
5662 }
5663
5664 %% cute choke
5665 \pgfcircdeclarebipolescaled{inductors}
5666 {
5667 \savedanchor{\midtap}{%
5668 \pgf@x=0pt\relax
5669 \pgfmathsetlength{\pgf@y}{%
5670 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5671 \ctikzvalof{bipoles/cuteinductor/height} :% even
5672 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5673 *\pgf@circ@scaled@Rlen/2
5674 }
5675 }
5676 \anchor{midtap}{\midtap}
5677 }
5678 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5679 {cutechoke}
5680 {\ctikzvalof{bipoles/cutechoke/height}}
5681 {\ctikzvalof{bipoles/cutechoke/width}}
5682 {
5683 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5684 \pgftransformationadjustments
5685
5686 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5687 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5688
5689
5690 \pgfmathsetlength{\pgf@circ@res@step}
5691 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5692
5693 \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
5694 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5695 {
5696 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5697 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5698 }
5699 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5700 \pgfsetbuttcap
5701 \pgfsetbeveljoin
5702 \pgfusepath{stroke}
5703
5704 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5705 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5706 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5707 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5708 \pgfusepath{stroke}
5709
5710 \ifpgf@circuit@bipole@twolineschoke
5711 \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}}
5712 \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}}
5713 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5714 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5715 \pgfusepath{stroke}
5716 \fi
5717 }
5718
5719 %% variable cute inductor
5720 \pgfcircdeclarebipolescaled{inductors}
5721 {
5722 \savedanchor{\midtap}{%
5723 \pgf@x=0pt\relax
5724 \pgfmathsetlength{\pgf@y}{%
5725 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5726 \ctikzvalof{bipoles/cuteinductor/height} :% even
5727 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5728 *\pgf@circ@scaled@Rlen/2
5729 }
5730 }
5731 \anchor{midtap}{\midtap}
5732 }
5733 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5734 {vcuteinductor}
5735 {\ctikzvalof{bipoles/vcuteinductor/height}}
5736 {\ctikzvalof{bipoles/vcuteinductor/width}}
5737 {
5738 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5739 \pgftransformationadjustments
5740
5741 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5742 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5743
5744
5745 \pgfmathsetlength{\pgf@circ@res@step}
5746 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5747
5748 \pgfscope
5749 \pgfsetarrowsend{latexslim}
5750 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5751 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5752 \pgfusepath{draw}
5753 \endpgfscope
5754
5755 \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
5756 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5757 {
5758 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5759 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5760 }
5761 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5762 \pgfsetbuttcap
5763 \pgfsetbeveljoin
5764 \pgfusepath{stroke}
5765 }
5766
5767 %% american inductor
5768 \pgfcircdeclarebipolescaled{inductors}
5769 {
5770 \savedanchor{\midtap}{%
5771 \pgf@x=0pt\relax
5772 \pgfmathsetlength{\pgf@y}{%
5773 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5774 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5775 0) %odd
5776 *\pgf@circ@scaled@Rlen/2
5777 }
5778 }
5779 \anchor{midtap}{\midtap}
5780 }
5781 {\ctikzvalof{bipoles/americaninductor/height 2}}
5782 {americaninductor}
5783 {\ctikzvalof{bipoles/americaninductor/height}}
5784 {\ctikzvalof{bipoles/americaninductor/width}}
5785 {
5786 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5787 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5788 \pgftransformationadjustments
5789 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5790 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5791 \divide \pgf@circ@res@step by 2
5792 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5793
5794 \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
5795 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5796 {
5797 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5798 }
5799 \pgfsetbuttcap
5800 \pgfsetbeveljoin
5801 \pgfusepath{stroke}
5802 }
5803
5804
5805 %% american inductive sensor
5806 \pgfcircdeclarebipolescaled{inductors}
5807 {% anchor for labelling the type of dependency
5808 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5809 \savedanchor{\midtap}{%
5810 \pgf@x=0pt\relax
5811 \pgfmathsetlength{\pgf@y}{%
5812 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5813 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5814 0) %odd
5815 *\pgf@circ@scaled@Rlen/2
5816 }
5817 }
5818 \anchor{midtap}{\midtap}
5819 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5820 }
5821 {\ctikzvalof{bipoles/americaninductor/height 2}}
5822 {samericaninductor}
5823 {\ctikzvalof{bipoles/americaninductor/height}}
5824 {\ctikzvalof{bipoles/americaninductor/width}}
5825 {
5826 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5827 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5828 \pgftransformationadjustments
5829 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5830 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5831 \divide \pgf@circ@res@step by 2
5832 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5833
5834 \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
5835 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5836 {
5837 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5838 }
5839 \pgfsetbuttcap
5840 \pgfsetbeveljoin
5841 \pgfusepath{stroke}
5842 \pgfscope
5843 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5844 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5845 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5846 \pgfusepath{draw}
5847 \endpgfscope
5848 }
5849
5850 %% variable american inductor
5851 \pgfcircdeclarebipolescaled{inductors}
5852 {
5853 \savedanchor{\midtap}{%
5854 \pgf@x=0pt\relax
5855 \pgfmathsetlength{\pgf@y}{%
5856 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5857 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5858 0) %odd
5859 *\pgf@circ@scaled@Rlen/2
5860 }
5861 }
5862 \anchor{midtap}{\midtap}
5863 }
5864 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5865 {vamericaninductor}
5866 {\ctikzvalof{bipoles/vamericaninductor/height}}
5867 {\ctikzvalof{bipoles/vamericaninductor/width}}
5868 {
5869 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5870 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5871 \pgftransformationadjustments
5872 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5873 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5874 \divide \pgf@circ@res@step by 2
5875 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5876
5877 \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
5878 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5879 {
5880 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5881 }
5882 \pgfsetbuttcap
5883 \pgfsetbeveljoin
5884 \pgfusepath{stroke}
5885
5886 \pgfscope
5887 \pgfsetarrowsend{latexslim}
5888 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5889 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5890 \pgfusepath{draw}
5891 \endpgfscope
5892 }
5893
5894 %% Generic bipole, filled - used as inductor by some
5895 \pgfcircdeclarebipolescaled{inductors}
5896 {
5897 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5898 }
5899 {\ctikzvalof{bipoles/fullgeneric/height}}
5900 {fullgeneric}
5901 {\ctikzvalof{bipoles/fullgeneric/height}}
5902 {\ctikzvalof{bipoles/fullgeneric/width}}
5903 {
5904 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5905 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5906
5907 \pgfusepath{draw,fill}
5908 }
5909
5910 %% Generic sensor, filled - used as inductive sensor by some
5911 \pgfcircdeclarebipolescaled{inductors}
5912 {% anchor for labelling the type of dependency
5913 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5914 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5915 \pgfcirc@border@extend@full{1}{2}{1}{2}
5916 }
5917 {\ctikzvalof{bipoles/fullgeneric/height}}
5918 {sfullgeneric}
5919 {\ctikzvalof{bipoles/fullgeneric/height}}
5920 {\ctikzvalof{bipoles/fullgeneric/width}}
5921 {
5922
5923 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5924 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5925 \pgfusepath{draw,fill}
5926 %\pgfscope
5927 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5928 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5929 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5930 \pgfusepath{draw}
5931 %\endpgfscope
5932 }
5933
5934 %% Generic full tunable
5935 \pgfcircdeclarebipolescaled{inductors}
5936 {
5937 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5938 }
5939 {\ctikzvalof{bipoles/tfullgeneric/height}}
5940 {tfullgeneric}
5941 {\ctikzvalof{bipoles/tfullgeneric/height}}
5942 {\ctikzvalof{bipoles/tfullgeneric/width}}
5943 {
5944 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5945 \divide \pgf@circ@res@step by 14
5946
5947 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5948 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5949 \pgfusepath{draw,fill}
5950
5951 \pgfscope
5952 \pgfsetarrowsend{latexslim}
5953 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5954 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5955 \pgfusepath{draw}
5956 \endpgfscope
5957 }
5958
5959 %%%%%%%%%%%
5960 %% Battery
5961 %%%%%%%%%%%
5962
5963 %% Battery
5964 \pgfcircdeclarebipolescaled{batteries}
5965 {}
5966 {\ctikzvalof{bipoles/battery/height}}
5967 {battery}
5968 {\ctikzvalof{bipoles/battery/height}}
5969 {\ctikzvalof{bipoles/battery/width}}
5970 {
5971 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5972 \divide \pgf@circ@res@step by 6
5973
5974 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5975
5976 \ifpgf@circ@fixbatteries
5977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5978 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5979
5980 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5981 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5982
5983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5985
5986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5988 \else
5989 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5990 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5991
5992 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5993 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5994
5995 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5996 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5997
5998 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5999 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6000 \fi
6001 \pgfusepath{draw}
6002 }
6003
6004
6005 %% Battery 1 % poles with equl thickness
6006
6007 \pgfcircdeclarebipolescaled{batteries}
6008 {}
6009 {\ctikzvalof{bipoles/battery1/height}}
6010 {battery1}
6011 {\ctikzvalof{bipoles/battery1/height}}
6012 {\ctikzvalof{bipoles/battery1/width}}
6013 {
6014 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6015 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6016 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6017 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6018 \pgfusepath{draw}
6019
6020 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6021 \ifpgf@circ@fixbatteries
6022 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6023 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6024
6025 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6026 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6027 \else
6028 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6029 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6030
6031 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6032 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6033 \fi
6034 \pgfusepath{draw}
6035 }
6036
6037 %% Battery 2 % negative pole thicker
6038
6039 \pgfcircdeclarebipolescaled{batteries}
6040 {}
6041 {\ctikzvalof{bipoles/battery2/height}}
6042 {battery2}
6043 {\ctikzvalof{bipoles/battery2/height}}
6044 {\ctikzvalof{bipoles/battery2/width}}
6045 {
6046 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6047 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6048 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6049 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6050 \pgfusepath{draw}
6051
6052 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6053 \ifpgf@circ@fixbatteries
6054 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6055 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6056 \pgfusepath{draw}
6057 \pgfsetlinewidth{3\pgflinewidth}
6058 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6059 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6060 \else
6061 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6062 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6063 \pgfusepath{draw}
6064 \pgfsetlinewidth{3\pgflinewidth}
6065 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6066 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6067 \fi
6068 \pgfusepath{draw}
6069 }
6070
6071 %%%%%%%%%%%
6072 %% Round and diamond sources
6073 %%%%%%%%%%%
6074
6075 %% Independent voltage source
6076 \pgfcircdeclarebipolescaled{sources}
6077 {}
6078 {\ctikzvalof{bipoles/vsource/height}}
6079 {vsource}
6080 {\ctikzvalof{bipoles/vsource/height}}
6081 {\ctikzvalof{bipoles/vsource/width}}
6082 {
6083
6084 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6085
6086 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6087 \pgf@circ@draworfill
6088 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6089 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6090 \pgfusepath{draw}
6091 }
6092
6093 %% To change the internal symbols of the voltage source american style
6094 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
6095 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
6096 %% Independent voltage source - American style
6097 \pgfcircdeclarebipolescaled{sources}
6098 {}
6099 {\ctikzvalof{bipoles/vsourceam/height}}
6100 {vsourceAM}
6101 {\ctikzvalof{bipoles/vsourceam/height}}
6102 {\ctikzvalof{bipoles/vsourceam/width}}
6103 {
6104
6105 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6106 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6107 \pgf@circ@draworfill
6108 \pgfsetcolor{\ctikzvalof{color}}
6109 \ifpgf@circ@oldvoltagedirection
6110 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6111 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6112 \else
6113 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6114 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6115 \fi
6116 }
6117
6118 %% Independent sinusoidal voltage source
6119 \pgfcircdeclarebipolescaled{sources}
6120 {}
6121 {\ctikzvalof{bipoles/vsourcesin/height}}
6122 {vsourcesin}
6123 {\ctikzvalof{bipoles/vsourcesin/height}}
6124 {\ctikzvalof{bipoles/vsourcesin/width}}
6125 {
6126
6127 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6128 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6129 \pgf@circ@draworfill
6130
6131 \pgf@circ@res@up = .5\pgf@circ@res@up
6132 \pgfscope
6133 \pgftransformrotate{90}
6134 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6135 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6136 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6137 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6138 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6139 \pgfusepath{draw}
6140 \endpgfscope
6141 }
6142
6143 % Square Voltage source - contributed by Alistair Kwan
6144 \pgfcircdeclarebipolescaled{sources}
6145 {}
6146 {\ctikzvalof{bipoles/vsourcesquare/height}}
6147 {vsourcesquare}
6148 {\ctikzvalof{bipoles/vsourcesquare/height}}
6149 {\ctikzvalof{bipoles/vsourcesquare/width}}
6150 {
6151 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6152 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6153 \pgf@circ@draworfill
6154 \pgf@circ@res@up = .5\pgf@circ@res@up
6155 \pgfscope
6156 \pgftransformrotate{90}
6157 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6158 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
6159 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
6160 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6161 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6162 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6163 \pgfusepath{draw}
6164 \endpgfscope
6165 }
6166
6167 % Triangle Voltage source - contributed by Ralf Farkas
6168 \pgfcircdeclarebipolescaled{sources}
6169 {}
6170 {\ctikzvalof{bipoles/vsourcetri/height}}
6171 {vsourcetri}
6172 {\ctikzvalof{bipoles/vsourcetri/height}}
6173 {\ctikzvalof{bipoles/vsourcetri/width}}
6174 {
6175
6176 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6177 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6178 \pgf@circ@draworfill
6179
6180 \pgf@circ@res@up = .5\pgf@circ@res@up
6181 \pgfscope
6182 \pgftransformrotate{90}
6183 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6184 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
6185 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
6186 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6187 \pgfusepath{draw}
6188 \endpgfscope
6189 }
6190
6191
6192 %% PV Source
6193 \pgfcircdeclarebipolescaled{sources}
6194 {}
6195 {\ctikzvalof{bipoles/pvsource/height}}
6196 {pvsource}
6197 {\ctikzvalof{bipoles/pvsource/height}}
6198 {\ctikzvalof{bipoles/pvsource/width}}
6199 {
6200 \pgfpointorigin
6201 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6202 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6204 \pgf@circ@draworfill
6205
6206 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
6207 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6208 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
6209 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6210 \pgfusepath{draw}
6211
6212 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6213 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
6214 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
6215
6216 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
6217 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
6218 \pgfusepath{draw}
6219
6220 %Arrow Part
6221 \pgfscope
6222 \pgfsetarrowsend{latex}
6223 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6224 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6225 \pgfusepath{draw}
6226 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6227 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6228 \pgfusepath{draw}
6229 \endpgfscope
6230
6231 }
6232
6233 %% Empty Source
6234 \pgfcircdeclarebipolescaled{sources}
6235 {}
6236 {\ctikzvalof{bipoles/esource/height}}
6237 {esource}
6238 {\ctikzvalof{bipoles/esource/height}}
6239 {\ctikzvalof{bipoles/esource/width}}
6240 {
6241 \pgfpointorigin
6242 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6243 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6244 \pgf@circ@draworfill
6245 }
6246
6247 %% DC Current Source with open shape
6248 \pgfcircdeclarebipolescaled{sources}
6249 {}
6250 {\ctikzvalof{bipoles/dcisource/height}}
6251 {dcisource}
6252 {\ctikzvalof{bipoles/dcisource/height}}
6253 {\ctikzvalof{bipoles/dcisource/width}}
6254 {
6255 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6256 \pgfpathmoveto{\pgfpointorigin}
6257 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6258 \pgf@circ@maybefill
6259 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
6260 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
6261 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
6262 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
6263 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
6264 \pgfusepath{draw}
6265
6266 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6267 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6268 \pgfusepath{draw}
6269 \pgfscope
6270 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6271 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6272 \endpgfscope
6273 }
6274
6275 %% DC-Voltage source
6276 \pgfcircdeclarebipolescaled{sources}
6277 {}
6278 {\ctikzvalof{bipoles/dcvsource/height}}
6279 {dcvsource}
6280 {\ctikzvalof{bipoles/dcvsource/height}}
6281 {\ctikzvalof{bipoles/dcvsource/width}}
6282 {
6283 \pgfpointorigin
6284 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6285 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6286 \pgf@circ@draworfill
6287 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
6288 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
6289 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
6290 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
6291 \pgfusepath{draw}
6292 }
6293
6294 %% Independent current source
6295 \pgfcircdeclarebipolescaled{sources}
6296 {}
6297 {\ctikzvalof{bipoles/isource/height}}
6298 {isource}
6299 {\ctikzvalof{bipoles/isource/height}}
6300 {\ctikzvalof{bipoles/isource/width}}
6301 {
6302 \pgfpointorigin
6303 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6304 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6305 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6306 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6307 \pgf@circ@draworfill
6308 }
6309
6310 %% Independent double oo source
6311 \pgfcircdeclarebipolescaled{sources}
6312 {}
6313 {\ctikzvalof{bipoles/oosource/height}}
6314 {oosource}
6315 {\ctikzvalof{bipoles/oosource/height}}
6316 {\ctikzvalof{bipoles/oosource/width}}
6317 {
6318 \pgfpointorigin
6319 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6320 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6321 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6322 \pgf@circ@maybefill
6323 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
6324 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
6325 \pgf@circ@draworfill
6326 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6327 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6328 \pgfusepath{draw}
6329 }
6330
6331 % % % winding symbols
6332 % triangle
6333 \def\pgf@circ@delta#1{
6334 \pgfscope
6335 \pgftransformscale{-.01\pgf@circ@res@left*#1}
6336 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6337 \pgftransformrotate{-\pgfcircmathresult}
6338
6339 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6340 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6342 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
6343 \pgfpathclose
6344 \pgfusepath{stroke}
6345 \endpgfscope
6346 }
6347
6348 % star
6349 \def\pgf@circ@wye#1{
6350 \pgfscope
6351 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6352 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6353 \pgftransformrotate{-\pgfcircmathresult}
6354
6355 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6356 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
6357 \pgfpathlineto{\pgfpointorigin}
6358 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
6359 \pgfpathmoveto{\pgfpointorigin}
6360 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
6361 \pgfusepath{stroke}
6362 \endpgfscope
6363 }
6364
6365 % zigzag
6366 \def\pgf@circ@zig#1{
6367 \pgfscope
6368 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6369 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6370 \pgftransformrotate{-\pgfcircmathresult}
6371
6372 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6373 \pgfpathmoveto{\pgfpointorigin}
6374 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
6375 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
6376
6377 \pgfpathmoveto{\pgfpointorigin}
6378 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
6379 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
6380
6381 \pgfpathmoveto{\pgfpointorigin}
6382 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
6383 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
6384 \pgfusepath{stroke}
6385 \endpgfscope
6386 }
6387
6388 % % % % round three-phase transformer
6389 \pgfcircdeclarebipolescaled{sources}
6390 {}
6391 {\ctikzvalof{bipoles/oosourcetrans/height}}
6392 {oosourcetrans}
6393 {\ctikzvalof{bipoles/oosourcetrans/height}}
6394 {\ctikzvalof{bipoles/oosourcetrans/width}}
6395 {
6396
6397 \pgfpointorigin
6398 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6399 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6400 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6401 \pgf@circ@maybefill
6402 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
6403 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6404 \pgf@circ@draworfill
6405 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6406 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6407 \pgfusepath{draw}
6408
6409
6410 % % % % draw inner symbols
6411
6412 %%primary winding
6413 \ifpgf@circ@prim@delta
6414 \pgfscope
6415 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6416 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6417 \endpgfscope
6418
6419 \else\ifpgf@circ@prim@wye
6420 \pgfscope
6421 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6422 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6423 \endpgfscope
6424
6425 \else\ifpgf@circ@prim@zig
6426 \pgfscope
6427 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6428 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6429 \endpgfscope
6430 \fi\fi\fi
6431
6432 %%secondary winding
6433 \ifpgf@circ@sec@delta
6434 \pgfscope
6435 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6436 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6437 \endpgfscope
6438
6439 \else\ifpgf@circ@sec@wye
6440 \pgfscope
6441 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6442 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6443 \endpgfscope
6444
6445 \else\ifpgf@circ@sec@zig
6446 \pgfscope
6447 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6448 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6449 \endpgfscope
6450 \fi\fi\fi
6451 }
6452
6453
6454 % % % % ooosource for three phase transformer
6455 \pgfcircdeclarebipolescaled{sources}
6456 {
6457 \anchor{right}{
6458 \northeast
6459 \pgf@y=0pt
6460 \pgfmathparse{
6461 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
6462 %%the sqrt must be > 0, the circles have to intersect
6463 sqrt(
6464 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
6465 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
6466 )
6467 }
6468 \pgf@x=\pgfmathresult\pgf@x
6469 }
6470 \anchor{east}{
6471 \northeast
6472 \pgf@y=0pt
6473 }
6474 \savedanchor{\centerprim}{
6475 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6476 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6477 \pgf@y=0pt
6478 \pgf@x=.5\pgf@circ@scaled@Rlen
6479 }
6480 \anchor{centerprim}{
6481 \centerprim
6482 }
6483 \savedanchor{\centersec}{
6484 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6485 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6486 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6487 \pgf@y=-\pgf@y
6488 \pgf@x=-\pgf@x
6489 }
6490 \anchor{centersec}{
6491 \centersec
6492 }
6493 \savedanchor{\centertert}{
6494 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6495 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6496 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6497 \pgf@y=\pgf@y
6498 \pgf@x=-\pgf@x
6499 }
6500 \anchor{centertert}{
6501 \centertert
6502 }
6503
6504 % add some anchors in case the are needed :)
6505 \anchor{prim1}{
6506 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6507 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6508 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}}
6509 }
6510 \anchor{prim2}{
6511 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6512 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6513 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}}
6514 }
6515 \anchor{sec1}{
6516 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6517 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6518 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6519 }
6520 \anchor{sec2}{
6521 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6522 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6523 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}}
6524 }
6525 \anchor{sec3}{
6526 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6527 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6528 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}}
6529 }
6530 \anchor{tert1}{
6531 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6532 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6533 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6534 }
6535 \anchor{tert2}{
6536 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6537 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6538 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}}
6539 }
6540 \anchor{tert3}{
6541 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6542 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6543 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}}
6544 }
6545 }
6546 {\ctikzvalof{bipoles/ooosource/height}}
6547 {ooosource}
6548 {\ctikzvalof{bipoles/ooosource/height}}
6549 {\ctikzvalof{bipoles/ooosource/height}}
6550 {
6551 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
6552
6553 % % filling
6554 % left
6555 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6556 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6557 \pgf@circ@maybefill
6558
6559 % up
6560 \pgfscope
6561 \pgfpointorigin
6562 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6563 \pgf@circ@maybefill
6564 \endpgfscope
6565 % down
6566 \pgfscope
6567 \pgfpointorigin
6568 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6569 \pgf@circ@draworfill
6570 \endpgfscope
6571
6572 % drawing
6573 % left
6574 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6575 \pgfusepath{draw}
6576
6577 % up
6578 \pgfscope
6579 \pgfpointorigin
6580 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6581 \pgfusepath{draw}
6582 \endpgfscope
6583
6584 % % % draw inner symbols
6585
6586 % % primary winding
6587 \ifpgf@circ@prim@delta
6588 \pgfscope
6589 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6590 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6591 \endpgfscope
6592
6593 \else\ifpgf@circ@prim@wye
6594 \pgfscope
6595 \pgftransformxshift{.6\pgf@circ@res@left}
6596 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6597 \endpgfscope
6598
6599 \else\ifpgf@circ@prim@zig
6600 \pgfscope
6601 \pgftransformxshift{.6\pgf@circ@res@left}
6602 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6603 \endpgfscope
6604 \fi\fi\fi
6605
6606 % % secondary winding
6607 \ifpgf@circ@sec@delta
6608 \pgfscope
6609 \pgfpointorigin
6610 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6611 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6612 \endpgfscope
6613
6614 \else\ifpgf@circ@sec@wye
6615 \pgfscope
6616 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6617 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6618 \endpgfscope
6619
6620 \else\ifpgf@circ@sec@zig
6621 \pgfscope
6622 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6623 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6624 \endpgfscope
6625 \fi\fi\fi
6626
6627 % % tertiary winding
6628 \ifpgf@circ@tert@delta
6629 \pgfscope
6630 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6631 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6632 \endpgfscope
6633
6634 \else\ifpgf@circ@tert@wye
6635 \pgfscope
6636 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6637 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6638 \endpgfscope
6639
6640 \else\ifpgf@circ@tert@zig
6641 \pgfscope
6642 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6643 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6644 \endpgfscope
6645 \fi\fi\fi
6646 }
6647
6648 %% Independent current source - American
6649 \pgfcircdeclarebipolescaled{sources}
6650 {}
6651 {\ctikzvalof{bipoles/isourceam/height}}
6652 {isourceAM}
6653 {\ctikzvalof{bipoles/isourceam/height}}
6654 {\ctikzvalof{bipoles/isourceam/width}}
6655 {
6656 \pgfpointorigin
6657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6658 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6659 \pgf@circ@draworfill
6660
6661 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6662 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6663 \pgfusepath{draw}
6664 \pgfscope
6665 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6666 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6667 \endpgfscope
6668 }
6669
6670 %% Independent sinusoidal current source
6671 \pgfcircdeclarebipolescaled{sources}
6672 {}
6673 {\ctikzvalof{bipoles/isource/height}}
6674 {isourcesin}
6675 {\ctikzvalof{bipoles/isource/height}}
6676 {\ctikzvalof{bipoles/isource/width}}
6677 {
6678 \pgfpointorigin
6679 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6680 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6681 \pgf@circ@draworfill
6682
6683 \pgf@circ@res@up = .5\pgf@circ@res@up
6684 \pgfscope
6685 \pgftransformrotate{90}
6686 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6687 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6688 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6689 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6690 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6691 \pgfusepath{draw}
6692 \endpgfscope
6693 }
6694
6695 %% Empty controlled source
6696 \pgfcircdeclarebipolescaled{csources}
6697 {}
6698 {\ctikzvalof{bipoles/ecsource/height}}
6699 {ecsource}
6700 {\ctikzvalof{bipoles/ecsource/height}}
6701 {\ctikzvalof{bipoles/ecsource/width}}
6702 {
6703
6704 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6705
6706 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6707 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6708 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6709 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6710 \pgfpathclose
6711 \pgf@circ@draworfill
6712 }
6713
6714 %% Controlled voltage source
6715 \pgfcircdeclarebipolescaled{csources}
6716 {}
6717 {\ctikzvalof{bipoles/cvsource/height}}
6718 {cvsource}
6719 {\ctikzvalof{bipoles/cvsource/height}}
6720 {\ctikzvalof{bipoles/cvsource/width}}
6721 {
6722
6723 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6724
6725 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6726 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6727 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6728 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6729 \pgfpathclose
6730 \pgf@circ@draworfill
6731
6732 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6733 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6734 \pgfusepath{draw}
6735 }
6736
6737 %% To change the internal symbols of the controlled voltage source american style
6738 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6739 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6740 %% Controlled voltage source - American
6741 \pgfcircdeclarebipolescaled{csources}
6742 {}
6743 {\ctikzvalof{bipoles/cvsourceam/height}}
6744 {cvsourceAM}
6745 {\ctikzvalof{bipoles/cvsourceam/height}}
6746 {\ctikzvalof{bipoles/cvsourceam/width}}
6747 {
6748 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6749 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6750 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6751 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6752 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6753 \pgfpathclose
6754 \pgf@circ@draworfill
6755
6756 \pgfsetcolor{\ctikzvalof{color}}
6757 \ifpgf@circ@oldvoltagedirection
6758 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6759 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6760 \else
6761 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6762 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6763 \fi
6764 }
6765
6766 %% Controlled sinusoidal voltage source
6767 \pgfcircdeclarebipolescaled{csources}
6768 {}
6769 {\ctikzvalof{bipoles/cvsourcesin/height}}
6770 {cvsourcesin}
6771 {\ctikzvalof{bipoles/cvsourcesin/height}}
6772 {\ctikzvalof{bipoles/cvsourcesin/width}}
6773 {
6774
6775 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6776
6777 \pgfscope
6778 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6780 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6781 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6782 \pgfpathclose
6783 \pgf@circ@draworfill
6784 \endpgfscope
6785
6786 \pgf@circ@res@up = .5\pgf@circ@res@up
6787 \pgfscope
6788 \pgftransformrotate{90}
6789 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6790 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6791 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6792 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6793 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6794 \pgfusepath{draw}
6795 \endpgfscope
6796 }
6797
6798 %% Controlled sinusoidal current source
6799 \pgfcircdeclarebipolescaled{csources}
6800 {}
6801 {\ctikzvalof{bipoles/cvsourcesin/height}}
6802 {cisourcesin}
6803 {\ctikzvalof{bipoles/cvsourcesin/height}}
6804 {\ctikzvalof{bipoles/cvsourcesin/width}}
6805 {
6806
6807 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6808
6809 \pgfscope
6810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6813 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6814 \pgfpathclose
6815 \pgf@circ@draworfill
6816 \endpgfscope
6817
6818 \pgf@circ@res@up = .5\pgf@circ@res@up
6819 \pgfscope
6820 \pgftransformrotate{90}
6821 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6822 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6823 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6824 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6825 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6826 \pgfusepath{draw}
6827 \endpgfscope
6828 }
6829
6830 %% Controlled current source
6831 \pgfcircdeclarebipolescaled{csources}
6832 {}
6833 {\ctikzvalof{bipoles/cisource/height}}
6834 {cisource}
6835 {\ctikzvalof{bipoles/cisource/height}}
6836 {\ctikzvalof{bipoles/cisource/width}}
6837 {
6838
6839 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6840
6841 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6842 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6843 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6844 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6845 \pgfpathclose
6846 \pgf@circ@draworfill
6847
6848 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6849 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6850 \pgfusepath{draw}
6851 }
6852
6853 %% Controlled current source - American
6854 \pgfcircdeclarebipolescaled{csources}
6855 {}
6856 {\ctikzvalof{bipoles/cisourceam/height}}
6857 {cisourceAM}
6858 {\ctikzvalof{bipoles/cisourceam/height}}
6859 {\ctikzvalof{bipoles/cisourceam/width}}
6860 {
6861 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6862
6863 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6864 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6865 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6867 \pgfpathclose
6868 \pgf@circ@draworfill
6869 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6870 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6871 \pgfusepath{draw}
6872 \pgfscope
6873 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6874 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6875 \endpgfscope
6876 }
6877
6878 %% Cute Independent voltage source
6879 \pgfcircdeclarebipolescaled{sources}
6880 {}
6881 {\ctikzvalof{bipoles/vsource/height}}
6882 {vsourceC}
6883 {\ctikzvalof{bipoles/vsource/height}}
6884 {\ctikzvalof{bipoles/vsource/width}}
6885 {
6886 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6887 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6888 \pgf@circ@draworfill
6889 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6890 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6891 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6892 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6893 \pgfsetroundcap\pgfusepath{draw}
6894 }
6895
6896 %% Cute Independent current source
6897 \pgfcircdeclarebipolescaled{sources}
6898 {}
6899 {\ctikzvalof{bipoles/isource/height}}
6900 {isourceC}
6901 {\ctikzvalof{bipoles/isource/height}}
6902 {\ctikzvalof{bipoles/isource/width}}
6903 {
6904 \pgfpointorigin
6905 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6906 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6907 \pgf@circ@draworfill
6908 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6909 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6910 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6912 \pgfsetroundcap\pgfusepath{draw}
6913 }
6914
6915 %% Cute Controlled voltage source
6916 \pgfcircdeclarebipolescaled{csources}
6917 {}
6918 {\ctikzvalof{bipoles/cvsource/height}}
6919 {cvsourceC}
6920 {\ctikzvalof{bipoles/cvsource/height}}
6921 {\ctikzvalof{bipoles/cvsource/width}}
6922 {
6923 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6925 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6927 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6929 \pgf@circ@draworfill
6930 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6931 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6932 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6933 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6934 \pgfsetroundcap\pgfusepath{draw}
6935 }
6936
6937 %% Cute Controlled current source
6938 \pgfcircdeclarebipolescaled{csources}
6939 {}
6940 {\ctikzvalof{bipoles/cisource/height}}
6941 {cisourceC}
6942 {\ctikzvalof{bipoles/cisource/height}}
6943 {\ctikzvalof{bipoles/cisource/width}}
6944 {
6945 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6946 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6947 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6948 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6949 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6950 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6951 \pgf@circ@draworfill
6952 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6953 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6955 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6956 \pgfsetroundcap\pgfusepath{draw}
6957 }
6958
6959 %% Noise voltage source
6960 \pgfcircdeclarebipolescaled{sources}
6961 {}
6962 {\ctikzvalof{bipoles/vsource/height}}
6963 {vsourceN}
6964 {\ctikzvalof{bipoles/vsource/height}}
6965 {\ctikzvalof{bipoles/vsource/width}}
6966 {
6967 \pgfscope
6968 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6969 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6970 %
6971 \pgf@circ@scaled@Rlen=\scaledRlen
6972 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6973 \edef\pgf@noise@temp{dashed}
6974 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6975 \ifx\pgf@noise@temp\pgf@noise@fill
6976 % fillable in this case
6977 \pgf@circ@draworfillandclip
6978 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6979 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6980 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6981 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6982 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6985 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6988 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6989 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6990 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6991 %
6992 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6994 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6995 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6996 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6997 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6998 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7000 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7001 \pgfusepath{draw}
7002 \else
7003 \pgfsetfillcolor{\pgf@noise@fill}
7004 \pgfusepath{draw,fill}
7005 \fi
7006 \endpgfscope
7007 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7008 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7009 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7010 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7011 \pgfsetroundcap\pgfusepath{draw}
7012 }
7013 %% Noise current source
7014
7015 \pgfcircdeclarebipolescaled{sources}
7016 {}
7017 {\ctikzvalof{bipoles/isource/height}}
7018 {isourceN}
7019 {\ctikzvalof{bipoles/isource/height}}
7020 {\ctikzvalof{bipoles/isource/width}}
7021 {
7022 \pgfpointorigin
7023 \pgfscope
7024 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7025 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7026 %
7027 \pgf@circ@scaled@Rlen=\scaledRlen
7028 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
7029 \edef\pgf@noise@temp{dashed}
7030 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
7031 \ifx\pgf@noise@temp\pgf@noise@fill
7032 % fillable in this case
7033 \pgf@circ@draworfillandclip
7034 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
7035 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
7036 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7037 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7038 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7039 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7040 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7041 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7042 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7043 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7044 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7045 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7046 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7047 %
7048 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
7049 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7050 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7051 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7052 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7053 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7054 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7056 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7057 \pgfusepath{draw}
7058 \else
7059 \pgfsetfillcolor{\pgf@noise@fill}
7060 \pgfusepath{draw,fill}
7061 \fi
7062 \endpgfscope
7063 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7064 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7065 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
7066 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
7067 \pgfsetroundcap\pgfusepath{draw}
7068 }
7069
7070 %%%%%%%%%%%%%%
7071 %% Diodes
7072 %%%%%%%%%%%%%%
7073
7074 %% Black generic diode
7075 \pgfcircdeclarebipolescaled{diodes}
7076 {}
7077 {\ctikzvalof{bipoles/diode/height}}
7078 {fulldiode}
7079 {\ctikzvalof{bipoles/diode/height}}
7080 {\ctikzvalof{bipoles/diode/width}}
7081 {
7082
7083 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7084
7085 \pgfscope
7086 \pgftransformxshift{\pgf@circ@res@left}
7087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7088 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7089 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7091 \pgfusepath{draw,fill}
7092 \endpgfscope
7093 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7094 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7095 \pgfusepath{draw}
7096 }
7097
7098 %% Black Zener diode
7099 \pgfcircdeclarebipolescaled{diodes}
7100 {}
7101 {\ctikzvalof{bipoles/diode/height}}
7102 {fullzdiode}
7103 {\ctikzvalof{bipoles/diode/height}}
7104 {\ctikzvalof{bipoles/diode/width}}
7105 {
7106
7107 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7108
7109 \pgfscope
7110 \pgftransformxshift{\pgf@circ@res@left}
7111 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7112 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7113 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7114 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7115 \pgfusepath{draw,fill}
7116 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7118 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7119 \pgfusepath{draw}
7120 \endpgfscope
7121 }
7122
7123 %% Black alternative zigzag Zener diode
7124 \pgfcircdeclarebipolescaled{diodes}
7125 {% fix the anchor border
7126 \pgfcirc@border@extend@updown{1.3}{1.3}
7127 }
7128 {\ctikzvalof{bipoles/diode/height}}
7129 {fullzzdiode}
7130 {\ctikzvalof{bipoles/diode/height}}
7131 {\ctikzvalof{bipoles/diode/width}}
7132 {
7133
7134 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7135
7136 \pgfscope
7137 \pgftransformxshift{\pgf@circ@res@left}
7138 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7139 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7140 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7141 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7142 \pgfusepath{draw,fill}
7143 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7144 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7145 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7146 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7147 \pgfusepath{draw}
7148 \endpgfscope
7149 }
7150
7151 %% Black Schottky diode
7152 \pgfcircdeclarebipolescaled{diodes}
7153 {}
7154 {\ctikzvalof{bipoles/diode/height}}
7155 {fullsdiode}
7156 {\ctikzvalof{bipoles/diode/height}}
7157 {\ctikzvalof{bipoles/diode/width}}
7158 {
7159
7160 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7161 \pgfscope
7162 \pgftransformxshift{\pgf@circ@res@left}
7163 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7164 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7165 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7166 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7167 \pgfusepath{draw,fill}
7168
7169 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7170 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7171 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7172 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7174 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7175 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7176 \pgfusepath{draw}
7177 \endpgfscope
7178
7179 }
7180
7181 %% Black tunnel diode
7182 \pgfcircdeclarebipolescaled{diodes}
7183 {}
7184 {\ctikzvalof{bipoles/diode/height}}
7185 {fulltdiode}
7186 {\ctikzvalof{bipoles/diode/height}}
7187 {\ctikzvalof{bipoles/diode/width}}
7188 {
7189
7190 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7191 \pgfscope
7192 \pgftransformxshift{\pgf@circ@res@left}
7193 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7194 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7195 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7196 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7197 \pgfusepath{draw,fill}
7198
7199 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7202 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7203 \pgfusepath{draw}
7204 \endpgfscope
7205 }
7206
7207 %
7208 % draw LED arrows
7209 %
7210 \def\pgf@circ@draw@ledarrows{%
7211 \pgfsetlinewidth{\pgfstartlinewidth}
7212 \pgfsetarrowsend{latexslim}
7213 \ifpgf@led@fliparrows
7214 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7215 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7216 \pgfusepath{draw}
7217 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7218 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7219 \pgfusepath{draw}
7220 \else
7221 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7222 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7223 \pgfusepath{draw}
7224 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7225 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7226 \pgfusepath{draw}
7227 \fi
7228 }
7229 %
7230 % ---and photodiode arrows
7231 %
7232 \def\pgf@circ@draw@pdarrows{%
7233 \pgfsetlinewidth{\pgfstartlinewidth}
7234 \pgfsetarrowsstart{latexslim}
7235 \ifpgf@pd@fliparrows
7236 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7237 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7238 \pgfusepath{draw}
7239 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7240 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7241 \pgfusepath{draw}
7242 \else
7243 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7244 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7245 \pgfusepath{draw}
7246 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7247 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7248 \pgfusepath{draw}
7249 \fi
7250 }
7251 %% Black light emitting diode
7252 \pgfcircdeclarebipolescaled{diodes}
7253 {% fix the anchor border
7254 \pgfcirc@border@extend@updown{1.8}{1}
7255 }
7256 {\ctikzvalof{bipoles/diode/height}}
7257 {fulllediode}
7258 {\ctikzvalof{bipoles/diode/height}}
7259 {\ctikzvalof{bipoles/diode/width}}
7260 {
7261
7262 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7263 \pgfscope
7264 \pgftransformxshift{\pgf@circ@res@left}
7265 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7266 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7267 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7268 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7269 \pgfusepath{draw,fill}
7270 \endpgfscope
7271 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7272 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7273 \pgfusepath{draw}
7274
7275 \pgf@circ@draw@ledarrows
7276 }
7277
7278 %% Black photodiode
7279 \pgfcircdeclarebipolescaled{diodes}
7280 {% fix the anchor border
7281 \pgfcirc@border@extend@updown{1.8}{1}
7282 }
7283 {\ctikzvalof{bipoles/diode/height}}
7284 {fullpdiode}
7285 {\ctikzvalof{bipoles/diode/height}}
7286 {\ctikzvalof{bipoles/diode/width}}
7287 {
7288
7289 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7290 \pgfscope
7291 \pgftransformxshift{\pgf@circ@res@left}
7292 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7293 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7294 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7296 \pgfusepath{draw,fill}
7297 \endpgfscope
7298 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7299 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7300 \pgfusepath{draw}
7301
7302 \pgf@circ@draw@pdarrows
7303 }
7304
7305 %% Black varcap
7306 \pgfcircdeclarebipolescaled{diodes}
7307 {}
7308 {\ctikzvalof{bipoles/varcap/height}}
7309 {fullvarcap}
7310 {\ctikzvalof{bipoles/varcap/height}}
7311 {\ctikzvalof{bipoles/varcap/width}}
7312 {
7313 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7314 \pgfsetlinewidth{\pgf@circ@res@temp}
7315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7316 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7317 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7318 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7319 \pgfusepath{draw,fill}
7320 %
7321 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7322 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7323 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7324 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7325 \pgfusepath{draw}
7326 }
7327
7328 %% Code for the diode triangle
7329 \def\pgf@circ@basicdiodeshape{
7330 % \pgfscope
7331 \pgftransformxshift{\pgf@circ@res@left}
7332 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7333 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7334 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7335 \pgfpathclose
7336 \pgf@circ@draworfill
7337 \pgfscope
7338 % to allow filling, we need to draw explicitly the stroke here.
7339 \pgfsetlinewidth{\pgfstartlinewidth}
7340 \ifpgf@circuit@bipole@strokedsymbol
7341 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7342 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7343 \pgfusepath{draw}
7344 \fi
7345 \endpgfscope
7346 % \endpgfscope
7347 }
7348
7349 %% Empty generic diode
7350 \pgfcircdeclarebipolescaled{diodes}
7351 {}
7352 {\ctikzvalof{bipoles/diode/height}}
7353 {emptydiode}
7354 {\ctikzvalof{bipoles/diode/height}}
7355 {\ctikzvalof{bipoles/diode/width}}
7356 {
7357 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7358 \pgfscope
7359 \pgf@circ@basicdiodeshape
7360 \endpgfscope
7361 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7363 \pgfusepath{draw}
7364 }
7365
7366 %% Empty Zener diode
7367 \pgfcircdeclarebipolescaled{diodes}
7368 {}
7369 {\ctikzvalof{bipoles/diode/height}}
7370 {emptyzdiode}
7371 {\ctikzvalof{bipoles/diode/height}}
7372 {\ctikzvalof{bipoles/diode/width}}
7373 {
7374
7375 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7376
7377 \pgfscope
7378 \pgf@circ@basicdiodeshape
7379 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7380 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7381 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7382 \pgfusepath{draw}
7383 \endpgfscope
7384 }
7385
7386 %% Empty alternative zigzag Zener diode
7387 \pgfcircdeclarebipolescaled{diodes}
7388 {% fix the anchor border
7389 \pgfcirc@border@extend@updown{1.3}{1.3}
7390 }
7391 {\ctikzvalof{bipoles/diode/height}}
7392 {emptyzzdiode}
7393 {\ctikzvalof{bipoles/diode/height}}
7394 {\ctikzvalof{bipoles/diode/width}}
7395 {
7396
7397 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7398
7399 \pgfscope
7400 \pgf@circ@basicdiodeshape
7401 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7403 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7404 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7405 \pgfusepath{draw}
7406 \endpgfscope
7407 }
7408 %% Empty Schottky diode
7409 \pgfcircdeclarebipolescaled{diodes}
7410 {}
7411 {\ctikzvalof{bipoles/diode/height}}
7412 {emptysdiode}
7413 {\ctikzvalof{bipoles/diode/height}}
7414 {\ctikzvalof{bipoles/diode/width}}
7415 {
7416
7417 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7418 \pgfscope
7419 \pgf@circ@basicdiodeshape
7420 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7421 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7422 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7425 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7426 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7427 \pgfusepath{draw}
7428 \endpgfscope
7429
7430 }
7431
7432 %% Empty tunnel diode
7433 \pgfcircdeclarebipolescaled{diodes}
7434 {}
7435 {\ctikzvalof{bipoles/diode/height}}
7436 {emptytdiode}
7437 {\ctikzvalof{bipoles/diode/height}}
7438 {\ctikzvalof{bipoles/diode/width}}
7439 {
7440
7441 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7442 \pgfscope
7443 \pgf@circ@basicdiodeshape
7444 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7445 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7446 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7447 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7448 \pgfusepath{draw}
7449 \endpgfscope
7450 }
7451
7452 %% Empty light emitting diode
7453 \pgfcircdeclarebipolescaled{diodes}
7454 {% fix the anchor border
7455 \pgfcirc@border@extend@updown{1.8}{1}
7456 }
7457 {\ctikzvalof{bipoles/diode/height}}
7458 {emptylediode}
7459 {\ctikzvalof{bipoles/diode/height}}
7460 {\ctikzvalof{bipoles/diode/width}}
7461 {
7462
7463 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7464 \pgfscope
7465 \pgf@circ@basicdiodeshape
7466 \endpgfscope
7467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7469 \pgfusepath{draw}
7470
7471 \pgf@circ@draw@ledarrows
7472 }
7473
7474 %% Empty photodiode
7475 \pgfcircdeclarebipolescaled{diodes}
7476 {% fix the anchor border
7477 \pgfcirc@border@extend@updown{1.8}{1}
7478 }
7479 {\ctikzvalof{bipoles/diode/height}}
7480 {emptypdiode}
7481 {\ctikzvalof{bipoles/diode/height}}
7482 {\ctikzvalof{bipoles/diode/width}}
7483 {
7484
7485 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7486 \pgfscope
7487 \pgf@circ@basicdiodeshape
7488 \endpgfscope
7489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7490 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7491 \pgfusepath{draw}
7492
7493 \pgf@circ@draw@pdarrows
7494 }
7495
7496 %% Empty varcap
7497 \pgfcircdeclarebipolescaled{diodes}
7498 {}
7499 {\ctikzvalof{bipoles/varcap/height}}
7500 {emptyvarcap}
7501 {\ctikzvalof{bipoles/varcap/height}}
7502 {\ctikzvalof{bipoles/varcap/width}}
7503 {
7504 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7505 \pgfsetlinewidth{\pgf@circ@res@temp}
7506 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7507 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7508 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7509 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7510 \pgfpathclose
7511 \pgf@circ@draworfill
7512 \pgfscope
7513 % to allow filling, we need to draw explicitily the stroke here.
7514 \pgfsetlinewidth{\pgfstartlinewidth}
7515 \ifpgf@circuit@bipole@strokedsymbol
7516 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7517 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7518 \pgfusepath{draw}
7519 \fi
7520 \endpgfscope
7521 %
7522 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7523 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7524 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7526 \pgfusepath{draw}
7527 }
7528
7529 %% Empty bidirectionaldiode
7530 \pgfcircdeclarebipolescaled{diodes}
7531 {}
7532 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7533 {emptybidirectionaldiode}
7534 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7535 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7536 {
7537
7538 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7539
7540 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7541 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7542
7543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7544 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7546 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7547
7548 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7549 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7550 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7551 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7552
7553 \pgf@circ@draworfill
7554
7555 \pgfsetlinewidth{\pgfstartlinewidth}
7556
7557 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7558 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7559
7560 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7561 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7562
7563 \pgfusepath{draw}
7564 }
7565
7566 %% Full bidirectionaldiode
7567 \pgfcircdeclarebipolescaled{diodes}
7568 {}
7569 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7570 {fullbidirectionaldiode}
7571 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7572 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7573 {
7574
7575 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7576
7577 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7578 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7579
7580 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7581 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7582 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7583 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7584
7585 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7586 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7587 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7588 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7589
7590 \pgfusepath{draw, fill}
7591
7592 \pgfsetlinewidth{\pgfstartlinewidth}
7593
7594 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7595 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7596
7597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7599
7600 \pgfusepath{draw}
7601 }
7602
7603 %% Black thyristor
7604 \pgfcircdeclarebipolescaled{diodes}
7605 {
7606 \anchor{gate}{\northeast}
7607 \anchor{anode}{\southwest\pgf@y=0cm}
7608 \anchor{G}{\northeast}
7609 \anchor{cathode}{\northeast\pgf@y=0cm }
7610 }
7611 {\ctikzvalof{tripoles/thyristor/height 2}}
7612 {fullthyristor}
7613 {\ctikzvalof{tripoles/thyristor/height}}
7614 {\ctikzvalof{tripoles/thyristor/width}}
7615 {
7616
7617 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7618
7619 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7620 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7621
7622 \pgfscope
7623 \pgftransformxshift{\pgf@circ@res@other}
7624 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7625
7626 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7627 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7628 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7629 \pgfusepath{draw,fill}
7630
7631 \pgfsetlinewidth{\pgfstartlinewidth}
7632
7633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7634 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7635 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7636 \pgfusepath{draw}
7637 \endpgfscope
7638
7639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7641
7642 \pgfusepath{draw}
7643
7644 \pgfsetlinewidth{\pgfstartlinewidth}
7645
7646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7647 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7648
7649 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7651
7652 \pgfusepath{draw}
7653
7654 }
7655
7656 %% Empty thyristor
7657
7658 \pgfcircdeclarebipolescaled{diodes}
7659 {
7660 \anchor{gate}{\northeast}
7661 \anchor{anode}{\southwest\pgf@y=0cm}
7662 \anchor{G}{\northeast}
7663 \anchor{cathode}{\northeast\pgf@y=0cm }
7664 }
7665 {\ctikzvalof{tripoles/thyristor/height 2}}
7666 {emptythyristor}
7667 {\ctikzvalof{tripoles/thyristor/height}}
7668 {\ctikzvalof{tripoles/thyristor/width}}
7669 {
7670
7671 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7672
7673 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7674 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7675
7676 \pgfscope
7677 \pgftransformxshift{\pgf@circ@res@other}
7678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7679
7680 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7681 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7682 \pgfpathclose
7683 \pgf@circ@draworfill
7684 \pgfscope
7685 % to allow filling, we need to draw explicitily the stroke here.
7686 \pgfsetlinewidth{\pgfstartlinewidth}
7687 \ifpgf@circuit@bipole@strokedsymbol
7688 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7689 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7690 \pgfusepath{draw}
7691 \fi
7692 \endpgfscope
7693
7694 \pgfsetlinewidth{\pgfstartlinewidth}
7695
7696 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7697 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7698 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7699 \pgfusepath{draw}
7700 \endpgfscope
7701
7702 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7703 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7704
7705 \pgfusepath{draw}
7706
7707 \pgfsetlinewidth{\pgfstartlinewidth}
7708
7709 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7710 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7711
7712 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7713 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7714
7715 \pgfusepath{draw}
7716 }
7717
7718 %% Empty triac
7719 \pgfcircdeclarebipolescaled{diodes}
7720 {
7721 \anchor{gate}{\northeast}
7722 \anchor{anode}{\southwest\pgf@y=0cm}
7723 \anchor{G}{\northeast}
7724 \anchor{cathode}{\northeast\pgf@y=0cm }
7725 }
7726 {\ctikzvalof{tripoles/triac/height}}
7727 {emptytriac}
7728 {\ctikzvalof{tripoles/triac/height}}
7729 {\ctikzvalof{tripoles/triac/width}}
7730 {
7731
7732 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7733
7734 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7735 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7736
7737 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7738 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7739 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7741
7742 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7743 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7744 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7746
7747 \pgf@circ@draworfill
7748
7749 \pgfsetlinewidth{\pgfstartlinewidth}
7750
7751 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7752 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7753 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7754
7755 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7756 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7757
7758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7760
7761 \pgfusepath{draw}
7762 }
7763
7764 %% Full triac
7765 \pgfcircdeclarebipolescaled{diodes}
7766 {
7767 \anchor{gate}{\northeast}
7768 \anchor{anode}{\southwest\pgf@y=0cm}
7769 \anchor{G}{\northeast}
7770 \anchor{cathode}{\northeast\pgf@y=0cm }
7771 }
7772 {\ctikzvalof{tripoles/triac/height}}
7773 {fulltriac}
7774 {\ctikzvalof{tripoles/triac/height}}
7775 {\ctikzvalof{tripoles/triac/width}}
7776 {
7777 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7778
7779 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7780 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7781
7782 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7783 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7784 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7785 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7786
7787 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7788 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7789 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7790 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7791
7792 \pgfusepath{draw,fill}
7793
7794 \pgfsetlinewidth{\pgfstartlinewidth}
7795
7796 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7797 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7798 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7799
7800 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7802
7803 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7804 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7805
7806 \pgfusepath{draw}
7807 }
7808
7809 %%%%%%%%%%%%%
7810 %% switches
7811 %%%%%%%%%%%%%
7812
7813 %% (Closing) SPST
7814 \pgfcircdeclarebipolescaled{switches}
7815 {}
7816 {\ctikzvalof{bipoles/spst/depth}}
7817 {cspst}
7818 {\ctikzvalof{bipoles/spst/height}}
7819 {\ctikzvalof{bipoles/spst/width}}
7820 {
7821 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7822 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7823 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7824 \pgfusepath{draw}
7825
7826 \pgfscope
7827 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7828 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
7829 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
7830 \pgfsetarrowsend{latexslim}
7831 \pgfsetbeveljoin
7832 \pgfusepath{draw}
7833 \endpgfscope
7834 }
7835
7836 %% Opening SPST
7837 \pgfcircdeclarebipolescaled{switches}
7838 {}
7839 {\ctikzvalof{bipoles/spst/depth}}
7840 {ospst}
7841 {\ctikzvalof{bipoles/spst/height}}
7842 {\ctikzvalof{bipoles/spst/width}}
7843 {
7844
7845 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7846 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7847 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7848 \pgfusepath{draw}
7849
7850 \pgfscope
7851 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7852 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7853 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
7854 \pgfsetarrowsend{latexslim}
7855 \pgfsetbeveljoin
7856 \pgfusepath{draw}
7857 \endpgfscope
7858 }
7859
7860 %% Normal open Switch
7861 \pgfcircdeclarebipolescaled{switches}
7862 {}
7863 {\ctikzvalof{bipoles/nos/depth}}
7864 {nos}
7865 {\ctikzvalof{bipoles/nos/height}}
7866 {\ctikzvalof{bipoles/nos/width}}
7867 {
7868
7869 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7870 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7871 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7872 \pgfsetbuttcap
7873 \pgfusepath{draw}
7874 }
7875
7876 %% Normal closed Switch
7877 \pgfcircdeclarebipolescaled{switches}
7878 {}
7879 {\ctikzvalof{bipoles/ncs/depth}}
7880 {ncs}
7881 {\ctikzvalof{bipoles/ncs/height}}
7882 {\ctikzvalof{bipoles/ncs/width}}
7883 {
7884 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7885 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7886 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7887 \pgfusepath{draw}
7888 \pgfsetlinewidth{\pgfstartlinewidth}
7889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7890 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
7891 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
7892 \pgfusepath{draw}
7893 }
7894
7895 %% Push Button
7896 \pgfcircdeclarebipolescaled{switches}
7897 {
7898 \anchor{tip}{\northeast\pgf@x=0pt\relax}
7899 }
7900 {\ctikzvalof{bipoles/pushbutton/height 2}}
7901 {pushbutton}
7902 {\ctikzvalof{bipoles/pushbutton/height}}
7903 {\ctikzvalof{bipoles/pushbutton/width}}
7904 {
7905 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7906 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
7907 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
7908 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
7909 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7910 \pgfusepath{draw}
7911
7912 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7913 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7914 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7915 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7916 }
7917
7918 %% Normally closed Push Button
7919 \pgfcircdeclarebipolescaled{switches}
7920 {
7921 \anchor{tip}{\northeast\pgf@x=0pt\relax}
7922 }
7923 {\ctikzvalof{bipoles/pushbutton/height 2}}
7924 {ncpushbutton}
7925 {\ctikzvalof{bipoles/pushbutton/height}}
7926 {\ctikzvalof{bipoles/pushbutton/width}}
7927 {
7928 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7929 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7930 % Warning, if the nodes will have a class, we have to touch this.
7931 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7932 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
7933 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
7934 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
7935 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7936 \pgfusepath{draw}
7937 %
7938 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7939 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7940 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7941 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7942 }
7943 %% Push Button (normally closed but now open :-) see
7944 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
7945 \pgfcircdeclarebipolescaled{switches}
7946 {
7947 \anchor{tip}{
7948 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7949 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
7950 \pgf@x=0pt\relax
7951 }
7952 }
7953 {\ctikzvalof{bipoles/pushbutton/height 2}}
7954 {pushbuttonc}
7955 {\ctikzvalof{bipoles/pushbutton/height}}
7956 {\ctikzvalof{bipoles/pushbutton/width}}
7957 {
7958 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7959 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
7961 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
7962 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
7963 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
7964 \pgfusepath{draw}
7965
7966 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7967 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7968 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7969 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7970 }
7971
7972 %% Normally closed Push Button now open
7973 \pgfcircdeclarebipolescaled{switches}
7974 {
7975 \anchor{tip}{
7976 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7977 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
7978 \pgf@x=0pt\relax
7979 }
7980 }
7981 {\ctikzvalof{bipoles/pushbutton/height 2}}
7982 {ncpushbuttono}
7983 {\ctikzvalof{bipoles/pushbutton/height}}
7984 {\ctikzvalof{bipoles/pushbutton/width}}
7985 {
7986 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7987 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7988 % Warning, if the nodes will have a class, we have to touch this.
7989 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7990 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
7991 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
7992 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
7993 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
7994 \pgfusepath{draw}
7995 %
7996 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7997 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7998 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7999 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8000 }
8001 %%% reed switches
8002 \pgfcircdeclarebipolescaled{switches}
8003 {}
8004 {\ctikzvalof{bipoles/reed/depth}}
8005 {reed}
8006 {\ctikzvalof{bipoles/reed/height}}
8007 {\ctikzvalof{bipoles/reed/width}}
8008 {
8009 % this is designed to be the same as a "nos".
8010 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
8011 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
8012 \pgfscope
8013 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8014 % eclosure
8015 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
8016 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
8017 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
8018 \pgfpatharc{270}{90}{\pgf@circ@res@up}
8019 \pgfpathclose
8020 \pgf@circ@draworfill
8021 % switch
8022 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8023 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
8024 % connection lines
8025 \pgfsetbuttcap
8026 \pgfusepath{draw}
8027 \endpgfscope
8028 % connection lines
8029 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8030 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8031 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8032 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
8033 \pgfusepath{draw}
8034 }
8035
8036 % cute switch "to" shapes help function
8037 % #1 -> name
8038 % #2 -> barposition
8039 % #3 -> arrowcode
8040 \long\def\pgfcircdeclarecutesw#1#2#3{
8041 \pgfcircdeclarebipolescaled{switches}
8042 {
8043 \savedanchor\midlever{
8044 % these values are calculated when we create the definition of the shape.
8045 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8046 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8047 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
8048 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8049 \pgf@circ@res@down = -.5\pgf@y
8050 \pgf@circ@res@up = .5\pgf@y
8051 \pgfextracty{\pgf@circ@res@other}{#2}
8052 \pgf@x=0pt
8053 \pgf@y=.5\pgf@circ@res@other
8054 }
8055 % radius of the connector
8056 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8057 % If cnnecting nodes are scaled, we have to modify this
8058 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
8059 % shapename
8060 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
8061 % shape type
8062 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
8063 % mid of the lever, to stack switches
8064 \anchor{mid}{\midlever}
8065 \anchor{cout}{\northeast \pgf@y=0cm}
8066 \anchor{cin}{\southwest\pgf@y=0cm}
8067 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
8068 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
8069 }
8070 {\ctikzvalof{bipoles/cuteswitch/height 2}}
8071 {#1}
8072 {\ctikzvalof{bipoles/cuteswitch/height}}
8073 {\ctikzvalof{bipoles/cuteswitch/width}}{
8074 \pgfscope
8075 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8076 % If cnnecting nodes are scaled, we have to modify this
8077 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8078 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8079 \pgfsetlinewidth{2\pgf@circ@res@temp}
8080 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8081 \pgfpathlineto{#2}
8082 \pgfsetroundcap\pgfusepath{draw}
8083 \endpgfscope
8084 \pgfscope % arrow
8085 #3
8086 \endpgfscope
8087 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8088 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
8089 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8090 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
8091 }
8092 }
8093
8094 %% closed cute switch
8095 \pgfcircdeclarecutesw{cuteclosedswitch}
8096 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8097 {}
8098
8099 %% open cute switch
8100 \pgfcircdeclarecutesw{cuteopenswitch}
8101 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8102 {}
8103
8104 %% closing cute switch
8105 \pgfcircdeclarecutesw{cuteclosingswitch}
8106 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8107 {
8108 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8109 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8110 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
8111 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
8112 \pgfsetarrowsend{latexslim}
8113 \pgfusepath{draw}
8114 }
8115
8116 %% opening cute switch
8117 \pgfcircdeclarecutesw{cuteopeningswitch}
8118 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8119 {
8120 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8121 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8122 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
8123 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
8124 \pgfsetarrowsend{latexslim}
8125 \pgfusepath{draw}
8126 }
8127
8128 %%%%%%%%%%%%%%%%%
8129 %% Instruments
8130 %%%%%%%%%%%%%%%%%
8131
8132 % % METERINGSHAPE
8133 \long\def\drawmeteringcircle{
8134 \def\pgf@circ@temp{right}
8135 \ifx\tikz@res@label@pos\pgf@circ@temp
8136 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8137 \else
8138 \def\pgf@circ@temp{below}
8139 \ifx\tikz@res@label@pos\pgf@circ@temp
8140 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8141 \else
8142 \pgf@circ@res@step=1.2\pgf@circ@res@up
8143 \fi
8144 \fi
8145 %draw connections to circle
8146 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8147 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
8148 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
8149 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8150 \pgfusepath{draw}
8151 %draw circle
8152 \pgfscope
8153 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8154 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
8155 \pgf@circ@draworfill
8156 \endpgfscope
8157 %draw arrow
8158 \pgfscope
8159 \pgfsetarrowsend{latex}
8160 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8161 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
8162 \pgfusepath{draw}
8163 \endpgfscope
8164 }
8165
8166 %AMPEREMETER
8167 \pgfcircdeclarebipolescaled{instruments}
8168 {}
8169 {\ctikzvalof{bipoles/ammeter/height}}
8170 {ammeter}
8171 {\ctikzvalof{bipoles/ammeter/height}}
8172 {\ctikzvalof{bipoles/ammeter/width}}
8173 {
8174 \drawmeteringcircle
8175 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
8176 }
8177 %OHMMETER
8178 \pgfcircdeclarebipolescaled{instruments}
8179 {}
8180 {\ctikzvalof{bipoles/ohmmeter/height}}
8181 {ohmmeter}
8182 {\ctikzvalof{bipoles/ohmmeter/height}}
8183 {\ctikzvalof{bipoles/ohmmeter/width}}
8184 {
8185 \drawmeteringcircle
8186 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
8187 }
8188 %VOLTMETER
8189 \pgfcircdeclarebipolescaled{instruments}
8190 {}
8191 {\ctikzvalof{bipoles/voltmeter/height}}
8192 {voltmeter}
8193 {\ctikzvalof{bipoles/voltmeter/height}}
8194 {\ctikzvalof{bipoles/voltmeter/width}}
8195 {
8196 \drawmeteringcircle
8197 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
8198
8199 }
8200
8201 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
8202 \pgfcircdeclarebipolescaled{instruments}
8203 {
8204 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
8205 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
8206 % put the node text above and centered
8207 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8208 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8209 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8210 }
8211 }
8212 }
8213 {\ctikzvalof{bipoles/oscope/height}}
8214 {oscope}
8215 {\ctikzvalof{bipoles/oscope/height}}
8216 {\ctikzvalof{bipoles/oscope/width}}
8217 {
8218 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8219 \pgfextracty{\pgf@circ@res@up}{\northeast}
8220 \pgfextractx{\pgf@circ@res@right}{\northeast}
8221 \pgfextractx{\pgf@circ@res@left}{\southwest}
8222 \pgfextracty{\pgf@circ@res@down}{\southwest}
8223 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8224 \pgfscope
8225 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8226 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8227 % this would create a round (analog?) scope...
8228 % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8229 \pgf@circ@draworfill
8230 \endpgfscope
8231 % get the rotation
8232 \ifpgf@circuit@straightinstruments
8233 \pgfgettransformentries\a\b\temp\temp\temp\temp
8234 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8235 \else
8236 \edef\rot{0}
8237 \fi
8238 % and unrotate the scope
8239 \pgfscope
8240 \pgftransformrotate{\rot}
8241 % grid
8242 \pgfscope
8243 \pgfsetlinewidth{0.5\pgfstartlinewidth}
8244 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
8245 \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]%
8246 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8247 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
8248 \pgfsetstrokeopacity{0.5}
8249 \pgfusepath{draw}
8250 \endpgfscope
8251 % function displayed, thanks to
8252 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8253 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
8254 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
8255 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
8256 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
8257 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
8258 \pgfusepath{draw}
8259 \endpgfscope
8260 }
8261
8262 % generic round meter with always horizontal text, no arrow
8263 \pgfcircdeclarebipolescaled{instruments}
8264 {}
8265 {\ctikzvalof{bipoles/esource/height}}
8266 {rmeter}
8267 {\ctikzvalof{bipoles/esource/height}}
8268 {\ctikzvalof{bipoles/esource/width}}
8269 {
8270 \pgfpointorigin
8271 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8272 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8273 \pgf@circ@draworfill
8274 % draw the text label
8275 % get the rotation
8276 \ifpgf@circuit@straightinstruments
8277 \pgfgettransformentries\a\b\temp\temp\temp\temp
8278 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8279 \else
8280 \edef\rot{0}
8281 \fi
8282 % and unrotate the scope
8283 \pgfscope
8284 \pgfsetcolor{\ctikzvalof{color}}
8285 \pgftransformrotate{\rot}
8286 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8287 \endpgfscope
8288 }
8289
8290 % generic round meter with always horizontal text, with arrow
8291 \pgfcircdeclarebipolescaled{instruments}
8292 {}
8293 {\ctikzvalof{bipoles/esource/height}}
8294 {rmeterwa}
8295 {\ctikzvalof{bipoles/esource/height}}
8296 {\ctikzvalof{bipoles/esource/width}}
8297 {
8298 \pgfpointorigin
8299 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8300 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8301 \pgf@circ@draworfill
8302 % draw the text label
8303 % get the rotation
8304 \ifpgf@circuit@straightinstruments
8305 \pgfgettransformentries\a\b\temp\temp\temp\temp
8306 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8307 \else
8308 \edef\rot{0}
8309 \fi
8310 % and unrotate the scope
8311 \pgfscope
8312 \pgftransformrotate{\rot}
8313 \pgfsetcolor{\ctikzvalof{color}}
8314 \pgfsetlinewidth{\pgfstartlinewidth}
8315 % arrow: create a center hole to have better visual
8316 \pgfscope
8317 % clipping path: first a rectangle bigger then the shape
8318 % to avoid problems with the line thickness
8319 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8320 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8321 % next open a circle into it
8322 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
8323 % do the difference and clip before drawing
8324 \pgfseteorule
8325 \pgfusepath{clip}
8326 \pgfsetarrowsend{latexslim}
8327 % the arrow is better if it has a bit of breath and it's not 45º
8328 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
8329 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
8330 \pgfusepath{draw}
8331 \endpgfscope
8332 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
8333 \endpgfscope
8334 }
8335
8336 % generic square meter with always horizontal text
8337 \pgfcircdeclarebipolescaled{instruments}
8338 {
8339 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
8340 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
8341 % put the node text above and centered
8342 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8343 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8344 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8345 }
8346 }
8347 }
8348 {\ctikzvalof{bipoles/smeter/height}}
8349 {smeter}
8350 {\ctikzvalof{bipoles/smeter/height}}
8351 {\ctikzvalof{bipoles/smeter/width}}
8352 {
8353 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8354 \pgfextracty{\pgf@circ@res@up}{\northeast}
8355 \pgfextractx{\pgf@circ@res@right}{\northeast}
8356 \pgfextractx{\pgf@circ@res@left}{\southwest}
8357 \pgfextracty{\pgf@circ@res@down}{\southwest}
8358 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8359 \pgfscope
8360 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8361 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8362 \pgf@circ@draworfill
8363 \endpgfscope
8364 % get the rotation
8365 \ifpgf@circuit@straightinstruments
8366 \pgfgettransformentries\a\b\temp\temp\temp\temp
8367 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8368 \else
8369 \edef\rot{0}
8370 \fi
8371 % and unrotate the scope
8372 \pgfscope
8373 \pgftransformrotate{\rot}
8374 % the metering window
8375 \pgfscope
8376 \def\@starta{105}\def\@stopa{75}
8377 \pgfsetlinewidth{\pgfstartlinewidth}
8378 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
8379 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
8380 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
8381 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8382 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8383 \pgfclosepath
8384 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
8385 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
8386 \pgfusepath{draw}
8387 \endpgfscope
8388 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
8389 \endpgfscope
8390 }
8391
8392 % probes qucs style:
8393 % #1 : name
8394 % #2 : extra code
8395 \long\def\pgfcirc@qucsprobe#1#2{
8396 \pgfcircdeclarebipolescaled{instruments}
8397 {
8398 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
8399 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
8400 % put the node text above and centered
8401 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8402 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8403 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8404 }
8405 }
8406 }
8407 {\ctikzvalof{bipoles/qmeter/depth}}
8408 {#1}
8409 {\ctikzvalof{bipoles/qmeter/height}}
8410 {\ctikzvalof{bipoles/qmeter/width}}
8411 {
8412 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8413 \pgfextracty{\pgf@circ@res@up}{\northeast}
8414 \pgfextractx{\pgf@circ@res@right}{\northeast}
8415 \pgfextractx{\pgf@circ@res@left}{\southwest}
8416 \pgfextracty{\pgf@circ@res@down}{\southwest}
8417 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8418 \pgfscope
8419 \pgfscope
8420 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8421 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8422 \pgf@circ@draworfill
8423 \endpgfscope
8424 \def\@starta{103}\def\@stopa{77}
8425 \pgfsetlinewidth{\pgfstartlinewidth}
8426 \pgfscope
8427 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
8428 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
8429 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
8430 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8431 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8432 \pgfclosepath
8433 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
8434 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
8435 \pgfusepath{draw}
8436 \pgf@circ@draworfill
8437 \endpgfscope
8438 #2
8439 \endpgfscope
8440 }
8441 }
8442
8443 \pgfcirc@qucsprobe{qiprobe}{
8444 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8445 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8446 \pgfusepath{draw}
8447 \pgfnode{currarrow}{center}{}{}{}
8448 }
8449
8450 \pgfcirc@qucsprobe{qvprobe}{
8451 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8452 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8453 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
8454 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8455 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
8456 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8457 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8458 \pgfusepath{draw}
8459 \pgfscope
8460 % "+" and "-", drawn so that they scale correctly
8461 \pgfsetlinewidth{2\pgfstartlinewidth}
8462 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
8463 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
8464 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8465 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8466 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8467 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8468 \pgfusepath{draw}
8469 \endpgfscope
8470 }
8471
8472 \pgfcirc@qucsprobe{qpprobe}{
8473 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8474 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8475 \pgfusepath{draw}
8476 \pgfnode{currarrow}{center}{}{}{}
8477 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8478 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8479 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
8480 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
8481 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8482 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
8483 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
8484 \pgfusepath{draw}
8485 \pgfscope
8486 % "+" and "-", drawn so that they scale correctly
8487 \pgfsetlinewidth{2\pgfstartlinewidth}
8488 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
8489 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
8490 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8491 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8492 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8493 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8494 \pgfusepath{draw}
8495 \endpgfscope
8496 }
8497
8498 % current loop for oscope and similar: stylized
8499 \pgfcircdeclarebipolescaled{instruments}
8500 {
8501 \anchor{i}{\northeast\pgf@x=0pt\relax}
8502 \anchor{text}{
8503 \pgfextracty{\pgf@circ@res@up}{\northeast}
8504 \pgfextractx{\pgf@circ@res@left}{\northeast}
8505 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8506 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8507 }
8508 }
8509 }
8510 {\ctikzvalof{bipoles/iloop/height}}
8511 {iloop}
8512 {\ctikzvalof{bipoles/iloop/height}}
8513 {\ctikzvalof{bipoles/iloop/width}}
8514 {
8515 \pgfextracty{\pgf@circ@res@up}{\northeast}
8516 \pgfextractx{\pgf@circ@res@right}{\northeast}
8517 \pgf@circ@res@down=-\pgf@circ@res@up
8518 \pgf@circ@res@left=-\pgf@circ@res@right
8519 \pgfscope
8520 \pgfstartlinewidth=\pgflinewidth
8521 \pgfsetcolor{\ctikzvalof{color}}
8522 % external ellipse
8523 \pgfscope
8524 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8525 % clipping path: first a rectangle bigger then the shape
8526 % to avoid problems with the line thickness
8527 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8528 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8529 % next the opening to the left
8530 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8531 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8532 % do the difference and clip before drawing
8533 \pgfseteorule
8534 \pgfusepath{clip}
8535 \pgfpathellipse{\pgfpointorigin}{
8536 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
8537 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
8538 \pgfusepath{draw}
8539 \endpgfscope
8540 % internal wire
8541 \pgfsetlinewidth{\pgfstartlinewidth}
8542 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8543 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8544 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8546 % and the contact line up
8547 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8548 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8549 \pgfusepath{draw}
8550 \endpgfscope
8551 }
8552
8553 % current loop for oscope and similar: real (double connection)
8554 \pgfcircdeclarebipolescaled{instruments}
8555 {
8556 \anchor{i+}{
8557 \pgfextracty{\pgf@circ@res@up}{\northeast}
8558 \pgfextractx{\pgf@circ@res@right}{\northeast}
8559 \pgf@circ@res@step=0.4\pgf@circ@res@right
8560 \pgf@circ@res@other=0.8\pgf@circ@res@up
8561 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
8562 \pgf@y=\pgf@circ@res@up
8563 }
8564 \anchor{i-}{
8565 \pgfextracty{\pgf@circ@res@up}{\northeast}
8566 \pgfextractx{\pgf@circ@res@right}{\northeast}
8567 \pgf@circ@res@step=0.4\pgf@circ@res@right
8568 \pgf@circ@res@other=0.8\pgf@circ@res@up
8569 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
8570 \pgf@y=\pgf@circ@res@up
8571 }
8572 \anchor{text}{
8573 \pgfextracty{\pgf@circ@res@up}{\northeast}
8574 \pgfextractx{\pgf@circ@res@left}{\northeast}
8575 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8576 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8577 }
8578 }
8579 }
8580 {\ctikzvalof{bipoles/iloop/height}}
8581 {iloop2}
8582 {\ctikzvalof{bipoles/iloop/height}}
8583 {\ctikzvalof{bipoles/iloop/width}}
8584 {
8585 \pgfextracty{\pgf@circ@res@up}{\northeast}
8586 \pgfextractx{\pgf@circ@res@right}{\northeast}
8587 \pgf@circ@res@down=-\pgf@circ@res@up
8588 \pgf@circ@res@left=-\pgf@circ@res@right
8589 % must be the same than internal i+ and i- anchors definition
8590 \pgf@circ@res@step=0.4\pgf@circ@res@right
8591 \pgf@circ@res@other=0.8\pgf@circ@res@up
8592 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
8593 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
8594 \pgfscope
8595 \pgfstartlinewidth=\pgflinewidth
8596 \pgfsetcolor{\ctikzvalof{color}}
8597 % external ellipse
8598 \pgfscope
8599 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8600 % clipping path: first a rectangle bigger then the shape
8601 % to avoid problems with the line thickness
8602 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8603 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8604 % next the opening to the left
8605 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8606 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8607 % do the difference and clip before drawing
8608 \pgfseteorule
8609 \pgfusepath{clip}
8610 \pgfpathmoveto{\@plus}
8611 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
8612 \pgfusepath{draw}
8613 \endpgfscope
8614 % internal wire
8615 \pgfsetlinewidth{\pgfstartlinewidth}
8616 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8617 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8618 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8619 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8620 % and the contact line up
8621 % I use ...left and ---right as temporal lengths here to avoid defining more
8622 \pgfextractx{\pgf@circ@res@left}{\@plus}
8623 \pgfextractx{\pgf@circ@res@right}{\@minus}
8624 \pgfpathmoveto{\@plus}
8625 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8626 \pgfpathmoveto{\@minus}
8627 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8628 \pgfusepath{draw}
8629 \endpgfscope
8630 }
8631
8632
8633 %% Varistor
8634 \pgfcircdeclarebipolescaled{resistors}
8635 {
8636 \pgfcirc@border@extend@updown{1}{1.4}
8637 }
8638 {\ctikzvalof{bipoles/varistor/height}}
8639 {varistor}
8640 {\ctikzvalof{bipoles/varistor/height}}
8641 {\ctikzvalof{bipoles/varistor/width}}
8642 {
8643 \pgfscope
8644 \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}}
8645 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8646 \pgf@circ@draworfill
8647 \endpgfscope
8648
8649 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
8650 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
8651 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8652 \pgfusepath{draw}
8653
8654 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
8655 }
8656
8657 %%%%%%%%%%%%%%
8658 %% RF bipoles
8659 %%%%%%%%%%%%%%
8660
8661 % transmission line
8662 \pgfcircdeclarebipolescaled{RF}
8663 {}
8664 {\ctikzvalof{bipoles/tline/height}}
8665 {tline}
8666 {\ctikzvalof{bipoles/tline/height}}
8667 {\ctikzvalof{bipoles/tline/width}}
8668 {
8669 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
8670 \begin{pgftransparencygroup}
8671 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
8673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
8674 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
8675 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
8676 \pgf@circ@draworfill
8677 \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8678 {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
8679 \pgf@circ@draworfill
8680 \end{pgftransparencygroup}
8681 \pgfsetlinewidth{\pgfstartlinewidth}
8682 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8683 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8684 \pgfusepath{stroke}
8685 }
8686
8687 % microstrip transmission line
8688 \pgfcircdeclarebipolescaled{RF}
8689 {}
8690 {\ctikzvalof{bipoles/mstline/height}}
8691 {mstline}
8692 {\ctikzvalof{bipoles/mstline/height}}
8693 {\ctikzvalof{bipoles/mstline/width}}
8694 {
8695 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8696 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8697 \pgf@circ@draworfill
8698 }
8699
8700 %%%%%%%%%%%%%%%%%%%
8701 %% Block diagrams
8702 %%%%%%%%%%%%%%%%%%%
8703
8704 %% Draw the two-port fillable box
8705 \def\pgf@circ@twoportbox{
8706 \pgfscope
8707 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8708 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8709 \pgf@circ@draworfill
8710 \endpgfscope
8711 }
8712
8713 %% Generic two port box
8714 \pgfcircdeclarebipolescaled{blocks}
8715 {}
8716 {\ctikzvalof{bipoles/twoport/height}}
8717 {twoport}
8718 {\ctikzvalof{bipoles/twoport/height}}
8719 {\ctikzvalof{bipoles/twoport/width}}
8720 {
8721 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
8722 \divide \pgf@circ@res@step by 2
8723
8724 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8725 \pgf@circ@res@other = \pgf@circ@res@left
8726 \advance\pgf@circ@res@other by \pgf@circ@res@step
8727 \ifpgf@circuit@dashed
8728 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8729 \fi
8730 % draw outer box
8731 \pgf@circ@twoportbox
8732 \ifpgf@circuit@inputarrow
8733 {
8734 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8735 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8736 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8737 }
8738 \fi
8739
8740 % rotate inner symbol
8741 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8742 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8743 \pgftransformrotate{270}
8744 \fi\fi
8745 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8746 \pgftransformrotate{180}
8747 \fi\fi
8748 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8749 \pgftransformrotate{90}
8750 \fi\fi
8751
8752 % draw inner symbol
8753 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8754
8755 }
8756
8757 %% twoport split
8758 \pgfcircdeclarebipolescaled{blocks}
8759 {}
8760 {\ctikzvalof{bipoles/twoportsplit/width}}
8761 {twoportsplit}
8762 {\ctikzvalof{bipoles/twoportsplit/width}}
8763 {\ctikzvalof{bipoles/twoportsplit/width}}
8764 {
8765 \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen
8766 \divide \pgf@circ@res@step by 2
8767
8768 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8769 \pgf@circ@res@other = \pgf@circ@res@left
8770 \advance\pgf@circ@res@other by \pgf@circ@res@step
8771
8772 \ifpgf@circuit@dashed
8773 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8774 \fi
8775
8776 % draw outer box
8777 \pgf@circ@twoportbox
8778
8779 \ifpgf@circuit@inputarrow
8780 {
8781 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8782 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8783 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8784 }
8785 \fi
8786
8787 %get texts
8788 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
8789 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
8790
8791 % rotate inner symbol
8792 \def\texti{\pgfcirc@tin}
8793 \def\textii{\pgfcirc@tout}
8794 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8795 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8796 \def\texti{\pgfcirc@tout}
8797 \def\textii{\pgfcirc@tin}
8798 \pgftransformrotate{270}
8799 \fi\fi
8800 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8801 \def\texti{\pgfcirc@tout}
8802 \def\textii{\pgfcirc@tin}
8803 \pgftransformrotate{180}
8804 \fi\fi
8805 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8806 \pgftransformrotate{90}
8807 \def\texti{\pgfcirc@tin}
8808 \def\textii{\pgfcirc@tout}
8809 \fi\fi
8810
8811 % draw inner symbol
8812 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8813 \pgfsetarrows{-} %never draw arrows
8814 \pgfsetlinewidth{\pgfstartlinewidth}
8815 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8816 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8817 \pgfusepath{draw}
8818
8819 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti}
8820 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii}
8821 }
8822
8823 %% voltage controled oscillator
8824 \pgfcircdeclarebipolescaled{blocks}
8825 {}
8826 {\ctikzvalof{bipoles/vco/width}}
8827 {vco}
8828 {\ctikzvalof{bipoles/twoport/width}}
8829 {\ctikzvalof{bipoles/vco/width}}
8830 {
8831 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
8832 \divide \pgf@circ@res@step by 2
8833
8834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8835 \pgf@circ@res@other = \pgf@circ@res@left
8836 \advance\pgf@circ@res@other by \pgf@circ@res@step
8837
8838 \ifpgf@circuit@dashed
8839 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8840 \fi
8841 % draw circle
8842 \pgfscope
8843 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8844 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
8845 \pgf@circ@draworfill
8846 \endpgfscope
8847 \ifpgf@circuit@inputarrow
8848 {
8849 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8850 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8851 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8852 }
8853 \fi
8854
8855 % rotate inner symbol
8856 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8857 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8858 \pgftransformrotate{270}
8859 \fi\fi
8860 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8861 \pgftransformrotate{180}
8862 \fi\fi
8863 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8864 \pgftransformrotate{90}
8865 \fi\fi
8866
8867 % draw inner sine waves
8868 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8869 \pgfsetlinewidth{\pgfstartlinewidth}
8870 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
8871 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8872 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8873 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8874 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8875 \pgfusepath{draw}
8876 }
8877
8878 %% bandpass filter
8879 \pgfcircdeclarebipolescaled{blocks}
8880 {}
8881 {\ctikzvalof{bipoles/bandpass/width}}
8882 {bandpass}
8883 {\ctikzvalof{bipoles/bandpass/width}}
8884 {\ctikzvalof{bipoles/bandpass/width}}
8885 {
8886
8887 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
8888 \divide \pgf@circ@res@step by 2
8889
8890 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8891 \pgf@circ@res@other = \pgf@circ@res@left
8892 \advance\pgf@circ@res@other by \pgf@circ@res@step
8893
8894 \ifpgf@circuit@dashed
8895 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8896 \fi
8897
8898 % draw outer box
8899 \pgf@circ@twoportbox
8900
8901 \ifpgf@circuit@inputarrow
8902 {
8903 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8904 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8905 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8906 }
8907 \fi
8908
8909 % rotate inner symbol
8910 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8911 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8912 \pgftransformrotate{270}
8913 \fi\fi
8914 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8915 \pgftransformrotate{180}
8916 \fi\fi
8917 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8918 \pgftransformrotate{90}
8919 \fi\fi
8920
8921 % draw inner symbol
8922 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8923 \pgfsetarrows{-} %never draw arrows
8924 \pgfsetlinewidth{\pgfstartlinewidth}
8925 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8926 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8927 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8928 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8929 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8930 \pgfusepath{draw}
8931 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8932 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8933 \pgfusepath{draw}
8934
8935 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8936 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8937 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8938 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8939 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8940 \pgfusepath{draw}
8941
8942 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8943 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8944 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8945 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8946 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8947 \pgfusepath{draw}
8948 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8949 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8950 \pgfusepath{draw}
8951 }
8952
8953 %% bandstop filter
8954 \pgfcircdeclarebipolescaled{blocks}
8955 {}
8956 {\ctikzvalof{bipoles/bandstop/width}}
8957 {bandstop}
8958 {\ctikzvalof{bipoles/bandstop/width}}
8959 {\ctikzvalof{bipoles/bandstop/width}}
8960 {
8961 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
8962 \divide \pgf@circ@res@step by 2
8963
8964 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8965 \pgf@circ@res@other = \pgf@circ@res@left
8966 \advance\pgf@circ@res@other by \pgf@circ@res@step
8967
8968 \ifpgf@circuit@dashed
8969 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8970 \fi
8971
8972 % draw outer box
8973 \pgf@circ@twoportbox
8974
8975 \ifpgf@circuit@inputarrow
8976 {
8977 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8978 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8979 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8980 }
8981 \fi
8982
8983 % rotate inner symbol
8984 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8985 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8986 \pgftransformrotate{270}
8987 \fi\fi
8988 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
8989 \pgftransformrotate{180}
8990 \fi\fi
8991 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8992 \pgftransformrotate{90}
8993 \fi\fi
8994
8995 % draw inner symbol
8996 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
8997 \pgfsetarrows{-}%never draw arrows
8998 \pgfsetlinewidth{\pgfstartlinewidth}
8999 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
9000 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9001 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9002 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9003 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9004 \pgfusepath{draw}
9005
9006 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
9007 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9008 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9009 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9010 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9011 \pgfusepath{draw}
9012 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
9013 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
9014 \pgfusepath{draw}
9015
9016 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9017 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9018 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9019 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9020 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9021 \pgfusepath{draw}
9022 }
9023
9024 %% highpass filter
9025 \pgfcircdeclarebipolescaled{blocks}
9026 {}
9027 {\ctikzvalof{bipoles/highpass/width}}
9028 {highpass}
9029 {\ctikzvalof{bipoles/highpass/width}}
9030 {\ctikzvalof{bipoles/highpass/width}}
9031 {
9032 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
9033 \divide \pgf@circ@res@step by 2
9034
9035 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9036 \pgf@circ@res@other = \pgf@circ@res@left
9037 \advance\pgf@circ@res@other by \pgf@circ@res@step
9038
9039 \ifpgf@circuit@dashed
9040 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9041 \fi
9042
9043 % draw outer box
9044 \pgf@circ@twoportbox
9045
9046 \ifpgf@circuit@inputarrow
9047 {
9048 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9049 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9050 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9051 }
9052 \fi
9053
9054 % rotate inner symbol
9055 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9056 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9057 \pgftransformrotate{270}
9058 \fi\fi
9059 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9060 \pgftransformrotate{180}
9061 \fi\fi
9062 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
9063 \pgftransformrotate{90}
9064 \fi\fi
9065
9066 % draw inner symbol
9067 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9068 \pgfsetarrows{-} %never draw arrows
9069 \pgfsetlinewidth{\pgfstartlinewidth}
9070 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
9071 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9072 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9073 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9074 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9075 \pgfusepath{draw}
9076
9077 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
9078 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9079 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9080 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9081 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9082 \pgfusepath{draw}
9083 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
9084 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
9085 \pgfusepath{draw}
9086
9087 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9088 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9089 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9090 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9091 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9092 \pgfusepath{draw}
9093 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
9094 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
9095 \pgfusepath{draw}
9096 }
9097
9098 %% lowpass filter
9099 \pgfcircdeclarebipolescaled{blocks}
9100 {}
9101 {\ctikzvalof{bipoles/lowpass/width}}
9102 {lowpass}
9103 {\ctikzvalof{bipoles/lowpass/width}}
9104 {\ctikzvalof{bipoles/lowpass/width}}
9105 {
9106 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
9107 \divide \pgf@circ@res@step by 2
9108
9109 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9110 \pgf@circ@res@other = \pgf@circ@res@left
9111 \advance\pgf@circ@res@other by \pgf@circ@res@step
9112
9113 \ifpgf@circuit@dashed
9114 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9115 \fi
9116
9117 % draw outer box
9118 \pgf@circ@twoportbox
9119
9120 \ifpgf@circuit@inputarrow
9121 {
9122 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9123 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9124 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9125 }
9126 \fi
9127
9128 % rotate inner symbol
9129 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9130 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9131 \pgftransformrotate{270}
9132 \fi\fi
9133 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9134 \pgftransformrotate{180}
9135 \fi\fi
9136 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
9137 \pgftransformrotate{90}
9138 \fi\fi
9139
9140 % draw inner symbol
9141 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9142 \pgfsetarrows{-} %never draw arrows
9143 \pgfsetlinewidth{\pgfstartlinewidth}
9144 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
9145 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9146 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9147 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9148 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9149 \pgfusepath{draw}
9150 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
9151 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
9152 \pgfusepath{draw}
9153
9154 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
9155 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9156 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9157 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9158 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9159 \pgfusepath{draw}
9160 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
9161 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
9162 \pgfusepath{draw}
9163
9164 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9165 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9166 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9167 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9168 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9169 \pgfusepath{draw}
9170 }
9171
9172 %% allpass filter
9173 \pgfcircdeclarebipolescaled{blocks}
9174 {}
9175 {\ctikzvalof{bipoles/allpass/width}}
9176 {allpass}
9177 {\ctikzvalof{bipoles/allpass/width}}
9178 {\ctikzvalof{bipoles/allpass/width}}
9179 {
9180 \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen
9181 \divide \pgf@circ@res@step by 2
9182
9183 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9184 \pgf@circ@res@other = \pgf@circ@res@left
9185 \advance\pgf@circ@res@other by \pgf@circ@res@step
9186
9187 \ifpgf@circuit@dashed
9188 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9189 \fi
9190
9191 % draw outer box
9192 \pgf@circ@twoportbox
9193
9194 \ifpgf@circuit@inputarrow
9195 {
9196 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9197 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9198 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9199 }
9200 \fi
9201
9202 % rotate inner symbol
9203 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9204 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9205 \pgftransformrotate{270}
9206 \fi\fi
9207 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9208 \pgftransformrotate{180}
9209 \fi\fi
9210 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
9211 \pgftransformrotate{90}
9212 \fi\fi
9213
9214 % draw inner symbol
9215 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9216 \pgfsetarrows{-} %never draw arrows
9217 \pgfsetlinewidth{\pgfstartlinewidth}
9218 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
9219 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9220 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9221 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9222 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9223 \pgfusepath{draw}
9224
9225 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
9226 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9227 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9228 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9229 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9230 \pgfusepath{draw}
9231
9232 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9233 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9234 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9235 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
9236 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
9237 \pgfusepath{draw}
9238 }
9239
9240 %% ADC
9241 \pgfcircdeclarebipolescaled{blocks}
9242 {}
9243 {\ctikzvalof{bipoles/adc/width}}
9244 {adc}
9245 {\ctikzvalof{bipoles/adc/width}}
9246 {\ctikzvalof{bipoles/adc/width}}
9247 {
9248 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
9249 \divide \pgf@circ@res@step by 2
9250
9251 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9252 \pgf@circ@res@other = \pgf@circ@res@left
9253 \advance\pgf@circ@res@other by \pgf@circ@res@step
9254
9255 \ifpgf@circuit@dashed
9256 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9257 \fi
9258
9259 % draw outer box
9260 \pgf@circ@twoportbox
9261
9262 \ifpgf@circuit@inputarrow
9263 {
9264 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9265 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9266 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9267 }
9268 \fi
9269
9270 % rotate inner symbol
9271 \def\texti{A}
9272 \def\textii{D}
9273 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9274 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9275 \def\texti{D}
9276 \def\textii{A}
9277 \pgftransformrotate{270}
9278 \fi\fi
9279 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9280 \def\texti{D}
9281 \def\textii{A}
9282 \pgftransformrotate{180}
9283 \fi\fi
9284 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9285 \pgftransformrotate{90}
9286 \def\texti{A}
9287 \def\textii{D}
9288 \fi\fi
9289
9290 % draw inner symbol
9291 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9292 \pgfsetarrows{-} %never draw arrows
9293 \pgfsetlinewidth{\pgfstartlinewidth}
9294 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9296 \pgfusepath{draw}
9297
9298 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
9299 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
9300 }
9301
9302 %% DAC
9303 \pgfcircdeclarebipolescaled{blocks}
9304 {}
9305 {\ctikzvalof{bipoles/dac/width}}
9306 {dac}
9307 {\ctikzvalof{bipoles/dac/width}}
9308 {\ctikzvalof{bipoles/dac/width}}
9309 {
9310 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
9311 \divide \pgf@circ@res@step by 2
9312
9313 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9314 \pgf@circ@res@other = \pgf@circ@res@left
9315 \advance\pgf@circ@res@other by \pgf@circ@res@step
9316
9317 \ifpgf@circuit@dashed
9318 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9319 \fi
9320
9321 % draw outer box
9322 \pgf@circ@twoportbox
9323
9324 \ifpgf@circuit@inputarrow
9325 {
9326 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9327 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9328 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9329 }
9330 \fi
9331
9332 % rotate inner symbol
9333 \def\texti{D}
9334 \def\textii{A}
9335 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9336 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9337 \def\texti{A}
9338 \def\textii{D}
9339 \pgftransformrotate{270}
9340 \fi\fi
9341 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9342 \def\texti{A}
9343 \def\textii{D}
9344 \pgftransformrotate{180}
9345 \fi\fi
9346 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9347 \pgftransformrotate{90}
9348 \def\texti{D}
9349 \def\textii{A}
9350 \fi\fi
9351
9352 % draw inner symbol
9353 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9354 \pgfsetarrows{-} %never draw arrows
9355 \pgfsetlinewidth{\pgfstartlinewidth}
9356 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9357 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9358 \pgfusepath{draw}
9359
9360 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
9361 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
9362 }
9363
9364 %% DSP
9365 \pgfcircdeclarebipolescaled{blocks}
9366 {}
9367 {\ctikzvalof{bipoles/dsp/width}}
9368 {dsp}
9369 {\ctikzvalof{bipoles/dsp/width}}
9370 {\ctikzvalof{bipoles/dsp/width}}
9371 {
9372 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
9373 \divide \pgf@circ@res@step by 2
9374
9375 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9376 \pgf@circ@res@other = \pgf@circ@res@left
9377 \advance\pgf@circ@res@other by \pgf@circ@res@step
9378
9379 \ifpgf@circuit@dashed
9380 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9381 \fi
9382
9383 % draw outer box
9384 \pgf@circ@twoportbox
9385
9386 \ifpgf@circuit@inputarrow
9387 {
9388 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9389 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9390 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9391 }
9392 \fi
9393
9394 % rotate inner symbol
9395 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9396 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9397 \pgftransformrotate{270}
9398 \fi\fi
9399 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9400 \pgftransformrotate{180}
9401 \fi\fi
9402 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9403 \pgftransformrotate{90}
9404 \fi\fi
9405
9406 % draw inner symbol
9407 \pgftext[center,x=0,y=0]{\textsf{DSP}}
9408 }
9409
9410 %% FFT
9411 \pgfcircdeclarebipolescaled{blocks}
9412 {}
9413 {\ctikzvalof{bipoles/fft/width}}
9414 {fft}
9415 {\ctikzvalof{bipoles/fft/width}}
9416 {\ctikzvalof{bipoles/fft/width}}
9417 {
9418 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
9419 \divide \pgf@circ@res@step by 2
9420
9421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9422 \pgf@circ@res@other = \pgf@circ@res@left
9423 \advance\pgf@circ@res@other by \pgf@circ@res@step
9424
9425 \ifpgf@circuit@dashed
9426 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9427 \fi
9428
9429 % draw outer box
9430 \pgf@circ@twoportbox
9431
9432 \ifpgf@circuit@inputarrow
9433 {
9434 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9435 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9436 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9437 }
9438 \fi
9439
9440 % rotate inner symbol
9441 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9442 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9443 \pgftransformrotate{270}
9444 \fi\fi
9445 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9446 \pgftransformrotate{180}
9447 \fi\fi
9448 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9449 \pgftransformrotate{90}
9450 \fi\fi
9451
9452 % draw inner symbol
9453 \pgftext[center,x=0,y=0]{\textsf{FFT}}
9454 }
9455
9456 %% Amplifier
9457 \pgfcircdeclarebipolescaled{blocks}
9458 {}
9459 {
9460 \ifpgf@circuit@boxed
9461 \ctikzvalof{bipoles/twoport/width}
9462 \else
9463 \ctikzvalof{bipoles/amp/width}
9464 \fi
9465 }
9466 {amp}
9467 {
9468 \ifpgf@circuit@boxed
9469 \ctikzvalof{bipoles/twoport/width}
9470 \else
9471 \ctikzvalof{bipoles/amp/width}
9472 \fi
9473 }
9474 {
9475 \ifpgf@circuit@boxed
9476 \ctikzvalof{bipoles/twoport/width}
9477 \else
9478 \ctikzvalof{bipoles/amp/width}
9479 \fi
9480 }
9481 {
9482 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
9483
9484 \ifpgf@circuit@dashed
9485 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9486 \fi
9487
9488 % draw outer box
9489 \ifpgf@circuit@boxed
9490 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9491 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
9492 \pgf@circ@draworfill
9493 \fi
9494
9495 % draw input arrow
9496 \ifpgf@circuit@inputarrow
9497 {
9498 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9499 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9500 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9501 }
9502 \fi
9503
9504 \ifpgf@circuit@boxed
9505 \pgfsetlinewidth{\pgfstartlinewidth}
9506 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
9507 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
9508 \else
9509 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9510 \fi
9511
9512 \pgfsetarrows{-} %never draw arrows
9513
9514 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
9515 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
9516 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
9517
9518 \pgfpathclose
9519 \pgf@circ@draworfill
9520
9521 % draw inner text
9522 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
9523 }
9524
9525
9526 %% variable amplifier
9527 \pgfcircdeclarebipolescaled{blocks}
9528 {}
9529 {
9530 \ifpgf@circuit@boxed
9531 \ctikzvalof{bipoles/twoport/width}
9532 \else
9533 \ctikzvalof{bipoles/amp/width}
9534 \fi
9535 }
9536 {vamp}
9537 {
9538 \ifpgf@circuit@boxed
9539 \ctikzvalof{bipoles/twoport/width}
9540 \else
9541 \ctikzvalof{bipoles/amp/width}
9542 \fi
9543 }
9544 {
9545 \ifpgf@circuit@boxed
9546 \ctikzvalof{bipoles/twoport/width}
9547 \else
9548 \ctikzvalof{bipoles/amp/width}
9549 \fi
9550 }
9551 {
9552 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
9553
9554 \ifpgf@circuit@dashed
9555 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9556 \fi
9557
9558 % draw outer box
9559 \ifpgf@circuit@boxed
9560 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
9561 \fi
9562
9563 % draw input arrow
9564 \ifpgf@circuit@inputarrow
9565 {
9566 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9567 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9568 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9569 }
9570 \fi
9571
9572 \ifpgf@circuit@boxed
9573 \pgfsetlinewidth{\pgfstartlinewidth}
9574 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
9575 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
9576 \else
9577 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9578 \fi
9579
9580
9581 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9582 \pgfsetarrows{-} %never draw arrows
9583
9584 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
9585 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
9586 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
9587
9588 \pgfpathclose
9589 \pgf@circ@draworfill
9590
9591 % draw inner text
9592 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
9593
9594 % draw arrow
9595 \pgfsetlinewidth{\pgfstartlinewidth}
9596 \pgfsetarrowsend{latex}
9597 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9598 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
9599 \pgfusepath{draw}
9600 }
9601
9602 %% pi attenuator
9603 \pgfcircdeclarebipolescaled{blocks}
9604 {}
9605 {\ctikzvalof{bipoles/piattenuator/width}}
9606 {piattenuator}
9607 {\ctikzvalof{bipoles/piattenuator/width}}
9608 {\ctikzvalof{bipoles/piattenuator/width}}
9609 {
9610 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
9611 \divide \pgf@circ@res@step by 2
9612
9613 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9614 \pgf@circ@res@other = \pgf@circ@res@left
9615 \advance\pgf@circ@res@other by \pgf@circ@res@step
9616
9617 \ifpgf@circuit@dashed
9618 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9619 \fi
9620
9621 % draw outer box
9622 \pgf@circ@twoportbox
9623
9624 \ifpgf@circuit@inputarrow
9625 {
9626 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9627 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9628 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9629 }
9630 \fi
9631
9632 % rotate inner symbol
9633 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9634 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9635 \pgftransformrotate{270}
9636 \fi\fi
9637 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9638 \pgftransformrotate{90}
9639 \fi\fi
9640
9641 % draw inner symbol
9642 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9643 \pgfsetarrows{-} %never draw arrows
9644 \pgfsetlinewidth{\pgfstartlinewidth}
9645 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9646 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9647 \pgfusepath{draw}
9648 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9649 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9650 \pgfusepath{draw}
9651 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9652 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9653 \pgfusepath{draw}
9654 }
9655
9656 %% variable pi attenuator
9657 \pgfcircdeclarebipolescaled{blocks}
9658 {}
9659 {\ctikzvalof{bipoles/vpiattenuator/width}}
9660 {vpiattenuator}
9661 {\ctikzvalof{bipoles/vpiattenuator/width}}
9662 {\ctikzvalof{bipoles/vpiattenuator/width}}
9663 {
9664 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
9665 \divide \pgf@circ@res@step by 2
9666
9667 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9668 \pgf@circ@res@other = \pgf@circ@res@left
9669 \advance\pgf@circ@res@other by \pgf@circ@res@step
9670
9671 \ifpgf@circuit@dashed
9672 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9673 \fi
9674
9675 % draw outer box
9676 \pgf@circ@twoportbox
9677
9678 \ifpgf@circuit@inputarrow
9679 {
9680 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9681 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9682 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9683 }
9684 \fi
9685
9686 % rotate inner symbol
9687 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9688 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9689 \pgftransformrotate{270}
9690 \fi\fi
9691 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9692 \pgftransformrotate{90}
9693 \fi\fi
9694
9695 % draw inner symbol
9696 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9697 \pgfsetarrows{-} %never draw arrows
9698 \pgfsetlinewidth{\pgfstartlinewidth}
9699 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9700 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9701 \pgfusepath{draw}
9702 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9703 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9704 \pgfusepath{draw}
9705 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9706 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9707 \pgfusepath{draw}
9708
9709 \pgfsetarrowsend{latex}
9710 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9711 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9712 \pgfusepath{draw}
9713 }
9714
9715 %% T attenuator
9716 \pgfcircdeclarebipolescaled{blocks}
9717 {}
9718 {\ctikzvalof{bipoles/tattenuator/width}}
9719 {tattenuator}
9720 {\ctikzvalof{bipoles/tattenuator/width}}
9721 {\ctikzvalof{bipoles/tattenuator/width}}
9722 {
9723 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
9724 \divide \pgf@circ@res@step by 2
9725
9726 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9727 \pgf@circ@res@other = \pgf@circ@res@left
9728 \advance\pgf@circ@res@other by \pgf@circ@res@step
9729
9730 \ifpgf@circuit@dashed
9731 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9732 \fi
9733
9734 % draw outer box
9735 \pgf@circ@twoportbox
9736
9737 \ifpgf@circuit@inputarrow
9738 {
9739 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9740 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9741 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9742 }
9743 \fi
9744
9745 % rotate inner symbol
9746 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9747 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9748 \pgftransformrotate{270}
9749 \fi\fi
9750 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9751 \pgftransformrotate{90}
9752 \fi\fi
9753
9754 % draw inner symbol
9755 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9756 \pgfsetarrows{-} %never draw arrows
9757 \pgfsetlinewidth{\pgfstartlinewidth}
9758 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9759 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9760 \pgfusepath{draw}
9761 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9762 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9763 \pgfusepath{draw}
9764 }
9765
9766 %% variable T attenuator
9767 \pgfcircdeclarebipolescaled{blocks}
9768 {}
9769 {\ctikzvalof{bipoles/vtattenuator/width}}
9770 {vtattenuator}
9771 {\ctikzvalof{bipoles/vtattenuator/width}}
9772 {\ctikzvalof{bipoles/vtattenuator/width}}
9773 {
9774 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
9775 \divide \pgf@circ@res@step by 2
9776
9777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9778 \pgf@circ@res@other = \pgf@circ@res@left
9779 \advance\pgf@circ@res@other by \pgf@circ@res@step
9780
9781 \ifpgf@circuit@dashed
9782 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9783 \fi
9784
9785 % draw outer box
9786 \pgf@circ@twoportbox
9787
9788 \ifpgf@circuit@inputarrow
9789 {
9790 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9791 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9792 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9793 }
9794 \fi
9795
9796 % rotate inner symbol
9797 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9798 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9799 \pgftransformrotate{270}
9800 \fi\fi
9801 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9802 \pgftransformrotate{90}
9803 \fi\fi
9804
9805 % draw inner symbol
9806 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9807 \pgfsetarrows{-} %never draw arrows
9808 \pgfsetlinewidth{\pgfstartlinewidth}
9809 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9810 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9811 \pgfusepath{draw}
9812 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9813 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9814 \pgfusepath{draw}
9815
9816 \pgfsetarrowsend{latex}
9817 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9818 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9819 \pgfusepath{draw}
9820 }
9821
9822 %% phase shifter
9823 \pgfcircdeclarebipolescaled{blocks}
9824 {}
9825 {\ctikzvalof{bipoles/phaseshifter/width}}
9826 {phaseshifter}
9827 {\ctikzvalof{bipoles/phaseshifter/width}}
9828 {\ctikzvalof{bipoles/phaseshifter/width}}
9829 {
9830 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
9831 \divide \pgf@circ@res@step by 2
9832
9833 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9834 \pgf@circ@res@other = \pgf@circ@res@left
9835 \advance\pgf@circ@res@other by \pgf@circ@res@step
9836
9837 \ifpgf@circuit@dashed
9838 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9839 \fi
9840
9841 % draw outer box
9842 \pgf@circ@twoportbox
9843
9844 \ifpgf@circuit@inputarrow
9845 {
9846 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9847 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9848 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9849 }
9850 \fi
9851
9852 % rotate inner symbol
9853 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9854 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9855 \pgftransformrotate{270}
9856 \fi\fi
9857 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9858 \pgftransformrotate{180}
9859 \fi\fi
9860 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9861 \pgftransformrotate{90}
9862 \fi\fi
9863
9864 % inner symbol
9865 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9866 }
9867
9868 %% variable phase shifter
9869 \pgfcircdeclarebipolescaled{blocks}
9870 {}
9871 {\ctikzvalof{bipoles/phaseshifter/width}}
9872 {vphaseshifter}
9873 {\ctikzvalof{bipoles/vphaseshifter/width}}
9874 {\ctikzvalof{bipoles/vphaseshifter/width}}
9875 {
9876 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
9877 \divide \pgf@circ@res@step by 2
9878
9879 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9880 \pgf@circ@res@other = \pgf@circ@res@left
9881 \advance\pgf@circ@res@other by \pgf@circ@res@step
9882
9883 \ifpgf@circuit@dashed
9884 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9885 \fi
9886
9887 % draw outer box
9888 \pgf@circ@twoportbox
9889
9890 \ifpgf@circuit@inputarrow
9891 {
9892 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9893 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9894 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9895 }
9896 \fi
9897
9898 % rotate inner symbol
9899 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9900 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9901 \pgftransformrotate{270}
9902 \fi\fi
9903 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9904 \pgftransformrotate{180}
9905 \fi\fi
9906 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9907 \pgftransformrotate{90}
9908 \fi\fi
9909
9910 % inner symbol
9911 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9912
9913 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9914 \pgfsetlinewidth{\pgfstartlinewidth}
9915 \pgfsetarrowsend{latex}
9916 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
9917 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
9918 \pgfusepath{draw}
9919 }
9920
9921 %% detector
9922 \pgfcircdeclarebipolescaled{blocks}
9923 {}
9924 {\ctikzvalof{bipoles/detector/width}}
9925 {detector}
9926 {\ctikzvalof{bipoles/detector/width}}
9927 {\ctikzvalof{bipoles/detector/width}}
9928 {
9929 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
9930 \divide \pgf@circ@res@step by 2
9931
9932 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9933 \pgf@circ@res@other = \pgf@circ@res@left
9934 \advance\pgf@circ@res@other by \pgf@circ@res@step
9935
9936 \ifpgf@circuit@dashed
9937 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9938 \fi
9939
9940 % draw outer box
9941 \pgf@circ@twoportbox
9942
9943 \ifpgf@circuit@inputarrow
9944 {
9945 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9946 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9947 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9948 }
9949 \fi
9950
9951 % draw inner stuff
9952 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9953 \pgfsetarrows{-} %never draw arrows
9954 \pgfsetlinewidth{0.8\pgfstartlinewidth}
9955 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
9956 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
9957 \pgfusepath{draw}
9958
9959 \ifpgf@circuit@fulldiode
9960 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
9961 \pgftransformscale{\pgfmathresult}
9962 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
9963 \else
9964 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
9965 \pgftransformscale{\pgfmathresult}
9966 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
9967 \fi
9968
9969 }
9970
9971 %% single phase ac/dc converter
9972 \pgfcircdeclarebipolescaled{blocks}
9973 {
9974 \anchor{dc1}{
9975 \northeast
9976 \pgf@y=.4\pgf@y
9977 }
9978 \anchor{dc2}{
9979 \northeast
9980 \pgf@y=-.4\pgf@y
9981 }
9982 }
9983 {\ctikzvalof{bipoles/sacdc/width}}
9984 {sacdc}
9985 {\ctikzvalof{bipoles/sacdc/width}}
9986 {\ctikzvalof{bipoles/sacdc/width}}
9987 {
9988 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
9989 \divide \pgf@circ@res@step by 2
9990
9991 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9992 \pgf@circ@res@other = \pgf@circ@res@left
9993 \advance\pgf@circ@res@other by \pgf@circ@res@step
9994
9995 \ifpgf@circuit@dashed
9996 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9997 \fi
9998
9999 % draw outer box
10000 \pgf@circ@twoportbox
10001
10002 \ifpgf@circuit@inputarrow
10003 {
10004 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
10005 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10006 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
10007 }
10008 \fi
10009
10010 % rotate inner symbol
10011 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
10012 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
10013 \pgftransformrotate{270}
10014 \fi\fi
10015 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
10016 \pgftransformrotate{180}
10017 \fi\fi
10018 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
10019 \pgftransformrotate{90}
10020 \fi\fi
10021
10022 % draw inner symbol
10023 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
10024 \pgfsetarrows{-} %never draw arrows
10025 \pgfsetlinewidth{\pgfstartlinewidth}
10026 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10027 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10028 \pgfusepath{draw}
10029
10030 % draw sin wave
10031 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
10032 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10033 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10034 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10035 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10036 \pgfusepath{draw}
10037
10038 % draw equal sign
10039 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
10040 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
10041 \pgfusepath{draw}
10042 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
10043 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
10044 \pgfusepath{draw}
10045 }
10046
10047
10048
10049 %% single phase dc/ac converter
10050 \pgfcircdeclarebipolescaled{blocks}
10051 {
10052 \anchor{dc1}{
10053 \northeast
10054 \pgf@y=.4\pgf@y
10055 \pgf@x=-\pgf@x
10056 }
10057 \anchor{dc2}{
10058 \northeast
10059 \pgf@y=-.4\pgf@y
10060 \pgf@x=-\pgf@x
10061 }
10062 }
10063 {\ctikzvalof{bipoles/sdcac/width}}
10064 {sdcac}
10065 {\ctikzvalof{bipoles/sdcac/width}}
10066 {\ctikzvalof{bipoles/sdcac/width}}
10067 {
10068 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
10069 \divide \pgf@circ@res@step by 2
10070
10071 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10072 \pgf@circ@res@other = \pgf@circ@res@left
10073 \advance\pgf@circ@res@other by \pgf@circ@res@step
10074
10075 \ifpgf@circuit@dashed
10076 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
10077 \fi
10078
10079 % draw outer box
10080 \pgf@circ@twoportbox
10081
10082 \ifpgf@circuit@inputarrow
10083 {
10084 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
10085 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10086 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
10087 }
10088 \fi
10089
10090 % rotate inner symbol
10091 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
10092 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
10093 \pgftransformrotate{270}
10094 \fi\fi
10095 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
10096 \pgftransformrotate{180}
10097 \fi\fi
10098 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
10099 \pgftransformrotate{90}
10100 \fi\fi
10101
10102 % draw inner symbol
10103 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
10104 \pgfsetarrows{-} %never draw arrows
10105 \pgfsetlinewidth{\pgfstartlinewidth}
10106 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10107 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10108 \pgfusepath{draw}
10109
10110 % draw sin wave
10111 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
10112 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10113 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10114 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10115 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10116 \pgfusepath{draw}
10117
10118 % draw equal sign
10119 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
10120 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
10121 \pgfusepath{draw}
10122 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
10123 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
10124 \pgfusepath{draw}
10125 }
10126
10127
10128 %% threephase ac/dc converter
10129 \pgfcircdeclarebipolescaled{blocks}
10130 {
10131 \anchor{dc1}{
10132 \northeast
10133 \pgf@y=.4\pgf@y
10134 }
10135 \anchor{dc2}{
10136 \northeast
10137 \pgf@y=-.4\pgf@y
10138 }
10139 \anchor{ac1}{
10140 \northeast
10141 \pgf@y=.6\pgf@y
10142 \pgf@x=-\pgf@x
10143 }
10144 \anchor{ac2}{
10145 \northeast
10146 \pgf@y=0\pgf@y
10147 \pgf@x=-\pgf@x
10148 }
10149 \anchor{ac3}{
10150 \northeast
10151 \pgf@y=-.6\pgf@y
10152 \pgf@x=-\pgf@x
10153 }
10154 }
10155 {\ctikzvalof{bipoles/tacdc/width}}
10156 {tacdc}
10157 {\ctikzvalof{bipoles/tacdc/width}}
10158 {\ctikzvalof{bipoles/tacdc/width}}
10159 {
10160 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
10161 \divide \pgf@circ@res@step by 2
10162
10163 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10164 \pgf@circ@res@other = \pgf@circ@res@left
10165 \advance\pgf@circ@res@other by \pgf@circ@res@step
10166
10167 \ifpgf@circuit@dashed
10168 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
10169 \fi
10170
10171 % draw outer box
10172 \pgf@circ@twoportbox
10173
10174 \ifpgf@circuit@inputarrow
10175 {
10176 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
10177 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10178 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
10179 }
10180 \fi
10181
10182 % rotate inner symbol
10183 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
10184 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
10185 \pgftransformrotate{270}
10186 \fi\fi
10187 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
10188 \pgftransformrotate{180}
10189 \fi\fi
10190 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
10191 \pgftransformrotate{90}
10192 \fi\fi
10193
10194 % draw inner symbol
10195 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
10196 \pgfsetarrows{-} %never draw arrows
10197 \pgfsetlinewidth{\pgfstartlinewidth}
10198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10200 \pgfusepath{draw}
10201
10202 % draw sin waves
10203 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
10204 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10205 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10206 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10207 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10208 \pgfusepath{draw}
10209 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
10210 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10211 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10212 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10213 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10214 \pgfusepath{draw}
10215 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
10216 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10217 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10218 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10219 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10220 \pgfusepath{draw}
10221
10222
10223
10224
10225 % draw equal sign
10226 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
10227 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
10228 \pgfusepath{draw}
10229 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
10230 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
10231 \pgfusepath{draw}
10232 }
10233
10234
10235 %% threephase dc/ac converter
10236 \pgfcircdeclarebipolescaled{blocks}
10237 {
10238 \anchor{dc1}{
10239 \northeast
10240 \pgf@y=.4\pgf@y
10241 \pgf@x=-\pgf@x
10242 }
10243 \anchor{dc2}{
10244 \northeast
10245 \pgf@y=-.4\pgf@y
10246 \pgf@x=-\pgf@x
10247 }
10248 \anchor{ac1}{
10249 \northeast
10250 \pgf@y=.6\pgf@y
10251 }
10252 \anchor{ac2}{
10253 \northeast
10254 \pgf@y=0\pgf@y
10255 }
10256 \anchor{ac3}{
10257 \northeast
10258 \pgf@y=-.6\pgf@y
10259 }
10260 }
10261 {\ctikzvalof{bipoles/tdcac/width}}
10262 {tdcac}
10263 {\ctikzvalof{bipoles/tdcac/width}}
10264 {\ctikzvalof{bipoles/tdcac/width}}
10265 {
10266 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
10267 \divide \pgf@circ@res@step by 2
10268
10269 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10270 \pgf@circ@res@other = \pgf@circ@res@left
10271 \advance\pgf@circ@res@other by \pgf@circ@res@step
10272
10273 \ifpgf@circuit@dashed
10274 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
10275 \fi
10276
10277 % draw outer box
10278 \pgf@circ@twoportbox
10279
10280 \ifpgf@circuit@inputarrow
10281 {
10282 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
10283 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10284 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
10285 }
10286 \fi
10287
10288 % rotate inner symbol
10289 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
10290 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
10291 \pgftransformrotate{270}
10292 \fi\fi
10293 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
10294 \pgftransformrotate{180}
10295 \fi\fi
10296 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
10297 \pgftransformrotate{90}
10298 \fi\fi
10299
10300 % draw inner symbol
10301 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
10302 \pgfsetarrows{-} %never draw arrows
10303 \pgfsetlinewidth{\pgfstartlinewidth}
10304 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10305 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10306 \pgfusepath{draw}
10307
10308 % draw sin waves
10309 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
10310 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10311 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10312 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10313 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10314 \pgfusepath{draw}
10315 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
10316 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10317 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10318 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10319 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10320 \pgfusepath{draw}
10321 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}}
10322 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10323 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10324 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10325 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10326 \pgfusepath{draw}
10327
10328
10329
10330
10331 % draw equal sign
10332 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
10333 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
10334 \pgfusepath{draw}
10335 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
10336 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
10337 \pgfusepath{draw}
10338 }
10339
10340
10341 %%%%%%%%%%%%%%%%%%%%%%%
10342 %% MECHANICAL SYMBOLS
10343 %%%%%%%%%%%%%%%%%%%%%%%
10344
10345 %% mechanical capacitance - stiffness/spring
10346
10347 \pgfcircdeclarebipolescaled{mechanicals}
10348 {}
10349 {\ctikzvalof{bipoles/spring/height}}
10350 {spring}
10351 {\ctikzvalof{bipoles/spring/height}}
10352 {\ctikzvalof{bipoles/spring/width}}{
10353 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10354 \pgftransformationadjustments
10355
10356 \pgfmathsetlength{\pgf@circ@res@step}
10357 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
10358
10359 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
10360 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
10361 \pgf@circ@res@other = \pgf@circ@res@left
10362 \advance\pgf@circ@res@other by \pgf@circ@res@step
10363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10364 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10365 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10366 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10367 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10368 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10369 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10370 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10372 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10373 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10374 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10376 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10377 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10378 \advance\pgf@circ@res@other by \pgf@circ@res@step
10379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10380 \pgfsetbuttcap
10381 \pgfsetbeveljoin
10382 \pgfusepath{stroke}
10383 }
10384
10385 %% mechanical capacitance - inerter
10386 \pgfcircdeclarebipolescaled{mechanicals}
10387 {}
10388 {\ctikzvalof{bipoles/inerter/height}}
10389 {inerter}
10390 {\ctikzvalof{bipoles/inerter/height}}
10391 {\ctikzvalof{bipoles/inerter/width}}
10392 {
10393 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10394 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10395 \pgf@circ@draworfill
10396 }
10397
10398
10399 %% mechanical inductance - mass
10400 \pgfcircdeclarebipolescaled{mechanicals}
10401 {}
10402 {\ctikzvalof{bipoles/mass/box height}}
10403 {mass}
10404 {\ctikzvalof{bipoles/mass/height}}
10405 {\ctikzvalof{bipoles/mass/width}}
10406 {
10407 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10408 \pgftransformationadjustments
10409 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10410 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
10411 \pgf@circ@draworfill
10412
10413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10414 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10416 \pgfsetrectcap
10417 \pgfsetmiterjoin
10418 \pgfusepath{stroke}
10419 }
10420
10421 %% mechanical resistor - damper
10422 \pgfcircdeclarebipolescaled{mechanicals}
10423 {}
10424 {\ctikzvalof{bipoles/damper/height}}
10425 {damper}
10426 {\ctikzvalof{bipoles/damper/height}}
10427 {\ctikzvalof{bipoles/damper/width}}
10428 {
10429 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10430 \pgf@circ@maybefill
10431
10432 % line into the damper
10433 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10434 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10435 {\pgf@circ@res@zero}}
10436 \pgfusepath{stroke}
10437
10438 % damper box
10439 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10440 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10441 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10442 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10444
10445 \pgfsetrectcap
10446 \pgfsetmiterjoin
10447 \pgfusepath{stroke}
10448
10449 % damper vertical element
10450 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10451 {.8\pgf@circ@res@down}}
10452 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10453 {.8\pgf@circ@res@up}}
10454 \pgfsetbuttcap
10455 \pgfusepath{stroke}
10456
10457 }
10458 %% mechanical viscoelastic element, suggested by @alex
10459 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
10460 \pgfcircdeclarebipolescaled{mechanicals}
10461 {} % extra anchors
10462 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
10463 {viscoe} % name
10464 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
10465 {\ctikzvalof{bipoles/damper/width}} % width
10466 { % draw the bipole
10467 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10468 \pgf@circ@maybefill
10469
10470 % spring into the damper
10471 \pgfscope
10472 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10473 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10474 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
10475 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
10476 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
10477 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
10478 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
10479 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
10480 \pgfusepath{stroke}
10481 \endpgfscope
10482 % damper box
10483 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10485 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10486 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10488
10489 \pgfsetrectcap
10490 \pgfsetmiterjoin
10491 \pgfusepath{stroke}
10492
10493 % damper vertical element
10494 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10495 {.8\pgf@circ@res@down}}
10496 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10497 {.8\pgf@circ@res@up}}
10498 \pgfsetbuttcap
10499 \pgfusepath{stroke}
10500
10501 }
10502
10503 %%%%%%%%%%%%%%%%
10504 %% Crossing
10505 %%%%%%%%%%%%%%%%
10506
10507 %% crossing bipole (but see also nodes)
10508 \pgfcircdeclarebipole
10509 {}
10510 {\ctikzvalof{bipoles/crossing/size}}
10511 {crossing}
10512 {\ctikzvalof{bipoles/crossing/size}}
10513 {\ctikzvalof{bipoles/crossing/size}}{
10514 \pgfscope
10515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10516 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
10517 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
10518 \pgfsetbeveljoin
10519 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10520 \pgfusepath{draw}
10521 \endpgfscope
10522 }
10523
10524 %%%%%%%%%%%%%%%%%%%%%%%%%
10525 %% Miscellaneous bipoles
10526 %%%%%%%%%%%%%%%%%%%%%%%%%
10527
10528 %% loudspeaker and microphone
10529
10530 \pgfcircdeclarebipolescaled{misc}
10531 {}
10532 {\ctikzvalof{bipoles/loudspeaker/depth}}
10533 {loudspeaker}
10534 {\ctikzvalof{bipoles/loudspeaker/height}}
10535 {\ctikzvalof{bipoles/loudspeaker/width}}{
10536
10537 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
10538 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10539 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
10540 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
10541 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
10542 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
10543 \pgfpathclose
10544 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10545 \pgf@circ@draworfill
10546 }
10547
10548 \pgfcircdeclarebipolescaled{misc}
10549 {}
10550 {\ctikzvalof{bipoles/mic/depth}}
10551 {mic}
10552 {\ctikzvalof{bipoles/mic/height}}
10553 {\ctikzvalof{bipoles/mic/width}}{
10554
10555 \pgfscope
10556 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10557 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
10558 \pgf@circ@draworfill
10559 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
10560 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
10561 \pgfusepath{draw}
10562 \endpgfscope
10563 \pgfscope
10564 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10565 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
10566 % 0.25358 is 0.6-0.4*cos(30)
10567 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10568 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10569 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
10570 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10571 \pgfusepath{draw}
10572
10573 \pgfusepath{draw}
10574 \endpgfscope
10575 }
10576
10577 %% european gas filled surge arrester
10578 \pgfcircdeclarebipolescaled{misc}
10579 {}
10580 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10581 {european gas filled surge arrester}
10582 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10583 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
10584 {
10585
10586 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10587 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10588
10589 \pgf@circ@draworfill
10590
10591 \pgfscope
10592 \pgfsetarrowsend{latexslim}
10593 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10594 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
10595 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10596 \pgfusepath{draw}
10597
10598 \endpgfscope
10599 }
10600
10601 %% american gas filled surge arrester
10602 \pgfcircdeclarebipolescaled{misc}
10603 {}
10604 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10605 {american gas filled surge arrester}
10606 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10607 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
10608
10609 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10610 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
10611 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10612 \pgfusepath{draw}
10613
10614 \pgfscope
10615 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10616 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10617 \pgf@circ@draworfill
10618 \endpgfscope
10619
10620 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
10621 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10622 \pgfusepath{draw}
10623
10624 \pgfscope
10625 \pgfsetarrowsend{latex}
10626
10627 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10628 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
10629 \pgfusepath{draw}
10630
10631 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10632 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
10633 \pgfusepath{draw}
10634 \endpgfscope{}
10635
10636 \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}
10637 \pgfusepath{fill}
10638 }
10639
10640 %% thermocouple
10641 \pgfcircdeclarebipolescaled{misc}
10642 {}
10643 {\ctikzvalof{bipoles/thermocouple/height 2}}
10644 {thermocouple}
10645 {\ctikzvalof{bipoles/thermocouple/height}}
10646 {\ctikzvalof{bipoles/thermocouple/width}}
10647 {
10648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10650 \pgfusepath{draw}
10651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10652 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10653 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
10654 \pgfusepath{draw}
10655 \pgfsetlinewidth{\pgfstartlinewidth}
10656 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
10657 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
10658 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10659 \pgfusepath{draw}
10660 }
10661
10662 %% fuse
10663 \pgfcircdeclarebipolescaled{misc}
10664 {}
10665 {\ctikzvalof{bipoles/fuse/height}}
10666 {fuse}
10667 {\ctikzvalof{bipoles/fuse/height}}
10668 {\ctikzvalof{bipoles/fuse/width}}
10669 {
10670 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10671 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10672 \pgfusepath{draw}
10673
10674 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10675 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10676
10677 \pgf@circ@draworfill
10678 }
10679
10680 %% asymmetric fuse
10681 \pgfcircdeclarebipolescaled{misc}
10682 {}
10683 {\ctikzvalof{bipoles/afuse/height}}
10684 {afuse}
10685 {\ctikzvalof{bipoles/afuse/height}}
10686 {\ctikzvalof{bipoles/afuse/width}}
10687 {
10688 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10689 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10690 \pgfusepath{draw}
10691
10692 \pgfscope
10693 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10694 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10695 \pgf@circ@draworfill
10696 \endpgfscope
10697
10698 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10699 \pgfusepath{stroke,fill}
10700 }
10701
10702 %% SQUID added by Cor Molenaar 5 March 2010
10703 \pgfcircdeclarebipolescaled{misc}
10704 {}
10705 {\ctikzvalof{bipoles/squid/height}}
10706 {squid}
10707 {\ctikzvalof{bipoles/squid/height}}
10708 {\ctikzvalof{bipoles/squid/width}}
10709 {
10710 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10711
10712 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10713 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
10714 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
10715 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
10716 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
10717 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
10718 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
10719 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
10720 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
10721
10722 \pgfusepath{draw}
10723 }
10724
10725 % Generic barrier added by Cor Molenaar 5 March 2010
10726 \pgfcircdeclarebipolescaled{misc}
10727 {}
10728 {\ctikzvalof{bipoles/barrier/height}}
10729 {barrier}
10730 {\ctikzvalof{bipoles/barrier/height}}
10731 {\ctikzvalof{bipoles/barrier/width}}
10732 {
10733 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10734
10735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
10736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
10737 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10738 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10739 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10740 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10741
10742 \pgfusepath{draw}
10743 }
10744
10745 %
10746 % open version of the barrier symbol
10747 % suggested by Radványi Patrik Tamás <[email protected]>
10748 %
10749 \pgfcircdeclarebipolescaled{misc}
10750 {}
10751 {\ctikzvalof{bipoles/barrier/height}}
10752 {openbarrier}
10753 {\ctikzvalof{bipoles/barrier/height}}
10754 {\ctikzvalof{bipoles/barrier/width}}
10755 {
10756 % this is set with normal wire linewidth
10757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10758 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
10759 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10760 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
10761 \pgfusepath{draw}
10762
10763 % do the cross part
10764 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10765
10766 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10767 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10768 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10769 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10770
10771 \pgfusepath{draw}
10772 }
10773 %% Lamp
10774 \pgfcircdeclarebipolescaled{misc}
10775 {}
10776 {\ctikzvalof{bipoles/lamp/height}}
10777 {lamp}
10778 {\ctikzvalof{bipoles/lamp/height}}
10779 {\ctikzvalof{bipoles/lamp/width}}
10780 {
10781 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10782
10783 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10784 \pgf@circ@draworfill
10785 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
10786 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
10787 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
10788 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
10789 \pgfusepath{draw}
10790 }
10791
10792 %% bulb
10793 \pgfcircdeclarebipolescaled{misc}
10794 {}
10795 {\ctikzvalof{bipoles/bulb/height}}
10796 {bulb}
10797 {\ctikzvalof{bipoles/bulb/height}}
10798 {\ctikzvalof{bipoles/bulb/width}}
10799 {%
10800 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10801 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
10802 \pgf@circ@draworfill
10803 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10804 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
10805 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
10806 \pgfsetbeveljoin
10807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10808 \pgfusepath{draw}
10809 }
10810
10811
10812 % end of pgfcircbipoles.tex
10813 %%%---------- close: tex/pgfcircbipoles
10814 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
10815 %%%---------- open: tex/pgfcirctripoles.tex
10816 % Copyright 2018-2026 by Romano Giannetti
10817 % Copyright 2015-2026 by Stefan Lindner
10818 % Copyright 2013-2026 by Stefan Erhardt
10819 % Copyright 2007-2026 by Massimo Redaelli
10820 %
10821 % This file may be distributed and/or modified
10822 %
10823 % 1. under the LaTeX Project Public License and/or
10824 % 2. under the GNU Public License.
10825 %
10826 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
10827
10828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10829 %% Tripoles
10830
10831 %%%%%%%%%%%%%
10832 %% switches
10833 %%%%%%%%%%%%%
10834
10835 % Legacy spdt
10836 \pgfdeclareshape{spdt}{
10837 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10838 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10839 \savedanchor\northwest{%
10840 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10841 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
10842 \pgf@y=.5\pgf@y
10843 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10844 \pgf@x=.5\pgf@x
10845 }
10846 \anchor{left}{%
10847 \northwest
10848 \pgf@y=0pt
10849 }
10850 \anchor{in}{
10851 \northwest
10852 \pgf@y=0pt
10853 }
10854 \anchor{out 1}{
10855 \northwest
10856 \pgf@x=-\pgf@x
10857 }
10858 \anchor{out 2}{
10859 \northwest
10860 \pgf@x=-\pgf@x
10861 \pgf@y=-\pgf@y
10862 }
10863 \anchor{center}{
10864 \pgf@y=0pt
10865 \pgf@x=0pt
10866 }
10867 \anchor{east}{
10868 \northwest
10869 \pgf@y=0pt
10870 \pgf@x=-\pgf@x
10871 }
10872 \anchor{west}{
10873 \northwest
10874 \pgf@y=0pt
10875 }
10876 \anchor{south}{
10877 \northwest
10878 \pgf@x=0pt
10879 \pgf@y=-\pgf@y
10880 }
10881 \anchor{north}{
10882 \northwest
10883 \pgf@x=0pt
10884 }
10885 \anchor{south west}{
10886 \northwest
10887 \pgf@y=-\pgf@y
10888 }
10889 \anchor{north east}{
10890 \northwest
10891 \pgf@x=-\pgf@x
10892 }
10893 \anchor{north west}{
10894 \northwest
10895 }
10896 \anchor{south east}{
10897 \northwest
10898 \pgf@x=-\pgf@x
10899 \pgf@y=-\pgf@y
10900 }
10901 \backgroundpath{
10902 \pgfsetcolor{\ctikzvalof{color}}
10903
10904 \northwest
10905 \pgf@circ@res@up = \pgf@y
10906 \pgf@circ@res@down = -\pgf@y
10907 \pgf@circ@res@right = -\pgf@x
10908 \pgf@circ@res@left = \pgf@x
10909 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
10910
10911
10912 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10913 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10914 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10915 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10916
10917 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10918 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10919
10920 \pgfusepath{draw}
10921
10922 \pgfscope
10923 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10924 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
10925 \endpgfscope
10926 \pgfscope
10927 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10928 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
10929 \endpgfscope
10930 \pgfscope
10931 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
10932 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
10933 \endpgfscope
10934
10935 \pgfscope
10936 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
10937 \pgfpathlineto{
10938 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
10939 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
10940 }
10941 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10942 \pgfusepath{draw}
10943 \endpgfscope
10944 }
10945 }
10946
10947
10948 % cute switch "node" shapes, matching with cute "to" shapes
10949 % #1 -> name
10950 % #2 -> barposition
10951 % #3 -> arrowcode
10952 \long\def\pgfcircdeclarecutespdt#1#2#3{
10953 \pgfdeclareshape{#1}
10954 {
10955 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10956 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10957 \savedanchor\northwest{%
10958 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10959 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10960 \pgf@y=.5\pgf@y
10961 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10962 \pgf@x=.25\pgf@x
10963 }
10964 \savedanchor\midlever{
10965 % these values are calculated when we create the definition of the shape.
10966 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10967 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10968 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
10969 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10970 \pgf@circ@res@down = -.5\pgf@y
10971 \pgf@circ@res@up = .5\pgf@y
10972 \pgfextracty{\pgf@circ@res@other}{#2}
10973 \pgf@x=0pt
10974 \pgf@y=.5\pgf@circ@res@other
10975 }
10976 % radius of the connector
10977 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10978 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10979 % shapename
10980 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10981 % shape type
10982 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
10983 % mid of the lever, to stack switches
10984 \anchor{mid}{\midlever}
10985 % center anchors
10986 \anchor{cin}{ \northwest \pgf@y=0pt}
10987 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
10988 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10989 % horizontal angles
10990 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
10991 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
10992 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
10993
10994 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
10995 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
10996 \anchor{west}{ \northwest \pgf@y=0pt }
10997 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
10998 \anchor{north}{ \northwest \pgf@x=0pt }
10999 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
11000 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
11001 \anchor{north west}{ \northwest }
11002 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
11003
11004 \backgroundpath{
11005 \pgfsetcolor{\ctikzvalof{color}}
11006 \northwest
11007 \pgf@circ@res@up = \pgf@y
11008 \pgf@circ@res@down = -\pgf@y
11009 \pgf@circ@res@right = -\pgf@x
11010 \pgf@circ@res@left = \pgf@x
11011
11012 \pgfscope
11013 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
11014 \pgf@circ@res@temp=\radius\relax
11015 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
11016 \pgfsetlinewidth{2\pgf@circ@res@temp}
11017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11018 \pgfpathlineto{#2}
11019 \pgfsetroundcap\pgfusepath{draw}
11020 \endpgfscope
11021 \pgfscope % arrow
11022 #3
11023 \endpgfscope
11024 % terminals
11025 \pgfscope
11026 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11027 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
11028 \endpgfscope
11029 \pgfscope
11030 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11031 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
11032 \endpgfscope
11033 \pgfscope
11034 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
11035 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
11036 \endpgfscope
11037
11038 }
11039 }
11040 }
11041
11042 \pgfcircdeclarecutespdt{cute spdt up}
11043 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
11044 {}
11045
11046 \pgfcircdeclarecutespdt{cute spdt mid}
11047 {\pgfpoint{\pgf@circ@res@right}{0pt}}
11048 {}
11049
11050 \pgfcircdeclarecutespdt{cute spdt down}
11051 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
11052 {}
11053
11054 \pgfcircdeclarecutespdt{cute spdt up arrow}
11055 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
11056 {
11057 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11058 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
11059 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
11060 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
11061 \pgfsetarrowsend{latexslim}
11062 \pgfusepath{draw}
11063 }
11064
11065 \pgfcircdeclarecutespdt{cute spdt mid arrow}
11066 {\pgfpoint{\pgf@circ@res@right}{0pt}}
11067 {
11068 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11069 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
11070 \pgfsetarrowsstart{latexslim}
11071 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
11072 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
11073 \pgfsetarrowsend{latexslim}
11074 \pgfusepath{draw}
11075 }
11076
11077 \pgfcircdeclarecutespdt{cute spdt down arrow}
11078 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
11079 {
11080 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11081 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
11082 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
11083 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
11084 \pgfsetarrowsend{latexslim}
11085 \pgfusepath{draw}
11086 }
11087
11088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090 %%
11091 %% Logic ports
11092 %%
11093 %% Code from John Kormylo at tex.stackexchange.com
11094 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
11095 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
11096 %%
11097
11098 \newcount\pgf@circ@res@count% reserve global register
11099
11100 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
11101 {%
11102 \pgfextracty{\pgf@circ@res@up}{\northeast}%
11103 \step
11104 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
11105 \advance\pgf@y by -#1\pgf@circ@res@step\relax
11106 }%
11107
11108 % #1 = \pgfmathcounter #2=type #3 specificic port
11109 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
11110 \def\pgf@circ@logicport@baseinput#1#2#3%
11111 {%
11112 % and and nand
11113 \ifnum #2=1\relax
11114 \pgfextracty{\pgf@circ@res@up}{\northeast}%
11115 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11116 \step
11117 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
11118 \advance\pgf@y by -#1\pgf@circ@res@step\relax
11119 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
11120 \fi
11121 % or and nor
11122 \ifnum #2=2\relax
11123 \pgfextracty{\pgf@circ@res@up}{\northeast}%
11124 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11125 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11126 \step
11127 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
11128 \advance\pgf@y by -#1\pgf@circ@res@step\relax
11129 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
11130 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
11131 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11132 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
11133 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
11134 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11135 \pgf@circ@res@temp=\pgf@y
11136 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
11137 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11138 \pgf@x=\pgf@circ@res@other
11139 \fi
11140 % xor and xnor
11141 \ifnum #2=3\relax
11142 \pgfextracty{\pgf@circ@res@up}{\northeast}%
11143 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11144 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11145 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
11146 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
11147 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11148 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
11149 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
11150 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11151 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
11152 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
11153 % this compensates for the effect of the line width on the gap between the arcs
11154 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
11155 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
11156
11157 \step
11158 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
11159 \advance\pgf@y by -#1\pgf@circ@res@step\relax
11160 \pgf@circ@res@temp=\pgf@y
11161 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
11162 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11163 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
11164 \pgf@x=\pgf@circ@res@other
11165 \fi
11166 % european
11167 \ifnum #2=4\relax
11168 \pgfextracty{\pgf@circ@res@up}{\northeast}%
11169 \pgfextractx{\pgf@circ@res@other}{\left}%
11170 \step
11171 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
11172 \advance\pgf@y by -#1\pgf@circ@res@step\relax
11173 \pgf@x=\pgf@circ@res@other
11174 \fi
11175 }%
11176
11177 %%% american
11178 \long\def\pgfcircdeclarelogicport#1#2#3{%
11179 \pgfdeclareshape{american #1 port}%
11180 {%
11181 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11182 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11183 \savedmacro\resize{% automatic
11184 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11185 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
11186 \pgf@circ@res@up = .5\pgf@circ@res@up
11187 \pgf@circ@res@down = -\pgf@circ@res@up
11188 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
11189 \pgf@circ@res@right = .5\pgf@circ@res@right
11190 \pgf@circ@res@left = -\pgf@circ@res@right
11191 }%
11192 \savedmacro\inputs{% get number of inputs
11193 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11194 \ifnum\pgf@circ@res@count=0
11195 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
11196 \fi
11197 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11198 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11199 \def\inputs{\the\pgf@circ@res@count}%
11200 }%
11201 \savedanchor\step{% 1/2 gap at edges
11202 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11203 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
11204 \divide\pgf@circ@res@step by \pgf@circ@res@count
11205 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11206 }%
11207 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11208 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11209 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
11210 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
11211 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
11212
11213 \anchor{center}{\origin}% for backwards compatibility
11214 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
11215
11216 % create input anchors
11217 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
11218 \pgfmathloop%
11219 \ifnum\pgfmathcounter>\pgf@circ@res@count%
11220 \else%
11221 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
11222 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
11223 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11224 }%
11225 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
11226 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
11227 }%
11228 %}{}%
11229 \repeatpgfmathloop%
11230 }
11231
11232 \anchor{out}{\northeast\pgf@y=0pt}
11233 \anchor{bout}{\right\pgf@y=0pt}
11234
11235
11236 \anchor{left}{\left}% edges of component minus leads
11237 \anchor{right}{\right}
11238
11239 \anchor{north east}{\northeast}% see \Compass macro
11240 \anchor{south west}{\southwest}
11241 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11242 \pgfpoint{0cm}{\pgf@circ@res@up}}
11243 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11244 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11245 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11246 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
11247 \pgfpoint{\pgf@circ@res@left}{0cm}}
11248 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11249 \pgfpoint{0cm}{\pgf@circ@res@down}}
11250 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11251 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11252 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11253 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
11254 \pgfpoint{\pgf@circ@res@right}{0cm}}
11255
11256 \backgroundpath{
11257 \pgfsetcolor{\ctikzvalof{color}}
11258 #3
11259 }
11260 }
11261 }
11262 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11263 \pgfcircdeclarelogicport{and}{1}{
11264 \pgfextracty{\pgf@circ@res@temp}{\step}%
11265 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11266 \pgf@circ@res@count = \inputs\relax
11267 \ifpgfcirc@draw@input@leads
11268 %input leads
11269 \loop\ifnum\pgf@circ@res@count>0
11270 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11271 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11272 \pgfpathlineto{\pgfpoint
11273 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
11274 {\pgf@circ@res@temp}}
11275 \advance\pgf@circ@res@count by -1
11276 \repeat
11277 \fi
11278 % output lead
11279 \ifpgfcirc@draw@output@leads
11280 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11281 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
11282 \pgfusepath{draw}
11283 \fi
11284
11285
11286 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11287 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
11288
11289 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11290 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11291 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
11292 \pgfpathclose
11293 \pgf@circ@draworfill
11294 }
11295 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11296 \pgfcircdeclarelogicport{nand}{1}{
11297 \pgfextracty{\pgf@circ@res@temp}{\step}%
11298 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11299 \pgf@circ@res@count = \inputs\relax
11300 \ifpgfcirc@draw@input@leads
11301 %input leads
11302 \loop\ifnum\pgf@circ@res@count>0
11303 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11304 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11305 \pgfpathlineto{\pgfpoint
11306 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
11307 {\pgf@circ@res@temp}}
11308 \advance\pgf@circ@res@count by -1
11309 \repeat
11310 \fi
11311
11312 \ifpgfcirc@draw@output@leads
11313 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11314 \pgfpathlineto{\pgfpoint
11315 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
11316 \pgfusepath{draw}
11317 \fi
11318 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11319 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
11320 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
11321 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11322
11323 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
11324 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
11325 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
11326 \pgfpathclose
11327
11328 \pgfpathellipse
11329 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
11330 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11331 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11332
11333 \pgf@circ@draworfill
11334 }
11335 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11336 \pgfcircdeclarelogicport{nor}{2}{
11337 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
11338 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
11339 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11340 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
11341 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
11342 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11343
11344 \pgfextracty{\pgf@circ@res@temp}{\step}%
11345 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11346 \pgf@circ@res@count = \inputs\relax
11347 \ifpgfcirc@draw@input@leads
11348 %input leads
11349 \loop\ifnum\pgf@circ@res@count>0
11350 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11351 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11352 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
11353 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11354 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11355 \advance\pgf@circ@res@count by -1
11356 \repeat
11357 \fi
11358
11359 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
11360 \ifpgfcirc@draw@output@leads
11361 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11363 \pgfusepath{draw}
11364 \fi
11365
11366 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11367
11368 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
11369 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
11370 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11371 \advance\pgf@circ@res@other by -\pgf@circ@res@step
11372
11373 % main shape
11374 \ifpgfcirc@roundy@or@shapes
11375 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11376 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11377 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11378 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11379 \pgfpathclose
11380 \else
11381 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11382 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11383 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11384 \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}}
11385 \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}}
11386 \pgfpathclose
11387 \fi
11388
11389 % not dot
11390 \pgfpathellipse
11391 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11392 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11393 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11394
11395 \pgf@circ@draworfill
11396 }
11397 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11398 \pgfcircdeclarelogicport{or}{2}{
11399 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
11400 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
11401 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11402 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
11403 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
11404 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11405
11406 \pgfextracty{\pgf@circ@res@temp}{\step}%
11407 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11408 \pgf@circ@res@count = \inputs\relax
11409 \ifpgfcirc@draw@input@leads
11410 %input leads
11411 \loop\ifnum\pgf@circ@res@count>0
11412 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11414 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
11415 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11416 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11417 \advance\pgf@circ@res@count by -1
11418 \repeat
11419 \fi
11420
11421 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
11422 \ifpgfcirc@draw@output@leads
11423 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11425 \pgfusepath{draw}
11426 \fi
11427
11428 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11429
11430 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
11431
11432 % main shape
11433 \ifpgfcirc@roundy@or@shapes
11434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11435 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11436 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11437 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11438 \pgfpathclose
11439 \else
11440 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11441 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11442 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11443 \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}}
11444 \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}}
11445 \pgfpathclose
11446 \fi
11447
11448 \pgf@circ@draworfill
11449 }
11450 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11451 \pgfcircdeclarelogicport{xor}{3}{
11452 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
11453 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
11454 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11455 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
11456 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
11457 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11458 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
11459 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
11460 % this compensates for the effect of the line width on the gap between the arcs
11461 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
11462 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
11463
11464 \pgfextracty{\pgf@circ@res@temp}{\step}%
11465 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11466 \pgf@circ@res@count = \inputs\relax
11467 \ifpgfcirc@draw@input@leads
11468 %input leads
11469 \loop\ifnum\pgf@circ@res@count>0
11470 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11471 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11472 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
11473 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11474 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
11475 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11476 \advance\pgf@circ@res@count by -1
11477 \repeat
11478 \fi
11479
11480 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
11481 \ifpgfcirc@draw@output@leads
11482 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11484 \pgfusepath{draw}
11485 \fi
11486
11487 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11488
11489 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
11490
11491 % main shape
11492 \ifpgfcirc@roundy@or@shapes
11493 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11494 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11495 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11496 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11497 \pgfpathclose
11498 \else
11499 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11501 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11502 \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}}
11503 \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}}
11504 \pgfpathclose
11505 \fi
11506 \pgf@circ@draworfill
11507
11508 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11509
11510 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11511 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11512
11513 \pgfusepath{draw}
11514 }
11515 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11516 \pgfcircdeclarelogicport{xnor}{3}{
11517 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
11518 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
11519 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11520 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
11521 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
11522 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11523 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
11524 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
11525 % this compensates for the effect of the line width on the gap between the arcs
11526 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
11527 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
11528
11529 \pgfextracty{\pgf@circ@res@temp}{\step}%
11530 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11531 \pgf@circ@res@count = \inputs\relax
11532 \ifpgfcirc@draw@input@leads
11533 %input leads
11534 \loop\ifnum\pgf@circ@res@count>0
11535 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11536 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11537 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
11538 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11539 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
11540 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11541 \advance\pgf@circ@res@count by -1
11542 \repeat
11543 \fi
11544
11545 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
11546 \ifpgfcirc@draw@output@leads
11547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11548 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11549 \pgfusepath{draw}
11550 \fi
11551
11552 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11553
11554 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
11555 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
11556 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11557 \advance\pgf@circ@res@other by -\pgf@circ@res@step
11558
11559 % main shape
11560 \ifpgfcirc@roundy@or@shapes
11561 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11562 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11563 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11564 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11565 \pgfpathclose
11566 \else
11567 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11568 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11569 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11570 \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}}
11571 \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}}
11572 \pgfpathclose
11573 \fi
11574
11575 \pgfpathellipse
11576 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11577 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11578 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11579 \pgf@circ@draworfill
11580
11581 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
11582 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11583
11584 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11585 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11586
11587 \pgfusepath{draw}
11588 }
11589
11590 %%% Original one-input ports
11591
11592 \pgfdeclareshape{american not port}{
11593 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11594 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11595 \anchor{center}{\pgfpointorigin}
11596 \savedanchor\northwest{%
11597 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11598 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11599 \pgf@y=.5\pgf@y
11600 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11601 \pgf@x=.5\pgf@x
11602 }
11603 \anchor{in}{
11604 \northwest
11605 \pgf@y=0pt
11606 }
11607 \anchor{in 1}{
11608 \northwest
11609 \pgf@y=0pt
11610 }
11611 \anchor{left}{
11612 \northwest
11613 \pgf@x=0.7\pgf@x
11614 \pgf@y=0pt
11615 }
11616 \anchor{bin}{
11617 \northwest
11618 \pgf@x=0.7\pgf@x
11619 \pgf@y=0pt
11620 }
11621 \anchor{bin 1}{
11622 \northwest
11623 \pgf@y=0pt
11624 \pgf@x=0.7\pgf@x
11625 }
11626 \anchor{out}{
11627 \northwest
11628 \pgf@y=0pt
11629 \pgf@x=-\pgf@x
11630 }
11631 \anchor{right}{
11632 \northwest
11633 \pgf@y=0pt
11634 \pgf@x=-0.7\pgf@x
11635 }
11636 \anchor{bout}{
11637 \northwest
11638 \pgf@y=0pt
11639 \pgf@x=-0.7\pgf@x
11640 }
11641 \anchor{center}{
11642 \pgfpointorigin
11643 }
11644 \anchor{east}{
11645 \northwest
11646 \pgf@y=0pt
11647 \pgf@x=-\pgf@x
11648 }
11649 \anchor{west}{
11650 \northwest
11651 \pgf@y=0pt
11652 }
11653 \anchor{south}{
11654 \northwest
11655 \pgf@x=0pt
11656 \pgf@y=-\pgf@y
11657 }
11658 \anchor{north}{
11659 \northwest
11660 \pgf@x=0pt
11661 }
11662 \anchor{south west}{
11663 \northwest
11664 \pgf@y=-\pgf@y
11665 }
11666 \anchor{north east}{
11667 \northwest
11668 \pgf@x=-\pgf@x
11669 }
11670 \anchor{north west}{
11671 \northwest
11672 }
11673 \anchor{south east}{
11674 \northwest
11675 \pgf@x=-\pgf@x
11676 \pgf@y=-\pgf@y
11677 }
11678 \anchorborder{% this is used when the node is used as a path element
11679 \pgf@xa=\pgf@x
11680 \pgf@ya=\pgf@y
11681 \pgfextracty{\pgf@circ@res@up}{\northwest}
11682 \pgfextractx{\pgf@circ@res@left}{\northwest}
11683 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11684 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11685 }
11686 \anchor{text}{%
11687 % centered and a bit to the left (it's a triangle)!
11688 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11689 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11690 }
11691 \backgroundpath{
11692 \pgfsetcolor{\ctikzvalof{color}}
11693
11694 \northwest
11695 \pgf@circ@res@up = \pgf@y
11696 \pgf@circ@res@down = -\pgf@y
11697 \pgf@circ@res@right = -\pgf@x
11698 \pgf@circ@res@left = \pgf@x
11699
11700 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11701
11702 \pgfscope
11703 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11704 \pgftransformxshift{.7\pgf@circ@res@left}
11705 \pgf@circ@res@step=\pgf@circ@res@right
11706 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11707 \pgf@circ@res@step=.7\pgf@circ@res@step
11708
11709 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11710 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11711 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11712 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11713 \pgf@circ@draworfill
11714 \pgfpathellipse
11715 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11716 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11717 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11718 \pgf@circ@draworfill
11719 \endpgfscope
11720
11721 \ifpgfcirc@draw@input@leads
11722 %input leads
11723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11724 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11725 \fi
11726
11727 \ifpgfcirc@draw@output@leads
11728 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11729 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11730 \fi
11731
11732 \pgfusepath{draw}
11733 }
11734 }
11735
11736 \pgfdeclareshape{american buffer port}{
11737 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11738 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11739 \anchor{center}{\pgfpointorigin}
11740 \savedanchor\northwest{%
11741 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11742 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11743 \pgf@y=.5\pgf@y
11744 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11745 \pgf@x=.5\pgf@x
11746 }
11747 \anchor{in}{
11748 \northwest
11749 \pgf@y=0pt
11750 }
11751 \anchor{in 1}{
11752 \northwest
11753 \pgf@y=0pt
11754 }
11755 \anchor{left}{
11756 \northwest
11757 \pgf@x=0.7\pgf@x
11758 \pgf@y=0pt
11759 }
11760 \anchor{bin}{
11761 \northwest
11762 \pgf@x=0.7\pgf@x
11763 \pgf@y=0pt
11764 }
11765 \anchor{bin 1}{
11766 \northwest
11767 \pgf@y=0pt
11768 \pgf@x=0.7\pgf@x
11769 }
11770 \anchor{out}{
11771 \northwest
11772 \pgf@y=0pt
11773 \pgf@x=-\pgf@x
11774 }
11775 \anchor{right}{
11776 \northwest
11777 \pgf@y=0pt
11778 \pgf@x=-0.7\pgf@x
11779 }
11780 \anchor{bout}{
11781 \northwest
11782 \pgf@y=0pt
11783 \pgf@x=-0.7\pgf@x
11784 }
11785 \anchor{center}{
11786 \pgfpointorigin
11787 }
11788 \anchor{east}{
11789 \northwest
11790 \pgf@y=0pt
11791 \pgf@x=-\pgf@x
11792 }
11793 \anchor{west}{
11794 \northwest
11795 \pgf@y=0pt
11796 }
11797 \anchor{south}{
11798 \northwest
11799 \pgf@x=0pt
11800 \pgf@y=-\pgf@y
11801 }
11802 \anchor{north}{
11803 \northwest
11804 \pgf@x=0pt
11805 }
11806 \anchor{south west}{
11807 \northwest
11808 \pgf@y=-\pgf@y
11809 }
11810 \anchor{north east}{
11811 \northwest
11812 \pgf@x=-\pgf@x
11813 }
11814 \anchor{north west}{
11815 \northwest
11816 }
11817 \anchor{south east}{
11818 \northwest
11819 \pgf@x=-\pgf@x
11820 \pgf@y=-\pgf@y
11821 }
11822 \anchorborder{% this is used when the node is used as a path element
11823 \pgf@xa=\pgf@x
11824 \pgf@ya=\pgf@y
11825 \pgfextracty{\pgf@circ@res@up}{\northwest}
11826 \pgfextractx{\pgf@circ@res@left}{\northwest}
11827 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11828 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11829 }
11830 \anchor{text}{%
11831 % centered and a bit to the left (it's a triangle)!
11832 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11833 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11834 }
11835 \backgroundpath{
11836 \pgfsetcolor{\ctikzvalof{color}}
11837
11838 \northwest
11839 \pgf@circ@res@up = \pgf@y
11840 \pgf@circ@res@down = -\pgf@y
11841 \pgf@circ@res@right = -\pgf@x
11842 \pgf@circ@res@left = \pgf@x
11843
11844 \pgfscope
11845 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11846 \pgftransformxshift{.7\pgf@circ@res@left}
11847 \pgf@circ@res@step=\pgf@circ@res@right
11848 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11849 \pgf@circ@res@step=.7\pgf@circ@res@step
11850
11851 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11852 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11853 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11854 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11855 \pgf@circ@draworfill
11856 \endpgfscope
11857
11858 \ifpgfcirc@draw@input@leads
11859 %input leads
11860 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11861 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11862 \fi
11863
11864 \ifpgfcirc@draw@output@leads
11865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11866 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11867 \fi
11868
11869 \pgfusepath{draw}
11870 }
11871 }
11872 \pgfdeclareshape{invschmitt}{
11873 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11874 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11875 \anchor{center}{\pgfpointorigin}
11876 \savedanchor\northwest{%
11877 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11878 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11879 \pgf@y=.5\pgf@y
11880 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11881 \pgf@x=.5\pgf@x
11882 }
11883 \anchor{in}{
11884 \northwest
11885 \pgf@y=0pt
11886 }
11887 \anchor{in 1}{
11888 \northwest
11889 \pgf@y=0pt
11890 }
11891 \anchor{left}{
11892 \northwest
11893 \pgf@y=0pt
11894 \pgf@x=0.7\pgf@x
11895 }
11896 \anchor{bin}{
11897 \northwest
11898 \pgf@y=0pt
11899 \pgf@x=0.7\pgf@x
11900 }
11901 \anchor{bin 1}{
11902 \northwest
11903 \pgf@y=0pt
11904 \pgf@x=0.7\pgf@x
11905 }
11906 \anchor{out}{
11907 \northwest
11908 \pgf@y=0pt
11909 \pgf@x=-\pgf@x
11910 }
11911 \anchor{right}{
11912 \northwest
11913 \pgf@y=0pt
11914 \pgf@x=-0.7\pgf@x
11915 }
11916 \anchor{bout}{
11917 \northwest
11918 \pgf@y=0pt
11919 \pgf@x=-0.7\pgf@x
11920 }
11921 \anchor{center}{
11922 \pgfpointorigin
11923 }
11924 \anchor{east}{
11925 \northwest
11926 \pgf@y=0pt
11927 \pgf@x=-\pgf@x
11928 }
11929 \anchor{west}{
11930 \northwest
11931 \pgf@y=0pt
11932 }
11933 \anchor{south}{
11934 \northwest
11935 \pgf@x=0pt
11936 \pgf@y=-\pgf@y
11937 }
11938 \anchor{north}{
11939 \northwest
11940 \pgf@x=0pt
11941 }
11942 \anchor{south west}{
11943 \northwest
11944 \pgf@y=-\pgf@y
11945 }
11946 \anchor{north east}{
11947 \northwest
11948 \pgf@x=-\pgf@x
11949 }
11950 \anchor{north west}{
11951 \northwest
11952 }
11953 \anchor{south east}{
11954 \northwest
11955 \pgf@x=-\pgf@x
11956 \pgf@y=-\pgf@y
11957 }
11958 \anchorborder{% this is used when the node is used as a path element
11959 \pgf@xa=\pgf@x
11960 \pgf@ya=\pgf@y
11961 \pgfextracty{\pgf@circ@res@up}{\northwest}
11962 \pgfextractx{\pgf@circ@res@left}{\northwest}
11963 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11964 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11965 }
11966 \anchor{text}{%
11967 % centered and a bit to the left (it's a triangle)!
11968 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11969 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11970 }
11971 \backgroundpath{
11972 \pgfsetcolor{\ctikzvalof{color}}
11973
11974 \northwest
11975 \pgf@circ@res@up = \pgf@y
11976 \pgf@circ@res@down = -\pgf@y
11977 \pgf@circ@res@right = -\pgf@x
11978 \pgf@circ@res@left = \pgf@x
11979
11980 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11981
11982 \pgfscope
11983 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11984 \pgftransformxshift{.7\pgf@circ@res@left}
11985 \pgf@circ@res@step=\pgf@circ@res@right
11986 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11987 \pgf@circ@res@step=.7\pgf@circ@res@step
11988
11989 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11990 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11991 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11992 \pgfpathclose
11993 \pgf@circ@draworfill
11994 \pgfpathellipse
11995 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11996 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11997 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11998 \pgf@circ@draworfill
11999 \endpgfscope
12000
12001 \ifpgfcirc@draw@input@leads
12002 %input leads
12003 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12004 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
12005 \fi
12006
12007 \ifpgfcirc@draw@output@leads
12008 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12009 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
12010 \fi
12011 \pgfusepath{draw}
12012 %draw inner shape
12013
12014 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12015
12016 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12017 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12018 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12019 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12020 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12021 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12022 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12023 \pgfusepath{draw}
12024
12025 }
12026 }
12027
12028 \pgfdeclareshape{schmitt}{
12029 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12030 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12031 \anchor{center}{\pgfpointorigin}
12032 \savedanchor\northwest{%
12033 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12034 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
12035 \pgf@y=.5\pgf@y
12036 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
12037 \pgf@x=.5\pgf@x
12038 }
12039 \anchor{in}{
12040 \northwest
12041 \pgf@y=0pt
12042 }
12043 \anchor{in 1}{
12044 \northwest
12045 \pgf@y=0pt
12046 }
12047 \anchor{left}{
12048 \northwest
12049 \pgf@y=0pt
12050 \pgf@x=0.7\pgf@x
12051 }
12052 \anchor{bin}{
12053 \northwest
12054 \pgf@y=0pt
12055 \pgf@x=0.7\pgf@x
12056 }
12057 \anchor{bin 1}{
12058 \northwest
12059 \pgf@y=0pt
12060 \pgf@x=0.7\pgf@x
12061 }
12062 \anchor{out}{
12063 \northwest
12064 \pgf@y=0pt
12065 \pgf@x=-\pgf@x
12066 }
12067 \anchor{right}{
12068 \northwest
12069 \pgf@y=0pt
12070 \pgf@x=-.7\pgf@x
12071 }
12072 \anchor{bout}{
12073 \northwest
12074 \pgf@y=0pt
12075 \pgf@x=-.7\pgf@x
12076 }
12077 \anchor{center}{
12078 \pgfpointorigin
12079 }
12080 \anchor{east}{
12081 \northwest
12082 \pgf@y=0pt
12083 \pgf@x=-\pgf@x
12084 }
12085 \anchor{west}{
12086 \northwest
12087 \pgf@y=0pt
12088 }
12089 \anchor{south}{
12090 \northwest
12091 \pgf@x=0pt
12092 \pgf@y=-\pgf@y
12093 }
12094 \anchor{north}{
12095 \northwest
12096 \pgf@x=0pt
12097 }
12098 \anchor{south west}{
12099 \northwest
12100 \pgf@y=-\pgf@y
12101 }
12102 \anchor{north east}{
12103 \northwest
12104 \pgf@x=-\pgf@x
12105 }
12106 \anchor{north west}{
12107 \northwest
12108 }
12109 \anchor{south east}{
12110 \northwest
12111 \pgf@x=-\pgf@x
12112 \pgf@y=-\pgf@y
12113 }
12114 \anchorborder{% this is used when the node is used as a path element
12115 \pgf@xa=\pgf@x
12116 \pgf@ya=\pgf@y
12117 \pgfextracty{\pgf@circ@res@up}{\northwest}
12118 \pgfextractx{\pgf@circ@res@left}{\northwest}
12119 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12120 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12121 }
12122 \anchor{text}{%
12123 % centered and a bit to the left (it's a triangle)!
12124 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
12125 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
12126 }
12127 \backgroundpath{
12128 \pgfsetcolor{\ctikzvalof{color}}
12129
12130
12131 \northwest
12132 \pgf@circ@res@up = \pgf@y
12133 \pgf@circ@res@down = -\pgf@y
12134 \pgf@circ@res@right = -\pgf@x
12135 \pgf@circ@res@left = \pgf@x
12136
12137 \pgfscope
12138 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12139 \pgftransformxshift{.7\pgf@circ@res@left}
12140 \pgf@circ@res@step=\pgf@circ@res@right
12141 \advance\pgf@circ@res@step by -\pgf@circ@res@left
12142 \pgf@circ@res@step=.7\pgf@circ@res@step
12143
12144 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
12145 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12146 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12147 \pgfpathclose
12148 \pgf@circ@draworfill
12149 \endpgfscope
12150
12151 \ifpgfcirc@draw@input@leads
12152 %input leads
12153 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12154 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
12155 \fi
12156
12157 \ifpgfcirc@draw@output@leads
12158 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12159 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
12160 \fi
12161 \pgfusepath{draw}
12162 %draw inner shape
12163
12164 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12165
12166 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12167 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12168 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12169 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12170 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12171 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
12172 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
12173 \pgfusepath{draw}
12174
12175 }
12176 }
12177
12178
12179 %%% start european logic ports, from John Kormylo
12180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12181 %%
12182
12183 % #1 - name
12184 % #2 - text inside
12185 % #3 - number of inputs
12186 % #4 = is it a not?
12187 %
12188 % option to add a circle for not-output, see
12189 % https://github.com/circuitikz/circuitikz/issues/385
12190 %
12191 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
12192 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
12193 \ctikzset{tripoles/european not shape/.initial=ocirc}
12194 \ctikzset{tripoles/european not symbol/.is choice}
12195 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
12196 \ctikzset{tripoles/european not symbol/circle/.code={%
12197 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
12198 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
12199 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
12200
12201 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
12202 \pgfdeclareshape{european #1 port}
12203 {
12204 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12205 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12206 \saveddimen{\boutshift}{%
12207 \edef\pgf@temp{not}
12208 \edef\pgf@circ@temp{#4}
12209 \ifx\pgf@temp\pgf@circ@temp % is a not
12210 \ifpgf@circ@european@port@circle
12211 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12212 \edef\pgf@temp{ocirc}
12213 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
12214 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
12215 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
12216 \else % it's ieee not circ
12217 \pgf@circ@notradius % defined together with ieeestd ports
12218 \pgf@x=2\pgf@circ@res@temp
12219 \fi
12220 \else
12221 \pgf@x=0pt
12222 \fi
12223 \else
12224 \pgf@x=0pt
12225 \fi
12226 }
12227 \savedmacro\resize{% automatic
12228 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12229 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
12230 \pgf@circ@res@up = .5\pgf@circ@res@up
12231 \pgf@circ@res@down = -\pgf@circ@res@up
12232 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
12233 \pgf@circ@res@right = .5\pgf@circ@res@right
12234 \pgf@circ@res@left = -\pgf@circ@res@right
12235 }%
12236 \savedmacro\inputs{% get number of inputs
12237 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
12238 \ifnum\pgf@circ@res@count=0
12239 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
12240 \fi
12241 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
12242 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
12243 \def\inputs{\the\pgf@circ@res@count}%
12244 }%
12245 \savedanchor\step{% 1/2 gap at edges
12246 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12247 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
12248 \divide\pgf@circ@res@step by #3
12249 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
12250 }%
12251 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
12252 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
12253 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
12254 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
12255 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
12256
12257 \anchor{center}{\origin}% for backwards compatibility
12258 % the text anchor overlaps the logic symbol
12259 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
12260 % create input anchors
12261 \ifnum#3=1\relax
12262 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
12263 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
12264 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
12265 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
12266 \else
12267 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
12268 \pgfmathloop%
12269 \ifnum\pgfmathcounter>#3%
12270 \else%
12271 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
12272 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
12273 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
12274 }%
12275 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
12276 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
12277 }%
12278 %}{}%
12279 \repeatpgfmathloop%
12280 }
12281 \fi
12282 \anchor{out}{\northeast\pgf@y=0pt}
12283 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
12284
12285 \anchor{left}{\left}% edges of component minus leads
12286 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
12287
12288 \anchor{north east}{\northeast}% see \Compass macro
12289 \anchor{south west}{\southwest}
12290 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12291 \pgfpoint{0cm}{\pgf@circ@res@up}}
12292 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12293 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12294 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12295 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
12296 \pgfpoint{\pgf@circ@res@left}{0cm}}
12297 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12298 \pgfpoint{0cm}{\pgf@circ@res@down}}
12299 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12300 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12301 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12302 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
12303 \pgfpoint{\pgf@circ@res@right}{0cm}}
12304
12305 \anchorborder{% this is used when the node is used as a path element
12306 \pgf@xa=\pgf@x
12307 \pgf@ya=\pgf@y
12308 \pgfextracty{\pgf@circ@res@up}{\northeast}
12309 \pgfextractx{\pgf@circ@res@right}{\northeast}
12310 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12311 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12312 }
12313 \backgroundpath{
12314 \pgfsetcolor{\ctikzvalof{color}}
12315 \pgfstartlinewidth=\pgflinewidth
12316 \pgfscope
12317 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12318 \pgfpathrectanglecorners
12319 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
12320 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
12321 \pgf@circ@draworfill
12322 \endpgfscope
12323 \ifpgfcirc@draw@input@leads
12324 %input leads
12325 \ifnum#3=1\relax
12326 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
12327 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
12328 \else
12329 \pgfextracty{\pgf@circ@res@temp}{\step}%
12330 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12331 %\pgf@circ@res@count = #3\relax% redundant
12332 \loop\ifnum\pgf@circ@res@count>0
12333 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12334 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12335 \pgfpathlineto{\pgfpoint
12336 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
12337 {\pgf@circ@res@temp}}
12338 \advance\pgf@circ@res@count by -1
12339 \repeat
12340 \fi
12341 \pgfusepath{draw}
12342 \fi
12343 %
12344 \ifpgfcirc@draw@output@leads
12345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12346 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
12347 \pgfusepath{draw}
12348 \fi
12349 %
12350 \edef\pgf@temp{not}
12351 \edef\pgf@circ@temp{#4}
12352 \ifx\pgf@temp\pgf@circ@temp % is a not
12353 \ifpgf@circ@european@port@circle
12354 \pgfscope
12355 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12356 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
12357 % reset linewidth for IEEE ports, otherwise they will multiply...
12358 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
12359 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
12360 \endpgfscope
12361 \else
12362 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
12363 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
12364 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
12365 \pgfusepath{draw}
12366 \fi
12367 \fi
12368 %
12369 \pgfpathmoveto{\pgfpointorigin}
12370 \pgftext{#2}
12371 }
12372 }
12373 }
12374 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
12375 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
12376 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
12377 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
12378 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
12379 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
12380 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
12381 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
12382
12383 %% end european logic ports
12384
12385 %%%%%%%%%%%%%%%%%%%%%%%%
12386 %% Transistors
12387 %%%%%%%%%%%%%%%%%%%%%%%%
12388
12389 %
12390 % definitions for transistor circles
12391 %
12392 \ctikzset{transistor circle/.is family}
12393 \ctikzset{transistor circle/relative thickness/.initial=1}
12394 \ctikzset{transistor circle/color/.initial=default}
12395 \ctikzset{transistor circle/dash/.initial=none}
12396 \ctikzset{transistor circle/scale circle radius/.initial=1}
12397 \ctikzset{transistor circle/default base in/.initial=0.9}
12398 \ctikzset{transistor circle/njfet base in/.initial=1.05}
12399 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
12400 \ctikzset{transistor circle/isfet base in/.initial=0.65}
12401
12402 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
12403 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
12404 \tikzset{tr circle/.is if=pgf@circ@trcircle}
12405 %
12406 % add a circle to the transistor:
12407 %
12408 \def\pgfcirc@transistorcircle{
12409 \ifpgf@circ@trcircle
12410 \pgfscope
12411 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12412 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
12413 \edef\@@none{none}\edef\@@default{default}
12414 \edef\@@tmp{\ctikzvalof{transistor circle/color}}
12415 \ifx\@@tmp\@@default\else
12416 \pgfsetcolor{\@@tmp}
12417 \fi
12418 \edef\@@tmp{\ctikzvalof{transistor circle/dash}}
12419 \ifx\@@tmp\@@none\else
12420 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
12421 \fi
12422 % radius of the circle
12423 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
12424 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
12425 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
12426 \pgf@circ@draworfill
12427 \endpgfscope
12428 \fi
12429 }
12430
12431 \long\def\pgfcircdeclaretransistor#1#2#3{
12432 \pgfdeclareshape{#1}
12433 {
12434 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
12435 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12436 \savedmacro{\circlebase}{
12437 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
12438 {% yes, we have it
12439 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
12440 }{% no, use default
12441 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
12442 }}
12443 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
12444 \saveddimen{\extrabodydiodelen}{
12445 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12446 \ifpgf@circuit@fet@bodydiode
12447 % try to put the text to the right of the flyback diode
12448 \pgfmathsetlength{\pgf@x}{(
12449 \ctikzvalof{tripoles/#1/bodydiode distance}*
12450 \ctikzvalof{tripoles/#1/width} +
12451 \ctikzvalof{tripoles/#1/bodydiode scale}*
12452 \ctikzvalof{bipoles/diode/height}/2
12453 )*\pgf@circ@scaled@Rlen}
12454 \else
12455 \pgf@x=0pt\relax
12456 \fi
12457 }
12458 \savedmacro{\scaecircleradius}{
12459 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
12460 }
12461 \saveddimen{\circleradius}{
12462 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12463 % repeat the extrabodydiodelen (grrr)
12464 \ifpgf@circuit@fet@bodydiode
12465 % try to put the text to the right of the flyback diode
12466 \pgfmathsetlength{\pgf@circ@res@other}{(
12467 \ctikzvalof{tripoles/#1/bodydiode distance}*
12468 \ctikzvalof{tripoles/#1/width} +
12469 \ctikzvalof{tripoles/#1/bodydiode scale}*
12470 \ctikzvalof{bipoles/diode/height}/2
12471 )*\pgf@circ@scaled@Rlen}
12472 \else
12473 \pgf@circ@res@other=0pt\relax
12474 \fi
12475 % left
12476 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12477 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
12478 % northeast
12479 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
12480 \pgf@yb=.5\pgf@yb
12481 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
12482 %
12483 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
12484 % find the radius of the circle
12485 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
12486 }
12487 \saveddimen{\circleleft}{
12488 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12489 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12490 \pgf@x=\circlebase\pgf@xa
12491 }
12492 \anchor{circle center}{
12493 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
12494 }
12495 \anchor{center}{
12496 \pgfpointorigin
12497 }
12498 \savedanchor\northeast{% upper right
12499 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12500 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
12501 \pgf@y=.5\pgf@y
12502 \pgf@x=0pt
12503 }
12504 \savedanchor\left{%center left
12505 \pgf@y=0pt
12506 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12507 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12508 }
12509 \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
12510 \pgf@y=0pt
12511 \pgf@x=0pt
12512 }
12513 \anchor{text}{
12514 \northeast
12515 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12516 \ifpgf@circuit@transisors@fixlabels
12517 \ifpgf@circuit@fet@bodydiode
12518 \advance \pgf@x by \extrabodydiodelen
12519 \fi
12520 \ifpgf@circ@trcircle
12521 \left\pgf@xa=\pgf@x
12522 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
12523 % \advance \pgf@x by \circleradius
12524 \fi
12525 % add a bit of space to avoid central (substrate) terminal if drawn
12526 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
12527 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
12528 \else
12529 \pgf@y=.7\pgf@y
12530 \pgf@x= \pgf@circ@scaled@Rlen
12531 \pgf@x=0.1\pgf@x
12532 \fi
12533 }
12534 \anchor{pathstart}{ % south
12535 \northeast
12536 \pgf@y=-\pgf@y
12537 }
12538 \anchor{pathend}{
12539 \northeast
12540 }
12541 \anchor{north}{
12542 \northeast
12543 \pgf@circ@res@step=\pgf@y
12544 \left
12545 \pgf@y=\pgf@circ@res@step
12546 \pgf@x=.5\pgf@x
12547 }
12548 \anchor{west}{
12549 \left
12550 }
12551 \anchor{east}{
12552 \northeast
12553 \pgf@y=0pt
12554 }
12555 \anchor{south}{
12556 \northeast
12557 \pgf@circ@res@step=\pgf@y
12558 \left
12559 \pgf@y=-\pgf@circ@res@step
12560 \pgf@x=.5\pgf@x
12561 }
12562 \anchor{south west}{
12563 \northeast
12564 \pgf@circ@res@step=\pgf@y
12565 \left
12566 \pgf@y=-\pgf@circ@res@step
12567 }
12568 \anchor{north east}{
12569 \northeast
12570 }
12571 \anchor{north west}{
12572 \northeast
12573 \pgf@circ@res@step=\pgf@y
12574 \left
12575 \pgf@y=\pgf@circ@res@step
12576 }
12577 \anchor{south east}{
12578 \northeast
12579 \pgf@y=-\pgf@y
12580 }
12581 \anchor{B}{
12582 \northeast
12583 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12584 \left
12585 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12586 }
12587 \anchor{base}{
12588 \northeast
12589 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12590 \left
12591 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12592 }
12593 \anchor{bulk}{ %added by Burak Kelleci
12594 \northeast
12595 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12596 \right
12597 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12598 }
12599 \anchor{nobulk}{ %added by Burak Kelleci
12600 \left
12601 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
12602 }
12603 \anchor{G}{
12604 \northeast
12605 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12606 \left
12607 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12608 }
12609 \anchor{gate}{
12610 \northeast
12611 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12612 \left
12613 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12614 }
12615 \anchor{nobase}{
12616 \left
12617 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
12618 }
12619 \anchor{circle base}{
12620 \left
12621 \pgf@x=\circlebase\pgf@x
12622 }
12623 \anchor{nogate}{
12624 \left
12625 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
12626 }
12627 \anchor{E}{
12628 \northeast
12629 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12630 }
12631 \anchor{emitter}{
12632 \northeast
12633 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12634 }
12635 \anchor{C}{
12636 \northeast
12637 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12638 }
12639 \anchor{collector}{
12640 \northeast
12641 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12642 }
12643 \anchor{S}{
12644 \northeast
12645 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12646 }
12647 \anchor{source}{
12648 \northeast
12649 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12650 }
12651 \anchor{D}{
12652 \northeast
12653 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12654 }
12655 \anchor{drain}{
12656 \northeast
12657 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12658 }
12659 \anchor{body C in}{
12660 \northeast
12661 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12662 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
12663 }
12664 \anchor{circle C}{
12665 \left
12666 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
12667 \northeast
12668 \pgf@xb=\pgf@x %this is #2 of the circle
12669 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
12670 % the base of the triangle is x_2 - x_1 - r
12671 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
12672 % so let's go with the height
12673 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
12674 % finally, direction
12675 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
12676 }
12677 \anchor{circle E}{
12678 \left
12679 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
12680 \northeast
12681 \pgf@xb=\pgf@x %this is #2 of the circle
12682 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
12683 % the base of the triangle is x_2 - x_1 - r
12684 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
12685 % so let's go with the height
12686 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
12687 % finally, direction
12688 % finally, direction
12689 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
12690 }
12691 \anchor{body E in}{
12692 \northeast
12693 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12694 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
12695 }
12696 \anchor{body C out}{
12697 \northeast
12698 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12699 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
12700 \pgf@y=\pgf@ya
12701 \left
12702 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
12703 \pgf@y=\pgf@ya
12704 }
12705 \anchor{body E out}{
12706 \northeast
12707 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12708 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
12709 \pgf@y=\pgf@ya
12710 \left
12711 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
12712 \pgf@y=\pgf@ya
12713 }
12714 #2
12715 \backgroundpath{
12716 \pgftransformationadjustments
12717 \pgfsetcolor{\ctikzvalof{color}}
12718 %
12719 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
12720 \pgf@circuit@trans@ntypetrue
12721 \else
12722 \pgf@circuit@trans@ntypefalse
12723 \fi
12724 \northeast
12725 \pgf@circ@res@up = \pgf@y
12726 \pgf@circ@res@down = -\pgf@y
12727 \pgf@circ@res@right = \pgf@x
12728 \left
12729 \pgf@circ@res@left = \pgf@x
12730 \pgf@circ@scaled@Rlen=\scaledRlen
12731 %
12732 #3
12733 % BODY DIODE
12734 \ifpgf@circuit@fet@bodydiode
12735 \drawbodydiode{#1}
12736 \fi
12737 %
12738 }
12739 }
12740 }
12741
12742 \long\def\drawbodydiode#1{
12743 \pgfscope
12744 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
12745 \pgftransformrotate{90}
12746 % diode scale and bodydiode scale interacts. We want the size of the diode
12747 % proportional to the transistor, so we will:
12748 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
12749 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
12750 \pgftransformscale{\@@BDscale}
12751 \ifpgf@circuit@fulldiode
12752 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
12753 \else
12754 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
12755 \fi
12756 \endpgfscope
12757 % Draw stroke line
12758 \ifpgf@circuit@strokediode
12759 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
12760 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
12761 \pgfusepath{stroke}
12762 \fi
12763 %Draw upper connection to body diode
12764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
12765 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12766 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
12767 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12768 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
12769 \pgfusepath{draw}
12770 \pgfscope
12771 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
12772 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12773 \pgftransformscale{0.5}
12774 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
12775 \endpgfscope{}
12776 %Draw lower connection to body diode
12777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
12778 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12779 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12780 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
12781 \pgfusepath{draw}
12782 \pgfscope
12783 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12784 \pgftransformscale{0.5}
12785 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
12786 \endpgfscope
12787 }
12788
12789 \long\def\declarebpt#1{
12790 \pgfcircdeclaretransistor{#1}{
12791 \anchor{inner up}{
12792 \northeast
12793 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
12794 }
12795 \anchor{inner down}{
12796 \northeast
12797 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
12798 }
12799 }{
12800
12801 % add the circle if requested (before everything else, so we can fill it)
12802 \pgfcirc@transistorcircle
12803
12804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12806 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12807 \pgfpathlineto{\pgfpoint
12808 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12809 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
12810 \pgfusepath{draw}
12811
12812 % drawing base
12813 \pgfscope
12814 \pgfpathmoveto{\pgfpoint
12815 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12816 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12817 \pgfpathlineto{\pgfpoint
12818 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12819 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12820 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12821 \ifpgf@circuit@bpt@schottky
12822 % upper
12823 \pgfpathmoveto{\pgfpoint
12824 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12825 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12826 \pgfpathlineto{\pgfpoint
12827 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12828 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12829 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12830 \pgfpathlineto{\pgfpoint
12831 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12832 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12833 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12834 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12835 \pgfpathlineto{\pgfpoint
12836 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12837 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12838 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12839 % % lower
12840 \pgfpathmoveto{\pgfpoint
12841 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12842 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12843 \pgfpathlineto{\pgfpoint
12844 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12845 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12846 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12847 \pgfpathlineto{\pgfpoint
12848 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12849 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12850 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12851 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12852 \pgfpathlineto{\pgfpoint
12853 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12854 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12855 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12856 \fi
12857 \pgfusepath{draw}
12858 \endpgfscope
12859
12860 \pgfpathmoveto{\pgfpoint
12861 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12862 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
12863 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12864 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12865 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12866 \pgfusepath{draw}
12867 %draw arrow depending on type of transistor
12868 \pgfscope
12869 \pgfslopedattimetrue
12870 \pgfallowupsidedownattimetrue
12871 \pgfresetnontranslationattimefalse
12872 \edef\@@anchor{center}
12873 \ifpgf@circuit@trans@ntype
12874 \ifpgf@circuit@trans@arrowatend
12875 \edef\@@anchor{btip}
12876 \pgftransformlineattime{1.0}{%
12877 \pgfpoint%
12878 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12879 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12880 }{%
12881 \pgfpoint{\pgf@circ@res@right}%
12882 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12883 }
12884 \else
12885 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12886 \pgfpoint%
12887 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12888 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12889 }{%
12890 \pgfpoint{\pgf@circ@res@right}%
12891 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12892 }
12893 \fi
12894 \else % p-type
12895 \ifpgf@circuit@trans@arrowatend
12896 \edef\@@anchor{tip}
12897 \pgftransformlineattime{1.0}{%
12898 \pgfpoint{\pgf@circ@res@right}%
12899 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12900 }{%
12901 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12902 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12903 }
12904 \else
12905 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12906 \pgfpoint{\pgf@circ@res@right}%
12907 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12908 }{%
12909 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12910 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12911 }
12912 \fi
12913 \fi
12914 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12915 \endpgfscope
12916
12917 \ifpgf@circuit@bpt@drawphoto
12918 \pgfscope
12919 \pgfsetarrowsstart{latexslim}
12920 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12921 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12922 {\pgf@circ@res@up+\pgf@circ@res@down}}
12923 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12924 \pgfpathlineto{\pgfpointadd{\pgfpoint
12925 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12926 {\pgf@circ@res@up+\pgf@circ@res@down}}
12927 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
12928 \pgfusepath{draw}
12929 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12930 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12931 {\pgf@circ@res@up+\pgf@circ@res@down}}
12932 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
12933 \pgfpathlineto{\pgfpointadd{\pgfpoint
12934 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12935 {\pgf@circ@res@up+\pgf@circ@res@down}}
12936 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12937 \pgfusepath{draw}
12938 \endpgfscope
12939 \else
12940 \ifpgf@circuit@bpt@drawbase
12941 \pgfpathmoveto{\pgfpoint
12942 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12943 {\pgf@circ@res@up+\pgf@circ@res@down}}
12944 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12945 \pgfusepath{draw}
12946 \fi
12947 \fi
12948 }
12949 }
12950
12951 \declarebpt{npn}
12952 \declarebpt{pnp}
12953 %
12954 % multi-emitter and multi-collector BJTs by Romano Giannetti
12955 %
12956 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
12957 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12958 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12959 \ifnum\cdir>0 % NPN, above
12960 \pgfpoint{\pgf@circ@res@temp}{%
12961 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12962 \else % PNP, below
12963 \pgfpoint{\pgf@circ@res@temp}{%
12964 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12965 \fi
12966 }
12967 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
12968 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12969 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12970 \ifnum\cdir<0 % PNP, above
12971 \pgfpoint{\pgf@circ@res@temp}{%
12972 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12973 \else % PNP, below
12974 \pgfpoint{\pgf@circ@res@temp}{%
12975 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12976 \fi
12977 }
12978
12979 \long\def\declarebjt#1{
12980 \pgfdeclareshape{bjt#1}{
12981 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
12982 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12983 % \cdir is 1 for npn, -1 for pnp
12984 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
12985 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
12986 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
12987 % step up or down for the additional C/Es
12988 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
12989 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12990 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12991 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
12992 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12993 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
12994 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12995 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12996 \pgf@y=.5\pgf@y
12997 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12998 \pgf@x=.5\pgf@x
12999 }
13000 \savedanchor\northeast{% upper right
13001 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13002 \pgfmathsetlength{\pgf@circ@res@step}{%
13003 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
13004 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13005 \ifnum\cdir> 0
13006 \edef\numup{\numC}\edef\numdown{\numE}
13007 \else
13008 \edef\numup{\numE}\edef\numdown{\numC}
13009 \fi
13010 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
13011 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
13012 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13013 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
13014 \pgf@x=.5\pgf@x
13015 }
13016 \savedanchor\southeast{% lower right
13017 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13018 \pgfmathsetlength{\pgf@circ@res@step}{%
13019 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
13020 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13021 \ifnum\cdir> 0
13022 \edef\numup{\numC}\edef\numdown{\numE}
13023 \else
13024 \edef\numup{\numE}\edef\numdown{\numC}
13025 \fi
13026 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
13027 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
13028 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13029 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
13030 \pgf@x=.5\pgf@x
13031 }
13032 \savedanchor\southwest{% lower left
13033 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13034 \pgfmathsetlength{\pgf@circ@res@step}{%
13035 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
13036 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13037 \ifnum\cdir> 0
13038 \edef\numup{\numC}\edef\numdown{\numE}
13039 \else
13040 \edef\numup{\numE}\edef\numdown{\numC}
13041 \fi
13042 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
13043 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
13044 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13045 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
13046 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13047 }
13048 \anchor{center}{\pgfpointorigin}
13049 \anchor{north}{\northeast\pgf@x=0cm\relax}
13050 \anchor{east}{\northeast\pgf@y=0cm\relax}
13051 \anchor{south}{\southwest\pgf@x=0cm\relax}
13052 \anchor{west}{\southwest\pgf@y=0cm}
13053 \anchor{north east}{\northeast}
13054 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
13055 \anchor{south west}{\southwest}
13056 \anchor{south east}{\southeast}
13057
13058 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
13059 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
13060 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
13061 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
13062 % center of the base "bar"
13063 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
13064 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
13065 }
13066 % geometrical centers
13067 \anchor{vcenter}{\pgf@x=0cm\relax
13068 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
13069 }
13070 \anchor{gcenter}{%
13071 \northeast\pgf@xa=0.5\pgf@x
13072 \southwest\advance\pgf@xa by 0.5\pgf@x
13073 \pgf@x=\pgf@xa
13074 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
13075 }
13076 % external connections
13077 \anchor{E}{
13078 \ifnum\cdir>0% npn, emitter down
13079 \southeast
13080 \else
13081 \northeast
13082 \fi
13083 }% first emitter
13084 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
13085 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
13086 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
13087
13088 \backgroundpath{
13089 \pgftransformationadjustments
13090 \pgfsetcolor{\ctikzvalof{color}}
13091 %
13092 % set the type and up and down number of connections
13093 %
13094 \ifnum\cdir> 0
13095 \pgf@circuit@trans@ntypetrue
13096 \edef\numup{\numC}
13097 \edef\numdown{\numE}
13098 \else
13099 \pgf@circuit@trans@ntypefalse
13100 \edef\numup{\numE}
13101 \edef\numdown{\numC}
13102 \fi
13103 \basedimension
13104 \pgf@circ@res@up = \pgf@y
13105 \pgf@circ@res@down = -\pgf@y
13106 \pgf@circ@res@right = \pgf@x
13107 \pgf@circ@res@left = -\pgf@x
13108 \pgf@circ@scaled@Rlen=\scaledRlen
13109 \pgf@circ@res@step=\multistep
13110 %
13111 % set arrow positions options
13112 %
13113 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
13114 \ifpgf@circuit@trans@arrowatend
13115 \edef\@@pos{1.0}
13116 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
13117 \edef\@@anchor{btip}
13118 \else
13119 \edef\@@anchor{tip}
13120 \fi
13121 \fi
13122 %
13123 % Drawing upper connections
13124 %
13125 \pgfscope
13126 \pgf@circ@count@a=\numup\relax
13127 \pgfmathloop%
13128 \ifnum\pgf@circ@count@a>0
13129 \advance\pgf@circ@count@a-1\relax
13130 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
13131 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
13132 \pgfpathmoveto{\pgfpoint
13133 {\pgf@circ@res@right}%
13134 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
13135 \pgfpathlineto{\pgfpoint
13136 {\pgf@circ@res@right}%
13137 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
13138 \else
13139 \pgfpathmoveto{\pgfpoint
13140 {\pgf@circ@res@right}%
13141 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
13142 \fi
13143 \pgfpathlineto{\pgfpoint
13144 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
13145 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
13146 \pgfsetroundcap % better when connecting to sloped lines
13147 \pgfusepath{draw}
13148 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
13149 \pgfscope
13150 \pgfslopedattimetrue
13151 \pgfallowupsidedownattimetrue
13152 \pgfresetnontranslationattimefalse
13153 \pgftransformlineattime{\@@pos}{%
13154 \pgfpoint
13155 {\pgf@circ@res@right}%
13156 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
13157 }{\pgfpoint
13158 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
13159 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
13160 }
13161 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13162 \endpgfscope
13163 \fi
13164 \repeatpgfmathloop
13165 \endpgfscope
13166 %
13167 % Drawing base
13168 %
13169 \pgfscope
13170 \pgfpathmoveto{\pgfpoint
13171 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13172 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
13173 \pgfpathlineto{\pgfpoint
13174 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13175 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
13176 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13177 \ifpgf@circuit@bpt@schottky
13178 % upper
13179 \pgfpathmoveto{\pgfpoint
13180 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13181 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
13182 \pgfpathlineto{\pgfpoint
13183 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13184 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
13185 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13186 \pgfpathlineto{\pgfpoint
13187 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
13188 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13189 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
13190 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13191 \pgfpathlineto{\pgfpoint
13192 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
13193 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13194 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
13195 % lower
13196 \pgfpathmoveto{\pgfpoint
13197 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13198 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
13199 \pgfpathlineto{\pgfpoint
13200 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13201 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
13202 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13203 \pgfpathlineto{\pgfpoint
13204 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
13205 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13206 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
13207 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13208 \pgfpathlineto{\pgfpoint
13209 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
13210 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13211 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
13212 \fi
13213 \pgfsetroundcap % I like it more...
13214 \pgfusepath{draw}
13215 \endpgfscope
13216 %
13217 % draw base external connection
13218 %
13219 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
13220 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
13221 \pgfusepath{draw}
13222 %
13223 % Drawing lower connections
13224 %
13225 \pgfscope
13226 \pgf@circ@count@a=\numdown\relax
13227 \pgfmathloop%
13228 \ifnum\pgf@circ@count@a>0
13229 \advance\pgf@circ@count@a-1\relax
13230 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
13231 \pgfpathmoveto{\pgfpoint
13232 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
13233 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
13234 \pgfpathlineto{\pgfpoint
13235 {\pgf@circ@res@right}
13236 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
13237 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
13238 \pgfpathlineto{\pgfpoint
13239 {\pgf@circ@res@right}
13240 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
13241 \fi
13242 \pgfsetroundcap % better when connecting to sloped lines
13243 \pgfusepath{draw}
13244 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
13245 \pgfscope
13246 \pgfslopedattimetrue
13247 \pgfallowupsidedownattimetrue
13248 \pgfresetnontranslationattimefalse
13249 \pgftransformlineattime{\@@pos}{%
13250 \pgfpoint
13251 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
13252 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
13253 }{\pgfpoint
13254 {\pgf@circ@res@right}%
13255 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
13256 }
13257 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13258 \endpgfscope
13259 \fi
13260 \repeatpgfmathloop
13261 \endpgfscope
13262 }
13263 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
13264 % and is executed just before a node is drawn.
13265 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
13266 % Start with the maximum collector number and go backwards.
13267 \pgf@circ@count@a=\numC\relax
13268 \pgfmathloop%
13269 \ifnum\pgf@circ@count@a>0
13270 % we will create two anchors per pin: the "normal one" like `pin 1` for the
13271 % electrical contact, and the "border one" like `bpin 1` for labels.
13272 % they will coincide if `external pins width` is set to 0.
13273 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
13274 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
13275 }
13276 \advance\pgf@circ@count@a by -1\relax%
13277 \repeatpgfmathloop%
13278 % and emitters
13279 \pgf@circ@count@a=\numE\relax
13280 \pgfmathloop%
13281 \ifnum\pgf@circ@count@a>0
13282 % we will create two anchors per pin: the "normal one" like `pin 1` for the
13283 % electrical contact, and the "border one" like `bpin 1` for labels.
13284 % they will coincide if `external pins width` is set to 0.
13285 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
13286 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
13287 }
13288 \advance\pgf@circ@count@a by -1\relax%
13289 \repeatpgfmathloop%
13290 }%
13291 }
13292 }
13293
13294 \declarebjt{npn}
13295 \declarebjt{pnp}
13296
13297 % end of multi-bjts
13298
13299 \long\def\declareigbt#1{
13300 \pgfcircdeclaretransistor{#1}{
13301 \anchor{inner up}{
13302 \northeast
13303 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
13304 }
13305 \anchor{inner down}{
13306 \northeast
13307 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
13308 }
13309 }
13310 {
13311 % add the circle if requested (before everything else, so we can fill it)
13312 \pgfcirc@transistorcircle
13313 %draw upper connection
13314 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13315 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13316 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13317 \pgfpathlineto{\pgfpoint
13318 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13319 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
13320 \pgfusepath{draw}
13321
13322 %draw thicker gate lines
13323 \pgfscope
13324 \pgfscope
13325 \pgfpathmoveto{\pgfpoint
13326 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13327 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13328 \pgfpathlineto{\pgfpoint
13329 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13330 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13331 % set the normal thickness
13332 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13333 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
13334 \pgfsetlinewidth{\@@extrat\pgflinewidth}
13335 \pgfusepath{draw}
13336 \endpgfscope
13337 \pgfpathmoveto{\pgfpoint
13338 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13339 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13340 \pgfpathlineto{\pgfpoint
13341 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13342 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13343 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13344 \pgfusepath{draw}
13345 \endpgfscope
13346 %draw lower connection
13347 \pgfpathmoveto{\pgfpoint
13348 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13349 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
13350 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13351 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13352 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13353 \pgfusepath{draw}
13354 %draw arrow depending on type of transistor
13355 \pgfscope
13356 \pgfslopedattimetrue
13357 \pgfallowupsidedownattimetrue
13358 \pgfresetnontranslationattimefalse
13359 \ifpgf@circuit@trans@arrowatend
13360 \ifpgf@circuit@trans@ntype
13361 \edef\@@anchor{btip}\edef\@@pos{1.0}
13362 \else
13363 \edef\@@anchor{tip}\edef\@@pos{1.0}
13364 \fi
13365 \else
13366 \edef\@@anchor{center}\edef\@@pos{0.5}
13367 \fi
13368 \ifpgf@circuit@trans@ntype
13369 \pgftransformlineattime{\@@pos}{%
13370 \pgfpoint%
13371 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13372 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
13373 }{%
13374 \pgfpoint{\pgf@circ@res@right}%
13375 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
13376 }
13377 \else
13378 \pgftransformlineattime{\@@pos}{%
13379 \pgfpoint{\pgf@circ@res@right}%
13380 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
13381 }{%
13382 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13383 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
13384 }
13385 \fi
13386 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13387 \endpgfscope
13388 %draw gate
13389 \ifpgf@circuit@trans@ntype
13390 \pgfpathmoveto{\pgfpoint
13391 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13392 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
13394 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13395 \else
13396 \pgfpathmoveto{\pgfpoint
13397 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13398 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
13399 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
13400 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
13401 \fi
13402 \pgfusepath{draw}
13403 }
13404 }
13405
13406 \declareigbt{pigbt}
13407 \declareigbt{nigbt}
13408 \declareigbt{Lnigbt}
13409 \declareigbt{Lpigbt}
13410
13411 \pgfcircdeclaretransistor{nmos}{
13412 \anchor{inner up}{
13413 \northeast
13414 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
13415 }
13416 \anchor{inner down}{
13417 \northeast
13418 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
13419 }
13420 }{%
13421 % add the circle if requested (before everything else, so we can fill it)
13422 \pgfcirc@transistorcircle
13423
13424 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13426 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13427 \pgfpathlineto{\pgfpoint
13428 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13429 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13430
13431 \pgfpathmoveto{\pgfpoint
13432 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13433 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13434 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13435 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13437 \pgfusepath{draw}
13438
13439 \pgfscope
13440 \pgfpathmoveto{\pgfpoint
13441 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13442 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
13443 \pgfpathlineto{\pgfpoint
13444 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13445 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
13446 \pgfpathmoveto{\pgfpoint
13447 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13448 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13449 \pgfpathlineto{\pgfpoint
13450 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13451 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13452 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13453 \pgfusepath{draw}
13454 \endpgfscope
13455 \ifpgf@circuit@mos@arrows
13456 \pgfscope
13457 \ifpgf@circuit@trans@arrowatend
13458 \pgftransformshift{\pgfpoint
13459 {\pgf@circ@res@right}%
13460 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
13461 }
13462 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
13463 \else
13464 \pgfslopedattimetrue
13465 \pgfallowupsidedownattimetrue
13466 \pgfresetnontranslationattimefalse
13467 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
13468 \pgfpoint%
13469 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
13470 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
13471 }{%
13472 \pgfpoint
13473 {\pgf@circ@res@right}%
13474 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
13475 }
13476 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13477 \fi
13478 \endpgfscope
13479 \fi
13480
13481 \ifpgf@circuit@bpt@drawgate
13482 \pgfpathmoveto{\pgfpoint
13483 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13484 {\pgf@circ@res@up+\pgf@circ@res@down}}
13485 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13486 \pgfusepath{draw}
13487 \fi
13488
13489 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13490 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13491 {\pgf@circ@res@up+\pgf@circ@res@down}}
13492 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13493 {\pgf@circ@res@up+\pgf@circ@res@down}}
13494 \pgfusepath{draw}
13495 \fi
13496 }
13497
13498 \pgfcircdeclaretransistor{pmos}{
13499 \anchor{inner up}{
13500 \northeast
13501 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
13502 }
13503 \anchor{inner down}{
13504 \northeast
13505 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
13506 }
13507 }{%
13508 % add the circle if requested (before everything else, so we can fill it)
13509 \pgfcirc@transistorcircle
13510 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13511 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13512 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13513 \pgfpathlineto{\pgfpoint
13514 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13515 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13516 \pgfusepath{draw}
13517
13518 \ifpgf@circuit@mos@arrows
13519 \pgfscope
13520 \ifpgf@circuit@trans@arrowatend
13521 \pgftransformshift{\pgfpoint
13522 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
13523 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13524 }
13525 \pgftransformrotate{180}
13526 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
13527 \else
13528 \pgfslopedattimetrue
13529 \pgfallowupsidedownattimetrue
13530 \pgfresetnontranslationattimefalse
13531 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
13532 \pgfpoint%
13533 {\pgf@circ@res@right}%
13534 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13535 }{%
13536 \pgfpoint
13537 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
13538 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13539 }
13540 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13541 \fi
13542 \endpgfscope
13543 \fi
13544
13545 \pgfscope
13546 \pgfpathmoveto{\pgfpoint
13547 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13548 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
13549 \pgfpathlineto{\pgfpoint
13550 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13551 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
13552 \pgfpathmoveto{\pgfpoint
13553 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13554 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13555 \pgfpathlineto{\pgfpoint
13556 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13557 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13558 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13559 \pgfusepath{draw}
13560 \endpgfscope
13561
13562 \pgfpathmoveto{\pgfpoint
13563 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13564 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13565 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13566 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13567 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13568
13569
13570 \pgfusepath{draw}
13571 \ifpgf@circuit@bpt@drawgate
13572 \pgfpathmoveto{\pgfpoint
13573 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13574 {\pgf@circ@res@up+\pgf@circ@res@down}}
13575 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13576 \pgfusepath{draw}
13577 \fi
13578
13579 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13580 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13581 {\pgf@circ@res@up+\pgf@circ@res@down}}
13582 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13583 {\pgf@circ@res@up+\pgf@circ@res@down}}
13584 \pgfusepath{draw}
13585 \fi
13586
13587 \ifpgf@circuit@pmos@nocircle\else
13588 % we are not scaling the circle with the MOS --- I think it's better to have it
13589 % coherent with the poles/nodes of the rest of the circuit.
13590 \pgfpathcircle{\pgfpoint
13591 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
13592 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13593 \ifpgf@circuit@pmos@emptycircle
13594 \pgfsetfillcolor{white}
13595 \fi
13596 \pgfusepath{draw,fill}
13597 \fi
13598 }
13599
13600 %%% depletion MOSFET (simplified symbols)
13601
13602 \long\def\pgfcirc@filldraw@depletion#1{%
13603 \ifx\tikz@fillcolor\pgfutil@empty
13604 % if there is no explicit fill check the specific key
13605 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
13606 \ifx\@@tmp\@@none % if it's none
13607 \pgfusepath{draw}%
13608 \else
13609 \edef\@@default{default}%
13610 \ifx\@@tmp\@@default % fill with the pen color
13611 \pgfusepath{draw, fill}%
13612 \else
13613 \pgfsetfillcolor{\@@tmp}%
13614 \pgfusepath{draw, fill}%
13615 \fi
13616 \fi
13617 \else
13618 \pgfsetfillcolor{\tikz@fillcolor}%
13619 \pgfusepath{draw, fill}%
13620 \fi
13621 }
13622
13623 \pgfcircdeclaretransistor{nmosd}{
13624 \anchor{inner up}{
13625 \northeast
13626 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
13627 }
13628 \anchor{inner down}{
13629 \northeast
13630 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
13631 }
13632 \anchor{nobulk}{ %override
13633 \left
13634 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
13635 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
13636 \advance\pgf@x by -\pgf@circ@res@temp
13637 }
13638 }{%
13639 % draw depletion channel
13640 % add the circle if requested (before everything else, so we can fill it)
13641 \pgfcirc@transistorcircle
13642 \pgfscope
13643 \pgfpathrectanglecorners
13644 {\pgfpoint
13645 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13646 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13647 {\pgfpoint
13648 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
13649 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13650 \pgfcirc@filldraw@depletion{nmosd}
13651 \endpgfscope
13652 % draw drain and source terminals
13653 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13654 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13655 \pgfpathlineto{\pgfpoint
13656 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13657 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13658
13659 \pgfpathmoveto{\pgfpoint
13660 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13661 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13662 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13663 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13664 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13665 \pgfusepath{draw}
13666
13667 \pgfscope
13668 \pgfpathmoveto{\pgfpoint
13669 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13670 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
13671 \pgfpathlineto{\pgfpoint
13672 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13673 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
13674 \pgfpathmoveto{\pgfpoint
13675 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13676 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13677 \pgfpathlineto{\pgfpoint
13678 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13679 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13680 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13681 \pgfusepath{draw}
13682 \endpgfscope
13683 \ifpgf@circuit@mos@arrows
13684 \pgfscope
13685 \ifpgf@circuit@trans@arrowatend
13686 \pgftransformshift{\pgfpoint
13687 {\pgf@circ@res@right}%
13688 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
13689 }
13690 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
13691 \else
13692 \pgfslopedattimetrue
13693 \pgfallowupsidedownattimetrue
13694 \pgfresetnontranslationattimefalse
13695 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
13696 \pgfpoint%
13697 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
13698 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
13699 }{%
13700 \pgfpoint
13701 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13702 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
13703 }
13704 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13705 \fi
13706 \endpgfscope
13707 \fi
13708
13709 \ifpgf@circuit@bpt@drawgate
13710 \pgfpathmoveto{\pgfpoint
13711 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13712 {\pgf@circ@res@up+\pgf@circ@res@down}}
13713 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13714 \pgfusepath{draw}
13715 \fi
13716
13717 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13718 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
13719 {\pgf@circ@res@up+\pgf@circ@res@down}}
13720 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13721 {\pgf@circ@res@up+\pgf@circ@res@down}}
13722 \pgfusepath{draw}
13723 \fi
13724 }
13725
13726 \pgfcircdeclaretransistor{pmosd}{
13727 \anchor{inner up}{
13728 \northeast
13729 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
13730 }
13731 \anchor{inner down}{
13732 \northeast
13733 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
13734 }
13735 \anchor{nobulk}{ %override
13736 \left
13737 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
13738 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
13739 \advance\pgf@x by -\pgf@circ@res@temp
13740 }
13741 }{%
13742 % add the circle if requested (before everything else, so we can fill it)
13743 \pgfcirc@transistorcircle
13744 % draw depletion channel
13745 \pgfscope
13746 \pgfpathrectanglecorners
13747 {\pgfpoint
13748 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13749 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13750 {\pgfpoint
13751 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
13752 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13753 \pgfcirc@filldraw@depletion{pmosd}
13754 \endpgfscope
13755 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13756 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13757 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13758 \pgfpathlineto{\pgfpoint
13759 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13760 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13761 \pgfusepath{draw}
13762
13763 \ifpgf@circuit@mos@arrows
13764 \pgfscope
13765 \ifpgf@circuit@trans@arrowatend
13766 \pgftransformshift{\pgfpoint
13767 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13768 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13769 }
13770 \pgftransformrotate{180}
13771 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
13772 \else
13773 \pgfslopedattimetrue
13774 \pgfallowupsidedownattimetrue
13775 \pgfresetnontranslationattimefalse
13776 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
13777 \pgfpoint%
13778 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13779 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13780 }{%
13781 \pgfpoint
13782 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
13783 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13784 }
13785 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13786 \fi
13787 \endpgfscope
13788 \fi
13789
13790 \pgfscope
13791 \pgfpathmoveto{\pgfpoint
13792 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13793 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
13794 \pgfpathlineto{\pgfpoint
13795 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13796 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
13797 \pgfpathmoveto{\pgfpoint
13798 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13799 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13800 \pgfpathlineto{\pgfpoint
13801 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13802 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13803 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13804 \pgfusepath{draw}
13805 \endpgfscope
13806
13807 \pgfpathmoveto{\pgfpoint
13808 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13809 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13810 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13811 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13813
13814
13815 \pgfusepath{draw}
13816 \ifpgf@circuit@bpt@drawgate
13817 \pgfpathmoveto{\pgfpoint
13818 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13819 {\pgf@circ@res@up+\pgf@circ@res@down}}
13820 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13821 \pgfusepath{draw}
13822 \fi
13823
13824 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13825 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
13826 {\pgf@circ@res@up+\pgf@circ@res@down}}
13827 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13828 {\pgf@circ@res@up+\pgf@circ@res@down}}
13829 \pgfusepath{draw}
13830 \fi
13831
13832 \ifpgf@circuit@pmos@nocircle\else
13833 % we are not scaling the circle with the MOS --- I think it's better to have it
13834 % coherent with the poles/nodes of the rest of the circuit.
13835 \pgfpathcircle{\pgfpoint
13836 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
13837 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13838 \ifpgf@circuit@pmos@emptycircle
13839 \pgfsetfillcolor{white}
13840 \fi
13841 \pgfusepath{draw,fill}
13842 \fi
13843 }
13844 %% HEMT FET Transistor
13845 \pgfcircdeclaretransistor{hemt}{
13846 \anchor{inner up}{
13847 \northeast
13848 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
13849 }
13850 \anchor{inner down}{
13851 \northeast
13852 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
13853 }
13854 }{%
13855 % add the circle if requested (before everything else, so we can fill it)
13856 \pgfcirc@transistorcircle
13857 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13858 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13859 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
13860 \pgfpathlineto{\pgfpoint
13861 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13862 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
13863
13864 \pgfpathmoveto{\pgfpoint
13865 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13866 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
13867 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13868 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
13869 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13870 \pgfusepath{draw}
13871
13872 \pgfscope
13873 \pgfpathmoveto{\pgfpoint
13874 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13875 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
13876 \pgfpathlineto{\pgfpoint
13877 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13878 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
13879 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13880 \pgfusepath{draw}
13881 \endpgfscope
13882
13883 \pgfpathmoveto{\pgfpoint
13884 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13885 {\pgf@circ@res@up+\pgf@circ@res@down}}
13886 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13887 \pgfusepath{draw}
13888 }
13889
13890 \long\def\drawfetcore#1{
13891 \pgftransformationadjustments
13892 % add the circle if requested (before everything else, so we can fill it)
13893 \pgfcirc@transistorcircle
13894
13895 %top connection
13896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13897 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13898 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13899 \pgfpathlineto{\pgfpoint
13900 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13901 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13902 \pgfusepath{draw}
13903 \pgfscope
13904 \pgfpathmoveto{\pgfpoint
13905 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13906 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13907 \ifpgf@circuit@trans@depletiontype
13908 \pgfpathlineto{\pgfpoint
13909 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13910 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13911 \else
13912
13913 \pgfpathlineto{\pgfpoint
13914 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13915 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
13916 \pgfpathmoveto{\pgfpoint
13917 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13918 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
13919 \pgfpathlineto{\pgfpoint
13920 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13921 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
13922 \pgfpathmoveto{\pgfpoint
13923 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13924 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
13925 \pgfpathlineto{\pgfpoint
13926 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13927 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13928 \fi
13929 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13930 \pgfusepath{draw}
13931 \endpgfscope
13932 %Bulk connection line
13933 \pgfpathmoveto{\pgfpoint
13934 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13935 {\pgf@circ@res@up+\pgf@circ@res@down}}
13936 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13937 {\pgf@circ@res@up+\pgf@circ@res@down}}
13938
13939 %bottom connection
13940 \pgfpathmoveto{\pgfpoint
13941 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13942 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13943 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13944 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13945 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13946 \pgfusepath{draw}
13947
13948 %draw thick gate line
13949 \pgfscope
13950 \pgfpathmoveto{\pgfpoint
13951 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13952 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13953 \pgfpathlineto{\pgfpoint
13954 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13955 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13956 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13957 \pgfusepath{draw}
13958 \endpgfscope
13959
13960 % arrows
13961 \pgfscope
13962 \pgfslopedattimetrue
13963 \pgfallowupsidedownattimetrue
13964 \pgfresetnontranslationattimefalse
13965 \ifpgf@circuit@trans@arrowatend
13966 \ifpgf@circuit@trans@ntype
13967 \edef\@@anchor{tip}
13968 \edef\@@pos{1.0}
13969 \else
13970 \edef\@@anchor{btip}
13971 \edef\@@pos{0.0}
13972 \fi
13973 \else
13974 \edef\@@anchor{center}\edef\@@pos{0.6}
13975 \fi
13976 \pgftransformlineattime{\@@pos}{%
13977 \pgfpoint
13978 {\pgf@circ@res@right}%
13979 {\pgf@circ@res@up+\pgf@circ@res@down}%
13980 }{%
13981 \pgfpoint%
13982 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13983 {\pgf@circ@res@up+\pgf@circ@res@down}%
13984 }
13985 \ifpgf@circuit@trans@ntype
13986 \else
13987 \pgftransformrotate{180}
13988 \fi
13989 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13990 \endpgfscope
13991
13992 % GATE CONNECTION
13993 \ifpgf@circuit@bpt@drawgate
13994 \ifpgf@circuit@trans@ntype
13995 \pgfpathmoveto{\pgfpoint
13996 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13997 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13998 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13999 \else
14000 \pgfpathmoveto{\pgfpoint
14001 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14002 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14003 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14004 \fi
14005 \pgfusepath{draw}
14006 \fi
14007
14008 }
14009
14010 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
14011 {\pgfcircdeclaretransistor{#1}{
14012 \anchor{bulk}{\left\pgf@x=0pt}
14013 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
14014 \anchor{inner up}{
14015 \northeast
14016 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
14017 }
14018 \anchor{inner down}{
14019 \northeast
14020 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
14021 }
14022 #2
14023 }
14024 {#3}
14025 }
14026
14027 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
14028 \pgf@circuit@trans@depletiontypefalse
14029 \drawfetcore{nfet}
14030 }
14031
14032 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
14033 \pgf@circuit@trans@depletiontypefalse
14034 \drawfetcore{pfet}
14035 }
14036
14037 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
14038 \pgf@circuit@trans@depletiontypetrue
14039 \drawfetcore{nfetd}
14040 }
14041
14042 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
14043 \pgf@circuit@trans@depletiontypetrue
14044 \drawfetcore{pfetd}
14045 }
14046 % N-CHANNEL IGFET ENHANCEMENT TYPE
14047 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
14048 \pgf@circuit@trans@depletiontypefalse
14049 \drawfetcore{nigfete}
14050
14051 % SOURCE CONNECTION
14052 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14053 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
14054 \pgfusepath{draw}
14055
14056 % SOLDER DOT at source-bulk connection
14057 \ifpgf@circuit@fet@solderdot
14058 \pgfscope
14059 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14060 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
14061 \pgfnode{circ}{center}{}{}{}
14062 \endpgfscope{}
14063 \fi
14064 }
14065
14066 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
14067 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
14068 \pgf@circuit@trans@depletiontypefalse
14069 \drawfetcore{nigfetebulk}
14070 % SOLDER DOT at source-bulk connection
14071 \ifpgf@circuit@fet@solderdot
14072 \pgfscope
14073 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14074 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
14075 \pgfnode{circ}{center}{}{}{}
14076 \endpgfscope{}
14077 \fi
14078 }
14079
14080 % N-CHANNEL IGFET DEPLETION TYPE
14081 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
14082 \pgf@circuit@trans@depletiontypetrue
14083 \drawfetcore{nigfetd}
14084
14085 % SOURCE CONNECTION
14086 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
14088 \pgfusepath{draw}
14089
14090 % SOLDER DOT at source-bulk connection
14091 \ifpgf@circuit@fet@solderdot
14092 \pgfscope
14093 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14094 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
14095 \pgfnode{circ}{center}{}{}{}
14096 \endpgfscope{}
14097 \fi
14098 }
14099
14100 % P-CHANNEL IGFET ENHANCEMENT TYPE
14101 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
14102 \pgf@circuit@trans@depletiontypefalse
14103 \drawfetcore{pigfete}
14104 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14105
14106 % SOURCE CONNECTION
14107 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14108 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14109 \pgfusepath{draw}
14110
14111
14112 % SOLDER DOT at source-bulk connection
14113 \ifpgf@circuit@fet@solderdot
14114 \pgfscope
14115 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14116 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
14117 \pgfnode{circ}{center}{}{}{}
14118 \endpgfscope
14119 \fi
14120 }
14121
14122 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
14123 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
14124 \pgf@circuit@trans@depletiontypefalse
14125 \drawfetcore{pigfetebulk}
14126 }
14127
14128 % P-CHANNEL IGFET DEPLETION TYPE
14129 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
14130 \pgf@circuit@trans@depletiontypetrue
14131 \drawfetcore{pigfetd}
14132
14133 % SOURCE CONNECTION
14134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14136 \pgfusepath{draw}
14137
14138
14139 % SOLDER DOT at source-bulk connection
14140 \ifpgf@circuit@fet@solderdot
14141 \pgfscope
14142 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14143 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
14144 \pgfnode{circ}{center}{}{}{}
14145 \endpgfscope{}
14146 \fi
14147 }
14148
14149 \pgfcircdeclaretransistor{njfet}{
14150 \anchor{inner up}{
14151 \northeast
14152 \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
14153 }
14154 \anchor{inner down}{
14155 \northeast
14156 \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
14157 }
14158 }{%
14159 % add the circle if requested (before everything else, so we can fill it)
14160 \pgfcirc@transistorcircle
14161 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14162 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14163 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
14164 \pgfpathlineto{\pgfpoint
14165 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
14166 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
14167
14168 \pgfpathmoveto{\pgfpoint
14169 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
14170 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
14171 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14172 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
14173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14174 \pgfusepath{draw}
14175
14176 \pgfscope
14177 \pgfpathmoveto{\pgfpoint
14178 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
14179 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}}
14180 \pgfpathlineto{\pgfpoint
14181 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
14182 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}}
14183 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14184 \pgfusepath{draw}
14185 \endpgfscope
14186
14187 % arrow
14188 \pgfscope
14189 \pgfslopedattimetrue
14190 \pgfallowupsidedownattimetrue
14191 \pgfresetnontranslationattimefalse
14192 \ifpgf@circuit@trans@arrowatend
14193 \edef\@@anchor{tip}\edef\@@pos{1.0}
14194 \else
14195 \edef\@@anchor{center}\edef\@@pos{0.6}
14196 \fi
14197 \pgftransformlineattime{\@@pos}{%
14198 \pgfpoint{\pgf@circ@res@left}%
14199 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
14200 }{%
14201 \pgfpoint
14202 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
14203 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
14204 }
14205 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14206 \endpgfscope
14207
14208 \pgfpathmoveto{\pgfpoint
14209 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
14210 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
14211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
14212 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
14213 \pgfusepath{draw}
14214 }
14215
14216 \pgfcircdeclaretransistor{pjfet}{
14217 \anchor{inner up}{
14218 \northeast
14219 \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
14220 }
14221 \anchor{inner down}{
14222 \northeast
14223 \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
14224 }
14225 }{%
14226 % add the circle if requested (before everything else, so we can fill it)
14227 \pgfcirc@transistorcircle
14228 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14229 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14230 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
14231 \pgfpathlineto{\pgfpoint
14232 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
14233 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
14234
14235 \pgfpathmoveto{\pgfpoint
14236 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
14237 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
14238 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14239 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
14240 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14241 \pgfusepath{draw}
14242
14243 \pgfscope
14244 \pgfpathmoveto{\pgfpoint
14245 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
14246 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}}
14247 \pgfpathlineto{\pgfpoint
14248 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
14249 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}}
14250 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14251 \pgfusepath{draw}
14252 \endpgfscope
14253
14254 \pgfscope
14255 \pgfslopedattimetrue
14256 \pgfallowupsidedownattimetrue
14257 \pgfresetnontranslationattimefalse
14258 \ifpgf@circuit@trans@arrowatend
14259 \edef\@@anchor{btip}\edef\@@pos{1.0}
14260 \else
14261 \edef\@@anchor{center}\edef\@@pos{0.4}
14262 \fi
14263 \pgftransformlineattime{\@@pos}{%
14264 \pgfpoint%
14265 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}%
14266 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
14267 }{%
14268 \pgfpoint{\pgf@circ@res@left}%
14269 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
14270 }
14271 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14272 \endpgfscope
14273
14274 \pgfpathmoveto{\pgfpoint
14275 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
14276 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
14277 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
14278 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
14279 \pgfusepath{draw}
14280 }
14281
14282 \pgfdeclaretransistorwrapperaddbulk{isfet}{
14283 }{%
14284 % add the circle if requested (before everything else, so we can fill it)
14285 \pgfcirc@transistorcircle
14286 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14287 % DRAIN CONNECTION
14288 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14289 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
14290 % DRAIN
14291 \pgfpathlineto{\pgfpoint
14292 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14293 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
14294 \pgfusepath{draw}
14295
14296 % GATE, DEPLETION TYPE
14297 \pgfscope %% added
14298 \pgfpathmoveto{\pgfpoint
14299 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14300 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
14301 \pgfpathlineto{\pgfpoint
14302 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14303 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
14304 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
14305 \pgfusepath{draw} %% added
14306 \endpgfscope %% added
14307
14308 % BULK
14309 \pgfpathmoveto{\pgfpoint
14310 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14311 {\pgf@circ@res@up+\pgf@circ@res@down}}
14312 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
14313 {\pgf@circ@res@up+\pgf@circ@res@down}}
14314
14315 % SOURCE
14316 \pgfpathmoveto{\pgfpoint
14317 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14318 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
14319 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14320 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
14321 % SOURCE CONNECTION
14322 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14323 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14324 \pgfusepath{draw}
14325
14326 % SOLDER DOT at source-bulk connection
14327 \ifpgf@circuit@fet@solderdot
14328 \pgfscope
14329 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14330 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
14331 \pgfnode{circ}{center}{}{}{}
14332 \endpgfscope{}
14333 \fi
14334 % ARROW
14335 \pgfscope
14336 \pgfslopedattimetrue
14337 \pgfallowupsidedownattimetrue
14338 \pgfresetnontranslationattimefalse
14339 \ifpgf@circuit@trans@arrowatend
14340 \edef\@@anchor{tip}\edef\@@pos{1.0}
14341 \else
14342 \edef\@@anchor{center}\edef\@@pos{0.6}
14343 \fi
14344 \pgftransformlineattime{\@@pos}{%
14345 \pgfpoint
14346 {\pgf@circ@res@right}%
14347 {\pgf@circ@res@up+\pgf@circ@res@down}%
14348 }{%
14349 \pgfpoint%
14350 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
14351 {\pgf@circ@res@up+\pgf@circ@res@down}%
14352 }
14353 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14354 \endpgfscope
14355 \pgfusepath{draw}
14356
14357 % Wavy lines
14358 \pgfscope
14359 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
14360 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14361 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14362 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14363 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14364 \pgfusepath{draw}
14365
14366 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
14367 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14368 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14369 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14370 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14371 \pgfusepath{draw}
14372
14373 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
14374 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14375 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14376 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14377 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14378 \pgfusepath{draw}
14379 \endpgfscope
14380 }
14381
14382 % end of transistors
14383
14384 %%%%%%%%%%%%%
14385 %% Switches
14386 %%%%%%%%%%%%%
14387
14388 \pgfcircdeclarebipole{
14389 \anchor{out 1}{
14390 \northeast
14391 \pgf@y=0cm
14392 }
14393 \anchor{out 2}{
14394 \northeast
14395 \pgf@y=.8\pgf@y
14396 }
14397 }
14398 {\ctikzvalof{tripoles/toggleswitch/height 2}}
14399 {toggleswitch}
14400 {\ctikzvalof{tripoles/toggleswitch/height}}
14401 {\ctikzvalof{tripoles/toggleswitch/width}}
14402 {
14403
14404 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14405 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
14406 \pgfusepath{draw}
14407 \pgfscope
14408 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
14409 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
14410 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
14411 \pgfusepath{draw}
14412 \endpgfscope
14413
14414 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14415 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
14416
14417 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
14418 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
14419 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
14420 \pgfusepath{draw}
14421
14422
14423 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
14424 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
14425 \pgfusepath{draw}
14426
14427 \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}
14428 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
14429 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
14430 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
14431 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
14432 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
14433 \pgfusepath{draw}
14434 \pgfsetdash{}{0cm}
14435 }
14436
14437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14438 %% operational and instrumentation amplifiers
14439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14440
14441 \pgfdeclareshape{op amp}
14442 {
14443 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14444 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14445 \anchor{center}{\pgfpointorigin}
14446 \savedanchor\northwest{%
14447 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14448 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14449 \pgf@y=.5\pgf@y
14450 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14451 \pgf@x=.5\pgf@x
14452 }
14453 \savedanchor\left{%
14454 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14455 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14456 \pgf@x=.5\pgf@x
14457 \pgf@y=0pt
14458 }
14459 \anchor{south}{
14460 \northwest
14461 \pgf@y=-\pgf@y
14462 \pgf@x=0pt
14463 }
14464 \anchor{north}{
14465 \northwest
14466 \pgf@x=0pt
14467 }
14468 \savedanchor\left{%
14469 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14470 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14471 \pgf@x=.5\pgf@x
14472 \pgf@y=0pt
14473 }
14474 \savedanchor\inOneFixed{%
14475 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14476 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14477 \pgf@y=.5\pgf@y
14478 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
14479 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14480 \pgf@x=.5\pgf@x
14481 }
14482 \anchor{in up}{
14483 \inOneFixed
14484 }
14485 \anchor{in down}{
14486 \inOneFixed
14487 \pgf@y=-\pgf@y
14488 }
14489 \savedanchor\inOne{%
14490 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14491 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14492 \pgf@y=.5\pgf@y
14493 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
14494 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14495 \pgf@x=.5\pgf@x
14496 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14497 }
14498 \anchor{-}{
14499 \inOne
14500 }
14501 \anchor{+}{
14502 \inOne
14503 \pgf@y=-\pgf@y
14504 }
14505 \savedanchor\up{%
14506 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14507 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14508 \pgf@y=.5\pgf@y
14509 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14510 \pgf@x=.5\pgf@x
14511 \pgf@circ@res@up = \pgf@y
14512 \pgf@circ@res@right = -\pgf@x
14513 \pgf@circ@res@left = \pgf@x
14514 \pgfpointlineattime{
14515 \ctikzvalof{tripoles/op amp/up pos}}{
14516 \pgfpoint{
14517 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14518 {\pgf@circ@res@up}}
14519 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
14520 }
14521 \anchor{up}{
14522 \up
14523 }
14524 \anchor{down}{
14525 \up
14526 \pgf@y=-\pgf@y
14527 }
14528 \anchor{out}{
14529 \northwest
14530 \pgf@y=0pt
14531 \pgf@x=-\pgf@x
14532 }
14533 \anchor{west}{
14534 \left
14535 }
14536 \anchor{east}{
14537 \left
14538 \pgf@x=-\pgf@x
14539 }
14540
14541 % support for border anchors
14542 \savedanchor\leftedge{%
14543 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14544 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14545 \pgf@x=.5\pgf@x
14546 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14547 \pgf@y=0pt
14548 }
14549 \anchor{leftedge}{\leftedge}
14550 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14551 \anchor{bin up}{
14552 \inOneFixed
14553 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14554 }
14555 \anchor{bin down}{
14556 \inOneFixed
14557 \pgf@y=-\pgf@y
14558 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14559 }
14560 \anchor{b-}{
14561 \inOne
14562 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14563 }
14564 \anchor{b+}{
14565 \inOne
14566 \pgf@y=-\pgf@y
14567 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14568 }
14569 \anchor{bout}{
14570 \leftedge
14571 \pgf@y=0pt
14572 \pgf@x=-\pgf@x
14573 }
14574 % end border anchors
14575 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14576 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14577 \anchor{north west}{ \northwest }
14578 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14579
14580 \anchor{text}{
14581 \ifpgf@circ@center@text
14582 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14583 \else
14584 \leftedge
14585 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14586 \fi
14587 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14588 }
14589
14590 \backgroundpath{
14591 \pgfsetcolor{\ctikzvalof{color}}
14592
14593 \northwest
14594 \pgf@circ@res@up = \pgf@y
14595 \pgf@circ@res@down = -\pgf@y
14596 \pgf@circ@res@right = -\pgf@x
14597 \pgf@circ@res@left = \pgf@x
14598 \pgf@circ@scaled@Rlen=\scaledRlen
14599
14600 % Triangle
14601 \pgfscope
14602 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14603 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14604 \pgf@circ@res@step=\pgf@circ@res@right
14605 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14606 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
14607
14608 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14609 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14610 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14611 \pgfpathclose
14612 \pgf@circ@draworfill
14613 \endpgfscope
14614
14615 % Negative input terminal
14616 \pgfpathmoveto{\pgfpoint
14617 {\pgf@circ@res@left}
14618 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
14619 \pgfpathlineto{\pgfpoint
14620 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14621 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
14622 \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}
14623
14624 % Positive input terminal
14625 \pgfpathmoveto{\pgfpoint
14626 {\pgf@circ@res@left}
14627 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
14628 \pgfpathlineto{\pgfpoint
14629 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14630 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
14631 \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}
14632
14633 % Output terminal
14634 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14635 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
14636 \pgfsetrectcap
14637 \pgfusepath{draw}
14638 }
14639 }
14640
14641 % Op amp shape as in european standard EN 60617
14642 \pgfdeclareshape{en amp}
14643 {
14644 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14645 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14646 \anchor{center}{\pgfpointorigin}
14647 \savedanchor\northwest{%
14648 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14649 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14650 \pgf@y=.5\pgf@y
14651 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14652 \pgf@x=.5\pgf@x
14653 }
14654 \savedanchor\left{%
14655 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14656 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14657 \pgf@x=.5\pgf@x
14658 \pgf@y=0pt
14659 }
14660 \anchor{south}{
14661 \northwest
14662 \pgf@y=-\pgf@y
14663 \pgf@x=0pt
14664 }
14665 \anchor{north}{
14666 \northwest
14667 \pgf@x=0pt
14668 }
14669 \savedanchor\inOneFixed{%
14670 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14671 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14672 \pgf@y=.5\pgf@y
14673 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
14674 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14675 \pgf@x=.5\pgf@x
14676 }
14677 \anchor{in up}{
14678 \inOneFixed
14679 }
14680 \anchor{in down}{
14681 \inOneFixed
14682 \pgf@y=-\pgf@y
14683 }
14684 \savedanchor\inOne{%
14685 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14686 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14687 \pgf@y=.5\pgf@y
14688 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
14689 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14690 \pgf@x=.5\pgf@x
14691 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14692 }
14693 \anchor{-}{
14694 \inOne
14695 }
14696 \anchor{+}{
14697 \inOne
14698 \pgf@y=-\pgf@y
14699 }
14700 \anchor{up}{
14701 \northwest
14702 \pgf@x=0pt
14703 }
14704 \anchor{down}{
14705 \northwest
14706 \pgf@x=0pt
14707 \pgf@y=-\pgf@y
14708 }
14709 \anchor{out}{
14710 \northwest
14711 \pgf@y=0pt
14712 \pgf@x=-\pgf@x
14713 }
14714 \anchor{west}{
14715 \left
14716 }
14717 \anchor{east}{
14718 \left
14719 \pgf@x=-\pgf@x
14720 }
14721 % support for border anchors
14722 \savedanchor\leftedge{%
14723 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14724 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14725 \pgf@x=.5\pgf@x
14726 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
14727 \pgf@y=0pt
14728 }
14729 \anchor{leftedge}{\leftedge}
14730 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14731 \anchor{bin up}{
14732 \inOneFixed
14733 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14734 }
14735 \anchor{bin down}{
14736 \inOneFixed
14737 \pgf@y=-\pgf@y
14738 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14739 }
14740 \anchor{b-}{
14741 \inOne
14742 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14743 }
14744 \anchor{b+}{
14745 \inOne
14746 \pgf@y=-\pgf@y
14747 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14748 }
14749 \anchor{bout}{
14750 \leftedge
14751 \pgf@y=0pt
14752 \pgf@x=-\pgf@x
14753 }
14754 % end border anchors
14755 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14756 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14757 \anchor{north west}{ \northwest }
14758 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14759 \anchor{text}{
14760 \ifpgf@circ@center@text
14761 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14762 \else
14763 \leftedge
14764 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14765 \fi
14766 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14767 }
14768
14769 \backgroundpath{
14770 \pgfsetcolor{\ctikzvalof{color}}
14771 \northwest
14772 \pgf@circ@res@up = \pgf@y
14773 \pgf@circ@res@down = -\pgf@y
14774 \pgf@circ@res@right = -\pgf@x
14775 \pgf@circ@res@left = \pgf@x
14776 \pgf@circ@scaled@Rlen=\scaledRlen
14777
14778 \pgfscope
14779 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14780 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
14781 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
14782 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
14783 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
14784 \pgfpathclose
14785 \pgf@circ@draworfill
14786 \endpgfscope
14787
14788 \pgfpathmoveto{\pgfpoint
14789 {\pgf@circ@res@left}
14790 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
14791 \pgfpathlineto{\pgfpoint
14792 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
14793 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
14794 \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}
14795
14796 \pgfpathmoveto{\pgfpoint
14797 {\pgf@circ@res@left}
14798 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
14799 \pgfpathlineto{\pgfpoint
14800 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
14801 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
14802 \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}
14803
14804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14805 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
14806 \pgfsetrectcap
14807 \pgfusepath{draw}
14808
14809
14810 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
14811 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
14812 }
14813 }
14814
14815 % Fully differential output op amp
14816 % Contributed by Kristofer M. Monisit
14817 \pgfdeclareshape{fd op amp}
14818 {
14819 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14820 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14821 \anchor{center}{\pgfpointorigin}
14822 \savedanchor\northwest{%
14823 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14824 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14825 \pgf@y=.5\pgf@y
14826 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14827 \pgf@x=.5\pgf@x
14828 }
14829 \savedanchor\outline{%
14830 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14831 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14832 \pgf@y=.5\pgf@y
14833 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14834 \pgf@x=.5\pgf@x
14835 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
14836 }
14837 \anchor{south}{
14838 \northwest
14839 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14840 }
14841 \anchor{north}{
14842 \northwest\pgf@x=0pt\relax
14843 }
14844 \savedanchor\left{%
14845 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14846 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14847 \pgf@x=.5\pgf@x
14848 \pgf@y=0pt
14849 }
14850 \savedanchor\inOneFixed{%
14851 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14852 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14853 \pgf@y=.5\pgf@y
14854 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
14855 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14856 \pgf@x=.5\pgf@x
14857 }
14858 \anchor{in up}{
14859 \inOneFixed
14860 }
14861 \anchor{in down}{
14862 \inOneFixed
14863 \pgf@y=-\pgf@y
14864 }
14865 \savedanchor\inOne{%
14866 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14867 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14868 \pgf@y=.5\pgf@y
14869 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
14870 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14871 \pgf@x=.5\pgf@x
14872 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14873 }
14874 \anchor{-}{
14875 \inOne
14876 }
14877 \anchor{+}{
14878 \inOne
14879 \pgf@y=-\pgf@y
14880 }
14881 \savedanchor\up{%
14882 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14883 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14884 \pgf@y=.5\pgf@y
14885 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14886 \pgf@x=.5\pgf@x
14887 \pgf@circ@res@up = \pgf@y
14888 \pgf@circ@res@right = -\pgf@x
14889 \pgf@circ@res@left = \pgf@x
14890 \pgfpointlineattime{
14891 \ctikzvalof{tripoles/fd op amp/up pos}}{
14892 \pgfpoint{
14893 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14894 {\pgf@circ@res@up}}
14895 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
14896 }
14897 \anchor{up}{
14898 \up
14899 }
14900 \anchor{down}{
14901 \up
14902 \pgf@y=-\pgf@y
14903 }
14904 \anchor{out up}{
14905 \northwest
14906 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14907 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14908 }
14909 \anchor{out down}{
14910 \northwest
14911 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14912 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14913 }
14914 \anchor{out +}{
14915 \outline
14916 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14917 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14918 }
14919 \anchor{out -}{
14920 \outline
14921 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14922 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14923 }
14924 % support for border anchors
14925 \savedanchor\leftedge{%
14926 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14927 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14928 \pgf@x=.5\pgf@x
14929 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14930 \pgf@y=0pt
14931 }
14932 \anchor{leftedge}{\leftedge}
14933 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14934 \anchor{bin up}{
14935 \inOneFixed
14936 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14937 }
14938 \anchor{bin down}{
14939 \inOneFixed
14940 \pgf@y=-\pgf@y
14941 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14942 }
14943 \anchor{b-}{
14944 \inOne
14945 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14946 }
14947 \anchor{b+}{
14948 \inOne
14949 \pgf@y=-\pgf@y
14950 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14951 }
14952 \anchor{bout}{
14953 \leftedge
14954 \pgf@y=0pt
14955 \pgf@x=-\pgf@x
14956 }
14957 \anchor{bout +}{
14958 \outline
14959 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14960 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14961 {\pgfpoint{\pgf@xa}{0pt}}
14962 {\pgfpoint{0pt}{\pgf@ya}}
14963 }
14964 \anchor{bout -}{
14965 \outline
14966 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14967 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14968 {\pgfpoint{\pgf@xa}{0pt}}
14969 {\pgfpoint{0pt}{\pgf@ya}}
14970 \pgf@y=-\pgf@y
14971 }
14972 \anchor{bout up}{
14973 \northwest
14974 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14975 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14976 {\pgfpoint{\pgf@xa}{0pt}}
14977 {\pgfpoint{0pt}{\pgf@ya}}
14978 }
14979 \anchor{bout down}{
14980 \northwest
14981 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14982 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14983 {\pgfpoint{\pgf@xa}{0pt}}
14984 {\pgfpoint{0pt}{\pgf@ya}}
14985 \pgf@y=-\pgf@y
14986 }
14987 % end border anchors
14988 \anchor{west}{
14989 \left
14990 }
14991 \anchor{east}{
14992 \left
14993 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14994 }
14995 \anchor{out}{% should not be used
14996 \left
14997 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14998 }
14999 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15000 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
15001 \anchor{north west}{ \northwest }
15002 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
15003 \anchor{text}{
15004 \ifpgf@circ@center@text
15005 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15006 \else
15007 \leftedge
15008 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15009 \fi
15010 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15011 }
15012 \backgroundpath{
15013 \pgfsetcolor{\ctikzvalof{color}}
15014
15015 \northwest
15016 \pgf@circ@res@up = \pgf@y
15017 \pgf@circ@res@down = -\pgf@y
15018 \pgf@circ@res@right = -\pgf@x
15019 \pgf@circ@res@left = \pgf@x
15020 \pgf@circ@scaled@Rlen=\scaledRlen
15021
15022 % Triangle
15023 % Includes output terminals in the traingular shape
15024 % to ensure that diagonal joins are properly displayed
15025 % we first draw the main triangle and the leads with normal thickness,
15026 % and the redraw the main triangle with the component shape
15027 \pgfscope
15028 % shift origin a bit to ease calculations
15029 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
15030 \pgf@circ@res@step=\pgf@circ@res@right
15031 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15032 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
15033
15034 % Initial point (right vertex)
15035 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15036
15037 % Negative output terminal
15038 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
15039 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
15040 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
15041
15042 % Top vertex
15043 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15044
15045 % Bottom vertex
15046 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15047
15048 % Positive output terminal
15049 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
15050 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
15051 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
15052
15053 % Right vertex
15054 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15055
15056 \pgfpathclose
15057 \pgfusepath{stroke}
15058
15059 % ok, now we'll redraw the triangle with the class specific
15060 % thickness and optionally fill
15061
15062 \pgfscope
15063 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
15064
15065 % Initial point (right vertex)
15066 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15067 % Top vertex
15068 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15069 % Bottom vertex
15070 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15071
15072 \pgfpathclose
15073 \pgf@circ@draworfill
15074 \endpgfscope % thick and fill
15075 \endpgfscope % shift
15076
15077 % Negative input terminal
15078 \pgfpathmoveto{\pgfpoint
15079 {\pgf@circ@res@left}
15080 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
15081 \pgfpathlineto{\pgfpoint
15082 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
15083 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
15084 \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}
15085
15086 % Positive input terminal
15087 \pgfpathmoveto{\pgfpoint
15088 {\pgf@circ@res@left}
15089 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
15090 \pgfpathlineto{\pgfpoint
15091 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
15092 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
15093 \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}
15094
15095 % Negative output terminal label
15096 \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}
15097
15098 % Positive output terminal label
15099 \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}
15100
15101 \pgfsetrectcap
15102 \pgfusepath{draw}
15103 }
15104 }
15105
15106
15107 % Instrumentation amplifier with differential output
15108 \pgfdeclareshape{fd inst amp}
15109 {
15110 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15111 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15112 % when tikz calls the anchor it wants the relative position in the lengths
15113 % \pgf@x \pgf@y
15114 % \pgfpoint* functions set that variables
15115 % anchors are visible outside and run on use
15116 \anchor{center}{\pgfpointorigin}
15117 % savedanchors are internals and run on node creation (not use)
15118 % bounding-box top left
15119 \savedanchor\northwest{%
15120 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15121 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15122 \pgf@y=.5\pgf@y
15123 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15124 \pgf@x=.5\pgf@x
15125 }
15126 \anchor{nw}{
15127 \northwest
15128 }
15129 \anchor{south}{
15130 \northwest
15131 \pgf@y=-\pgf@y\pgf@x=0pt\relax
15132 }
15133 \anchor{north}{
15134 \northwest\pgf@x=0pt\relax
15135 }
15136 \savedanchor\left{%
15137 \pgf@y=0pt
15138 }
15139 \anchor{leftedge}
15140 {\left
15141 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
15142 }
15143 \savedanchor\inOneFixed{%
15144 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15145 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15146 \pgf@y=.5\pgf@y
15147 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
15148 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15149 \pgf@x=.5\pgf@x
15150 }
15151 \anchor{in up}{
15152 \inOneFixed
15153 }
15154 \anchor{in down}{
15155 \inOneFixed
15156 \pgf@y=-\pgf@y
15157 }
15158 \savedanchor\inOne{%
15159 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15160 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15161 \pgf@y=.5\pgf@y
15162 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
15163 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15164 \pgf@x=.5\pgf@x
15165 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15166 }
15167 \anchor{-}{
15168 \inOne
15169 }
15170 \anchor{+}{
15171 \inOne
15172 \pgf@y=-\pgf@y
15173 }
15174 \savedanchor\up{%
15175 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15176 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15177 \pgf@y=.5\pgf@y
15178 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15179 \pgf@x=.5\pgf@x
15180 \pgf@circ@res@up = \pgf@y
15181 \pgf@circ@res@right = -\pgf@x
15182 \pgf@circ@res@left = \pgf@x
15183 \pgfpointlineattime{
15184 \ctikzvalof{tripoles/fd inst amp/up pos}}{
15185 \pgfpoint{
15186 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15187 {\pgf@circ@res@up}}
15188 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
15189 }
15190 \anchor{up}{
15191 \up
15192 }
15193 \anchor{down}{
15194 \up
15195 \pgf@y=-\pgf@y
15196 }
15197 % reference voltage input anchors.
15198 \savedanchor\refv{%
15199 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15200 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15201 \pgf@y=.5\pgf@y
15202 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15203 \pgf@x=.5\pgf@x
15204 \pgf@circ@res@up = \pgf@y
15205 \pgf@circ@res@right = -\pgf@x
15206 \pgf@circ@res@left = \pgf@x
15207 \pgfpointlineattime{
15208 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
15209 \pgfpoint{
15210 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15211 {\pgf@circ@res@up}}
15212 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
15213 }
15214 % we need both because they are normally drawn under the amp, and if you
15215 % mirror it vertically you need them
15216 \anchor{refv up}{
15217 \refv
15218 }
15219 \anchor{refv down}{
15220 \refv
15221 \pgf@y=-\pgf@y
15222 }
15223 \savedanchor\outport{
15224 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15225 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15226 \pgf@y=.5\pgf@y
15227 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
15228 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15229 \pgf@x=-.5\pgf@x
15230 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
15231 }
15232 \anchor{out}{
15233 \outport
15234 \pgf@y=0pt
15235 }
15236 \anchor{out +}{
15237 \outport
15238 }
15239 \anchor{out -}{
15240 \outport
15241 \pgf@y=-\pgf@y
15242 }
15243 \savedanchor\outportfixed{
15244 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15245 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
15246 \pgf@y=.5\pgf@y
15247 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
15248 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15249 \pgf@x=-.5\pgf@x
15250 }
15251 \anchor{out up}{
15252 \outportfixed
15253 }
15254 \anchor{out down}{
15255 \outportfixed
15256 \pgf@y=-\pgf@y
15257 }
15258 % support for border anchors
15259 \savedanchor\leftedge{%
15260 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15261 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
15262 \pgf@x=.5\pgf@x
15263 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
15264 \pgf@y=0pt
15265 }
15266 \anchor{leftedge}{\leftedge}
15267 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15268 \anchor{bin up}{
15269 \inOneFixed
15270 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15271 }
15272 \anchor{bin down}{
15273 \inOneFixed
15274 \pgf@y=-\pgf@y
15275 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15276 }
15277 \anchor{b-}{
15278 \inOne
15279 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15280 }
15281 \anchor{b+}{
15282 \inOne
15283 \pgf@y=-\pgf@y
15284 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15285 }
15286 \anchor{bout}{
15287 \leftedge
15288 \pgf@x=-\pgf@x \pgf@y=0pt
15289 }
15290 \anchor{bout +}{
15291 \outport
15292 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15293 }
15294 \anchor{bout -}{
15295 \outport
15296 \pgf@y=-\pgf@y
15297 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15298 }
15299 \anchor{bout up}{
15300 \outportfixed
15301 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15302 }
15303 \anchor{bout down}{
15304 \outportfixed
15305 \pgf@y=-\pgf@y
15306 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15307 }
15308 % end border anchors
15309 %
15310 \anchor{west}{
15311 \left
15312 }
15313 \anchor{east}{
15314 \left
15315 \pgf@x=-\pgf@x
15316 }
15317 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15318 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15319 \anchor{north west}{ \northwest }
15320 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15321 \anchor{text}{
15322 \ifpgf@circ@center@text
15323 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15324 \else
15325 \leftedge
15326 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15327 \fi
15328 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15329 }
15330
15331 % let's start drawing the component
15332 \backgroundpath{
15333 \pgfsetcolor{\ctikzvalof{color}}
15334 %
15335 \northwest
15336 \pgf@circ@res@up = \pgf@y
15337 \pgf@circ@res@down = -\pgf@y
15338 \pgf@circ@res@right = -\pgf@x
15339 \pgf@circ@res@left = \pgf@x
15340 \pgf@circ@scaled@Rlen=\scaledRlen
15341 % main component, normally in thicker lines
15342 \pgfscope
15343 \newdimen\pgf@circ@res@right@double
15344 \pgf@circ@res@right@double=2\pgf@circ@res@right
15345
15346 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15347 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15348 \pgf@circ@res@step=\pgf@circ@res@right
15349 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15350 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
15351 %first point (near output)
15352 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
15353 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
15354 \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}}
15355 % and then to the input "front up", "down", to the output short side "down"
15356 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15357 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15358 \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}}
15359 % ...and close
15360 \pgfpathclose
15361 \pgf@circ@draworfill
15362 \endpgfscope
15363
15364 % input terminal up
15365 \pgfpathmoveto{\pgfpoint
15366 {\pgf@circ@res@left}
15367 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
15368 %
15369 \pgfpathlineto{\pgfpoint
15370 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15371 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
15372 %
15373 \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}
15374
15375 % input terminal down
15376 \pgfpathmoveto{\pgfpoint
15377 {\pgf@circ@res@left}
15378 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
15379 %
15380 \pgfpathlineto{\pgfpoint
15381 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15382 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
15383 \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}
15384
15385 % output leads down and up
15386 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
15387 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
15388 \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}
15389
15390 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
15391 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
15392 \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}
15393 %
15394 \pgfsetrectcap
15395 \pgfusepath{draw}
15396 }
15397 }
15398
15399 % Transconductance amplifier (Transkonduktanzverstärker)
15400 \pgfdeclareshape{gm amp}
15401 {
15402 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15403 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15404 \anchor{center}{\pgfpointorigin}
15405 \savedanchor\northwest{%
15406 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15407 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15408 \pgf@y=.5\pgf@y
15409 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15410 \pgf@x=.5\pgf@x
15411 }
15412 \anchor{south}{
15413 \northwest
15414 \pgf@y=-\pgf@y
15415 }
15416 \anchor{north}{
15417 \northwest
15418 }
15419 \savedanchor\left{%
15420 \pgf@y=0pt
15421 }
15422 \anchor{leftedge}
15423 {\left
15424 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15425 }
15426 \savedanchor\inOneFixed{%
15427 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15428 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15429 \pgf@y=.5\pgf@y
15430 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
15431 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15432 \pgf@x=.5\pgf@x
15433 }
15434 \anchor{in up}{
15435 \inOneFixed
15436 }
15437 \anchor{in down}{
15438 \inOneFixed
15439 \pgf@y=-\pgf@y
15440 }
15441 \savedanchor\inOne{%
15442 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15443 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15444 \pgf@y=.5\pgf@y
15445 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
15446 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15447 \pgf@x=.5\pgf@x
15448 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15449 }
15450 \anchor{-}{
15451 \inOne
15452 }
15453 \anchor{+}{
15454 \inOne
15455 \pgf@y=-\pgf@y
15456 }
15457 \savedanchor\up{%
15458 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15459 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15460 \pgf@y=.5\pgf@y
15461 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15462 \pgf@x=.5\pgf@x
15463 \pgf@circ@res@up = \pgf@y
15464 \pgf@circ@res@right = -\pgf@x
15465 \pgf@circ@res@left = \pgf@x
15466 \pgfpointlineattime{
15467 \ctikzvalof{tripoles/gm amp/up pos}}{
15468 \pgfpoint{
15469 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15470 {\pgf@circ@res@up}}
15471 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
15472 }
15473 \anchor{up}{
15474 \up
15475 }
15476 \anchor{down}{
15477 \up
15478 \pgf@y=-\pgf@y
15479 }
15480 \anchor{out}{
15481 \northwest
15482 \pgf@y=0pt
15483 \pgf@x=-\pgf@x
15484 }
15485 % support for border anchors
15486 \savedanchor\leftedge{%
15487 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15488 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15489 \pgf@x=.5\pgf@x
15490 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
15491 \pgf@y=0pt
15492 }
15493 \anchor{leftedge}{\leftedge}
15494 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15495 \anchor{bin up}{
15496 \inOneFixed
15497 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15498 }
15499 \anchor{bin down}{
15500 \inOneFixed
15501 \pgf@y=-\pgf@y
15502 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15503 }
15504 \anchor{b-}{
15505 \inOne
15506 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15507 }
15508 \anchor{b+}{
15509 \inOne
15510 \pgf@y=-\pgf@y
15511 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15512 }
15513 \anchor{bout}{
15514 \leftedge
15515 \pgf@y=0pt
15516 \pgf@x=-\pgf@x
15517 }
15518 % end border anchors
15519 \anchor{west}{
15520 \left
15521 }
15522 \anchor{east}{
15523 \left
15524 \pgf@x=-\pgf@x
15525 }
15526 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15527 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15528 \anchor{north west}{ \northwest }
15529 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15530
15531 \anchor{text}{
15532 \ifpgf@circ@center@text
15533 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15534 \else
15535 \leftedge
15536 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15537 \fi
15538 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15539 }
15540 \backgroundpath{
15541 \pgfsetcolor{\ctikzvalof{color}}
15542
15543 \northwest
15544 \pgf@circ@res@up = \pgf@y
15545 \pgf@circ@res@down = -\pgf@y
15546 \pgf@circ@res@right = -\pgf@x
15547 \pgf@circ@res@left = \pgf@x
15548 \pgf@circ@scaled@Rlen=\scaledRlen
15549
15550 \pgfscope
15551 \newdimen\pgf@circ@res@right@double
15552 \pgf@circ@res@right@double=2\pgf@circ@res@right
15553
15554 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15555 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15556 \pgf@circ@res@step=\pgf@circ@res@right
15557 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15558 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
15559 %Umrandung:
15560 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
15561 \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
15562 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
15563 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
15564 \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
15565 \pgfpathclose
15566 \pgf@circ@draworfill
15567 \endpgfscope
15568
15569 \pgfpathmoveto{\pgfpoint
15570 {\pgf@circ@res@left}
15571 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
15572 \pgfpathlineto{\pgfpoint
15573 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15574 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
15575 \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}
15576
15577
15578 \pgfpathmoveto{\pgfpoint
15579 {\pgf@circ@res@left}
15580 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
15581 \pgfpathlineto{\pgfpoint
15582 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15583 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
15584 \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}
15585
15586 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15587 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
15588 \pgfsetrectcap
15589 \pgfusepath{draw}
15590
15591 }
15592 }
15593
15594 % Instrumentation amplifier
15595 \pgfdeclareshape{inst amp}
15596 {
15597 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15598 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15599 % when tikz calls the anchor it wants the relative position in the lengths
15600 % \pgf@x \pgf@y
15601 % \pgfpoint* functions set that variables
15602 % anchors are visible outside and run on use
15603 \anchor{center}{\pgfpointorigin}
15604 % savedanchors are internals and run on node creation (not use)
15605 % bounding-box top left
15606 \savedanchor\northwest{%
15607 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15608 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15609 \pgf@y=.5\pgf@y
15610 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15611 \pgf@x=.5\pgf@x
15612 }
15613 \anchor{nw}{
15614 \northwest
15615 }
15616 \anchor{south}{
15617 \northwest
15618 \pgf@y=-\pgf@y
15619 }
15620 \anchor{north}{
15621 \northwest
15622 }
15623 \savedanchor\left{%
15624 \pgf@y=0pt
15625 }
15626 \anchor{leftedge}
15627 {\left
15628 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15629 }
15630 \savedanchor\inOneFixed{%
15631 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15632 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15633 \pgf@y=.5\pgf@y
15634 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
15635 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15636 \pgf@x=.5\pgf@x
15637 }
15638 \anchor{in up}{
15639 \inOneFixed
15640 }
15641 \anchor{in down}{
15642 \inOneFixed
15643 \pgf@y=-\pgf@y
15644 }
15645 \savedanchor\inOne{%
15646 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15647 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15648 \pgf@y=.5\pgf@y
15649 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
15650 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15651 \pgf@x=.5\pgf@x
15652 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15653 }
15654 \anchor{-}{
15655 \inOne
15656 }
15657 \anchor{+}{
15658 \inOne
15659 \pgf@y=-\pgf@y
15660 }
15661 \savedanchor\up{%
15662 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15663 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15664 \pgf@y=.5\pgf@y
15665 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15666 \pgf@x=.5\pgf@x
15667 \pgf@circ@res@up = \pgf@y
15668 \pgf@circ@res@right = -\pgf@x
15669 \pgf@circ@res@left = \pgf@x
15670 \pgfpointlineattime{
15671 \ctikzvalof{tripoles/inst amp/up pos}}{
15672 \pgfpoint{
15673 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15674 {\pgf@circ@res@up}}
15675 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15676 }
15677 \anchor{up}{
15678 \up
15679 }
15680 \anchor{down}{
15681 \up
15682 \pgf@y=-\pgf@y
15683 }
15684 % reference voltage input anchors.
15685 \savedanchor\refv{%
15686 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15687 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15688 \pgf@y=.5\pgf@y
15689 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15690 \pgf@x=.5\pgf@x
15691 \pgf@circ@res@up = \pgf@y
15692 \pgf@circ@res@right = -\pgf@x
15693 \pgf@circ@res@left = \pgf@x
15694 \pgfpointlineattime{
15695 \ctikzvalof{tripoles/inst amp/refv pos}}{
15696 \pgfpoint{
15697 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15698 {\pgf@circ@res@up}}
15699 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15700 }
15701 % we need both because they are normally drawn under the amp, and if you
15702 % mirror it vertically you need them
15703 \anchor{refv up}{
15704 \refv
15705 }
15706 \anchor{refv down}{
15707 \refv
15708 \pgf@y=-\pgf@y
15709 }
15710 \anchor{out}{
15711 \northwest
15712 \pgf@y=0pt
15713 \pgf@x=-\pgf@x
15714 }
15715 % support for border anchors
15716 \savedanchor\leftedge{%
15717 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15718 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15719 \pgf@x=.5\pgf@x
15720 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
15721 \pgf@y=0pt
15722 }
15723 \anchor{leftedge}{\leftedge}
15724 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15725 \anchor{bin up}{
15726 \inOneFixed
15727 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15728 }
15729 \anchor{bin down}{
15730 \inOneFixed
15731 \pgf@y=-\pgf@y
15732 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15733 }
15734 \anchor{b-}{
15735 \inOne
15736 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15737 }
15738 \anchor{b+}{
15739 \inOne
15740 \pgf@y=-\pgf@y
15741 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15742 }
15743 \anchor{bout}{
15744 \leftedge
15745 \pgf@y=0pt
15746 \pgf@x=-\pgf@x
15747 }
15748 % end border anchors
15749 \anchor{west}{
15750 \left
15751 }
15752 \anchor{east}{
15753 \left
15754 \pgf@x=-\pgf@x
15755 }
15756 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15757 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15758 \anchor{north west}{ \northwest }
15759 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15760
15761 \anchor{text}{
15762 \ifpgf@circ@center@text
15763 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15764 \else
15765 \leftedge
15766 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15767 \fi
15768 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15769 }
15770
15771 % let's start drawing the component
15772 \backgroundpath{
15773 \pgfsetcolor{\ctikzvalof{color}}
15774 %
15775 \northwest
15776 \pgf@circ@res@up = \pgf@y
15777 \pgf@circ@res@down = -\pgf@y
15778 \pgf@circ@res@right = -\pgf@x
15779 \pgf@circ@res@left = \pgf@x
15780 \pgf@circ@scaled@Rlen=\scaledRlen
15781
15782 % main component, normally in thicker lines
15783 \pgfscope
15784 \newdimen\pgf@circ@res@right@double
15785 \pgf@circ@res@right@double=2\pgf@circ@res@right
15786
15787 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15788 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15789 \pgf@circ@res@step=\pgf@circ@res@right
15790 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15791 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
15792 %first point (near output)
15793 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
15794 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
15795 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15796 % and then to the input "front up", "down", to the output short side "down"
15797 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15798 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15799 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
15800 % ...and close
15801 \pgfpathclose
15802 \pgf@circ@draworfill
15803 \endpgfscope
15804
15805 % Negative input terminal
15806 \pgfpathmoveto{\pgfpoint
15807 {\pgf@circ@res@left}
15808 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
15809 %
15810 \pgfpathlineto{\pgfpoint
15811 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15812 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
15813 %
15814 \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}
15815
15816 % Positive input terminal
15817 \pgfpathmoveto{\pgfpoint
15818 {\pgf@circ@res@left}
15819 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
15820 %
15821 \pgfpathlineto{\pgfpoint
15822 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15823 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
15824 \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}
15825
15826 % Output terminal
15827 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15828 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
15829 %
15830 \pgfsetrectcap
15831 \pgfusepath{draw}
15832 }
15833 }
15834
15835 % Instrumentation amplifier with terminals for gain resistance between inputs
15836 \pgfdeclareshape{inst amp ra}
15837 {
15838 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15839 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15840 \anchor{center}{\pgfpointorigin}
15841 % bounding-box top left
15842 \savedanchor\northwest{%
15843 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15844 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15845 \pgf@y=.5\pgf@y
15846 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15847 \pgf@x=.5\pgf@x
15848 }
15849 \anchor{nw}{
15850 \northwest
15851 }
15852 \anchor{south}{
15853 \northwest
15854 \pgf@y=-\pgf@y\pgf@x=0pt\relax
15855 }
15856 \anchor{north}{
15857 \northwest\pgf@x=0pt\relax
15858 }
15859 \savedanchor\left{%
15860 \pgf@y=0pt
15861 }
15862 \anchor{leftedge}
15863 {\left
15864 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15865 }
15866 % inputs (+-)
15867 \savedanchor\inOneFixed{%
15868 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15869 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15870 \pgf@y=.5\pgf@y
15871 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
15872 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15873 \pgf@x=.5\pgf@x
15874 }
15875 \anchor{in up}{
15876 \inOneFixed
15877 }
15878 \anchor{in down}{
15879 \inOneFixed
15880 \pgf@y=-\pgf@y
15881 }
15882 \savedanchor\inOne{%
15883 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15884 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15885 \pgf@y=.5\pgf@y
15886 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
15887 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15888 \pgf@x=.5\pgf@x
15889 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15890 }
15891 \anchor{-}{
15892 \inOne
15893 }
15894 \anchor{+}{
15895 \inOne
15896 \pgf@y=-\pgf@y
15897 }
15898 % R ampli anchors. They are by default at 20% more than R-length distance
15899 % you can change that with the `ra pos` key (use 0.5 for one-R).
15900 \savedanchor\raOneFixed{%
15901 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15902 \pgf@y=\pgf@circ@scaled@Rlen
15903 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
15904 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15905 \pgf@x=.5\pgf@x
15906 }
15907 \anchor{ra up}{
15908 \raOneFixed
15909 }
15910 \anchor{ra down}{
15911 \raOneFixed
15912 \pgf@y=-\pgf@y
15913 }
15914 \savedanchor\raOne{%
15915 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15916 \pgf@y=\pgf@circ@scaled@Rlen
15917 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
15918 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15919 \pgf@x=.5\pgf@x
15920 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15921 }
15922 \anchor{ra-}{
15923 \raOne
15924 }
15925 \anchor{ra+}{
15926 \raOne
15927 \pgf@y=-\pgf@y
15928 }
15929 % power supplies
15930 \savedanchor\up{%
15931 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15932 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15933 \pgf@y=.5\pgf@y
15934 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15935 \pgf@x=.5\pgf@x
15936 \pgf@circ@res@up = \pgf@y
15937 \pgf@circ@res@right = -\pgf@x
15938 \pgf@circ@res@left = \pgf@x
15939 \pgfpointlineattime{
15940 \ctikzvalof{tripoles/inst amp ra/up pos}}{
15941 \pgfpoint{
15942 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15943 {\pgf@circ@res@up}}
15944 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
15945 }
15946 \anchor{up}{
15947 \up
15948 }
15949 \anchor{down}{
15950 \up
15951 \pgf@y=-\pgf@y
15952 }
15953 % reference voltage input anchors.
15954 \savedanchor\refv{%
15955 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15956 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15957 \pgf@y=0.5\pgf@y
15958 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15959 \pgf@x=0.5\pgf@x
15960 \pgf@circ@res@up = \pgf@y
15961 \pgf@circ@res@right = -\pgf@x
15962 \pgf@circ@res@left = \pgf@x
15963 \pgfpointlineattime{
15964 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
15965 \pgfpoint{
15966 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15967 {\pgf@circ@res@up}}
15968 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
15969 }
15970 % we need both because they are normally drawn under the amp, and if you
15971 % mirror it vertically you need them
15972 \anchor{refv up}{
15973 \refv
15974 }
15975 \anchor{refv down}{
15976 \refv
15977 \pgf@y=-\pgf@y
15978 }
15979 \anchor{out}{
15980 \northwest
15981 \pgf@y=0pt
15982 \pgf@x=-\pgf@x
15983 }
15984 % support for border anchors
15985 \savedanchor\leftedge{%
15986 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15987 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15988 \pgf@x=.5\pgf@x
15989 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
15990 \pgf@y=0pt
15991 }
15992 \anchor{leftedge}{\leftedge}
15993 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15994 \anchor{bin up}{
15995 \inOneFixed
15996 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15997 }
15998 \anchor{bin down}{
15999 \inOneFixed
16000 \pgf@y=-\pgf@y
16001 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16002 }
16003 \anchor{b-}{
16004 \inOne
16005 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16006 }
16007 \anchor{b+}{
16008 \inOne
16009 \pgf@y=-\pgf@y
16010 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16011 }
16012 \anchor{bra up}{
16013 \raOneFixed
16014 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16015 }
16016 \anchor{bra down}{
16017 \raOneFixed
16018 \pgf@y=-\pgf@y
16019 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16020 }
16021 \anchor{bra-}{
16022 \raOne
16023 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16024 }
16025 \anchor{bra+}{
16026 \raOne
16027 \pgf@y=-\pgf@y
16028 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16029 }
16030 \anchor{bout}{
16031 \leftedge
16032 \pgf@y=0pt
16033 \pgf@x=-\pgf@x
16034 }
16035 % end border anchors
16036 \anchor{west}{
16037 \left
16038 }
16039 \anchor{east}{
16040 \left
16041 \pgf@x=-\pgf@x
16042 }
16043 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16044 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16045 \anchor{north west}{ \northwest }
16046 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16047
16048 \anchor{text}{
16049 \ifpgf@circ@center@text
16050 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16051 \else
16052 \leftedge
16053 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16054 \fi
16055 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16056 }
16057
16058 % drawing of the component
16059 \backgroundpath{
16060 \pgfsetcolor{\ctikzvalof{color}}
16061
16062 \northwest
16063 \pgf@circ@res@up = \pgf@y
16064 \pgf@circ@res@down = -\pgf@y
16065 \pgf@circ@res@right = -\pgf@x
16066 \pgf@circ@res@left = \pgf@x
16067 \pgf@circ@scaled@Rlen=\scaledRlen
16068
16069 \newdimen\pgf@circ@res@right@double
16070 \pgf@circ@res@right@double=2\pgf@circ@res@right
16071
16072 % main component, normally in thicker lines
16073 \pgfscope
16074 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16075 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
16076 \pgf@circ@res@step=\pgf@circ@res@right
16077 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16078 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
16079 %primer punto: la linea de salida (lado componente)
16080 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
16081 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
16082 \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}}
16083 % and then to the input "front up", "down", to the output short side "down"
16084 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16085 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16086 \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}}
16087 % ...and close
16088 \pgfpathclose
16089 \pgf@circ@draworfill
16090 \endpgfscope
16091
16092 % ra terminal -
16093 \pgfpathmoveto{\pgfpoint
16094 {\pgf@circ@res@left}
16095 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
16096 %
16097 \pgfpathlineto{\pgfpoint
16098 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
16099 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
16100 % ra terminal +
16101 \pgfpathmoveto{\pgfpoint
16102 {\pgf@circ@res@left}
16103 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
16104 %
16105 \pgfpathlineto{\pgfpoint
16106 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
16107 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
16108
16109 % Negative input terminal
16110 \pgfpathmoveto{\pgfpoint
16111 {\pgf@circ@res@left}
16112 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
16113 %
16114 \pgfpathlineto{\pgfpoint
16115 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
16116 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
16117 %
16118 \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}
16119
16120 % Positive input terminal
16121 \pgfpathmoveto{\pgfpoint
16122 {\pgf@circ@res@left}
16123 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
16124 %
16125 \pgfpathlineto{\pgfpoint
16126 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
16127 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
16128 \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}
16129
16130 % Output terminal
16131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16132 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
16133 %
16134 \pgfsetrectcap
16135 \pgfusepath{draw}
16136 }
16137 }
16138
16139 % Buffer
16140 % Contributed by Danilo Piazzalunga
16141 \pgfdeclareshape{buffer}
16142 {
16143 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16144 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16145 \anchor{center}{\pgfpointorigin}
16146 \savedanchor\northwest{%
16147 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16148 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
16149 \pgf@y=.5\pgf@y
16150 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
16151 \pgf@x=.5\pgf@x
16152 }
16153 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
16154 \anchor{west}{ \northwest \pgf@y=0pt }
16155 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16156 \anchor{north}{ \northwest \pgf@x=0pt }
16157 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16158 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16159 \anchor{north west}{ \northwest }
16160 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16161 \savedanchor\left{%
16162 \pgf@y=0pt
16163 }
16164 \anchor{in}{
16165 \northwest
16166 \pgf@y=0pt
16167 }
16168 \anchor{out}{
16169 \northwest
16170 \pgf@y=0pt
16171 \pgf@x=-\pgf@x
16172 }
16173 \anchor{bin}{
16174 \northwest
16175 \pgf@y=0pt
16176 \pgf@x=0.7\pgf@x
16177 }
16178 \anchor{bout}{
16179 \northwest
16180 \pgf@y=0pt
16181 \pgf@x=-0.7\pgf@x
16182 }
16183
16184 \anchor{text}{
16185 \ifpgf@circ@center@text
16186 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16187 \else
16188 \northwest
16189 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
16190 \fi
16191 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16192 }
16193
16194 \backgroundpath{
16195 \pgfsetcolor{\ctikzvalof{color}}
16196
16197 \northwest
16198 \pgf@circ@res@up = \pgf@y
16199 \pgf@circ@res@down = -\pgf@y
16200 \pgf@circ@res@right = -\pgf@x
16201 \pgf@circ@res@left = \pgf@x
16202 \pgf@circ@scaled@Rlen=\scaledRlen
16203 \pgfscope
16204 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16205 \pgftransformxshift{.7\pgf@circ@res@left}
16206 \pgf@circ@res@step=\pgf@circ@res@right
16207 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16208 \pgf@circ@res@step=.7\pgf@circ@res@step
16209
16210 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16211 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16212 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16213 \pgfpathclose
16214 \pgf@circ@draworfill
16215 \endpgfscope
16216
16217 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
16218 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
16219
16220 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16221 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
16222
16223 \pgfusepath{draw}
16224 }
16225 }
16226
16227 % plain amplifier, no symbols
16228 \pgfdeclareshape{plain amp}
16229 {
16230 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16231 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16232 \anchor{center}{\pgfpointorigin}
16233 \savedanchor\northwest{%
16234 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16235 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16236 \pgf@y=.5\pgf@y
16237 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16238 \pgf@x=.5\pgf@x
16239 }
16240 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
16241 \anchor{west}{ \northwest \pgf@y=0pt }
16242 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16243 \anchor{north}{ \northwest \pgf@x=0pt }
16244 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16245 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16246 \anchor{north west}{ \northwest }
16247 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16248 \savedanchor\left{%
16249 \pgf@y=0pt
16250 }
16251 \savedanchor\inOne{%
16252 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16253 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16254 \pgf@y=.5\pgf@y
16255 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
16256 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16257 \pgf@x=.5\pgf@x
16258 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16259 }
16260 \savedanchor\inOneFixed{%
16261 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16262 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16263 \pgf@y=.5\pgf@y
16264 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
16265 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16266 \pgf@x=.5\pgf@x
16267 }
16268 \anchor{-}{
16269 \inOne
16270 }
16271 \anchor{+}{
16272 \inOne
16273 \pgf@y=-\pgf@y
16274 }
16275 \anchor{in up}{
16276 \inOneFixed
16277 }
16278 \anchor{in down}{
16279 \inOneFixed
16280 \pgf@y=-\pgf@y
16281 }
16282 % support for border anchors
16283 \savedanchor\leftedge{%
16284 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16285 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16286 \pgf@x=.5\pgf@x
16287 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
16288 \pgf@y=0pt
16289 }
16290 \anchor{leftedge}{\leftedge}
16291 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16292 \anchor{bin up}{
16293 \inOneFixed
16294 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16295 }
16296 \anchor{bin down}{
16297 \inOneFixed
16298 \pgf@y=-\pgf@y
16299 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16300 }
16301 \anchor{b-}{
16302 \inOne
16303 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16304 }
16305 \anchor{b+}{
16306 \inOne
16307 \pgf@y=-\pgf@y
16308 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16309 }
16310 \anchor{bout}{
16311 \leftedge
16312 \pgf@y=0pt
16313 \pgf@x=-\pgf@x
16314 }
16315 % end border anchors
16316 \savedanchor\up{%
16317 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16318 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16319 \pgf@y=.5\pgf@y
16320 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16321 \pgf@x=.5\pgf@x
16322 \pgf@circ@res@up = \pgf@y
16323 \pgf@circ@res@right = -\pgf@x
16324 \pgf@circ@res@left = \pgf@x
16325 \pgfpointlineattime{
16326 \ctikzvalof{tripoles/plain amp/up pos}}{
16327 \pgfpoint{
16328 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16329 {\pgf@circ@res@up}}
16330 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16331 }
16332 \anchor{up}{
16333 \up
16334 }
16335 \anchor{down}{
16336 \up
16337 \pgf@y=-\pgf@y
16338 }
16339 \anchor{out}{
16340 \northwest
16341 \pgf@y=0pt
16342 \pgf@x=-\pgf@x
16343 }
16344
16345 \anchor{text}{
16346 \ifpgf@circ@center@text
16347 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16348 \else
16349 \leftedge
16350 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16351 \fi
16352 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16353 }
16354
16355 \backgroundpath{
16356 \pgfsetcolor{\ctikzvalof{color}}
16357
16358 \northwest
16359 \pgf@circ@res@up = \pgf@y
16360 \pgf@circ@res@down = -\pgf@y
16361 \pgf@circ@res@right = -\pgf@x
16362 \pgf@circ@res@left = \pgf@x
16363
16364 \pgfscope
16365 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16366 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16367 \pgf@circ@res@step=\pgf@circ@res@right
16368 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16369 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
16370
16371 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16372 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16373 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16374 \pgfpathclose
16375 \pgf@circ@draworfill
16376 \endpgfscope
16377 \pgfpathmoveto{\pgfpoint
16378 {\pgf@circ@res@left}
16379 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
16380 \pgfpathlineto{\pgfpoint
16381 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16382 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
16383
16384
16385 \pgfpathmoveto{\pgfpoint
16386 {\pgf@circ@res@left}
16387 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
16388 \pgfpathlineto{\pgfpoint
16389 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16390 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
16391
16392 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16393 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16394
16395 \pgfusepath{draw}
16396 }
16397 }
16398
16399 % plain amplifier, no symbols, one input
16400 \pgfdeclareshape{plain mono amp}
16401 {
16402 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16403 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16404 \anchor{center}{\pgfpointorigin}
16405 \savedanchor\northwest{%
16406 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16407 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16408 \pgf@y=.5\pgf@y
16409 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16410 \pgf@x=.5\pgf@x
16411 }
16412 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
16413 \anchor{west}{ \northwest \pgf@y=0pt }
16414 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16415 \anchor{north}{ \northwest \pgf@x=0pt }
16416 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16417 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16418 \anchor{north west}{ \northwest }
16419 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16420 \savedanchor\left{%
16421 \pgf@y=0pt
16422 }
16423 \savedanchor\inOne{%
16424 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16425 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16426 \pgf@x=.5\pgf@x
16427 \pgf@y=0pt\relax
16428 }
16429 \anchor{in}{
16430 \inOne
16431 }
16432 % support for border anchors
16433 \savedanchor\leftedge{%
16434 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16435 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16436 \pgf@x=.5\pgf@x
16437 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
16438 \pgf@y=0pt
16439 }
16440 \anchor{leftedge}{\leftedge}
16441 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16442 \anchor{bin}{
16443 \inOne
16444 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16445 }
16446 \anchor{bout}{
16447 \leftedge
16448 \pgf@y=0pt
16449 \pgf@x=-\pgf@x
16450 }
16451 % end border anchors
16452 \savedanchor\up{%
16453 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16454 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16455 \pgf@y=.5\pgf@y
16456 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16457 \pgf@x=.5\pgf@x
16458 \pgf@circ@res@up = \pgf@y
16459 \pgf@circ@res@right = -\pgf@x
16460 \pgf@circ@res@left = \pgf@x
16461 \pgfpointlineattime{
16462 \ctikzvalof{tripoles/plain amp/up pos}}{
16463 \pgfpoint{
16464 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16465 {\pgf@circ@res@up}}
16466 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16467 }
16468 \anchor{up}{
16469 \up
16470 }
16471 \anchor{down}{
16472 \up
16473 \pgf@y=-\pgf@y
16474 }
16475 \anchor{out}{
16476 \northwest
16477 \pgf@y=0pt
16478 \pgf@x=-\pgf@x
16479 }
16480
16481 \anchor{text}{
16482 \ifpgf@circ@center@text
16483 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16484 \else
16485 \leftedge
16486 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16487 \fi
16488 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16489 }
16490 \backgroundpath{
16491 \pgfsetcolor{\ctikzvalof{color}}
16492
16493 \northwest
16494 \pgf@circ@res@up = \pgf@y
16495 \pgf@circ@res@down = -\pgf@y
16496 \pgf@circ@res@right = -\pgf@x
16497 \pgf@circ@res@left = \pgf@x
16498
16499 \pgfscope
16500 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16501 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16502 \pgf@circ@res@step=\pgf@circ@res@right
16503 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16504 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
16505
16506 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16507 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16508 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16509 \pgfpathclose
16510 \pgf@circ@draworfill
16511 \endpgfscope
16512 \pgfpathmoveto{\pgfpoint
16513 {\pgf@circ@res@left}
16514 {0pt}}
16515 \pgfpathlineto{\pgfpoint
16516 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16517 {0pt}}
16518
16519 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16520 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16521
16522 \pgfusepath{draw}
16523 }
16524 }
16525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16526 %% electromechanical device (motor/generator)
16527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16528
16529 \pgfdeclareshape{elmech}
16530 {
16531 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
16532 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16533 \savedanchor\northwest{
16534 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16535 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
16536 \pgf@y=.5\pgf@y
16537 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
16538 \pgf@x=.5\pgf@x
16539 }
16540 \anchor{center}{
16541 \pgfpointorigin
16542 }
16543 \anchor{text}{
16544 \pgfpointorigin
16545 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16546 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
16547 }
16548 \anchor{left}{%
16549 \northwest
16550 \pgf@y=0pt
16551 }
16552 \anchor{right}{%
16553 \northwest
16554 \pgf@y=0pt
16555 \pgf@x=-\pgf@x
16556 }
16557 \anchor{top}{
16558 \northwest
16559 \pgf@x=0pt
16560 }
16561 \anchor{pathstart}{
16562 \northwest
16563 \pgf@x=0pt
16564 }
16565 \anchor{pathend}{
16566 \northwest
16567 \pgf@x=0pt
16568 \pgf@y=-\pgf@y
16569 }
16570 \anchor{bottom}{
16571 \northwest
16572 \pgf@x=0pt
16573 \pgf@y=-\pgf@y
16574 }
16575 \anchor{center}{
16576 \pgf@y=0pt
16577 \pgf@x=0pt
16578 }
16579 \anchor{east}{
16580 \northwest
16581 \pgf@y=0pt
16582 \pgf@x=-\pgf@x
16583 }
16584 \anchor{west}{
16585 \northwest
16586 \pgf@y=0pt
16587 }
16588 \anchor{south}{
16589 \northwest
16590 \pgf@x=0pt
16591 \pgf@y=-\pgf@y
16592 }
16593 \anchor{north}{
16594 \northwest
16595 \pgf@x=0pt
16596 }
16597 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16598 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16599 \anchor{north west}{ \northwest }
16600 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16601 \anchorborder{%
16602 \@tempdima=\pgf@x\@tempdimb=\pgf@y
16603 \northwest\pgf@circ@res@other=-\pgf@x
16604 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
16605 }
16606 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
16607 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
16608 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
16609 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
16610 \anchor{block up right}{
16611 \northwest
16612 % remember that pgf@x is negative
16613 % center of the block is at 0.5*H+W*cos(30)/2
16614 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16615 \pgf@x=-0.5\pgf@x
16616 }
16617 \anchor{block up left}{
16618 \northwest
16619 % remember that pgf@x is negative
16620 % center of the block is at 0.5*H+W*cos(30)/2
16621 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16622 \pgf@x=0.5\pgf@x
16623 }
16624 \anchor{block down right}{
16625 \northwest
16626 % remember that pgf@x is negative
16627 % center of the block is at 0.5*H+W*cos(30)/2
16628 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16629 \pgf@y=-\pgf@y
16630 \pgf@x=-0.5\pgf@x
16631 }
16632 \anchor{block down left}{
16633 \northwest
16634 % remember that pgf@x is negative
16635 % center of the block is at 0.5*H+W*cos(30)/2
16636 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16637 \pgf@y=-\pgf@y
16638 \pgf@x=0.5\pgf@x
16639 }
16640 \behindbackgroundpath{
16641 \pgfsetcolor{\ctikzvalof{color}}
16642 \pgf@circ@scaled@Rlen=\scaledRlen
16643 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
16644 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
16645 \pgfscope
16646 \pgfstartlinewidth=\pgflinewidth
16647 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16648 \pgfscope % clip the bar: whole size minus the circle
16649 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
16650 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16651 \pgfseteorule
16652 \pgfusepath{clip}
16653 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
16654 \pgfsetfillcolor{\ctikzvalof{color}}
16655 \pgfusepath{fill, draw}
16656 \endpgfscope
16657 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16658 \ifx\tikz@fillcolor\pgfutil@empty
16659 % set the default fill color to white
16660 \pgfsetfillcolor{white}
16661 % ...but override it if the class is defined!
16662 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
16663 \else
16664 \pgfsetfillcolor{\tikz@fillcolor}
16665 \pgfusepath{draw, fill}
16666 \fi
16667 \endpgfscope
16668 }
16669 }
16670
16671 %%%%%%%%%%%%%%%%%%%
16672 %% Magnetron
16673 %%%%%%%%%%%%%%%%%%%
16674
16675 \pgfdeclareshape{magnetron}
16676 {
16677 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
16678 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16679 \savedanchor\northwest{
16680 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16681 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16682 \pgf@y=.5\pgf@y
16683 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16684 \pgf@x=.5\pgf@x
16685 }
16686 \anchor{center}{
16687 \pgfpointorigin
16688 }
16689 \anchor{anode}{
16690 \northwest
16691 \pgf@x=0pt
16692 \pgf@y=-\pgf@y
16693 }
16694 \anchor{cathode1}{
16695 \northwest
16696 \pgf@circ@res@step=\pgf@y
16697 \pgfmathparse{cos(105)}
16698 \pgf@x=\pgfmathresult\pgf@circ@res@step
16699 \pgfmathparse{sin(105)}
16700 \pgf@y=\pgfmathresult\pgf@circ@res@step
16701 %\pgfpointorigin
16702 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
16703 }
16704 \anchor{cathode2}{
16705 \northwest
16706 \pgf@circ@res@step=\pgf@y
16707 \pgfmathparse{cos(75)}
16708 \pgf@x=\pgfmathresult\pgf@circ@res@step
16709 \pgfmathparse{sin(75)}
16710 \pgf@y=\pgfmathresult\pgf@circ@res@step
16711 %\pgfpointorigin
16712 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
16713 }
16714 \anchor{text}{
16715 \pgfpointorigin
16716 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16717 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
16718 }
16719 \anchor{left}{%
16720 \northwest
16721 \pgf@y=0pt
16722 }
16723 \anchor{right}{%
16724 \northwest
16725 \pgf@y=0pt
16726 \pgf@x=-\pgf@x
16727 }
16728 \anchor{top}{
16729 \northwest
16730 \pgf@x=0pt
16731 }
16732 \anchor{pathstart}{
16733 \northwest
16734 \pgf@x=0pt
16735 }
16736 \anchor{pathend}{
16737 \northwest
16738 \pgf@x=0pt
16739 \pgf@y=-\pgf@y
16740 }
16741 \anchor{bottom}{
16742 \northwest
16743 \pgf@x=0pt
16744 \pgf@y=-\pgf@y
16745 }
16746 \anchor{center}{
16747 \pgf@y=0pt
16748 \pgf@x=0pt
16749 }
16750 \anchor{east}{
16751 \northwest
16752 \pgf@y=0pt
16753 \pgf@x=-\pgf@x
16754 }
16755 \anchor{west}{
16756 \northwest
16757 \pgf@y=0pt
16758 }
16759 \anchor{south}{
16760 \northwest
16761 \pgf@x=0pt
16762 \pgf@y=-\pgf@y
16763 }
16764 \anchor{north}{
16765 \northwest
16766 \pgf@x=0pt
16767 }
16768 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16769 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16770 \anchor{north west}{ \northwest }
16771 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16772 \backgroundpath{
16773 \pgfsetcolor{\ctikzvalof{color}}
16774 \pgf@circ@scaled@Rlen=\scaledRlen
16775 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16776 \northwest
16777 \pgf@circ@res@up = \pgf@y
16778 \pgf@circ@res@down = -\pgf@y
16779 \pgf@circ@res@right = -\pgf@x
16780 \pgf@circ@res@left = \pgf@x
16781 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
16782
16783 \pgfscope
16784 \pgfstartlinewidth=\pgflinewidth
16785 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16786 %create outer circle
16787 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
16788 \pgf@circ@draworfill
16789 %create chambers
16790 \foreach \angle in {45,135,225,315}{
16791 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
16792 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
16793 }
16794 \pgfsetroundcap
16795 \pgfusepath{draw}
16796 \pgfscope
16797 %draw connection from outside
16798 %anode
16799 \pgfsetlinewidth{\pgfstartlinewidth}
16800 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
16801 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
16802 %cathodes
16803 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
16804 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16805 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
16806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16807 \pgfsetbuttcap
16808 \pgfusepath{draw}
16809 \endpgfscope
16810 %create cathode
16811 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16812 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
16813 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16814 \pgfusepath{draw}
16815 %create anode
16816 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
16817 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
16818
16819 \pgfsetbuttcap
16820 \pgfusepath{draw}
16821 \endpgfscope
16822 }
16823 }
16824
16825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16826 % Electronic tubes, submitted by J. op den Brouw
16827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16828
16829 % Draw tube outline
16830 \def\pgf@circ@tubes@drawtube{%
16831 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
16832 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16833 \pgfutil@tempdima=\pgf@circ@res@right
16834 \advance\pgfutil@tempdima by -\pgf@circ@res@up
16835 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
16836 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
16837 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
16838 \pgfpatharc{270}{90}{\pgf@circ@res@up}
16839 \else
16840 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
16841 \pgfutil@tempdima=\pgf@circ@res@up
16842 \advance\pgfutil@tempdima by -\pgf@circ@res@right
16843 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16844 \pgfpatharc{180}{0}{\pgf@circ@res@right}
16845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
16846 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
16847 \fi
16848 \pgfpathclose
16849 }
16850
16851 %% The diode (tube), triode, tetrode and pentode only differ in the
16852 %% number of grids. So we construct a generic declare function in
16853 %% which we can put code for the grid anchors and grid drawing code
16854 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
16855 \long\def\pgfcircdeclaretube#1#2#3{%
16856 \pgfdeclareshape{#1}{
16857 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
16858 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16859 \anchor{center}{
16860 \pgfpointorigin
16861 }
16862 \savedanchor\northwest{%
16863 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16864 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16865 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16866 % x and y should be half the Rlen
16867 \pgf@y=\pgf@circ@res@up
16868 \pgf@y=.5\pgf@y
16869 \pgf@x=-\pgf@circ@res@right
16870 \pgf@x=.5\pgf@x
16871 }
16872 \anchor{north} {%
16873 \northwest
16874 \pgf@x=0pt
16875 }
16876 \anchor{east}{%
16877 \northwest
16878 \pgf@x=-\pgf@x
16879 \pgf@y=0pt
16880 }
16881 \anchor{south}{%
16882 \northwest
16883 \pgf@y=-\pgf@y
16884 \pgf@x=0pt
16885 }
16886 \anchor{west}{%
16887 \northwest
16888 \pgf@y=0pt
16889 }
16890 \anchor{north west}{%
16891 \northwest
16892 }
16893 \anchor{north east}{%
16894 \northwest
16895 \pgf@x=-\pgf@x
16896 }
16897 \anchor{south east}{
16898 \northwest
16899 \pgf@x=-\pgf@x
16900 \pgf@y=-\pgf@y
16901 }
16902 \anchor{south west}{
16903 \northwest
16904 \pgf@y=-\pgf@y
16905 }
16906 \anchor{anode} {%
16907 \northwest
16908 \pgf@x=0pt
16909 }
16910 \anchor{cathode}{%
16911 \northwest
16912 \pgf@y=-\pgf@y
16913 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
16914 }
16915 \anchor{cathode 1}{%
16916 \northwest
16917 \pgf@y=-\pgf@y
16918 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
16919 }
16920 \anchor{cathode 2}{%
16921 \northwest
16922 \pgf@y=-\pgf@y
16923 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
16924 }
16925 \anchor{filament 1}{%
16926 \northwest
16927 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16928 \pgf@x=\pgfmathresult\pgf@x
16929 \pgf@y=-\pgf@y
16930 }
16931 \anchor{filament 2}{%
16932 \northwest
16933 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16934 \pgf@x=-\pgfmathresult\pgf@x
16935 \pgf@y=-\pgf@y
16936 }
16937
16938 % Extra anchors
16939 #2
16940
16941 \backgroundpath{
16942 \pgfscope
16943 % Line width for tripoles
16944 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16945 \pgf@circ@scaled@Rlen=\scaledRlen
16946
16947 % Setup to draw tube
16948 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16949 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16950 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
16951 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16952
16953 % Tube outline
16954 \pgf@circ@tubes@drawtube
16955
16956 % Setup to draw grid, filament, anode and cathode
16957 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16958 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16959 \pgf@circ@res@up=0.5\pgf@circ@res@up
16960 \pgf@circ@res@right=0.5\pgf@circ@res@right
16961
16962 % Tube fill color (if any)
16963 \pgf@circ@draworfill
16964
16965 % Grid drawing
16966 #3
16967
16968 % Filament (is not drawn by default)
16969 \ifpgf@circuit@tubes@filament
16970 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
16971 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
16972 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16973 \pgf@xa=\pgfmathresult\pgf@circ@res@right
16974 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
16975 \pgf@ya=\pgfmathresult\pgf@circ@res@up
16976 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
16977 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
16978 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
16979 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
16980 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
16981 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
16982 \pgf@circuit@tubes@filamentfalse
16983 \fi
16984
16985 % Anode (or plate)
16986 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
16987 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16988 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16989 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16990
16991 % Cathode
16992 \ifpgf@circuit@tubes@nocathode
16993 \pgf@circuit@tubes@nocathodefalse
16994 \else
16995 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
16996 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
16997 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
16998 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
16999 \ifpgf@circuit@tubes@fullcathode
17000 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
17001 \pgf@circuit@tubes@fullcathodefalse
17002 \else
17003 \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}}
17004 \fi
17005 \fi
17006
17007 % Draw the background
17008 \pgfusepath{draw}
17009 \endpgfscope
17010 }
17011 }
17012 }
17013
17014 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
17015
17016 \pgfcircdeclaretube{triode}
17017 {
17018 \anchor{grid} {% should not be used
17019 \northwest
17020 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
17021 }
17022 \anchor{control} {%
17023 \northwest
17024 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
17025 }
17026 }
17027 {
17028 % Grid protrusion
17029 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
17030 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
17031 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
17032 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
17033 % Grid dashes: calculations
17034 \pgf@xb=2\pgf@circ@res@right
17035 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
17036 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
17037 \multiply\pgf@circ@count@a by 2\relax
17038 \advance\pgf@circ@count@a by 1\relax
17039 \advance\pgf@circ@res@step by -\pgf@xa
17040 \divide\pgf@circ@res@step by \pgf@circ@count@a
17041 % Grid dashes: draw
17042 \pgf@circ@res@temp=\pgf@xa
17043 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
17044 \loop
17045 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
17047 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17048 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
17049 \advance\pgf@circ@count@a by-1
17050 \ifnum\pgf@circ@count@a>0\relax
17051 \repeat
17052 }
17053
17054 \pgfcircdeclaretube{tetrode}
17055 {
17056 \anchor{grid} {% should not be used
17057 \northwest
17058 \pgfutil@tempdima=\pgf@y
17059 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17060 \pgf@y=0.5\pgf@y
17061 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17062 }
17063 \anchor{control} {%
17064 \northwest
17065 \pgfutil@tempdima=\pgf@y
17066 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17067 \pgf@y=0.5\pgf@y
17068 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17069 }
17070 \anchor{screen} {%
17071 \northwest
17072 \pgfutil@tempdima=\pgf@y
17073 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
17074 \pgf@y=0.5\pgf@y
17075 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17076 }
17077 }
17078 {
17079 % Grid x/y points
17080 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
17081 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
17082 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
17083 \pgfutil@tempdimb=-\pgfutil@tempdima
17084 \pgfutil@tempdima=0.5\pgfutil@tempdima
17085 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17086 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
17087 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17088 % Grid protrusion
17089 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
17090 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
17091 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
17092 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
17093 % Grid dashes: calculations
17094 \pgf@xb=2\pgf@circ@res@right
17095 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
17096 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
17097 \multiply\pgf@circ@count@a by 2\relax
17098 \advance\pgf@circ@count@a by 1\relax
17099 \advance\pgf@circ@res@step by -\pgf@xa
17100 \divide\pgf@circ@res@step by \pgf@circ@count@a
17101 % Grid dashes: draw
17102 \pgf@circ@res@temp=\pgf@xa
17103 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
17104 \loop
17105 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17106 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
17107 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
17108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
17109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
17110 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17111 \advance\pgf@circ@count@a by-1
17112 \ifnum\pgf@circ@count@a>0\relax
17113 \repeat
17114 }
17115
17116 \pgfcircdeclaretube{pentode}
17117 {
17118 \anchor{grid} {% should not be used
17119 \northwest
17120 \pgfutil@tempdima=\pgf@y
17121 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17122 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17123 }
17124 \anchor{control} {%
17125 \northwest
17126 \pgfutil@tempdima=\pgf@y
17127 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17128 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17129 }
17130 \anchor{screen} {%
17131 \northwest
17132 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
17133 }
17134 \anchor{suppressor} {%
17135 \northwest
17136 \pgfutil@tempdima=\pgf@y
17137 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
17138 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17139 }
17140 }
17141 {
17142 % Grid x/y points
17143 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
17144 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
17145 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
17146 \pgfutil@tempdimb=-\pgfutil@tempdima
17147 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17148 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17149 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17150 % Grid protrusion
17151 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
17152 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
17153 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
17154 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
17155 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
17156 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
17157 % Grid dashes: calculations
17158 \pgf@xb=2\pgf@circ@res@right
17159 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
17160 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
17161 \multiply\pgf@circ@count@a by 2\relax
17162 \advance\pgf@circ@count@a by 1\relax
17163 \advance\pgf@circ@res@step by -\pgf@xa
17164 \divide\pgf@circ@res@step by \pgf@circ@count@a
17165 % Grid dashes: draw
17166 \pgf@circ@res@temp=\pgf@xa
17167 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
17168 \loop
17169 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17170 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
17171 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
17172 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
17173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
17174 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
17175 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
17176 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17177 \advance\pgf@circ@count@a by-1
17178 \ifnum\pgf@circ@count@a>0\relax
17179 \repeat
17180 }
17181
17182 \pgfcircdeclaretube{pentode suppressor to cathode}
17183 {
17184 \anchor{grid} {% should not be used
17185 \northwest
17186 \pgfutil@tempdima=\pgf@y
17187 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17188 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17189 }
17190 \anchor{control} {%
17191 \northwest
17192 \pgfutil@tempdima=\pgf@y
17193 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
17194 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
17195 }
17196 \anchor{screen} {%
17197 \northwest
17198 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
17199 }
17200 }
17201 {
17202 % Grid x/y points
17203 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
17204 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
17205 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
17206 \pgfutil@tempdimb=-\pgfutil@tempdima
17207 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17208 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17209 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
17210 % Grid protrusion
17211 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
17212 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
17213 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
17214 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
17215 % Grid dashes: calculations
17216 \pgf@xb=2\pgf@circ@res@right
17217 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
17218 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
17219 \multiply\pgf@circ@count@a by 2\relax
17220 \advance\pgf@circ@count@a by 1\relax
17221 \advance\pgf@circ@res@step by -\pgf@xa
17222 \divide\pgf@circ@res@step by \pgf@circ@count@a
17223 % Grid dashes: draw
17224 \pgf@circ@res@temp=\pgf@xa
17225 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
17226 \loop
17227 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17228 \ifnum\pgf@circ@count@a>1\relax
17229 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
17230 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
17231 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
17232 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
17233 \fi
17234 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
17235 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
17236 \advance\pgf@circ@res@temp by\pgf@circ@res@step
17237 \advance\pgf@circ@count@a by-1
17238 \ifnum\pgf@circ@count@a>0\relax
17239 \repeat
17240 % Grid: connection from suppressor to cathode
17241 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
17242 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
17243 \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}}
17244
17245 }
17246
17247 %%%---------- close: tex/pgfcirctripoles
17248 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
17249 %%%---------- open: tex/pgfcircquadpoles.tex
17250 % Copyright 2018-2026 by Romano Giannetti
17251 % Copyright 2015-2026 by Stefan Lindner
17252 % Copyright 2013-2026 by Stefan Erhardt
17253 % Copyright 2007-2026 by Massimo Redaelli
17254 %
17255 % This file may be distributed and/or modified
17256 %
17257 % 1. under the LaTeX Project Public License and/or
17258 % 2. under the GNU Public License.
17259 %
17260 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
17261
17262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17263 %% Quadripoles
17264
17265 \long\def\pgfcircdeclarequadpole#1#2#3{
17266 \pgfdeclareshape{#1}
17267 {
17268 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
17269 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17270 % shapename
17271 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
17272 \anchor{center}{
17273 \northwest
17274 \pgf@x=0pt
17275 \pgf@y=0pt
17276 }
17277 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
17278 \savedanchor\northwest{%
17279 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17280 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
17281 \pgf@y=.5\pgf@y
17282 \pgf@x=.5\pgf@circ@scaled@Rlen
17283 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
17284 }
17285 %% we define the upper right (positive coord) dot (which is B1)
17286 \savedanchor{\innerdot}{%
17287 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17288 \pgf@xa=.5\pgf@circ@scaled@Rlen
17289 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
17290 % by default use the cute inductor size
17291 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
17292 % check if it's american
17293 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
17294 \edef\pgf@temp{american}
17295 \ifx\pgf@circ@temp\pgf@temp
17296 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
17297 \fi
17298 % check if it's european
17299 \edef\pgf@temp{european}
17300 \ifx\pgf@circ@temp\pgf@temp
17301 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
17302 \fi
17303 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
17304 }
17305 \savedanchor{\outerdot}{%
17306 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17307 \pgf@xa=.5\pgf@circ@scaled@Rlen
17308 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
17309 % by default use the cute inductor size
17310 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
17311 % check if it's american
17312 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
17313 \edef\pgf@temp{american}
17314 \ifx\pgf@circ@temp\pgf@temp
17315 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
17316 \fi
17317 % check if it's european
17318 \edef\pgf@temp{european}
17319 \ifx\pgf@circ@temp\pgf@temp
17320 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
17321 \fi
17322 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
17323 }
17324 \anchor{A2}{
17325 \northwest
17326 \pgf@y=-\pgf@y
17327 }
17328 \anchor{B1}{
17329 \northwest
17330 \pgf@x=-\pgf@x
17331 }
17332 \anchor{A1}{
17333 \northwest
17334 }
17335 \anchor{B2}{
17336 \northwest
17337 \pgf@x=-\pgf@x
17338 \pgf@y=-\pgf@y
17339 }
17340 %% dot's anchors
17341 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
17342 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
17343 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17344 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17345 \anchor{inner dot B1}{\innerdot}
17346 \anchor{outer dot B1}{\outerdot}
17347 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
17348 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
17349 % geographical
17350 \anchor{north}{
17351 \northwest
17352 \pgf@x=0pt
17353 }
17354 \anchor{south}{
17355 \northwest
17356 \pgf@x=0pt
17357 \pgf@y=-\pgf@y
17358 }
17359 \anchor{west}{
17360 \northwest
17361 \pgf@y=0pt
17362 }
17363 \anchor{east}{
17364 \northwest
17365 \pgf@y=0pt
17366 \pgf@x=-\pgf@x
17367 }
17368 \anchor{south west}{
17369 \northwest
17370 \pgf@y=-\pgf@y
17371 }
17372 \anchor{north east}{
17373 \northwest
17374 \pgf@x=-\pgf@x
17375 }
17376 \anchor{north west}{
17377 \northwest
17378 }
17379 \anchor{south east}{
17380 \northwest
17381 \pgf@x=-\pgf@x
17382 \pgf@y=-\pgf@y
17383 }
17384 \anchor{base}{
17385 \northwest
17386 \pgf@x=0pt
17387 }
17388 #3
17389 \backgroundpath{
17390 \pgfsetcolor{\ctikzvalof{color}}
17391
17392 \northwest
17393 \pgf@circ@res@up = \pgf@y
17394 \pgf@circ@res@down = -\pgf@y
17395 \pgf@circ@res@right = -\pgf@x
17396 \pgf@circ@res@left = \pgf@x
17397 #2
17398 }
17399 }
17400 }
17401
17402
17403 \def\pgf@circ@drawtransformerbasicanchor{
17404 \ctikzvalof{quadpoles/trans/height}
17405 \anchor{AA2}{
17406 \northwest
17407 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17408 \pgf@x=.7\pgf@x
17409 \pgf@y=-\pgf@y
17410 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17411 }
17412 \anchor{BB1}{
17413 \northwest
17414 \pgf@x=-\pgf@x
17415 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17416 \pgf@x=.7\pgf@x
17417 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17418 }
17419 \anchor{AA1}{
17420 \northwest
17421 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17422 \pgf@x=.7\pgf@x
17423 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17424 }
17425 \anchor{BB2}{
17426 \northwest
17427 \pgf@x=-\pgf@x
17428 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17429 \pgf@x=.7\pgf@x
17430 \pgf@y=-\pgf@y
17431 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17432 }
17433 }
17434
17435 %% Null styles that can be used to change individually the L1 and L2
17436 %% inductors of the transformer.
17437
17438 \ctikzset{transformer L1/.style={}}
17439 \ctikzset{transformer L2/.style={}}
17440
17441 \def\pgf@circ@drawtransformerbasicbody{
17442 \pgfscope
17443 \pgfslopedattimetrue
17444 \pgfallowupsidedownattimetrue
17445 \pgftransformlineattime{.5}{%
17446 \pgfpoint%
17447 {\stretto\pgf@circ@res@left}%
17448 {\pgf@circ@res@up}%
17449 }{%
17450 \pgfpoint
17451 {\stretto\pgf@circ@res@left}%
17452 {\pgf@circ@res@down}%
17453 }
17454
17455 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
17456 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
17457 \def\pgf@temp{european}%
17458 \ifx\pgf@temp\pgf@circ@temp%
17459 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17460 \else%
17461 \def\pgf@temp{cute}
17462 \ifx\pgf@temp\pgf@circ@temp%
17463 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17464 \else%
17465 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17466 \fi%
17467 \fi%
17468
17469
17470 \endpgfscope
17471 \pgfscope
17472 \pgfslopedattimetrue
17473 \pgfallowupsidedownattimetrue
17474 \pgftransformlineattime{.5}{%
17475 \pgfpoint%
17476 {\stretto\pgf@circ@res@right}%
17477 {\pgf@circ@res@down}%
17478 }{%
17479 \pgfpoint
17480 {\stretto\pgf@circ@res@right}%
17481 {\pgf@circ@res@up}%
17482 }
17483
17484 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
17485 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
17486 \def\pgf@temp{european}%
17487 \ifx\pgf@temp\pgf@circ@temp%
17488 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17489 \else%
17490 \def\pgf@temp{cute}
17491 \ifx\pgf@temp\pgf@circ@temp%
17492 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17493 \else%
17494 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17495 \fi%
17496 \fi%
17497
17498 \endpgfscope
17499
17500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
17501 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
17502 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
17503
17504 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
17505 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
17506 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
17507
17508 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17509 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
17510 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
17511
17512 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
17513 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
17514 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17515
17516 \pgfusepath{draw}
17517
17518 }
17519
17520
17521 \pgfcircdeclarequadpole{transformer}{
17522 \pgf@circ@drawtransformerbasicbody
17523 }{\pgf@circ@drawtransformerbasicanchor}
17524
17525 \pgfcircdeclarequadpole{transformer core}{
17526
17527 \pgf@circ@drawtransformerbasicbody
17528
17529 % use the chocke line thickness
17530 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
17531
17532 % Find the distance from center for the lines representing the core
17533 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
17534 % of the whole component, now as a fraction of the distance between coils, to be
17535 % compatible with the quadpoles "inner" style.
17536 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
17537
17538 \pgfmoveto{\pgfpoint%
17539 {\pgf@circ@res@other}%
17540 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
17541 }
17542 \pgflineto{
17543 \pgfpoint%
17544 {\pgf@circ@res@other}%
17545 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
17546 }
17547
17548 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
17549 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
17550 \pgfmoveto{\pgfpoint%
17551 {\pgf@circ@res@other}%
17552 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
17553 }
17554 \pgflineto{
17555 \pgfpoint%
17556 {\pgf@circ@res@other}%
17557 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
17558 }
17559
17560 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
17561 \pgfusepath{draw}
17562 }{\pgf@circ@drawtransformerbasicanchor}
17563
17564
17565 \pgfcircdeclarequadpole{gyrator}{
17566
17567 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
17568 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
17569 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
17570 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
17571
17572 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17573 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
17574 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
17575 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17576
17577 \pgfusepath{draw}
17578
17579 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
17580 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
17581 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
17582 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
17583 \pgfpathclose
17584 \pgf@circ@draworfill
17585
17586 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
17587 \pgfpatharc{90}{270}{\pgf@circ@res@other}
17588 \pgfpathclose
17589 \pgf@circ@draworfill
17590 }{}
17591
17592 %%%%%%%%%%%%%%%%%%%%
17593 %% Block elements
17594 %%%%%%%%%%%%%%%%%%%%
17595
17596 \pgfdeclareshape{mixer}
17597 {
17598 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17599 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17600 \savedanchor\northwest{
17601 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17602 \ifpgf@circuit@boxed
17603 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17604 \pgf@y=.5\pgf@y
17605 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17606 \pgf@x=.5\pgf@x
17607 \else
17608 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17609 \pgf@y=.5\pgf@y
17610 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17611 \pgf@x=.5\pgf@x
17612 \fi
17613 }
17614 \anchor{center}{
17615 \pgfpointorigin
17616 }
17617 \anchor{left}{%
17618 \northwest
17619 \pgf@y=0pt
17620 }
17621 \anchor{right}{
17622 \northwest
17623 \pgf@y=0pt
17624 \pgf@x=-\pgf@x
17625 }
17626 \anchor{1}{
17627 \northwest
17628 \pgf@y=0pt
17629 }
17630 \anchor{2}{
17631 \northwest
17632 \pgf@y=-\pgf@y
17633 \pgf@x=0pt
17634 }
17635 \anchor{3}{
17636 \northwest
17637 \pgf@y=0pt
17638 \pgf@x=-\pgf@x
17639 }
17640 \anchor{4}{
17641 \northwest
17642 \pgf@y=\pgf@y
17643 \pgf@x=0pt
17644 }
17645 \anchor{in 1}{
17646 \northwest
17647 \pgf@y=0pt
17648 }
17649 \anchor{in1}{
17650 \northwest
17651 \pgf@y=0pt
17652 }
17653 \anchor{in}{
17654 \northwest
17655 \pgf@y=0pt
17656 }
17657 \anchor{in 2}{
17658 \northwest
17659 \pgf@y=-\pgf@y
17660 \pgf@x=0pt
17661 }
17662 \anchor{in2}{
17663 \northwest
17664 \pgf@y=-\pgf@y
17665 \pgf@x=0pt
17666 }
17667 \anchor{out}{
17668 \northwest
17669 \pgf@y=0pt
17670 \pgf@x=-\pgf@x
17671 }
17672 \anchor{center}{
17673 \pgf@y=0pt
17674 \pgf@x=0pt
17675 }
17676 \anchor{east}{
17677 \northwest
17678 \pgf@y=0pt
17679 \pgf@x=-\pgf@x
17680 }
17681 \anchor{west}{
17682 \northwest
17683 \pgf@y=0pt
17684 }
17685 \anchor{south}{
17686 \northwest
17687 \pgf@x=0pt
17688 \pgf@y=-\pgf@y
17689 }
17690 \anchor{north}{
17691 \northwest
17692 \pgf@x=0pt
17693 }
17694 \anchor{e}{
17695 \northwest
17696 \pgf@y=0pt
17697 \pgf@x=-\pgf@x
17698 }
17699 \anchor{w}{
17700 \northwest
17701 \pgf@y=0pt
17702 }
17703 \anchor{s}{
17704 \northwest
17705 \pgf@x=0pt
17706 \pgf@y=-\pgf@y
17707 }
17708 \anchor{n}{
17709 \northwest
17710 \pgf@x=0pt
17711 }
17712 \anchor{down}{
17713 \northwest
17714 \pgf@x=0pt
17715 \pgf@y=-\pgf@y
17716 }
17717 \anchor{up}{
17718 \northwest
17719 \pgf@x=0pt
17720 }
17721 \anchor{south west}{
17722 \northwest
17723 \pgf@y=-\pgf@y
17724 }
17725 \anchor{north east}{
17726 \northwest
17727 \pgf@x=-\pgf@x
17728 }
17729 \anchor{north west}{
17730 \northwest
17731 }
17732 \anchor{south east}{
17733 \northwest
17734 \pgf@x=-\pgf@x
17735 \pgf@y=-\pgf@y
17736 }
17737 \anchorborder{
17738 \pgf@circ@res@left=\pgf@x
17739 \pgf@circ@res@up=\pgf@y
17740 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17741 }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}}
17742 }
17743 \backgroundpath{
17744 \pgfsetcolor{\ctikzvalof{color}}
17745 \pgf@circ@scaled@Rlen=\scaledRlen
17746
17747 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17748
17749 \pgfscope
17750 \pgfstartlinewidth=\pgflinewidth
17751
17752 % draw outer box
17753 \ifpgf@circuit@boxed
17754 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17755 \fi
17756
17757 % draw outer circle
17758 \ifpgf@circuit@boxed
17759 \pgf@circ@res@step=.7\pgf@circ@res@step
17760 \pgfsetdash{}{0pt} % draw solid circle if boxed
17761 \else
17762 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17763 \fi
17764 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17765 \pgf@circ@draworfill
17766
17767 % draw inner stuff
17768 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17769 \pgfsetlinewidth{\pgfstartlinewidth}
17770 \pgfpathmoveto{\pgfpointorigin}
17771 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
17772 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
17773 \pgfpathmoveto{\pgfpointorigin}
17774 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
17775 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
17776 \pgfusepath{draw}
17777
17778 \endpgfscope
17779 }
17780 }
17781
17782 \pgfdeclareshape{adder}
17783 {
17784 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17785 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17786 \savedanchor\northwest{
17787 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17788 \ifpgf@circuit@boxed
17789 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17790 \pgf@y=.5\pgf@y
17791 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17792 \pgf@x=.5\pgf@x
17793 \else
17794 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17795 \pgf@y=.5\pgf@y
17796 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17797 \pgf@x=.5\pgf@x
17798 \fi
17799 }
17800 \anchor{center}{
17801 \pgfpointorigin
17802 }
17803 \anchor{left}{%
17804 \northwest
17805 \pgf@y=0pt
17806 }
17807 \anchor{right}{
17808 \northwest
17809 \pgf@y=0pt
17810 \pgf@x=-\pgf@x
17811 }
17812 \anchor{1}{
17813 \northwest
17814 \pgf@y=0pt
17815 }
17816 \anchor{2}{
17817 \northwest
17818 \pgf@y=-\pgf@y
17819 \pgf@x=0pt
17820 }
17821 \anchor{3}{
17822 \northwest
17823 \pgf@y=0pt
17824 \pgf@x=-\pgf@x
17825 }
17826 \anchor{4}{
17827 \northwest
17828 \pgf@y=\pgf@y
17829 \pgf@x=0pt
17830 }
17831 \anchor{in 1}{
17832 \northwest
17833 \pgf@y=0pt
17834 }
17835 \anchor{in1}{
17836 \northwest
17837 \pgf@y=0pt
17838 }
17839 \anchor{in}{
17840 \northwest
17841 \pgf@y=0pt
17842 }
17843 \anchor{in 2}{
17844 \northwest
17845 \pgf@y=-\pgf@y
17846 \pgf@x=0pt
17847 }
17848 \anchor{in2}{
17849 \northwest
17850 \pgf@y=-\pgf@y
17851 \pgf@x=0pt
17852 }
17853 \anchor{out}{
17854 \northwest
17855 \pgf@y=0pt
17856 \pgf@x=-\pgf@x
17857 }
17858 \anchor{center}{
17859 \pgf@y=0pt
17860 \pgf@x=0pt
17861 }
17862 \anchor{east}{
17863 \northwest
17864 \pgf@y=0pt
17865 \pgf@x=-\pgf@x
17866 }
17867 \anchor{west}{
17868 \northwest
17869 \pgf@y=0pt
17870 }
17871 \anchor{south}{
17872 \northwest
17873 \pgf@x=0pt
17874 \pgf@y=-\pgf@y
17875 }
17876 \anchor{north}{
17877 \northwest
17878 \pgf@x=0pt
17879 }
17880 \anchor{e}{
17881 \northwest
17882 \pgf@y=0pt
17883 \pgf@x=-\pgf@x
17884 }
17885 \anchor{w}{
17886 \northwest
17887 \pgf@y=0pt
17888 }
17889 \anchor{s}{
17890 \northwest
17891 \pgf@x=0pt
17892 \pgf@y=-\pgf@y
17893 }
17894 \anchor{n}{
17895 \northwest
17896 \pgf@x=0pt
17897 }
17898 \anchor{down}{
17899 \northwest
17900 \pgf@x=0pt
17901 \pgf@y=-\pgf@y
17902 }
17903 \anchor{up}{
17904 \northwest
17905 \pgf@x=0pt
17906 }
17907 \anchor{south west}{
17908 \northwest
17909 \pgf@y=-\pgf@y
17910 }
17911 \anchor{north east}{
17912 \northwest
17913 \pgf@x=-\pgf@x
17914 }
17915 \anchor{north west}{
17916 \northwest
17917 }
17918 \anchor{south east}{
17919 \northwest
17920 \pgf@x=-\pgf@x
17921 \pgf@y=-\pgf@y
17922 }
17923 \anchorborder{
17924 \pgf@circ@res@left=\pgf@x
17925 \pgf@circ@res@up=\pgf@y
17926 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17927 }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}}
17928 }
17929 \backgroundpath{
17930 \pgfsetcolor{\ctikzvalof{color}}
17931 \pgf@circ@scaled@Rlen=\scaledRlen
17932
17933 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17934
17935 \pgfscope
17936 \pgfstartlinewidth=\pgflinewidth
17937
17938 % draw outer box
17939 \ifpgf@circuit@boxed
17940 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17941 \fi
17942
17943 % draw outer circle
17944 \ifpgf@circuit@boxed
17945 \pgf@circ@res@step=.7\pgf@circ@res@step{}
17946 \pgfsetdash{}{0pt} % draw solid circle if boxed
17947 \else
17948 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17949 \fi
17950 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17951 \pgf@circ@draworfill
17952
17953 % draw inner stuff
17954 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17955 \pgfsetlinewidth{\pgfstartlinewidth}
17956
17957 \pgfpathmoveto{\pgfpointorigin}
17958 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
17959 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
17960 \pgfpathmoveto{\pgfpointorigin}
17961 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
17962 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
17963 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17964 \pgfusepath{draw}
17965
17966 \endpgfscope
17967 }
17968 }
17969
17970 \pgfdeclareshape{oscillator}
17971 {
17972 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17973 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17974 \savedanchor\northwest{
17975 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17976 \ifpgf@circuit@boxed
17977 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17978 \pgf@y=.5\pgf@y
17979 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17980 \else
17981 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
17982 \pgf@y=.5\pgf@y
17983 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
17984 \fi
17985 }
17986 \anchor{center}{
17987 \pgfpointorigin
17988 }
17989 \anchor{north}{
17990 \northwest
17991 \pgf@x=.5\pgf@x
17992 }
17993 \anchor{south}{
17994 \northwest
17995 \pgf@x=.5\pgf@x
17996 \pgf@y=-\pgf@y
17997 }
17998 \anchor{east}{
17999 \northwest
18000 \pgf@y=0pt
18001 \pgf@x=0pt
18002 }
18003 \anchor{west}{
18004 \northwest
18005 \pgf@y=0pt
18006 }
18007 \anchor{up}{
18008 \northwest
18009 \pgf@x=.5\pgf@x
18010 }
18011 \anchor{down}{
18012 \northwest
18013 \pgf@x=.5\pgf@x
18014 \pgf@y=-\pgf@y
18015 }
18016 \anchor{n}{
18017 \northwest
18018 \pgf@x=.5\pgf@x
18019 }
18020 \anchor{s}{
18021 \northwest
18022 \pgf@x=.5\pgf@x
18023 \pgf@y=-\pgf@y
18024 }
18025 \anchor{e}{
18026 \northwest
18027 \pgf@y=0pt
18028 \pgf@x=0pt
18029 }
18030 \anchor{w}{
18031 \northwest
18032 \pgf@y=0pt
18033 }
18034 \anchor{up}{
18035 \northwest
18036 \pgf@x=.5\pgf@x
18037 }
18038 \anchor{down}{
18039 \northwest
18040 \pgf@x=.5\pgf@x
18041 \pgf@y=-\pgf@y
18042 }
18043 \anchor{right}{
18044 \northwest
18045 \pgf@y=0pt
18046 \pgf@x=0pt
18047 }
18048 \anchor{left}{
18049 \northwest
18050 \pgf@y=0pt
18051 }
18052 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
18053 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
18054 \anchor{north west}{ \northwest }
18055 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
18056 \anchor{text}{
18057 \pgf@x=-2\pgf@x
18058 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
18059 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
18060 }
18061 \anchorborder{
18062 \pgf@circ@res@left=\pgf@x
18063 \pgf@circ@res@up=\pgf@y
18064 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
18065 }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}}
18066 \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}
18067 }
18068 \backgroundpath{
18069 \pgfsetcolor{\ctikzvalof{color}}
18070 \pgf@circ@scaled@Rlen=\scaledRlen
18071
18072 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
18073
18074 \pgfscope
18075 \pgfstartlinewidth=\pgflinewidth
18076
18077 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
18078
18079 % draw outer box
18080 \ifpgf@circuit@boxed{}
18081 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
18082 \fi
18083
18084 % draw outer circle
18085 \ifpgf@circuit@boxed
18086 \pgf@circ@res@step=.7\pgf@circ@res@step{}
18087 \pgfsetdash{}{0pt} % draw solid circle if boxed
18088 \else
18089 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18090 \fi
18091 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
18092 \pgf@circ@draworfill
18093
18094 % draw inner sine waves
18095 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18096 \pgfsetlinewidth{\pgfstartlinewidth}
18097 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
18098 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
18099 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
18100 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
18101 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
18102 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
18103
18104 \pgfusepath{draw}
18105
18106 \endpgfscope
18107 }
18108 }
18109
18110 \pgfdeclareshape{circulator}
18111 {
18112 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18113 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18114 \savedanchor\northwest{
18115 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18116 \ifpgf@circuit@boxed
18117 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
18118 \pgf@y=.5\pgf@y
18119 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
18120 \pgf@x=.5\pgf@x
18121 \else
18122 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
18123 \pgf@y=.5\pgf@y
18124 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
18125 \pgf@x=.5\pgf@x
18126 \fi
18127 }
18128 \anchor{center}{
18129 \pgfpointorigin
18130 }
18131 \anchor{left}{%
18132 \northwest
18133 \pgf@y=0pt
18134 }
18135 \anchor{right}{
18136 \northwest
18137 \pgf@y=0pt
18138 \pgf@x=-\pgf@x
18139 }
18140 \anchor{1}{
18141 \northwest
18142 \pgf@y=0pt
18143 }
18144 \anchor{2}{
18145 \northwest
18146 \pgf@y=0pt
18147 \pgf@x=-\pgf@x
18148 }
18149 \anchor{3}{
18150 \northwest
18151 \pgf@y=-\pgf@y
18152 \pgf@x=0pt
18153 }
18154 \anchor{east}{
18155 \northwest
18156 \pgf@y=0pt
18157 \pgf@x=-\pgf@x
18158 }
18159 \anchor{west}{
18160 \northwest
18161 \pgf@y=0pt
18162 }
18163 \anchor{south}{
18164 \northwest
18165 \pgf@x=0pt
18166 \pgf@y=-\pgf@y
18167 }
18168 \anchor{north}{
18169 \northwest
18170 \pgf@x=0pt
18171 }
18172 \anchor{e}{
18173 \northwest
18174 \pgf@y=0pt
18175 \pgf@x=-\pgf@x
18176 }
18177 \anchor{w}{
18178 \northwest
18179 \pgf@y=0pt
18180 }
18181 \anchor{s}{
18182 \northwest
18183 \pgf@x=0pt
18184 \pgf@y=-\pgf@y
18185 }
18186 \anchor{n}{
18187 \northwest
18188 \pgf@x=0pt
18189 }
18190 \anchor{down}{
18191 \northwest
18192 \pgf@x=0pt
18193 \pgf@y=-\pgf@y
18194 }
18195 \anchor{up}{
18196 \northwest
18197 \pgf@x=0pt
18198 }
18199 \anchor{south west}{
18200 \northwest
18201 \pgf@y=-\pgf@y
18202 }
18203 \anchor{north east}{
18204 \northwest
18205 \pgf@x=-\pgf@x
18206 }
18207 \anchor{north west}{
18208 \northwest
18209 }
18210 \anchor{south east}{
18211 \northwest
18212 \pgf@x=-\pgf@x
18213 \pgf@y=-\pgf@y
18214 }
18215 \anchorborder{
18216 \pgf@circ@res@left=\pgf@x
18217 \pgf@circ@res@up=\pgf@y
18218 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
18219 }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}}
18220 }
18221 \backgroundpath{
18222 \pgfsetcolor{\ctikzvalof{color}}
18223 \pgf@circ@scaled@Rlen=\scaledRlen
18224
18225 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
18226
18227 \pgfscope
18228 \pgfstartlinewidth=\pgflinewidth
18229
18230 % draw outer box
18231 \ifpgf@circuit@boxed
18232 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
18233 \fi
18234
18235 % draw outer circle
18236 \ifpgf@circuit@boxed{}
18237 \pgf@circ@res@step=.7\pgf@circ@res@step{}
18238 \pgfsetdash{}{0pt} % draw solid circle if boxed
18239 \else
18240 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18241 \fi
18242 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
18243 \pgf@circ@draworfill
18244
18245 % inner arrow
18246 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18247 \pgfsetlinewidth{\pgfstartlinewidth}
18248
18249 \pgfsetarrowsend{latex}
18250 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
18251 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
18252 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
18253 \pgfusepath{draw}
18254
18255 \endpgfscope
18256 }
18257 }
18258
18259 %% gridnode
18260 \pgfdeclareshape{gridnode}
18261 {
18262 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18263 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18264 \savedanchor\northwest{
18265 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18266 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18267 \pgf@y=.5\pgf@y
18268 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18269 \pgf@x=.5\pgf@x
18270 }
18271 \anchor{center}{
18272 \pgfpointorigin
18273 }
18274
18275 \anchor{north}{
18276 \northwest
18277 \pgf@x=0pt
18278 }
18279 \anchor{up}{
18280 \northwest
18281 \pgf@x=0pt
18282 }
18283 \anchor{south}{
18284 \northwest
18285 \pgf@x=0pt
18286 \pgf@y=-\pgf@y
18287 }
18288 \anchor{down}{
18289 \northwest
18290 \pgf@x=0pt
18291 \pgf@y=-\pgf@y
18292 }
18293 \anchor{east}{
18294 \northwest
18295 \pgf@y=0pt
18296 \pgf@x=-\pgf@x
18297 }
18298 \anchor{right}{
18299 \northwest
18300 \pgf@y=0pt
18301 \pgf@x=-\pgf@x
18302 }
18303 \anchor{west}{
18304 \northwest
18305 \pgf@y=0pt
18306 }
18307 \anchor{left}{
18308 \northwest
18309 \pgf@y=0pt
18310 }
18311 \anchor{south west}{
18312 \northwest
18313 \pgf@y=-\pgf@y
18314 }
18315 \anchor{north east}{
18316 \northwest
18317 \pgf@x=-\pgf@x
18318 \relax
18319 }
18320 \anchor{north west}{
18321 \northwest
18322 }
18323 \anchor{south east}{
18324 \northwest
18325 \pgf@x=-\pgf@x
18326 \pgf@y=-\pgf@y
18327 }
18328 \anchor{text}{
18329 \pgf@x=-2\pgf@x
18330 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
18331 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
18332 }
18333 \backgroundpath{
18334 \pgfsetcolor{\ctikzvalof{color}}
18335 \pgf@circ@scaled@Rlen=\scaledRlen
18336
18337 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18338
18339 \northwest
18340 \pgf@circ@res@up = \pgf@y
18341 \pgf@circ@res@down = -\pgf@y
18342 \pgf@circ@res@right = -\pgf@x
18343 \pgf@circ@res@left = \pgf@x
18344
18345 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18346 \divide \pgf@circ@res@step by 2
18347
18348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
18349 \pgf@circ@res@other = \pgf@circ@res@left
18350 \advance\pgf@circ@res@other by \pgf@circ@res@step
18351
18352 \ifpgf@circuit@dashed
18353 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
18354 \fi
18355
18356 % draw outer box
18357 \pgf@circ@twoportbox
18358
18359
18360 \ifpgf@circuit@inputarrow
18361 {
18362 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
18363 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
18364 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
18365 }
18366 \fi
18367
18368 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18369 \pgfsetarrows{-} %never draw arrows
18370 \pgfsetlinewidth{0.05mm}
18371
18372 % draw grid
18373 \foreach \line in {-1,-.5,...,1}
18374 {
18375 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
18376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
18377
18378 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
18379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
18380 }
18381
18382 %prevent from draw the inner cross twice
18383 \foreach \line in {-.5,0,...,.5}
18384 {
18385 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
18386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
18387
18388 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
18389 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
18390 }
18391 \pgfusepath{draw}
18392 }
18393 }
18394
18395
18396 % Wilkinson divider
18397 \pgfdeclareshape{wilkinson}{
18398 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18399 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18400 \savedanchor\northwest{%
18401 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18402 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
18403 \pgf@y=.5\pgf@y
18404 \pgf@x= \pgf@circ@scaled@Rlen
18405 \pgf@x=.5\pgf@x
18406 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
18407 }
18408 \anchor{center}{
18409 \northwest
18410 \pgf@x=0pt
18411 \pgf@y=0pt
18412 }
18413 \anchor{north}{
18414 \northwest
18415 \pgf@x=0pt
18416 }
18417 \anchor{south}{
18418 \northwest
18419 \pgf@x=0pt
18420 \pgf@y=-\pgf@y
18421 }
18422 \anchor{west}{
18423 \northwest
18424 \pgf@y=0pt
18425 }
18426 \anchor{east}{
18427 \northwest
18428 \pgf@y=0pt
18429 \pgf@x=-\pgf@x
18430 }
18431 \anchor{south west}{
18432 \northwest
18433 \pgf@y=-\pgf@y
18434 }
18435 \anchor{north east}{
18436 \northwest
18437 \pgf@x=-\pgf@x
18438 }
18439 \anchor{north west}{
18440 \northwest
18441 }
18442 \anchor{south east}{
18443 \northwest
18444 \pgf@x=-\pgf@x
18445 \pgf@y=-\pgf@y
18446 }
18447 \anchor{in}{
18448 \northwest
18449 \pgf@y=0pt
18450 }
18451 \anchor{out1}{
18452 \northwest
18453 \pgf@x=-\pgf@x
18454 \pgf@y=-0.5\pgf@y
18455 }
18456 \anchor{out2}{
18457 \northwest
18458 \pgf@x=-\pgf@x
18459 \pgf@y=0.5\pgf@y
18460 }
18461 \anchor{text}{
18462 \northwest
18463 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18464 \pgf@x=-.5\wd\pgfnodeparttextbox
18465 }
18466 \backgroundpath{
18467 \pgfsetcolor{\ctikzvalof{color}}
18468 \pgf@circ@scaled@Rlen=\scaledRlen
18469
18470 \northwest
18471 \pgf@circ@res@up = \pgf@y
18472 \pgf@circ@res@down = -\pgf@y
18473 \pgf@circ@res@right = -\pgf@x
18474 \pgf@circ@res@left = \pgf@x
18475
18476 \pgfstartlinewidth=\pgflinewidth
18477
18478 % draw outer box
18479 \pgf@circ@twoportbox
18480
18481 % draw inner stuff
18482 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18483 \pgfsetarrows{-} %never draw arrows
18484 \pgfsetlinewidth{\pgfstartlinewidth}
18485 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
18486 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18487 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18488 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18489 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18490 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18492
18493 \pgfusepath{draw}
18494
18495 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18496 % draw inner resisitor - european or american style is recognised
18497 {
18498 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
18499 \pgftransformrotate{90}
18500
18501 % calculate size of resistor
18502 \ifpgf@circuit@europeanresistor
18503 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
18504 \pgftransformscale{\pgfmathresult}
18505 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18506 \else
18507 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
18508 \pgftransformscale{\pgfmathresult}
18509 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18510 \fi
18511 }
18512
18513 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18514 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
18515
18516 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
18517 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18518 \pgfusepath{draw}
18519
18520 }
18521 }
18522
18523 %% resistive splitter
18524 \pgfdeclareshape{splitter}{
18525 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18526 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18527 \savedanchor\northwest{%
18528 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18529 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
18530 \pgf@y=.5\pgf@y
18531 \pgf@x= \pgf@circ@scaled@Rlen
18532 \pgf@x=.5\pgf@x
18533 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
18534 }
18535 \anchor{center}{
18536 \northwest
18537 \pgf@x=0pt
18538 \pgf@y=0pt
18539 }
18540 \anchor{north}{
18541 \northwest
18542 \pgf@x=0pt
18543 }
18544 \anchor{south}{
18545 \northwest
18546 \pgf@x=0pt
18547 \pgf@y=-\pgf@y
18548 }
18549 \anchor{west}{
18550 \northwest
18551 \pgf@y=0pt
18552 }
18553 \anchor{east}{
18554 \northwest
18555 \pgf@y=0pt
18556 \pgf@x=-\pgf@x
18557 }
18558 \anchor{south west}{
18559 \northwest
18560 \pgf@y=-\pgf@y
18561 }
18562 \anchor{north east}{
18563 \northwest
18564 \pgf@x=-\pgf@x
18565 }
18566 \anchor{north west}{
18567 \northwest
18568 }
18569 \anchor{south east}{
18570 \northwest
18571 \pgf@x=-\pgf@x
18572 \pgf@y=-\pgf@y
18573 }
18574 \anchor{in}{
18575 \northwest
18576 \pgf@y=0pt
18577 }
18578 \anchor{out1}{
18579 \northwest
18580 \pgf@x=-\pgf@x
18581 \pgf@y=-0.5\pgf@y
18582 }
18583 \anchor{out2}{
18584 \northwest
18585 \pgf@x=-\pgf@x
18586 \pgf@y=0.5\pgf@y
18587 }
18588 \anchor{text}{
18589 \northwest
18590 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18591 \pgf@x=-.5\wd\pgfnodeparttextbox
18592 }
18593 \backgroundpath{
18594 \pgfsetcolor{\ctikzvalof{color}}
18595 \pgf@circ@scaled@Rlen=\scaledRlen
18596
18597 \northwest
18598 \pgf@circ@res@up = \pgf@y
18599 \pgf@circ@res@down = -\pgf@y
18600 \pgf@circ@res@right = -\pgf@x
18601 \pgf@circ@res@left = \pgf@x
18602
18603 \pgfstartlinewidth=\pgflinewidth
18604
18605 % draw outer box
18606 \pgf@circ@twoportbox
18607
18608 % draw inner stuff
18609 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18610 \pgfsetarrows{-} %never draw arrows
18611 \pgfsetlinewidth{\pgfstartlinewidth}
18612 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
18613 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18614 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18615 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18616 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18617 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18618 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18619
18620 \pgfusepath{draw}
18621
18622 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18623 % draw inner resisitors - european or american style is recognised
18624 \foreach \respt/\resang/\linepta/\lineptb in %
18625 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
18626 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},%
18627 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
18628 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
18629 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
18630 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
18631 {
18632 {
18633 \pgftransformshift{\respt}
18634 \pgftransformrotate{\resang}
18635
18636 % calculate size of resistor
18637 \ifpgf@circuit@europeanresistor
18638 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
18639 \pgftransformscale{\pgfmathresult}
18640 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18641 \else
18642 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
18643 \pgftransformscale{\pgfmathresult}
18644 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18645 \fi
18646 }
18647
18648 \pgfpathmoveto{\linepta}
18649 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
18650
18651 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
18652 \pgfpathlineto{\lineptb}
18653 \pgfusepath{draw}
18654 }
18655 }
18656 }
18657
18658 %% couplers generics
18659 \long\def\pgfcircdeclarefourport#1#2{
18660
18661 \pgfdeclareshape{#1}{
18662 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18663 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18664 \anchor{center}{
18665 \northwest
18666 \pgf@x=0pt
18667 \pgf@y=0pt
18668 }
18669 \savedanchor\northwest{%
18670 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18671 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
18672 \pgf@y=.5\pgf@y
18673 \pgf@x=.5\pgf@circ@scaled@Rlen
18674 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
18675 }
18676 \anchor{north}{
18677 \northwest
18678 \pgf@x=0pt
18679 }
18680 \anchor{south}{
18681 \northwest
18682 \pgf@x=0pt
18683 \pgf@y=-\pgf@y
18684 }
18685 \anchor{west}{
18686 \northwest
18687 \pgf@y=0pt
18688 }
18689 \anchor{east}{
18690 \northwest
18691 \pgf@y=0pt
18692 \pgf@x=-\pgf@x
18693 }
18694 \anchor{south west}{
18695 \northwest
18696 \pgf@y=-\pgf@y
18697 }
18698 \anchor{north east}{
18699 \northwest
18700 \pgf@x=-\pgf@x
18701 }
18702 \anchor{north west}{
18703 \northwest
18704 }
18705 \anchor{south east}{
18706 \northwest
18707 \pgf@x=-\pgf@x
18708 \pgf@y=-\pgf@y
18709 }
18710 \anchor{port1}{
18711 \northwest
18712 \pgf@y=-0.5\pgf@y
18713 }
18714 \anchor{port2}{
18715 \northwest
18716 \pgf@x=-\pgf@x
18717 \pgf@y=-0.5\pgf@y
18718 }
18719 \anchor{port3}{
18720 \northwest
18721 \pgf@x=-\pgf@x
18722 \pgf@y=0.5\pgf@y
18723 }
18724 \anchor{port4}{
18725 \northwest
18726 \pgf@y=0.5\pgf@y
18727 }
18728 \anchor{left down}{
18729 \northwest
18730 \pgf@y=-0.5\pgf@y
18731 }
18732 \anchor{right down}{
18733 \northwest
18734 \pgf@x=-\pgf@x
18735 \pgf@y=-0.5\pgf@y
18736 }
18737 \anchor{right up}{
18738 \northwest
18739 \pgf@x=-\pgf@x
18740 \pgf@y=0.5\pgf@y
18741 }
18742 \anchor{left up}{
18743 \northwest
18744 \pgf@y=0.5\pgf@y
18745 }
18746 \anchor{1}{
18747 \northwest
18748 \pgf@y=-0.5\pgf@y
18749 }
18750 \anchor{2}{
18751 \northwest
18752 \pgf@x=-\pgf@x
18753 \pgf@y=-0.5\pgf@y
18754 }
18755 \anchor{3}{
18756 \northwest
18757 \pgf@x=-\pgf@x
18758 \pgf@y=0.5\pgf@y
18759 }
18760 \anchor{4}{
18761 \northwest
18762 \pgf@y=0.5\pgf@y
18763 }
18764
18765 \anchor{text}{
18766 \northwest
18767 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18768 \pgf@x=-.5\wd\pgfnodeparttextbox
18769 }
18770 \backgroundpath{
18771 \pgfsetcolor{\ctikzvalof{color}}
18772
18773 \northwest
18774 \pgf@circ@res@up = \pgf@y
18775 \pgf@circ@res@down = -\pgf@y
18776 \pgf@circ@res@right = -\pgf@x
18777 \pgf@circ@res@left = \pgf@x
18778 \pgf@circ@scaled@Rlen=\scaledRlen
18779
18780 \pgfstartlinewidth=\pgflinewidth
18781
18782 % draw outer box
18783 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18784 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18785 \pgf@circ@draworfill
18786
18787 % draw inner stuff
18788 #2
18789
18790 % draw inner text
18791 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
18792 }
18793 }
18794 }
18795
18796 % four-port
18797 \pgfcircdeclarefourport{fourport}{}
18798
18799 % straight coupler
18800 \pgfcircdeclarefourport{coupler}{
18801 \pgfsetlinewidth{\pgfstartlinewidth}
18802 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
18803 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
18805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18806 \pgfusepath{draw}
18807
18808 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
18809 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
18810 \pgfsetarrows{latex-latex}
18811 \pgfusepath{draw}
18812 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
18813 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
18814 \pgfsetarrows{latex-latex}
18815 \pgfusepath{draw}
18816 }
18817
18818 % "bended" coupler
18819 \pgfcircdeclarefourport{coupler2}{
18820 \pgfsetlinewidth{\pgfstartlinewidth}
18821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
18822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
18824 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18825 \pgfusepath{draw}
18826
18827 \pgfscope
18828 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
18829 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
18830 \pgfsetarrowsend{latex}
18831 \pgfusepath{draw}
18832 \endpgfscope
18833 \pgfscope
18834 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
18835 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
18836 \pgfsetarrowsend{latex}
18837 \pgfusepath{draw}
18838 \endpgfscope
18839 \pgfscope
18840 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
18841 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
18842 \pgfsetarrowsend{latex}
18843 \pgfusepath{draw}
18844 \endpgfscope
18845 \pgfscope
18846 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
18847 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
18848 \pgfsetarrowsend{latex}
18849 \pgfusepath{draw}
18850 \endpgfscope
18851 }
18852
18853 % mach zehnder modulator
18854 \pgfdeclareshape{mzm}{
18855 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18856 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18857 \savedanchor\northwest{%
18858 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18859 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
18860 \pgf@y=.5\pgf@y
18861 \pgf@x= \pgf@circ@scaled@Rlen
18862 \pgf@x=.5\pgf@x
18863 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
18864 }
18865 \anchor{center}{
18866 \northwest
18867 \pgf@x=0pt
18868 \pgf@y=0pt
18869 }
18870 \anchor{north}{
18871 \northwest
18872 \pgf@x=0pt
18873 }
18874 \anchor{south}{
18875 \northwest
18876 \pgf@x=0pt
18877 \pgf@y=-\pgf@y
18878 }
18879 \anchor{west}{
18880 \northwest
18881 \pgf@y=0pt
18882 }
18883 \anchor{east}{
18884 \northwest
18885 \pgf@y=0pt
18886 \pgf@x=-\pgf@x
18887 }
18888 \anchor{south west}{
18889 \northwest
18890 \pgf@y=-\pgf@y
18891 }
18892 \anchor{north east}{
18893 \northwest
18894 \pgf@x=-\pgf@x
18895 }
18896 \anchor{north west}{
18897 \northwest
18898 }
18899 \anchor{south east}{
18900 \northwest
18901 \pgf@x=-\pgf@x
18902 \pgf@y=-\pgf@y
18903 }
18904 \anchor{in}{
18905 \northwest
18906 \pgf@y=0pt
18907 }
18908 \anchor{mod}{
18909 \northwest
18910 \pgf@x=0pt
18911 }
18912 \anchor{out}{
18913 \northwest
18914 \pgf@x=-\pgf@x
18915 \pgf@y=0pt
18916 }
18917 \anchor{text}{
18918 \northwest
18919 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18920 \pgf@x=-.5\wd\pgfnodeparttextbox
18921 }
18922 \backgroundpath{
18923 \pgfsetcolor{\ctikzvalof{color}}
18924 \pgf@circ@scaled@Rlen=\scaledRlen
18925
18926 \northwest
18927 \pgf@circ@res@up = \pgf@y
18928 \pgf@circ@res@down = -\pgf@y
18929 \pgf@circ@res@right = -\pgf@x
18930 \pgf@circ@res@left = \pgf@x
18931
18932 \pgfstartlinewidth=\pgflinewidth
18933
18934 % draw outer box
18935 \pgf@circ@twoportbox
18936
18937 % draw inner stuff
18938 % rotate inner symbol
18939 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
18940 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
18941 \pgftransformrotate{270}
18942 \fi\fi
18943 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
18944 \pgftransformrotate{180}
18945 \fi\fi
18946 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
18947 \pgftransformrotate{90}
18948 \fi\fi
18949
18950 % draw inner symbol
18951 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18952 \pgfsetarrows{-} %never draw arrows
18953 \pgfsetlinewidth{\pgfstartlinewidth}
18954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
18955 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18956 \pgfusepath{draw}
18957
18958 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18959 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
18960 \pgfusepath{draw}
18961
18962 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18963 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
18964 \pgfusepath{draw}
18965
18966 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
18967 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18968 \pgfusepath{draw}
18969
18970 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18971 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
18972 \pgfusepath{draw}
18973
18974 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18975 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
18976 \pgfusepath{draw}
18977
18978 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
18979 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
18980 \pgfusepath{draw}
18981
18982 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
18983 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
18984 \pgfusepath{draw}
18985
18986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
18987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
18988 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
18989 \pgfusepath{draw}
18990
18991 }
18992 }
18993 %%%---------- close: tex/pgfcircquadpoles
18994 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
18995 %%%---------- open: tex/pgfcircmultipoles.tex
18996 % Copyright 2018-2026 by Romano Giannetti
18997 % Copyright 2015-2026 by Stefan Lindner
18998 % Copyright 2013-2026 by Stefan Erhardt
18999 % Copyright 2007-2026 by Massimo Redaelli
19000 %
19001 % This file may be distributed and/or modified
19002 %
19003 % 1. under the LaTeX Project Public License and/or
19004 % 2. under the GNU Public License.
19005 %
19006 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
19007
19008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19009 %% Multipoles by Romano Giannetti
19010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19011
19012 %%%%%%%%%
19013 %% Chips
19014 %%%%%%%%%
19015
19016 % let's use the same shifts everywhere, no magic numbers
19017 \def\pgf@circ@dip@pin@shift{0.5}
19018 \def\pgf@circ@qfp@pin@shift{0.25}
19019
19020 % derived from https://tex.stackexchange.com/a/146753/38080
19021 % original author Mark Wibrow
19022 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
19023 % a lot of thanks to @marmot for the un-rotation hint
19024 % https://tex.stackexchange.com/a/473571/38080
19025
19026 % DIP (dual in line package) chips
19027
19028 \pgfdeclareshape{dipchip}{
19029 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
19030 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19031 \savedmacro\numpins{%
19032 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
19033 \def\numpins{\the\pgf@circ@count@a}
19034 }
19035 \savedanchor\centerpoint{%
19036 \pgf@x=-.5\wd\pgfnodeparttextbox%
19037 \pgf@y=-.5\ht\pgfnodeparttextbox%
19038 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
19039 }%
19040 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
19041 \anchor{center}{\origin}
19042 \anchor{text}{\centerpoint}% to adjust text
19043 \saveddimen\height{%
19044 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19045 \pgfmathsetlength\pgf@x{((\numpins)
19046 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19047 }%
19048 \saveddimen{\chipspacing}{
19049 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19050 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
19051 \saveddimen{\width}{
19052 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19053 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
19054 \saveddimen{\extshift}{
19055 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19056 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
19057 % standard anchors
19058 \savedanchor\northwest{%
19059 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19060 \pgfmathsetlength\pgf@y{0.5*((\numpins)
19061 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19062 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
19063 }
19064 \anchor{dot}{\northwest
19065 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
19066 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
19067 }
19068 \anchor{nw}{\northwest}
19069 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
19070 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19071 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
19072 \anchor{north west}{\northwest}
19073 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
19074 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
19075 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
19076 \anchor{n}{\northwest\pgf@x=0pt }
19077 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19078 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19079 \anchor{w}{\northwest\pgf@y=0pt }
19080 \anchor{north}{\northwest\pgf@x=0pt }
19081 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19082 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19083 \anchor{west}{\northwest\pgf@y=0pt }
19084 % start drawing
19085 \backgroundpath{%
19086 \northwest
19087 \pgf@circ@res@up = \pgf@y
19088 \pgf@circ@res@down = -\pgf@y
19089 \pgf@circ@res@right = -\pgf@x
19090 \pgf@circ@res@left = \pgf@x
19091 \pgf@circ@scaled@Rlen=\scaledRlen
19092 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
19093 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
19094 \pgfscope% (for the line width)
19095 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19096 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
19097 \pgf@circ@draworfill
19098 %% upside mark
19099 \ifpgf@circuit@chip@topmark
19100 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
19101 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
19102 \fi
19103 \pgfusepath{stroke}%
19104 \pgfsetcolor{\ctikzvalof{color}}
19105 % Adding the pin number
19106 \ifpgf@circuit@chip@shownumbers
19107 \pgf@circ@count@a=\numpins\relax
19108 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
19109 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
19110 \ifpgf@circuit@chip@straightnumbers
19111 \pgfgettransformentries\a\b\temp\temp\temp\temp
19112 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
19113 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
19114 \else
19115 \pgfmathsetmacro{\rot}{0}
19116 \pgfmathsetmacro{\quadrant}{0}
19117 \fi
19118 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
19119 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
19120 \pgfmathloop%
19121 \ifnum\pgf@circ@count@a>0
19122 \ifcase\quadrant % rotation 0
19123 % left
19124 \pgf@circ@count@c=\pgf@circ@count@a
19125 \pgftext[left,
19126 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19127 rotate=\rot]{\mytext}
19128 % right
19129 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19130 \pgftext[right,
19131 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19132 rotate=\rot]{\mytext}
19133 \or % rotation -90
19134 % left
19135 \pgf@circ@count@c=\pgf@circ@count@a
19136 \pgftext[top,
19137 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19138 rotate=\rot]{\mytext}
19139 % right
19140 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19141 \pgftext[bottom,
19142 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19143 rotate=\rot]{\mytext}
19144 \or %rotation 180
19145 % left
19146 \pgf@circ@count@c=\pgf@circ@count@a
19147 \pgftext[right,
19148 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19149 rotate=\rot]{\mytext}
19150 % right
19151 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19152 \pgftext[left,
19153 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19154 rotate=\rot]{\mytext}
19155 \or % rotation +90
19156 % left
19157 \pgf@circ@count@c=\pgf@circ@count@a
19158 \pgftext[bottom,
19159 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19160 rotate=\rot]{\mytext}
19161 % right
19162 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19163 \pgftext[top,
19164 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19165 rotate=\rot]{\mytext}
19166 \fi
19167 \advance\pgf@circ@count@a-1\relax%
19168 \repeatpgfmathloop
19169 \fi
19170 \endpgfscope
19171 \ifdim\pgf@circ@res@other>0pt
19172 \pgfscope
19173 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
19174 \pgf@circ@count@a=\numpins\relax
19175 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
19176 \pgfmathloop%
19177 \ifnum\pgf@circ@count@a>0
19178 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
19179 \ifnum\padfrac>0
19180 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
19181 % left side pads
19182 \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}}
19183 \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}}
19184 \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}}
19185 \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}}
19186 % right side pads
19187 \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}}
19188 \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}}
19189 \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}}
19190 \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}}
19191 \else
19192 % left side pins
19193 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19194 \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}}
19195 % right side pins
19196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19197 \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}}
19198 \fi
19199 \advance\pgf@circ@count@a by -1\relax%
19200 \repeatpgfmathloop
19201 \pgfusepath{stroke}
19202 \endpgfscope
19203 \fi
19204 }%
19205 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19206 % and is executed just before a node is drawn.
19207 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
19208 % Start with the maximum pin number and go backwards.
19209 \pgf@circ@count@a=\numpins\relax
19210 \pgfmathloop%
19211 \ifnum\pgf@circ@count@a>0
19212 % we will create two anchors per pin: the "normal one" like `pin 1` for the
19213 % electrical contact, and the "border one" like `bpin 1` for labels.
19214 % they will coincide if `external pins width` is set to 0.
19215 \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
19216 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
19217 }
19218 \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
19219 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
19220 }
19221 \advance\pgf@circ@count@a by -1\relax%
19222 \repeatpgfmathloop%
19223 }%
19224 }
19225
19226 % QFP (quad flat package) chips
19227
19228 \pgfdeclareshape{qfpchip}{
19229 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
19230 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19231 \savedmacro\numpins{%
19232 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
19233 \def\numpins{\the\pgf@circ@count@a}
19234 }
19235 \savedanchor\centerpoint{%
19236 \pgf@x=-.5\wd\pgfnodeparttextbox%
19237 \pgf@y=-.5\ht\pgfnodeparttextbox%
19238 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
19239 }%
19240 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
19241 \anchor{center}{\origin}
19242 \anchor{text}{\centerpoint}% to adjust text
19243 \saveddimen\height{%
19244 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19245 \pgfmathsetlength\pgf@x{((\numpins+2)
19246 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
19247 }%
19248 \saveddimen\width{%
19249 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19250 \pgfmathsetlength\pgf@x{((\numpins+2)
19251 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
19252 }%
19253 \saveddimen{\chipspacing}{
19254 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19255 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
19256 \saveddimen{\extshift}{
19257 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19258 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
19259 % standard anchors
19260 \savedanchor\northwest{%
19261 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19262 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
19263 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
19264 \pgf@x=-\pgf@y
19265 }
19266 \anchor{dot}{\northwest
19267 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
19268 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
19269 }
19270 \anchor{nw}{\northwest}
19271 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
19272 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19273 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
19274 \anchor{north west}{\northwest}
19275 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
19276 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
19277 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
19278 \anchor{n}{\northwest\pgf@x=0pt }
19279 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19280 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19281 \anchor{w}{\northwest\pgf@y=0pt }
19282 \anchor{north}{\northwest\pgf@x=0pt }
19283 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19284 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19285 \anchor{west}{\northwest\pgf@y=0pt }
19286 % start drawing
19287 \backgroundpath{%
19288 \northwest
19289 \pgf@circ@res@up = \pgf@y
19290 \pgf@circ@res@down = -\pgf@y
19291 \pgf@circ@res@right = -\pgf@x
19292 \pgf@circ@res@left = \pgf@x
19293 \pgf@circ@scaled@Rlen=\scaledRlen
19294 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
19295 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
19296 \pgfscope% (for the line width)
19297 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19298 %% upside mark
19299 \ifpgf@circuit@chip@topmark
19300 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
19301 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
19302 \else
19303 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
19304 \fi
19305 %% rest of the shape
19306 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
19307 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
19308 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
19309 \pgfpathclose
19310 \pgf@circ@draworfill
19311 % Adding the pin number
19312 \pgfsetcolor{\ctikzvalof{color}}
19313 \ifpgf@circuit@chip@shownumbers
19314 \pgf@circ@count@a=\numpins%
19315 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
19316 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
19317 \ifpgf@circuit@chip@straightnumbers
19318 \pgfgettransformentries\a\b\temp\temp\temp\temp
19319 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
19320 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
19321 \else
19322 \pgfmathsetmacro{\rot}{0}
19323 \pgfmathsetmacro{\quadrant}{0}
19324 \fi
19325 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
19326 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
19327 \pgfmathloop%
19328 \ifnum\pgf@circ@count@a>0
19329 \ifcase\quadrant % rotation 0
19330 % left
19331 \pgf@circ@count@c=\pgf@circ@count@a
19332 \pgftext[left,
19333 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19334 rotate=\rot]{\mytext}
19335 % bottom
19336 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19337 \pgftext[bottom,
19338 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19339 rotate=\rot]{\mytext}
19340 % right
19341 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19342 \pgftext[right,
19343 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19344 rotate=\rot]{\mytext}
19345 % top
19346 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19347 \pgftext[top,
19348 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19349 rotate=\rot]{\mytext}
19350 \or % rotation -90
19351 % left
19352 \pgf@circ@count@c=\pgf@circ@count@a
19353 \pgftext[top,
19354 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19355 rotate=\rot]{\mytext}
19356 % bottom
19357 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19358 \pgftext[left,
19359 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19360 rotate=\rot]{\mytext}
19361 % right
19362 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19363 \pgftext[bottom,
19364 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19365 rotate=\rot]{\mytext}
19366 % top
19367 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19368 \pgftext[right,
19369 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19370 rotate=\rot]{\mytext}
19371 \or %rotation 180
19372 % left
19373 \pgf@circ@count@c=\pgf@circ@count@a
19374 \pgftext[right,
19375 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19376 rotate=\rot]{\mytext}
19377 % bottom
19378 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19379 \pgftext[top,
19380 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19381 rotate=\rot]{\mytext}
19382 % right
19383 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19384 \pgftext[left,
19385 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19386 rotate=\rot]{\mytext}
19387 % top
19388 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19389 \pgftext[bottom,
19390 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19391 rotate=\rot]{\mytext}
19392 \or % rotation +90
19393 % left
19394 \pgf@circ@count@c=\pgf@circ@count@a
19395 \pgftext[bottom,
19396 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19397 rotate=\rot]{\mytext}
19398 % bottom
19399 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19400 \pgftext[right,
19401 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19402 rotate=\rot]{\mytext}
19403 % right
19404 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19405 \pgftext[top,
19406 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19407 rotate=\rot]{\mytext}
19408 % top
19409 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19410 \pgftext[left,
19411 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19412 rotate=\rot]{\mytext}
19413 \fi
19414 \advance\pgf@circ@count@a-1\relax%
19415 \repeatpgfmathloop
19416 \fi
19417 \endpgfscope
19418 \ifdim\pgf@circ@res@other>0pt
19419 \pgfscope
19420 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
19421 \pgf@circ@count@a=\numpins%
19422 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
19423 \pgfmathloop%
19424 \ifnum\pgf@circ@count@a>0
19425 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
19426 \ifnum\padfrac>0
19427 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
19428 % left side pads
19429 \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}}
19430 \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}}
19431 \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}}
19432 \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}}
19433 % bottom side pads
19434 \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}}
19435 \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}}
19436 \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}}
19437 \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}}
19438 % right side pads
19439 \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}}
19440 \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}}
19441 \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}}
19442 \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}}
19443 % top side pads
19444 \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}}
19445 \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}}
19446 \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}}
19447 \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}}
19448 \else
19449 % left side pins
19450 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19451 \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}}
19452 % bottom side pins
19453 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
19454 \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}}
19455 % right side pins
19456 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19457 \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}}
19458 % top side pins
19459 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
19460 \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}}
19461 \fi
19462 \advance\pgf@circ@count@a-1\relax%
19463 \repeatpgfmathloop
19464 \pgfusepath{stroke}
19465 \endpgfscope
19466 \fi
19467 }%
19468 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19469 % and is executed just before a node is drawn.
19470 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
19471 % Start with the maximum pin number and go backwards.
19472 \pgf@circ@count@a=\numpins%
19473 \pgfmathloop%
19474 \ifnum\pgf@circ@count@a>0
19475 \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
19476 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
19477 }
19478 \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
19479 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
19480 }
19481 \advance\pgf@circ@count@a-1\relax%
19482 \repeatpgfmathloop%
19483 }%
19484 }
19485
19486 %% anchors for DIP
19487 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19488 \c@pgf@countc=\numpins\relax
19489 \divide\c@pgf@countc by 2
19490 \ifnum #1 > \the\c@pgf@countc
19491 % right side
19492 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
19493 \else
19494 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
19495 \fi
19496 }
19497
19498 %% anchors for QFP
19499 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19500 \c@pgf@countc=\numpins\relax
19501 \divide\c@pgf@countc by 4
19502 \ifnum #1 > \the\c@pgf@countc
19503 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
19504 \ifnum #1 > \the\c@pgf@countb
19505 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
19506 \ifnum #1 > \the\c@pgf@countb
19507 % 3*npins/4 < pin, top side
19508 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
19509 \else
19510 % 2*npins/4 < pin <= 3*npins/4, right side
19511 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
19512 \fi
19513 \else
19514 % npins/4 < pin <= 2*npins/4, bottom side
19515 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
19516 \fi
19517 \else
19518 % <= npins/4, left side
19519 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
19520 \fi
19521 }
19522
19523 %%%%%%%%%%%%%%%%%
19524 %% Rotary Switch
19525 %%%%%%%%%%%%%%%%%
19526
19527 \pgfdeclareshape{rotaryswitch}
19528 {
19529 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
19530 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19531 \savedanchor\northeast{%
19532 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19533 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19534 % the magic number is 0.25/cos(35)
19535 % try to recalculate it for the actual switch
19536 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19537 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19538 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19539 \edef\r{\ctikzvalof{nodes width}}
19540 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19541 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
19542 }
19543 \savedanchor\northwest{%
19544 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19545 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19546 % the magic number is 0.25/cos(35)
19547 % try to recalculate it for the actual switch
19548 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19549 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19550 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19551 \edef\r{\ctikzvalof{nodes width}}
19552 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19553 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
19554 }
19555 \savedanchor\central{%
19556 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19557 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19558 % the magic number is 0.25/cos(35)
19559 % try to recalculate it for the actual switch
19560 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19561 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19562 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19563 \edef\r{\ctikzvalof{nodes width}}
19564 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19565 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
19566 }
19567 % external square limits
19568 \savedanchor\extnorthwest{%
19569 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19570 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19571 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19572 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
19573 \pgf@x=2.5\pgf@x % external square size
19574 \pgf@y=-\pgf@x %square thing when angle=180?
19575 }
19576 \saveddimen{\width}{
19577 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19578 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
19579 % radius of the connector
19580 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
19581 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
19582 % shapename
19583 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19584 % shape type
19585 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
19586 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
19587 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
19588 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
19589 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
19590 % mid of the lever, to stack switches
19591 %\anchor{mid}{\midlever}
19592 \anchor{mid}{\northwest
19593 \pgf@circ@res@temp=-\pgf@x
19594 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
19595 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
19596 }
19597 % center anchors
19598 \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
19599 % horizontal angles
19600 \anchor{in}{ \northwest \pgf@y=0pt}
19601 \anchor{ain}{ \northwest \pgf@y=0pt}
19602
19603 \anchor{center}{ \central \pgf@y=0pt }
19604 \anchor{east}{ \northeast \pgf@y=0pt }
19605 \anchor{west}{ \northwest \pgf@y=0pt }
19606 \anchor{south}{ \central \pgf@y=-\pgf@y }
19607 \anchor{north}{ \central }
19608 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19609 \anchor{north east}{ \northeast }
19610 \anchor{north west}{ \northwest }
19611 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
19612
19613 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
19614 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
19615 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
19616 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19617 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
19618 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19619 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
19620 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
19621 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19622
19623 \backgroundpath{
19624 \pgfsetcolor{\ctikzvalof{color}}
19625 \pgf@circ@res@right = \width
19626 \pgf@circ@res@left = -\width
19627
19628 \pgfscope %wiper
19629 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
19630 \pgf@circ@res@temp=\radius\relax
19631 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
19632 \pgfsetlinewidth{2\pgf@circ@res@temp}
19633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
19634 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
19635 \pgfsetroundcap\pgfusepath{draw}
19636 \endpgfscope
19637
19638 \ifpgf@circ@rotaryarrow
19639 \pgfscope % arrow
19640 \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
19641 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
19642 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
19643 \pgftransformrotate{\wiper}
19644 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
19645 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
19646 \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
19647 \pgfusepath{draw}
19648 \endpgfscope
19649 \fi
19650
19651 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
19652 \pgf@circ@count@a=\channels\relax
19653 \pgfmathsetmacro{\currenta}{-\angle}
19654 \pgfmathloop%
19655 \ifnum\pgf@circ@count@a>0
19656 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
19657 \pgfscope
19658 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
19659 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
19660 \endpgfscope
19661 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
19662 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
19663 \advance\pgf@circ@count@a by -1\relax%
19664 \repeatpgfmathloop
19665
19666 \pgfscope % input
19667 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19668 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
19669 \endpgfscope
19670 }
19671 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19672 % and is executed just before a node is drawn.
19673 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
19674 % Start with the maximum pin number and go backwards.
19675 \pgf@circ@count@a=\channels\relax
19676 \pgfmathloop%
19677 \ifnum\pgf@circ@count@a>0
19678 % we will create two anchors per pin: the "normal one" like `pin 1` for the
19679 % electrical contact, and the "border one" like `bpin 1` for labels.
19680 % they will coincide if `external pins width` is set to 0.
19681 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
19682 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
19683 }
19684 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
19685 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
19686 }
19687 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
19688 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
19689 }
19690 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
19691 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}%
19692 }
19693 \advance\pgf@circ@count@a by -1\relax%
19694 \repeatpgfmathloop%
19695 }%
19696 }
19697
19698 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
19699 \pgf@circ@res@temp=\width
19700 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
19701 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
19702 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
19703 \advance\pgf@x by -\pgf@circ@res@temp
19704 }
19705
19706 \def\pgf@circ@rotarysqanchor#1{% external square anchors
19707 \pgf@circ@res@temp=\width
19708 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
19709 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
19710 \advance\pgf@x by -\pgf@circ@res@temp
19711 }
19712
19713 %%%%%%%%%%%%%%%%%%%%%%%%%%
19714 % Seven segments displays
19715 %%%%%%%%%%%%%%%%%%%%%%%%%%
19716
19717 \pgfdeclareshape{bare7seg}{
19718 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
19719 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19720 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
19721 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
19722 \ifpgf@circ@sevenseg@dot
19723 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
19724 \else
19725 \pgf@x=0pt
19726 \fi
19727 }
19728 % The object extension is more or less (-width/2,-width) to (width/2,width)
19729 % and adjusted for line thickness (both sides) and eventually the dot
19730 \saveddimen{\width}{
19731 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19732 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
19733 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
19734 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
19735 \savedanchor{\southwest}{% both negative
19736 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19737 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19738 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
19739 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19740 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
19741 }
19742 \savedanchor{\northeast}{% both positive
19743 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19744 \ifpgf@circ@sevenseg@dot
19745 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
19746 \else
19747 \pgf@circ@res@other=0pt
19748 \fi
19749 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19750 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
19751 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19752 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
19753 }
19754 \savedanchor{\topright}{% anchor without the box sep and the thickness
19755 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19756 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
19757 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
19758 }
19759 \anchor{center}{\pgfpointorigin}
19760 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
19761 \anchor{north east}{\northeast}
19762 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
19763 \anchor{south west}{\southwest}
19764 \anchor{north}{\northeast\pgf@x=0pt}
19765 \anchor{east}{\northeast\pgf@y=0pt}
19766 \anchor{south}{\southwest\pgf@x=0pt}
19767 \anchor{west}{\southwest\pgf@y=0pt}
19768 \anchor{a}{\topright\pgf@x=0pt}
19769 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
19770 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
19771 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
19772 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
19773 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
19774 \anchor{g}{\pgfpointorigin}
19775 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
19776 \behindbackgroundpath{%
19777 \southwest % I do not want the dot here, it will stick out
19778 \pgf@circ@res@up = -\pgf@y
19779 \pgf@circ@res@down = \pgf@y
19780 \pgf@circ@res@right = \pgf@x
19781 \pgf@circ@res@left = -\pgf@x
19782 \pgfscope
19783 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19784 \pgfsetcolor{\ctikzvalof{color}}
19785 \pgfpathrectanglecorners%
19786 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19787 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
19788 \ifpgf@circ@sevenseg@box
19789 \pgf@circ@draworfill
19790 \else
19791 \pgf@circ@maybefill
19792 \fi
19793 \endpgfscope
19794 \edef\bits{\ctikzvalof{seven seg/bits}}
19795 \pgfscope
19796 \pfg@circ@sseg@drawbits{\bits}
19797 \endpgfscope
19798 \pgfscope
19799 \ifpgf@circ@sevenseg@dot
19800 \pgf@circ@sseg@drawdots
19801 \fi
19802 \endpgfscope
19803 }
19804 }
19805
19806 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
19807 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
19808 }
19809 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
19810 \ifnum #1 > 0\relax
19811 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
19812 \else
19813 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
19814 \fi
19815 \pgfpathmoveto{\pgfpoint{#2}{#3}}
19816 \pgfpathlineto{\pgfpoint{#4}{#5}}
19817 \pgfusepath{draw}
19818 }
19819 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
19820 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
19821 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
19822 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
19823 % \pgfsetroundcap
19824 \pgfsetarrowsstart{Triangle Cap[]}
19825 \pgfsetarrowsend{Triangle Cap[]}
19826 % segments
19827 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
19828 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
19829 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
19830 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
19831 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
19832 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
19833 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
19834 }
19835 \def\pgf@circ@sseg@drawdots{% dots
19836 \edef\what{empty}
19837 \ifx\what\pgf@circ@sevenseg@dotstate
19838 % do nothing
19839 \else
19840 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
19841 \edef\what{off}
19842 \ifx\what\pgf@circ@sevenseg@dotstate
19843 % dot off
19844 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
19845 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
19846 \else
19847 % dot on
19848 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
19849 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
19850 \fi
19851 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
19852 \pgfusepath{draw,fill}
19853 \fi
19854 }
19855
19856
19857 %%%%%%
19858 %%%%%% Flip-flops
19859 %%%%%%
19860
19861 % Flip flops are a specialized kind of dipchip.
19862 % they have a class by themselves
19863
19864 %% flip flop definitions --- by default empty
19865 %% pin texts
19866 \ctikzset{multipoles/flipflop/t1/.initial={}}
19867 \ctikzset{multipoles/flipflop/t2/.initial={}}
19868 \ctikzset{multipoles/flipflop/t3/.initial={}}
19869 \ctikzset{multipoles/flipflop/t4/.initial={}}
19870 \ctikzset{multipoles/flipflop/t5/.initial={}}
19871 \ctikzset{multipoles/flipflop/t6/.initial={}}
19872 \ctikzset{multipoles/flipflop/tu/.initial={}}
19873 \ctikzset{multipoles/flipflop/td/.initial={}}
19874 % pin clock wedge flags
19875 \ctikzset{multipoles/flipflop/c1/.initial={0}}
19876 \ctikzset{multipoles/flipflop/c2/.initial={0}}
19877 \ctikzset{multipoles/flipflop/c3/.initial={0}}
19878 \ctikzset{multipoles/flipflop/c4/.initial={0}}
19879 \ctikzset{multipoles/flipflop/c5/.initial={0}}
19880 \ctikzset{multipoles/flipflop/c6/.initial={0}}
19881 \ctikzset{multipoles/flipflop/cu/.initial={0}}
19882 \ctikzset{multipoles/flipflop/cd/.initial={0}}
19883 % pin negation circle flags
19884 \ctikzset{multipoles/flipflop/n1/.initial={0}}
19885 \ctikzset{multipoles/flipflop/n2/.initial={0}}
19886 \ctikzset{multipoles/flipflop/n3/.initial={0}}
19887 \ctikzset{multipoles/flipflop/n4/.initial={0}}
19888 \ctikzset{multipoles/flipflop/n5/.initial={0}}
19889 \ctikzset{multipoles/flipflop/n6/.initial={0}}
19890 \ctikzset{multipoles/flipflop/nu/.initial={0}}
19891 \ctikzset{multipoles/flipflop/nd/.initial={0}}
19892
19893
19894 % Thanks to @marmot
19895 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
19896
19897 % default set of flip flops
19898 \tikzset{
19899 % async
19900 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
19901 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
19902 % sync
19903 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
19904 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
19905 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
19906 % additional features
19907 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
19908 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
19909 }
19910
19911 %
19912 % commodity macro to draw the clock wedges. They leave the size of the
19913 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
19914 %
19915 \def\pgf@circ@do@wedge@left{
19916 \pgf@circ@res@temp=0pt\relax
19917 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
19918 \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}}
19919 \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}}
19920 \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}}
19921 \pgfusepath{stroke}
19922 \pgf@circ@res@temp=\wedge
19923 \fi
19924 }
19925 \def\pgf@circ@do@wedge@right{
19926 \pgf@circ@res@temp=0pt\relax
19927 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
19928 \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}}
19929 \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}}
19930 \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}}
19931 \pgfusepath{stroke}
19932 \pgf@circ@res@temp=-\wedge
19933 \fi
19934 }
19935 \def\pgf@circ@do@wedge@up{
19936 \pgf@circ@res@temp=0pt\relax
19937 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
19938 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
19939 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
19940 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
19941 \pgfusepath{stroke}
19942 \pgf@circ@res@temp=-\wedge
19943 \fi
19944 }
19945 \def\pgf@circ@do@wedge@down{
19946 \pgf@circ@res@temp=0pt\relax
19947 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
19948 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
19949 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
19950 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
19951 \pgfusepath{stroke}
19952 \pgf@circ@res@temp=\wedge
19953 \fi
19954 }
19955 % generic flip-flop shape
19956 \pgfdeclareshape{flipflop}{
19957 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
19958 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19959 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19960 \savedmacro\numpins{\def\numpins{6}}
19961 \savedanchor\centerpoint{%
19962 \pgf@x=-.5\wd\pgfnodeparttextbox%
19963 \pgf@y=-.5\ht\pgfnodeparttextbox%
19964 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
19965 }%
19966 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
19967 \anchor{center}{\origin}
19968 \anchor{text}{\centerpoint}% to adjust text
19969 \saveddimen\height{%
19970 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19971 \pgfmathsetlength\pgf@x{((\numpins)
19972 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19973 }%
19974 \saveddimen{\chipspacing}{
19975 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19976 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
19977 \saveddimen{\width}{
19978 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19979 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
19980 \saveddimen{\extshift}{
19981 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19982 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
19983 % standard anchors
19984 \savedanchor\northwest{%
19985 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19986 \pgfmathsetlength\pgf@y{0.5*((\numpins)
19987 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19988 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
19989 }
19990 \anchor{dot}{\northwest
19991 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
19992 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
19993 }
19994 \anchor{nw}{\northwest}
19995 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
19996 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19997 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
19998 \anchor{north west}{\northwest}
19999 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
20000 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
20001 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
20002 \anchor{n}{\northwest\pgf@x=0pt }
20003 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20004 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20005 \anchor{w}{\northwest\pgf@y=0pt }
20006 \anchor{north}{\northwest\pgf@x=0pt }
20007 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20008 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20009 \anchor{west}{\northwest\pgf@y=0pt }
20010 % upper and lower pin
20011 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
20012 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
20013 \anchor{bup}{\northwest\pgf@x=0pt }
20014 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20015 % start drawing
20016 \backgroundpath{%
20017 \northwest
20018 \pgf@circ@res@up = \pgf@y
20019 \pgf@circ@res@down = -\pgf@y
20020 \pgf@circ@res@right = -\pgf@x
20021 \pgf@circ@res@left = \pgf@x
20022 \pgf@circ@scaled@Rlen=\scaledRlen
20023 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
20024 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
20025 \pgfsetcolor{\ctikzvalof{color}}
20026 \pgfscope% (for the line width)
20027 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
20028 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
20029 \pgf@circ@draworfill
20030 \pgfusepath{stroke}%
20031 \endpgfscope
20032 % Adding the pin number
20033 \pgf@circ@count@a=\numpins\relax
20034 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
20035 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
20036 \ifpgf@circuit@chip@straightnumbers
20037 \pgfgettransformentries\a\b\temp\temp\temp\temp
20038 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
20039 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
20040 \else
20041 \pgfmathsetmacro{\rot}{0}
20042 \pgfmathsetmacro{\quadrant}{0}
20043 \fi
20044 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
20045 % text
20046 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
20047 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
20048 \pgf@circ@strut\space}
20049 % \typeout{TEXT\space\mytext}
20050 \pgfmathloop%
20051 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
20052 \pgf@circ@res@temp=0pt\relax
20053 \ifnum\pgf@circ@count@a>0
20054 \ifcase\quadrant % rotation 0
20055 % left
20056 \pgf@circ@count@c=\pgf@circ@count@a
20057 \pgf@circ@do@wedge@left
20058 % \typeout{TEXT Left Q1\space\mytext}
20059 \pgftext[left,
20060 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},
20061 rotate=\rot]{\mytext}
20062 % right
20063 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20064 \pgf@circ@do@wedge@right
20065 \pgftext[right,
20066 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},
20067 rotate=\rot]{\mytext}
20068 \or % rotation -90
20069 % left
20070 \pgf@circ@count@c=\pgf@circ@count@a
20071 \pgf@circ@do@wedge@left
20072 \pgftext[top,
20073 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},
20074 rotate=\rot]{\mytext}
20075 % right
20076 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20077 \pgf@circ@do@wedge@right
20078 \pgftext[bottom,
20079 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},
20080 rotate=\rot]{\mytext}
20081 \or %rotation 180
20082 % left
20083 \pgf@circ@count@c=\pgf@circ@count@a
20084 \pgf@circ@do@wedge@left
20085 \pgftext[right,
20086 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},
20087 rotate=\rot]{\mytext}
20088 % right
20089 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20090 \pgf@circ@do@wedge@right
20091 \pgftext[left,
20092 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},
20093 rotate=\rot]{\mytext}
20094 \or % rotation +90
20095 % left
20096 \pgf@circ@count@c=\pgf@circ@count@a
20097 \pgf@circ@do@wedge@left
20098 \pgftext[bottom,
20099 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},
20100 rotate=\rot]{\mytext}
20101 % right
20102 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20103 \pgf@circ@do@wedge@right
20104 \pgftext[top,
20105 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},
20106 rotate=\rot]{\mytext}
20107 \fi
20108 \advance\pgf@circ@count@a-1\relax%
20109 \repeatpgfmathloop
20110 % Now the up and down text
20111 % up
20112 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
20113 \pgf@circ@do@wedge@up
20114 \ifcase\quadrant % rotation 0
20115 \pgftext[top,
20116 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
20117 rotate=\rot]{\mytext}
20118 \or % rotation -90
20119 \pgftext[right,
20120 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
20121 rotate=\rot]{\mytext}
20122 \or %rotation 180
20123 \pgftext[bottom,
20124 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
20125 rotate=\rot]{\mytext}
20126 \or % rotation +90
20127 \pgftext[left,
20128 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
20129 rotate=\rot]{\mytext}
20130 \fi
20131 % down
20132 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
20133 \pgf@circ@do@wedge@down
20134 \ifcase\quadrant % rotation 0
20135 \pgftext[bottom,
20136 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
20137 rotate=\rot]{\mytext}
20138 \or % rotation -90
20139 \pgftext[left,
20140 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
20141 rotate=\rot]{\mytext}
20142 \or %rotation 180
20143 \pgftext[top,
20144 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
20145 rotate=\rot]{\mytext}
20146 \or % rotation +90
20147 \pgftext[right,
20148 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
20149 rotate=\rot]{\mytext}
20150 \fi
20151 % external pins
20152 \ifdim\pgf@circ@res@other>0pt
20153 \pgfscope
20154 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
20155 \pgf@circ@count@a=\numpins\relax
20156 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
20157 \pgfmathloop%
20158 \ifnum\pgf@circ@count@a>0
20159 % left side pins
20160 \pgf@circ@count@c=\pgf@circ@count@a
20161 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
20162 %% Or'ing tests in core TeX is tough
20163 \edef\@@or{0}
20164 % Just expand the key the minimum needed
20165 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
20166 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
20167 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
20168 \ifnum\@@tmp>0\edef\@@or{1}\fi
20169 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
20170 \ifnum\@@tmp>0\edef\@@or{1}\fi
20171 \ifnum\@@or>0
20172 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
20173 \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}}
20174 \pgfusepath{stroke}
20175 \fi
20176 % right side pins
20177 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20178 \edef\@@or{0}
20179 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
20180 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
20181 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
20182 \ifnum\@@tmp>0\edef\@@or{1}\fi
20183 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
20184 \ifnum\@@tmp>0\edef\@@or{1}\fi
20185 % \typeout{TEST\space\@@tmp\space\@@x}
20186 \ifnum\@@or>0
20187 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
20188 \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}}
20189 \pgfusepath{stroke}
20190 \fi
20191 \advance\pgf@circ@count@a by -1\relax%
20192 \repeatpgfmathloop
20193 % up side
20194 \edef\@@or{0}
20195 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
20196 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
20197 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
20198 \ifnum\@@tmp>0\edef\@@or{1}\fi
20199 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
20200 \ifnum\@@tmp>0\edef\@@or{1}\fi
20201 % \typeout{TEST\space\@@tmp\space\@@x}
20202 \ifnum\@@or>0
20203 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20204 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
20205 \pgfusepath{stroke}
20206 \fi
20207 % down side
20208 \edef\@@or{0}
20209 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
20210 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
20211 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
20212 \ifnum\@@tmp>0\edef\@@or{1}\fi
20213 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
20214 \ifnum\@@tmp>0\edef\@@or{1}\fi
20215 % \typeout{TEST\space\@@tmp\space\@@x}
20216 \ifnum\@@or>0
20217 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20218 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
20219 \pgfusepath{stroke}
20220 \fi
20221 \endpgfscope
20222 \fi % external pin width >0
20223 %
20224 % draw "inverting" circles on outputs, they must be last
20225 %
20226 \pgfscope
20227 \ifpgf@circuit@ieeelogicport
20228 \def\@@notcirc{notcirc}
20229 \else
20230 \ifpgf@circ@european@port@circle@ieee
20231 \def\@@notcirc{notcirc}
20232 \else
20233 \def\@@notcirc{ocirc}
20234 \fi
20235 \fi
20236 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
20237 \pgf@circ@count@a=\numpins\relax
20238 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
20239 \pgfmathloop%
20240 \ifnum\pgf@circ@count@a>0
20241 % left side pins
20242 \pgf@circ@count@c=\pgf@circ@count@a
20243 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
20244 \ifnum\@@tmp>0\pgfscope
20245 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
20246 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
20247 \endpgfscope\fi
20248 % right side pins
20249 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
20250 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
20251 \ifnum\@@tmp>0\pgfscope
20252 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
20253 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
20254 \endpgfscope\fi
20255 \advance\pgf@circ@count@a by -1\relax%
20256 \repeatpgfmathloop
20257 % up side
20258 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
20259 \ifnum\@@tmp>0\pgfscope
20260 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
20261 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
20262 \endpgfscope\fi
20263 % down side
20264 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
20265 \ifnum\@@tmp>0\pgfscope
20266 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
20267 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
20268 \endpgfscope\fi
20269 \endpgfscope
20270 }%
20271 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
20272 % and is executed just before a node is drawn.
20273 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
20274 % Start with the maximum pin number and go backwards.
20275 \pgf@circ@count@a=\numpins\relax
20276 \pgfmathloop%
20277 \ifnum\pgf@circ@count@a>0
20278 % we will create two anchors per pin: the "normal one" like `pin 1` for the
20279 % electrical contact, and the "border one" like `bpin 1` for labels.
20280 % they will coincide if `external pins width` is set to 0.
20281 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
20282 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
20283 }
20284 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
20285 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
20286 }
20287 \advance\pgf@circ@count@a by -1\relax%
20288 \repeatpgfmathloop%
20289 }%
20290 }
20291
20292 %
20293 % MUX-DEMUXES
20294 %
20295 % Thanks to @marmot
20296 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
20297 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
20298 \tikzset{one bit adder/.style={muxdemux,
20299 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
20300 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
20301 \tikzset{ALU/.style={muxdemux,
20302 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
20303 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
20304 %generic mux-demux shape
20305 \pgfdeclareshape{muxdemux}{
20306 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
20307 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20308 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
20309 % pins on the four sides
20310 % \savedmacro\NL{%
20311 % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
20312 % \def\NL{\the\pgf@circ@count@a}
20313 % }
20314 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
20315 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
20316 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
20317 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
20318 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
20319 % topleft and topright sizes
20320 \savedanchor{\topleft}{%
20321 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20322 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
20323 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20324 }
20325 \savedanchor{\topright}{%
20326 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20327 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
20328 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20329 }
20330 \savedanchor{\insetnortheast}{%
20331 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20332 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
20333 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
20334 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
20335 }
20336 \saveddimen{\insethright}{
20337 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20338 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
20339 \saveddimen{\extshift}{
20340 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20341 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
20342 \savedanchor{\northwest}{%
20343 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20344 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
20345 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20346 }
20347 \anchor{nw}{\northwest}
20348 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
20349 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
20350 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
20351 \anchor{north west}{\northwest}
20352 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
20353 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
20354 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
20355 \anchor{n}{\northwest\pgf@x=0pt }
20356 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20357 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20358 \anchor{w}{\northwest\pgf@y=0pt }
20359 \anchor{north}{\northwest\pgf@x=0pt }
20360 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20361 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20362 \anchor{west}{\northwest\pgf@y=0pt }
20363 \anchor{center}{\pgfpointorigin}
20364 \anchor{top right}{\topright}
20365 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
20366 \anchor{right}{\topright\pgf@y=0pt\relax}
20367 \anchor{top left}{\topleft}
20368 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
20369 \anchor{left}{\topleft\pgf@y=0pt\relax}
20370 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20371 \divide\pgf@y by 2 \pgf@x=0pt\relax}
20372 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20373 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
20374 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
20375 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
20376 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
20377 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
20378 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
20379 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
20380 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
20381 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
20382 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
20383 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
20384 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
20385 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
20386 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
20387 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
20388 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
20389 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
20390 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20391 \divide\pgf@y by 2
20392 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
20393 \divide\pgf@y by 2 \pgf@x=0pt\relax}
20394 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20395 \divide\pgf@y by 2
20396 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
20397 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
20398 \anchor{text}{%
20399 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20400 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
20401 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
20402 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
20403 \pgf@y=-.5\ht\pgfnodeparttextbox%
20404 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
20405 }%
20406 \backgroundpath{%
20407 \topleft
20408 \pgf@circ@res@up = \pgf@y
20409 \pgf@circ@res@down = -\pgf@y
20410 \pgf@circ@res@left = \pgf@x
20411 \topright
20412 \pgf@circ@res@other = \pgf@y
20413 \pgf@circ@res@right = \pgf@x
20414 \insetnortheast
20415 \pgf@circ@res@step = \pgf@x
20416 \pgf@circ@res@temp = \pgf@y
20417 %
20418 % external block
20419 %
20420 \pgfscope% (for the line width)
20421 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
20422 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
20423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
20424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
20425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20426 % inset, starting down
20427 \ifdim\pgf@circ@res@temp>0pt % inset
20428 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
20429 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
20430 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
20431 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
20432 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
20433 \fi
20434 \pgfpathclose
20435 \pgf@circ@draworfill
20436 \endpgfscope
20437 % now we have to draw the pins, if needed
20438 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
20439 % Ok, we have to draw the leads (a.k.a. pins)
20440 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
20441 % We mimic the anchors here --- probably there is a better way
20442 % left pins
20443 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
20444 \pgf@circ@count@a=\NL\relax
20445 \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
20446 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20447 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20448 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
20449 % we have to check oddity
20450 \ifodd\NL
20451 \ifnum\NL=1
20452 % only centerpin, step should not be used, but anyway...
20453 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
20454 \else
20455 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
20456 \fi
20457 \else
20458 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
20459 \fi
20460 \else % no inset
20461 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
20462 \fi
20463 \pgfmathloop%
20464 \ifnum\pgf@circ@count@a>0
20465 %%%%%
20466 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
20467 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
20468 % for lower pins we have to shift them down
20469 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
20470 \ifodd\NL
20471 % odd number of pins
20472 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
20473 % centerpin!
20474 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20475 \ifnum\squarepins>0
20476 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
20477 \else
20478 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
20479 \fi
20480 \else
20481 \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}}
20482 \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}}
20483 \fi
20484 \else
20485 % even numer of pins: just go down
20486 \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}}
20487 \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}}
20488 \fi
20489 \else
20490 % nothing need for #1<=NL/2
20491 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20492 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20493 \fi
20494 \else
20495 % no inset
20496 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20497 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20498 \fi
20499 %%%%%
20500 \advance\pgf@circ@count@a by -1\relax%
20501 \repeatpgfmathloop\fi%
20502 % right pins
20503 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
20504 \pgfmathloop%
20505 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
20506 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
20507 \ifnum\pgf@circ@count@a>0
20508 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20510 \advance\pgf@circ@count@a by -1\relax%
20511 \repeatpgfmathloop\fi%
20512 % bottom pins
20513 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
20514 \pgfmathloop%
20515 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20516 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20517 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
20518 \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}
20519 \ifnum\pgf@circ@count@a>0
20520 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20521 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
20522 \ifnum\squarepins>0
20523 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20524 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
20525 \else
20526 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20527 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
20528 \fi
20529 \advance\pgf@circ@count@a by -1\relax%
20530 \repeatpgfmathloop\fi%
20531 % top pins
20532 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
20533 \pgfmathloop%
20534 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20535 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20536 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
20537 \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}
20538 \ifnum\pgf@circ@count@a>0
20539 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20540 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
20541 \ifnum\squarepins>0
20542 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20543 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
20544 \else
20545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20546 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
20547 \fi
20548 \advance\pgf@circ@count@a by -1\relax%
20549 \repeatpgfmathloop\fi%
20550 % end drawing pins; stroke them
20551 \pgfusepath{stroke}
20552 \endpgfscope\fi\fi
20553 }
20554 % let's start adding anchors
20555 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
20556 % left side anchors
20557 \pgf@circ@count@a=\NL\relax
20558 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
20559 \pgfmathloop%
20560 \ifnum\pgf@circ@count@a>0
20561 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
20562 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
20563 % external leads, and the "border one" like `blpin 1` for internal ones.
20564 % they will coincide if `external pins width` is set to 0.
20565 \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
20566 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
20567 }
20568 \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
20569 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
20570 }
20571 \advance\pgf@circ@count@a by -1\relax%
20572 \repeatpgfmathloop%
20573 % right anchors
20574 \pgf@circ@count@a=\NR\relax
20575 \pgfmathloop%
20576 \ifnum\pgf@circ@count@a>0
20577 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
20578 % external leads, and the "border one" like `brpin 1` for internal ones.
20579 % they will coincide if `external pins width` is set to 0.
20580 \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
20581 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
20582 }
20583 \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
20584 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
20585 }
20586 \advance\pgf@circ@count@a by -1\relax%
20587 \repeatpgfmathloop%
20588 % bottom anchors
20589 \pgf@circ@count@a=\NB\relax
20590 \pgfmathloop%
20591 \ifnum\pgf@circ@count@a>0
20592 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
20593 % external leads, and the "border one" like `bbpin 1` for internal ones.
20594 % they will coincide if `external pins width` is set to 0.
20595 \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
20596 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
20597 }
20598 \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
20599 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
20600 }
20601 \advance\pgf@circ@count@a by -1\relax%
20602 \repeatpgfmathloop%
20603 % top anchors
20604 \pgf@circ@count@a=\NT\relax
20605 \pgfmathloop%
20606 \ifnum\pgf@circ@count@a>0
20607 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
20608 % external leads, and the "border one" like `btpin 1` for internal ones.
20609 % they will coincide if `external pins width` is set to 0.
20610 \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
20611 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
20612 }
20613 \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
20614 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
20615 }
20616 \advance\pgf@circ@count@a by -1\relax%
20617 \repeatpgfmathloop%
20618 }%
20619 }
20620
20621 %% left anchors for muxdemux
20622
20623 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20624 \topleft
20625 \pgf@xa=\pgf@x
20626 \pgf@ya=\pgf@y
20627 \insetnortheast
20628 \pgf@xb=\pgf@x
20629 \pgf@yb=\pgf@y
20630 \ifnum#1>\NL
20631 \PackageError{circuitikz}{%
20632 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
20633 which has been defined with \NL\space left pins%
20634 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20635 \fi
20636 \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
20637 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
20638 \ifnum\NL>1
20639 \ifdim\pgf@yb>0pt % check if we have an inset
20640 % we have to check oddity
20641 \ifodd\NL
20642 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
20643 \else
20644 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
20645 \fi
20646 \else % no inset
20647 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
20648 \fi
20649 \ifdim\pgf@yb>0pt % check if we have an inset
20650 \ifnum#1>\pgf@circ@count@a\relax
20651 % for lower pins we have to shift them down
20652 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
20653 \ifodd\NL
20654 % odd number of pins
20655 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
20656 % centerpin!
20657 \ifnum#2=0\relax
20658 \pgfpoint{\pgf@xb}{0pt}
20659 \else
20660 \ifnum\squarepins>0
20661 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
20662 \else
20663 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
20664 \fi
20665 \fi
20666 \else
20667 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
20668 \fi
20669 \else
20670 % even numer of pins: just go down
20671 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
20672 \fi
20673 \else
20674 % nothing need for #1<=NL/2
20675 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20676 \fi
20677 \else
20678 % no inset
20679 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20680 \fi
20681 \else
20682 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
20683 \fi
20684 }
20685
20686 % right anchors
20687 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20688 \topright
20689 \pgf@xa=\pgf@x
20690 \pgf@ya=\pgf@y
20691 \ifnum#1>\NR
20692 \PackageError{circuitikz}{%
20693 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
20694 which has been defined with \NR\space right pins%
20695 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20696 \fi
20697 \ifnum\NR>1
20698 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
20699 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20700 \else
20701 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
20702 \fi
20703 }
20704
20705 % bottom anchors
20706 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20707 \topleft
20708 \pgf@xa=\pgf@x
20709 \pgf@ya=\pgf@y
20710 \topright
20711 \pgf@xb=\pgf@x
20712 \pgf@yb=\pgf@y
20713 \ifnum#1>\NB
20714 \PackageError{circuitikz}{%
20715 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
20716 which has been defined with \NB\space bottom pins%
20717 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20718 \fi
20719 \ifnum\NB>0
20720 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
20721 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
20722 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
20723 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
20724 \ifnum#2=0\relax
20725 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
20726 \else
20727 \ifnum\squarepins>0\relax
20728 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
20729 \else
20730 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
20731 \fi
20732 \fi
20733 \else
20734 % should not happen, give the same as pin 1 anyway
20735 \ifnum#2=0\relax
20736 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
20737 \else
20738 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
20739 \fi
20740 \fi
20741 }
20742
20743 % top anchors
20744 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20745 \topleft
20746 \pgf@xa=\pgf@x
20747 \pgf@ya=\pgf@y
20748 \topright
20749 \pgf@xb=\pgf@x
20750 \pgf@yb=\pgf@y
20751 \ifnum#1>\NT
20752 \PackageError{circuitikz}{%
20753 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
20754 which has been defined with \NT\space top pins%
20755 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20756 \fi
20757 \ifnum\NT>0
20758 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
20759 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
20760 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
20761 \ifnum#2=0\relax
20762 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
20763 \else
20764 \ifnum\squarepins>0
20765 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
20766 \else
20767 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
20768 \fi
20769 \fi
20770 \else
20771 % should not happen, give the same as pin 1 anyway
20772 \ifnum#2=0\relax
20773 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
20774 \else
20775 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
20776 \fi
20777 \fi
20778 }
20779
20780 %% IEEE standard logic ports module
20781 %%
20782 %% Original multi-input code from John Kormylo at tex.stackexchange.com
20783 %% Help by TheTeXnician <[email protected]>
20784 %% Suggested idea and example code by Jason Sachs <[email protected]>
20785 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
20786 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
20787 %% Everything is in the same place here --- more or less; first step to move towards
20788 %% a module interface for circutikz
20789 %%
20790
20791 % base parameters for ieeestd ports.
20792
20793 \ctikzset{ieeestd ports/.is family}
20794 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
20795 % the value of 0.4 is the standard pin distance for a port with height=num pins
20796 % and matches the chip distance
20797 \ctikzset{ieeestd ports/baselen/.initial=0.4}
20798 % these are in term of baselen; width depends on height (fixed proportions)
20799 \ctikzset{ieeestd ports/height/.initial=2}
20800 \ctikzset{ieeestd ports/pin length/.initial=0.7}
20801 % the standard "not" circle should be 1/6.5 of height (diameter);
20802 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
20803 \ctikzset{ieeestd ports/not radius/.initial=0.154}
20804 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
20805 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
20806 % xor/xnor leads go full in in IEEE; let this be optional
20807 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
20808 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
20809 %
20810 % base size of a small external schmitt symbol
20811 %
20812 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
20813 %
20814 % input management
20815 % we are using the same /tikz/number inputs than the legacy ports
20816 %
20817 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
20818 %
20819 % integrate with the other logic ports
20820 %
20821 %
20822 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
20823 \ctikzset{logic ports/ieee/.code= {%
20824 \pgf@circuit@ieeelogicporttrue
20825 \pgf@circuit@europeanlogicportfalse
20826 \tikzset{and port/.style={shape=ieeestd and port}}%
20827 \tikzset{or port/.style={shape=ieeestd or port}}%
20828 \tikzset{xor port/.style={shape=ieeestd xor port}}%
20829 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
20830 \tikzset{not port/.style={shape=ieeestd not port}}%
20831 \tikzset{nand port/.style={shape=ieeestd nand port}}%
20832 \tikzset{nor port/.style={shape=ieeestd nor port}}%
20833 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
20834 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
20835 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
20836 }}
20837 % add code to be compatible with the other ports
20838 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
20839 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
20840 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
20841 %
20842 % the base angle for the or port. See the drawings. This will not change with height
20843 %
20844 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
20845 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
20846 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
20847 {%
20848 \ifnum#1>\inputs
20849 \PackageError{circuitikz}{%
20850 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
20851 which has been defined with \inputs\space pins%
20852 }{Please check the manual about logic ports; if you press return I'll try to continue}
20853 \fi
20854 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20855 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
20856 \pgf@circ@res@step=\pind
20857 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
20858 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
20859 }%
20860
20861 % #1 = \pgfmathcounter #2=type
20862 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
20863 \def\pgf@circ@ieeeport@baseinput#1#2%
20864 {%
20865 \ifnum#1>\inputs
20866 \PackageError{circuitikz}{%
20867 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
20868 which has been defined with \inputs\space pins%
20869 }{Please check the manual about logic ports; if you press return I'll try to continue}
20870 \fi
20871 % Find the vertical position (this is the same for any port)
20872 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20873 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
20874 % rack (extended) pins; they are the same for all the ports
20875 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
20876 % above: 1..K (included)
20877 % below: inputs-K..inputs
20878 % Find the pins on the rack; they are 1...
20879 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
20880 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
20881 % border anchors for rack should be ok
20882 \pgfextractx{\pgf@circ@res@left}{\topleft}
20883 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
20884 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
20885 % we have finished if we are in the rack
20886 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
20887 % we are on the inner ports; we have to do the hard work here
20888 % and and nand
20889 \ifnum #2=1
20890 \relax % It's an and/nand, all border ports are on the rack line
20891 \fi
20892 % or and nor
20893 \ifnum #2=2
20894 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20895 \fi
20896 % xor and xnor
20897 \ifnum #2=3\relax
20898 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20899 \fi
20900 \fi\fi
20901 }%
20902 % inner base ports for xor types port
20903 % #1 = \pgfmathcounter #2=type
20904 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
20905 \def\pgf@circ@ieeeport@innerbaseinput#1%
20906 {%
20907 \ifnum#1>\inputs
20908 \PackageError{circuitikz}{%
20909 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
20910 which has been defined with \inputs\space pins%
20911 }{Please check the manual about logic ports; if you press return I'll try to continue}
20912 \fi
20913 % Find the vertical position (this is the same for any port)
20914 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20915 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
20916 % rack (extended) pins; they are the same for all the ports
20917 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
20918 % above: 1..K (included)
20919 % below: inputs-K..inputs
20920 % Find the pins on the rack; they are 1...
20921 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
20922 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
20923 % border anchors for rack should be ok
20924 \pgfextractx{\pgf@circ@res@left}{\topleft}
20925 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
20926 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
20927 % we have finished if we are in the rack
20928 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
20929 % we are on the inner ports; we have to do the hard work here
20930 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20931 \fi\fi
20932 }%
20933
20934 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
20935 \def\pgf@circ@ieeestd@baselen{%
20936 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20937 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
20938 }
20939 \def\pgf@circ@ieeestd@stdH{%
20940 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20941 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
20942 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
20943 }
20944 \def\pgf@circ@ieeestd@pinlen{%
20945 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20946 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
20947 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
20948 }
20949 \def\pgf@circ@ieeestd@xorbar{%
20950 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20951 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
20952 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
20953 }
20954 %% Not circle
20955 \def\pgf@circ@notradius{
20956 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
20957 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
20958 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
20959 }
20960 %% Find (in ...@other) the height of the rack
20961 \def\pgf@circ@findrackH{%
20962 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
20963 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
20964 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
20965 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
20966 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
20967 \pgf@circ@ieeestd@stdH
20968 \multiply\pgf@circ@res@temp by 2\relax% full height
20969 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
20970 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
20971 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
20972 }
20973 %%
20974 \def\pgf@circ@find@ieeeport@up{% leave it in up
20975 % Normal port limits
20976 \pgf@circ@ieeestd@stdH
20977 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
20978 % rack top size
20979 \pgf@circ@findrackH
20980 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
20981 \pgf@circ@res@up=\pgf@circ@res@other
20982 \else
20983 \fi
20984 }
20985 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
20986 % Normal port limits
20987 \pgf@circ@ieeestd@stdH
20988 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
20989 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
20990 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
20991 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
20992 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20993 % this is the normal left border
20994 % For the or or xor port, the limit can be the pointy thing (in case the
20995 % pinlen is zero or too small)
20996 % add to the body margin the or/nor peak:
20997 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
20998 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
20999 \advance\pgf@circ@res@right by \pgf@circ@res@other
21000 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
21001 \fi
21002 % add to the body margin the xor/xnor distance
21003 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
21004 \pgf@circ@ieeestd@xorbar
21005 \advance\pgf@circ@res@right by \pgf@circ@res@temp
21006 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
21007 \fi
21008 % and if this exceeds the normal margin, this is it
21009 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
21010 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
21011 \pgf@circ@res@left=\pgf@circ@res@right
21012 \fi
21013 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
21014 \pgf@circ@res@left=-\pgf@circ@res@left
21015 }
21016 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
21017 % Normal port limits
21018 \pgf@circ@ieeestd@stdH
21019 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
21020 \pgf@circ@notradius
21021 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
21022 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
21023 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
21024 \pgf@circ@res@right=\pgf@circ@res@other
21025 \fi
21026 }
21027 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
21028 % Normal port limits
21029 \pgf@circ@ieeestd@stdH
21030 % notice 0.8660254 is cos(30)
21031 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
21032 \pgf@circ@notradius
21033 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
21034 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
21035 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
21036 \pgf@circ@res@right=\pgf@circ@res@other
21037 \fi
21038 }
21039
21040
21041 %%% ieeestd multi-input ports
21042 %%% #1: name
21043 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
21044 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
21045 %%% #4: drawing for the port
21046 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
21047 \pgfdeclareshape{ieeestd #1 port}%
21048 {%
21049 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21050 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21051 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21052 \saveddimen{\baselen}{%
21053 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
21054 }
21055 \saveddimen{\stdH}{% This is HALF the height of the inner port
21056 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
21057 }
21058 \saveddimen{\notdiameter}{
21059 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
21060 }
21061 \saveddimen{\pind}{% pin distance;
21062 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
21063 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
21064 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
21065 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
21066 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
21067 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
21068 \divide\pgf@x by \pgf@circ@count@b
21069 }
21070 \saveddimen{\pinlen}{%
21071 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
21072 }
21073 \saveddimen{\xorbar}{%
21074 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
21075 }
21076 % anchors for the body (no pins included here)
21077 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
21078 \pgf@circ@ieeestd@stdH
21079 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
21080 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21081 }
21082 \savedanchor{\topleft}{%
21083 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
21084 \pgf@circ@ieeestd@stdH
21085 \pgf@circ@res@other=0pt\relax
21086 \ifnum #2 = 2\relax% "or" or "nor" gates.
21087 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
21088 \fi
21089 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
21090 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
21091 +\pgf@circ@res@right}
21092 \fi
21093 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
21094 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21095 }
21096 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
21097 \pgf@circ@ieeestd@stdH
21098 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
21099 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21100 }
21101 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
21102 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
21103 \pgf@circ@ieeestd@stdH
21104 % #3 is =1 if the port is a negated output one
21105 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
21106 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21107 }
21108 % geographical anchors --- must be rectangulars!
21109 \savedanchor{\northwest}{%
21110 \pgf@circ@find@ieeeport@up
21111 \pgf@circ@find@ieeeport@left{#2}
21112 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
21113 \pgf@x=\pgf@circ@res@left
21114 \pgf@y=\pgf@circ@res@up
21115 }
21116 \savedanchor{\southwest}{%
21117 \pgf@circ@find@ieeeport@up
21118 \pgf@circ@find@ieeeport@left{#2}
21119 \pgf@x=\pgf@circ@res@left
21120 \pgf@y=-\pgf@circ@res@up
21121 }
21122 \savedanchor{\southeast}{%
21123 \pgf@circ@find@ieeeport@up
21124 \pgf@circ@find@ieeeport@right{#3}
21125 \pgf@x=\pgf@circ@res@right
21126 \pgf@y=-\pgf@circ@res@up
21127 }
21128 \savedanchor{\northeast}{%
21129 \pgf@circ@find@ieeeport@up
21130 \pgf@circ@find@ieeeport@right{#3}
21131 \pgf@x=\pgf@circ@res@right
21132 \pgf@y=\pgf@circ@res@up
21133 }
21134 \savedmacro\inputs{% get number of inputs
21135 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
21136 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
21137 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
21138 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
21139 \def\inputs{\the\pgf@circ@count@a}%
21140 }%
21141 \savedmacro\inners{% get number of "inner" inputs (for racks)
21142 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
21143 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
21144 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
21145 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
21146 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
21147 % \typeout{INNER is \the\pgf@circ@count@b}%
21148 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
21149 \def\inners{\the\pgf@circ@count@b}%
21150 }%
21151 \anchor{center}{\pgfpointorigin}
21152 \anchor{text}{
21153 \ifpgf@circ@center@text
21154 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21155 \else
21156 \pgf@circ@ieeestd@stdH
21157 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
21158 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21159 \fi
21160 }
21161 % create input anchors
21162 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
21163 \pgf@circ@count@a=\inputs
21164 \pgfmathloop%
21165 \ifnum\pgfmathcounter>\pgf@circ@count@a%
21166 \else%
21167 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
21168 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
21169 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
21170 }%
21171 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
21172 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
21173 }%
21174 \ifnum #2 = 3\relax % xor/xnor inner border pins
21175 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
21176 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
21177 }%
21178 \fi
21179 %}{}%
21180 \repeatpgfmathloop%
21181 }
21182 % output anchor
21183 \anchor{out}{%
21184 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
21185 \advance\pgf@circ@res@other by\pinlen
21186 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
21187 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
21188 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
21189 \fi
21190 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
21191 }
21192 \anchor{bout}{\bottomright\pgf@y=0pt}
21193
21194 \anchor{body right}{\bodyright\pgf@y=0pt}
21195 \anchor{right}{\bottomright\pgf@y=0pt}
21196 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
21197 \anchor{left}{% central edge of the component
21198 \bodyleft\pgf@y=0pt
21199 \ifnum #2=3\relax
21200 \advance\pgf@x by -\xorbar
21201 \fi
21202 }
21203 \anchor{up}{%
21204 \bodyleft
21205 \ifnum #2 > 1 % pointy shapes
21206 \pgf@circ@ieeestd@stdH
21207 % horizontal coordinate where the right semicircle starts
21208 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
21209 % vertical drop of the circle at the above coordinate
21210 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
21211 \advance \pgf@y by -\pgf@circ@res@step
21212 \fi
21213 \pgf@x=0pt
21214 }
21215 \anchor{down}{%
21216 \bodyleft
21217 \ifnum #2 > 1 % pointy shapes
21218 \pgf@circ@ieeestd@stdH
21219 % horizontal coordinate where the right semicircle starts
21220 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
21221 % vertical drop of the circle at the above coordinate
21222 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
21223 \advance \pgf@y by -\pgf@circ@res@step
21224 \fi
21225 \pgf@y=-\pgf@y\pgf@x=0pt
21226 }
21227
21228 % geographical anchors
21229 \anchor{nw}{\northwest}
21230 \anchor{ne}{\northeast}
21231 \anchor{se}{\southeast}
21232 \anchor{sw}{\southwest}
21233 \anchor{north west}{\northwest}
21234 \anchor{north east}{\northeast}
21235 \anchor{south east}{\southeast}
21236 \anchor{south west}{\southwest}
21237 % over 0,0 even if asymmetric
21238 % will break if the geocoords are not rectangular
21239 \anchor{n}{\northwest\pgf@x=0pt\relax}
21240 \anchor{e}{\northeast\pgf@y=0pt\relax}
21241 \anchor{s}{\southwest\pgf@x=0pt\relax}
21242 \anchor{w}{\northwest\pgf@y=0pt\relax}
21243 \anchor{north}{\northwest\pgf@x=0pt\relax}
21244 \anchor{east}{\northeast\pgf@y=0pt\relax}
21245 \anchor{south}{\southwest\pgf@x=0pt\relax}
21246 \anchor{west}{\northwest\pgf@y=0pt\relax}
21247
21248 \backgroundpath{
21249 \pgfscope
21250 \pgfsetcolor{\ctikzvalof{color}}
21251 #4
21252 \endpgfscope
21253 % output lead:
21254 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
21255 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
21256 \advance\pgf@circ@res@other by \pinlen\relax
21257 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
21258 \ifpgfcirc@draw@output@leads
21259 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21260 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
21261 \pgfusepath{draw}
21262 \fi
21263 \fi
21264 \ifnum #3=1\relax\pgfscope
21265 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
21266 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
21267 \endpgfscope\fi
21268 }
21269 }
21270 }
21271
21272 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
21273 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
21274 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
21275 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
21276 }
21277 %
21278 % ieeestd "and" and "nand"
21279 %
21280 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
21281 \pgf@circ@count@a = \inputs\relax
21282 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
21283 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
21284 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21285 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
21286 \ifpgfcirc@draw@input@leads
21287 %input leads --- all the same for AND ports
21288 \loop\ifnum\pgf@circ@count@a>0
21289 \advance\pgf@circ@res@temp by -\pind
21290 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
21291 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
21292 \advance\pgf@circ@count@a by -1
21293 \repeat
21294 \fi
21295 \pgfusepath{draw}
21296 %% Body. let's start from the top left
21297 \pgfscope
21298 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21299 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
21300 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
21301 \pgfpatharc{90}{-90}{\stdH}
21302 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
21303 \pgfpathclose
21304 \pgf@circ@draworfill
21305 % rack now; skip if not needed.
21306 % \typeout{WHAT\space \inputs\space \inners}
21307 \ifnum\inputs>\inners
21308 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21309 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21310 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
21311 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21312 \pgfusepath{draw}
21313 \fi
21314 \endpgfscope
21315 }
21316 %
21317 % or/nor and xor/xnor are practically the same. Let factor out everything
21318 % the argument #1 is put just before the drawing of the inner pins
21319 % the argument #2 is put after the drawing of the body
21320 %
21321 \long\def\pgf@circ@ieeeport@orxor#1#2{%
21322 \pgf@circ@count@a = \inputs\relax
21323 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
21324 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
21325 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21326 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
21327 % rack (extended) pins; they are the same for all the ports
21328 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
21329 % above: 1..K (included)
21330 % below: inputs-K..inputs
21331 % Find the pins on the rack; they are 1...
21332 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
21333 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
21334 \ifpgfcirc@draw@input@leads
21335 %input leads --- for or ports
21336 \loop\ifnum\pgf@circ@count@a>0
21337 \pgfextractx{\pgf@circ@res@right}{\topleft}
21338 \advance\pgf@circ@res@temp by -\pind
21339 % this is the height; let's find the "right" position
21340 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
21341 % inner pins
21342 % \typeout{INNER\space\pgf@circ@count@a}
21343 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
21344 % hook for xor/xnor
21345 #1
21346 \fi\fi
21347 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
21348 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
21349 \pgfusepath{draw}
21350 \advance\pgf@circ@count@a by -1
21351 \repeat
21352 \fi
21353 %% Body. let's start from the top left
21354 \pgfscope
21355 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21356 % it should start here, but with this trick the close comes out better.
21357 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21358 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
21359 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
21360 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
21361 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
21362 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
21363 %% this should be 2 and 2; but the round part is not a perfect circle that way
21364 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
21365 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21366 \pgfpathclose
21367 \pgf@circ@draworfill
21368 % hook for xor/xnor
21369 #2
21370 % rack now; skip if not needed.
21371 % \typeout{WHAT\space \inputs\space \inners}
21372 \ifnum\inputs>\inners
21373 \pgfextractx{\pgf@circ@res@left}{\topleft}
21374 \pgfextracty{\pgf@circ@res@down}{\topleft}
21375 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21377 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
21378 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21379 \pgfusepath{draw}
21380 \fi
21381 \endpgfscope
21382 }
21383 %
21384 % ieeestd "or" and "nor"
21385 %
21386 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
21387 \pgf@circ@ieeeport@orxor{}{}
21388 }
21389 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
21390 \pgf@circ@ieeeport@orxor{
21391 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
21392 \ifnum\@@tmp=0\relax
21393 % move pin start to the left to leave the xor gap free (not standard)
21394 \advance\pgf@circ@res@right by -\xorbar
21395 \fi
21396 }{%
21397 % add the xor/xnor bar
21398 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
21399 % see the comment on the main body about the 2.2
21400 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21401 \pgfusepath{draw}
21402 }
21403 }
21404 %
21405 % Buffer and inverters
21406 %
21407 % #1: name
21408 % #2: polarity
21409 % #3: content
21410 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
21411 \pgfdeclareshape{ieeestd #1 port}%
21412 {%
21413 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21414 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21415 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21416 \saveddimen{\baselen}{%
21417 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
21418 }
21419 \saveddimen{\stdH}{% This is HALF the height of the inner port
21420 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
21421 }
21422 \saveddimen{\notdiameter}{
21423 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
21424 }
21425 \saveddimen{\pinlen}{%
21426 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
21427 }
21428 % anchors for the body (no pins included here)
21429 % Notice that 0.8660254 is cos(30)
21430 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
21431 \pgf@circ@ieeestd@stdH
21432 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21433 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21434 }
21435 \savedanchor{\topleft}{%
21436 \pgf@circ@ieeestd@stdH
21437 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21438 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21439 }
21440 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
21441 \pgf@circ@ieeestd@stdH
21442 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
21443 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21444 }
21445 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
21446 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
21447 \pgf@circ@ieeestd@stdH
21448 % #2 is =1 if the port is a negated output one
21449 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
21450 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21451 }
21452 % geographical anchors --- must be rectangulars!
21453 \savedanchor{\northwest}{%
21454 \pgf@circ@ieeestd@stdH
21455 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21456 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21457 }
21458 \savedanchor{\southwest}{%
21459 \pgf@circ@ieeestd@stdH
21460 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21461 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21462 }
21463 \savedanchor{\southeast}{%
21464 \pgf@circ@ieeestd@stdH
21465 \pgf@circ@res@up=\pgf@circ@res@temp
21466 \pgf@circ@find@ieeeport@not@right{#2}
21467 \pgf@x=\pgf@circ@res@right
21468 \pgf@y=-\pgf@circ@res@up
21469 }
21470 \savedanchor{\northeast}{%
21471 \pgf@circ@ieeestd@stdH
21472 \pgf@circ@res@up=\pgf@circ@res@temp
21473 \pgf@circ@find@ieeeport@not@right{#2}
21474 \pgf@x=\pgf@circ@res@right
21475 \pgf@y=\pgf@circ@res@up
21476 }
21477 \anchor{center}{\pgfpointorigin}
21478 \anchor{text}{
21479 \ifpgf@circ@center@text
21480 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21481 \else
21482 \pgf@circ@ieeestd@stdH
21483 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21484 \fi
21485 }
21486 % input anchors
21487 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21488 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21489 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
21490 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
21491 % output anchors
21492 \anchor{out}{%
21493 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
21494 \advance\pgf@circ@res@other by\pinlen
21495 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
21496 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
21497 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
21498 \fi
21499 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
21500 }
21501 \anchor{bout}{\bottomright\pgf@y=0pt}
21502
21503 \anchor{body right}{\bodyright\pgf@y=0pt}
21504 \anchor{right}{\bottomright\pgf@y=0pt}
21505 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
21506 \anchor{left}{\bodyleft\pgf@y=0pt}
21507 \anchor{up}{%
21508 \bodyleft
21509 \pgf@y=+0.5\pgf@y\pgf@x=0pt
21510 }
21511 \anchor{down}{%
21512 \bodyleft
21513 \pgf@y=-0.5\pgf@y\pgf@x=0pt
21514 }
21515 % this is for when it's used as a bipole
21516 % we use the enclosing rectangle (see below)
21517 \anchorborder{%
21518 %% This (commented out) is the correct border anchor. But if we use the correct
21519 %% border anchor there is no horizontal space for the label ;-) because
21520 %% the triangle is too steep. So we will use a simple square border
21521 %%
21522 %% find the border anchor of a triangle (like a not port or an
21523 %% amplifier) ---
21524 %%
21525 %% -----^ up
21526 %% I --- |
21527 %% I -|--
21528 %%left I | --- right
21529 %% ----I-----|-------I-----
21530 %%
21531 %%
21532 %\pgf@xa=\pgf@x
21533 %% it's simmetrical w/ vertical side, use only positive y
21534 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
21535 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
21536 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
21537 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
21538 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
21539 %% limit angle for the left (vertical) side
21540 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
21541 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
21542 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
21543 %% find the border
21544 %\ifnum\@@leftside>0
21545 % % vertical side
21546 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21547 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21548 %\else
21549 % % triangle upper line
21550 % \pgfpointintersectionoflines
21551 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
21552 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
21553 %\fi
21554 %% readjust y sign
21555 %\pgf@y=\@@switchy\pgf@y
21556 %
21557 % this is the square border to position the path label with a bit of horizontal space
21558 %
21559 \pgf@xa=\pgf@x
21560 \pgf@ya=\pgf@y
21561 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21562 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21563 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21564 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21565 }
21566 % geographical anchors
21567 \anchor{nw}{\northwest}
21568 \anchor{ne}{\northeast}
21569 \anchor{se}{\southeast}
21570 \anchor{sw}{\southwest}
21571 \anchor{north west}{\northwest}
21572 \anchor{north east}{\northeast}
21573 \anchor{south east}{\southeast}
21574 \anchor{south west}{\southwest}
21575 % over 0,0 even if asymmetric
21576 % will break if the geocoords are not rectangular
21577 \anchor{n}{\northwest\pgf@x=0pt\relax}
21578 \anchor{e}{\northeast\pgf@y=0pt\relax}
21579 \anchor{s}{\southwest\pgf@x=0pt\relax}
21580 \anchor{w}{\northwest\pgf@y=0pt\relax}
21581 \anchor{north}{\northwest\pgf@x=0pt\relax}
21582 \anchor{east}{\northeast\pgf@y=0pt\relax}
21583 \anchor{south}{\southwest\pgf@x=0pt\relax}
21584 \anchor{west}{\northwest\pgf@y=0pt\relax}
21585
21586 \backgroundpath{
21587 \pgfscope
21588 \pgfsetcolor{\ctikzvalof{color}}
21589 #3
21590 \endpgfscope
21591 % output lead:
21592 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
21593 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
21594 \advance\pgf@circ@res@other by \pinlen\relax
21595 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
21596 \ifpgfcirc@draw@output@leads
21597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
21599 \pgfusepath{draw}
21600 \fi
21601 \fi
21602 \ifnum #2=1\relax\pgfscope
21603 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
21604 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
21605 \endpgfscope\fi
21606 }
21607 }
21608 }
21609
21610 %%% #1 direct name #2 negated name #3 drawing (without output)
21611 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
21612 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
21613 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
21614 }
21615
21616 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
21617 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21618 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21619 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21620 % \draw input pin
21621 \ifpgfcirc@draw@input@leads
21622 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21623 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21624 \pgfusepath{draw}
21625 \fi
21626 \pgfscope
21627 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21628 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21629 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21630 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21631 \pgfpathclose
21632 \pgf@circ@draworfill
21633 \endpgfscope
21634 }
21635
21636 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
21637 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21638 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21639 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21640 % \draw input pin
21641 \ifpgfcirc@draw@input@leads
21642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21643 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21644 \pgfusepath{draw}
21645 \fi
21646 \pgfscope
21647 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21651 \pgfpathclose
21652 \pgf@circ@draworfill
21653 \endpgfscope
21654 % draw schmitt symbol in normal line thickness
21655 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21656 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21657 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21658 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21659 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21660 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21661 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21662 \pgfusepath{draw}
21663 }
21664
21665
21666 \pgfdeclareshape{schmitt symbol}{
21667 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21668 \anchor{center}{\pgfpointorigin}
21669 \savedanchor\northwest{%
21670 \pgf@circ@ieeestd@stdH
21671 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
21672 \pgf@x=-1.5\pgf@y
21673 }
21674 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
21675 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21676 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
21677 \anchor{west}{\northwest\pgf@y=0pt}
21678 \anchor{w}{\northwest \pgf@y=0pt}
21679 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
21680 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
21681 \anchor{north}{\northwest\pgf@x=0pt}
21682 \anchor{n}{\northwest\pgf@x=0pt}
21683 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
21684 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
21685 \anchor{north west}{\northwest}
21686 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21687 \backgroundpath{
21688 \pgfscope
21689 \pgfsetcolor{\ctikzvalof{color}}
21690 \pgfextractx{\pgf@circ@res@left}{\northwest}
21691 \pgfextracty{\pgf@circ@res@up}{\northwest}
21692 \pgf@circ@res@left=0.7\pgf@circ@res@left
21693 \pgf@circ@res@up=0.7\pgf@circ@res@up
21694 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21695 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
21696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
21697 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21698 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
21699 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
21700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21701 \pgfusepath{draw}
21702 \endpgfscope
21703 }
21704 }
21705
21706 \pgfdeclareshape{notcirc}{
21707 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21708 \anchor{center}{\pgfpointorigin}
21709 \savedanchor\northwest{%
21710 \pgf@circ@notradius
21711 \pgf@y=\pgf@circ@res@temp
21712 \pgf@x=-\pgf@y
21713 }
21714 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
21715 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21716 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21717 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
21718 \anchor{left}{\northwest\pgf@y=0pt}
21719 \anchor{west}{\northwest\pgf@y=0pt}
21720 \anchor{w}{\northwest \pgf@y=0pt}
21721 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
21722 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
21723 \anchor{north}{\northwest\pgf@x=0pt}
21724 \anchor{n}{\northwest\pgf@x=0pt}
21725 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
21726 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
21727 \anchor{north west}{\northwest}
21728 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21729 \anchorborder{
21730 \pgf@circ@res@left=\pgf@x
21731 \pgf@circ@res@up=\pgf@y
21732 \northwest\pgf@circ@res@temp=\pgf@y
21733 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
21734 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
21735 }
21736 \behindforegroundpath{
21737 \pgfscope
21738 \northwest\pgf@circ@res@temp=\pgf@y
21739 \pgfsetcolor{\ctikzvalof{color}}
21740 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21741 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
21742 \ifx\tikz@fillcolor\pgfutil@empty
21743 % set the default fill color to white
21744 \pgfsetfillcolor{white}
21745 % ...but override it if the class is defined!
21746 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
21747 \else
21748 \pgfsetfillcolor{\tikz@fillcolor}
21749 \fi
21750 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
21751 \pgfusepath{draw,fill}
21752 \endpgfscope
21753 }
21754 }
21755
21756 %%%% Transmission gates
21757 % tgates are only ieee style for now
21758 \tikzset{%
21759 tgate/.style ={shape=ieee tgate},
21760 double tgate/.style ={shape=ieee double tgate},
21761 }
21762 \ctikzset{tgate scale/.initial=0.7}
21763 % Buffer and inverters
21764 %
21765 % #1: name
21766 % #2: 1: one-not, 2:double-not
21767 % #3: content
21768 \long\def\pgfcircdeclareieeetgate#1#2#3{%
21769 \pgfdeclareshape{ieee #1}%
21770 {%
21771 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21772 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21773 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21774 \saveddimen{\baselen}{%
21775 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
21776 }
21777 \saveddimen{\stdH}{% This is HALF the height of the inner port
21778 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
21779 }
21780 \saveddimen{\notdiameter}{
21781 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
21782 }
21783 \saveddimen{\notradius}{
21784 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
21785 }
21786 \saveddimen{\pinlen}{%
21787 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
21788 }
21789 % anchors for the body (no pins included here)
21790 % Notice that 0.8660254 is cos(30)
21791 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
21792 \pgf@circ@ieeestd@stdH
21793 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21794 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21795 }
21796 \savedanchor{\topleft}{%
21797 \pgf@circ@ieeestd@stdH
21798 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21799 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21800 }
21801 \savedanchor{\bodyright}{%
21802 \pgf@circ@ieeestd@stdH
21803 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21804 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21805 }
21806 \savedanchor{\bottomright}{% Here it is the same as \bodyright
21807 \pgf@circ@ieeestd@stdH
21808 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21809 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21810 }
21811 % geographical anchors --- must be rectangulars!
21812 \savedanchor{\northwest}{%
21813 \pgf@circ@ieeestd@stdH
21814 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21815 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21816 }
21817 \savedanchor{\southwest}{%
21818 \pgf@circ@ieeestd@stdH
21819 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21820 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21821 }
21822 \savedanchor{\southeast}{%
21823 \pgf@circ@ieeestd@stdH
21824 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21825 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21826 }
21827 \savedanchor{\northeast}{%
21828 \pgf@circ@ieeestd@stdH
21829 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21830 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21831 }
21832 \anchor{center}{\pgfpointorigin}
21833 \anchor{text}{
21834 \ifpgf@circ@center@text
21835 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21836 \else
21837 \pgf@circ@ieeestd@stdH
21838 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21839 \fi
21840 }
21841 % input anchors
21842 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21843 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21844 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
21845 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
21846 % gates
21847 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
21848 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
21849 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21850 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
21851 % gate (up) (2.1547 = 1+1/cos(30)
21852 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21853 \pgf@x=0pt\relax
21854 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
21855 \ifdim\pinlen>\pgf@circ@res@temp
21856 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
21857 \else
21858 \pgf@y=\pgf@circ@res@temp
21859 \fi
21860 }
21861 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21862 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
21863
21864 % output anchors
21865 \anchor{out}{%
21866 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
21867 \advance\pgf@circ@res@other by\pinlen
21868 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
21869 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
21870 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
21871 \fi
21872 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
21873 }
21874 \anchor{bout}{\bottomright\pgf@y=0pt}
21875
21876 \anchor{body right}{\bodyright\pgf@y=0pt}
21877 \anchor{right}{\bottomright\pgf@y=0pt}
21878 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
21879 \anchor{left}{\bodyleft\pgf@y=0pt}
21880 \anchor{up}{%
21881 \bodyleft
21882 \pgf@x=0pt
21883 \ifnum#2=1\relax
21884 \pgf@y=0pt
21885 \else
21886 \pgf@y=.5\pgf@y
21887 \fi
21888 \advance\pgf@y by \notdiameter
21889 }
21890 \anchor{down}{%
21891 \bodyleft
21892 \pgf@x=0pt
21893 \ifnum#2=1\relax
21894 \pgf@y=0pt
21895 \else
21896 \pgf@y=-.5\pgf@y
21897 \fi
21898 }
21899 % this is for when it's used as a bipole
21900 % we use the enclosing rectangle (see below)
21901 \anchorborder{%
21902 %
21903 % this is the square border to position the path label with a bit of horizontal space
21904 %
21905 \pgf@xa=\pgf@x
21906 \pgf@ya=\pgf@y
21907 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21908 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21909 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21910 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21911 }
21912 % geographical anchors
21913 \anchor{nw}{\northwest}
21914 \anchor{ne}{\northeast}
21915 \anchor{se}{\southeast}
21916 \anchor{sw}{\southwest}
21917 \anchor{north west}{\northwest}
21918 \anchor{north east}{\northeast}
21919 \anchor{south east}{\southeast}
21920 \anchor{south west}{\southwest}
21921 % over 0,0 even if asymmetric
21922 % will break if the geocoords are not rectangular
21923 \anchor{n}{\northwest\pgf@x=0pt\relax}
21924 \anchor{e}{\northeast\pgf@y=0pt\relax}
21925 \anchor{s}{\southwest\pgf@x=0pt\relax}
21926 \anchor{w}{\northwest\pgf@y=0pt\relax}
21927 \anchor{north}{\northwest\pgf@x=0pt\relax}
21928 \anchor{east}{\northeast\pgf@y=0pt\relax}
21929 \anchor{south}{\southwest\pgf@x=0pt\relax}
21930 \anchor{west}{\northwest\pgf@y=0pt\relax}
21931
21932 \backgroundpath{
21933 \pgfscope
21934 \pgfsetcolor{\ctikzvalof{color}}
21935 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21936 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21937 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21938 % \draw input pins
21939 \ifpgfcirc@draw@input@leads
21940 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21941 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21942 % gate (down)
21943 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
21944 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
21945 % gate (up) (2.1547 = 1+1/cos(30)
21946 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
21947 \ifdim\pinlen>\pgf@circ@res@temp
21948 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
21949 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
21950 \fi
21951 \pgfusepath{draw}
21952 \fi
21953 #3
21954 \endpgfscope
21955 % output lead:
21956 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
21957 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
21958 \advance\pgf@circ@res@other by \pinlen\relax
21959 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
21960 \ifpgfcirc@draw@output@leads
21961 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21962 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
21963 \pgfusepath{draw}
21964 \fi
21965 \fi
21966 }
21967 }
21968 }
21969
21970 \pgfcircdeclareieeetgate{tgate}{1}{%
21971 \pgfscope
21972 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21973 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21974 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
21975 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21976 \pgfpathclose
21977 \pgf@circ@draworfill
21978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21979 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
21980 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
21981 \pgfpathclose
21982 \pgf@circ@draworfill
21983 \endpgfscope
21984 \pgfscope
21985 % 1.1547 is 1/cos(30)
21986 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
21987 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
21988 \endpgfscope
21989 }
21990
21991 \pgfcircdeclareieeetgate{double tgate}{2}{%
21992 \pgfscope
21993 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21994 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21995 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
21996 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21997 \pgfpathclose
21998 \pgf@circ@draworfill
21999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
22000 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
22001 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
22002 \pgfpathclose
22003 \pgf@circ@draworfill
22004 % bottom triangles
22005 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
22006 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
22007 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
22008 \pgfpathclose
22009 \pgf@circ@draworfill
22010 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
22011 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
22012 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
22013 \pgfpathclose
22014 \pgf@circ@draworfill
22015 \endpgfscope
22016 \pgfscope
22017 % 1.1547 is 1/cos(30)
22018 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
22019 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
22020 \endpgfscope
22021 }
22022
22023 %%%---------- close: tex/pgfcircmultipoles
22024
22025 %%%%%%%%%%% Springe nach tex/pgfcirclabel
22026 %%%---------- open: tex/pgfcirclabel.tex
22027 % Copyright 2018-2026 by Romano Giannetti
22028 % Copyright 2015-2026 by Stefan Lindner
22029 % Copyright 2013-2026 by Stefan Erhardt
22030 % Copyright 2007-2026 by Massimo Redaelli
22031 %
22032 % This file may be distributed and/or modified
22033 %
22034 % 1. under the LaTeX Project Public License and/or
22035 % 2. under the GNU Public License.
22036 %
22037 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22038
22039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22040 %% Bipole label positioning
22041
22042 %% bipole labels and annotation extra style
22043
22044 \ctikzset{bipole label style/.style={}}
22045 \tikzset{bipole label style/.code={
22046 \ctikzset{bipole label style/.style={#1}}
22047 }}
22048 \tikzset{bipole label append style/.code={
22049 \ctikzset{bipole label style/.append style={#1}}
22050 }}
22051 \ctikzset{bipole annotation style/.style={}}
22052 \tikzset{bipole annotation style/.code={
22053 \ctikzset{bipole annotation style/.style={#1}}
22054 }}
22055 \tikzset{bipole annotation append style/.code={
22056 \ctikzset{bipole annotation style/.append style={#1}}
22057 }}
22058
22059 %% Options
22060 \ctikzset{label/.style = { l=#1 } }
22061 \ctikzset{l/.code = {
22062 \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
22063 \ctikzsetvalof{bipole/label/unit}{}
22064 \ifpgf@circ@siunitx
22065 \pgf@circ@handleSI{#1}
22066 \ifpgf@circ@siunitx@res
22067 \edef\pgf@temp{\pgf@circ@handleSI@val}
22068 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
22069 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22070 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
22071 \else
22072 \fi
22073 \else
22074 \fi
22075 }}
22076
22077 \ctikzset{label above/.code = {
22078 l=#1,
22079 \circuitikzbasekey/bipole/label/position=90 }
22080 }
22081
22082 \ctikzset{l^/.style = {
22083 l=#1,
22084 \circuitikzbasekey/bipole/label/position=90 }
22085 }
22086
22087 \ctikzset{label below/.code = {
22088 l=#1,
22089 \circuitikzbasekey/bipole/label/position=-90 }
22090 }
22091
22092 \ctikzset{l_/.style = {
22093 l=#1,
22094 \circuitikzbasekey/bipole/label/position=-90 }
22095 }
22096
22097 \ctikzset{annotation/.style = { a=#1 } }
22098 \ctikzset{a/.code = {
22099 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
22100 \ctikzsetvalof{bipole/annotation/unit}{}
22101 \ifpgf@circ@siunitx
22102 \pgf@circ@handleSI{#1}
22103 \ifpgf@circ@siunitx@res
22104 \edef\pgf@temp{\pgf@circ@handleSI@val}
22105 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
22106 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22107 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
22108 \else
22109 \fi
22110 \else
22111 \fi
22112 }}
22113
22114 \ctikzset{annotation above/.code = {
22115 a=#1,
22116 \circuitikzbasekey/bipole/annotation/position=90 }
22117 }
22118
22119 \ctikzset{a^/.style = {
22120 a=#1,
22121 \circuitikzbasekey/bipole/annotation/position=90 }
22122 }
22123
22124 \ctikzset{annotation below/.code = {
22125 a=#1,
22126 \circuitikzbasekey/bipole/annotation/position=-90 }
22127 }
22128 \ctikzset{a_/.style = {
22129 a=#1,
22130 \circuitikzbasekey/bipole/annotation/position=-90 }
22131 }
22132
22133 % This is to adjust spacing for the labels so that they are not cramped on components
22134 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
22135
22136 \def\pgf@circ@drawlabels#1{
22137 \pgfextra{
22138 % This function will be called with argument #1 equal
22139 % to "label" or "annotation" form pgfcircpath.tex.
22140 % pgf@circ@direction is the direction of the path,
22141 % its value is set in pgfcircpath.tex
22142 \pgfmathsubtract{\pgf@circ@direction}{90}
22143 \pgfmathround{\pgfmathresult} % avoid precision loss errors
22144 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22145
22146 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
22147 \ifnum \pgf@circ@temp < 0
22148 \pgfmathadd{\pgf@circ@labanc}{180}
22149 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22150 \fi
22151 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
22152 %
22153 % normalize the angle values
22154 %
22155 \pgfmathmod{\pgf@circ@labanc}{360}
22156 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22157 %
22158 \ifpgf@circuit@bipole@inverted
22159 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
22160 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22161 \fi
22162 %
22163 \ifnum \ctikzvalof{mirror value} = -1
22164 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
22165 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22166 \fi
22167 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
22168 }
22169 %Firstly, place a coordinate directly at the edge of the shape
22170 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
22171 %now decide, which labels should be drawn
22172 \pgfextra{
22173 \edef\pgf@temp{\ctikzvalof{label/align}}
22174 \def\pgf@circ@temp{straight}
22175 }
22176 \ifx\pgf@temp\pgf@circ@temp %straight
22177 \pgf@circ@drawreglabels{#1}
22178 \else
22179 \pgfextra{\def\pgf@circ@temp{rotate}}
22180 \ifx\pgf@temp\pgf@circ@temp %rotate
22181 \pgf@circ@drawrotlabels{#1}
22182 \else% smart
22183 \pgf@circ@drawsmartlabels{#1}
22184 \fi
22185 \fi
22186 }
22187
22188
22189 \def\pgf@circ@drawsmartlabels#1{
22190 \pgfextra{
22191 \pgfmathmod{\pgf@circ@direction}{90}
22192 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22193 }
22194 \ifnum \pgfcircmathresult > 20
22195 \ifnum \pgfcircmathresult < 70
22196 \pgf@circ@drawrotlabels{#1}
22197 \else
22198 \pgf@circ@drawreglabels{#1}
22199 \fi
22200 \else
22201 \pgf@circ@drawreglabels{#1}
22202 \fi
22203 }
22204
22205
22206 \def\pgf@circ@drawrotlabels#1{
22207 \pgfextra{
22208 % scale the distances in function of zoom, so that they are not
22209 % dependent on it but on font size. Thanks to @marmot
22210 % https://tex.stackexchange.com/a/476018/38080
22211 % the coeffcient is adjusted so that the distance is more or less
22212 % the same for rotated labels and straight ones (although it will
22213 % depend on the font, so it's not exact).
22214 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
22215 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
22216 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
22217 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale}
22218 \ifnum \ctikzvalof{bipole/#1/position}>0
22219 %we need some more space for placement below, due to mid-anchor
22220 \else % we do not have <= in \ifnum...
22221 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
22222 \fi
22223 %Calculate rotation of the label from direction and strip decimals
22224 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
22225 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
22226 % rotate the label at second or third quadrant:
22227 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
22228 \pgfmathsubtract{\pgf@circ@direction}{180}
22229 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22230 %invert the space relationships due to rotated strings
22231 \ifnum \ctikzvalof{bipole/#1/position}>0
22232 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
22233 \fi
22234 \fi\fi
22235 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
22236 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
22237 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
22238 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
22239 }
22240 % reset cm is not working correctly here
22241 (pgfcirc@labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22242 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
22243 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
22244 }
22245
22246 \def\pgf@circ@drawreglabels#1{
22247 %Now calculate all shape positions
22248 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
22249 %All points between will be addressed by angled-anchors:
22250 \pgfextra{
22251 % scale ex-distance to make it independent on scale
22252 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
22253 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
22254 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
22255 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
22256 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale}
22257 \pgfmathadd{\pgf@circ@labanc}{90}
22258 \pgfmathround{\pgfmathresult}
22259 \def\pgf@circ@labanctext{\pgf@circ@labanc}
22260 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22261 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
22262 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22263 }
22264 %Values around 90 are at both y-axis
22265 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
22266 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
22267 \ifnum \pgf@circ@labpos > 180
22268 \ifnum \ctikzvalof{bipole/#1/position} > 0
22269 \pgfextra{\def\pgf@circ@labanctext{mid west}}
22270 \else
22271 \pgfextra{\def\pgf@circ@labanctext{mid east}}
22272 \fi
22273 \else
22274 \ifnum \ctikzvalof{bipole/#1/position} > 0
22275 \pgfextra{\def\pgf@circ@labanctext{mid east}}
22276 \else
22277 \pgfextra{\def\pgf@circ@labanctext{mid west}}
22278 \fi
22279 \fi
22280 \fi\fi
22281 %Values between -5 and 5 are at pos /neg x-axis
22282 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
22283 \ifnum \ctikzvalof{bipole/#1/position} < 0
22284 \ifnum \pgf@circ@labanc > 90
22285 % using base coordinate instead of south to naturally align
22286 % symbols with descendants; but this invalidate the effect of
22287 % the inner sep, so recover it by shifting the anchor
22288 % reset cm is not working sometime, use @marmot solution
22289 % see https://tex.stackexchange.com/a/476018/38080
22290 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22291 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22292 \else
22293 \pgfextra{\def\pgf@circ@labanctext{north}}%north
22294 \fi
22295 \else
22296 \ifnum \pgf@circ@labanc < 90
22297 % shift, as above
22298 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22299 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22300 \else
22301 \ifnum \pgf@circ@labanc > 180
22302 % this shouldn't happen, but somehow it does (270 degree anchors)
22303 % shift, as above
22304 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22305 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22306 \else
22307 \pgfextra{\def\pgf@circ@labanctext{north}}%north
22308 \fi
22309 \fi
22310 \fi
22311 \fi\fi
22312 \pgfextra{%
22313 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
22314 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
22315 }
22316 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
22317 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
22318 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
22319 }
22320 }
22321
22322 \def\pgf@circ@finallabels#1{%
22323 \edef\pgf@temp{}%
22324 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
22325 \ifx\pgf@temp\pgf@circ@temp%
22326 \ctikzvalof{bipole/#1/name}%
22327 \else%
22328 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
22329 \fi%
22330 }
22331
22332
22333 %%%% Stacked labels
22334 %
22335 % stacked labels by Romano Giannetti [email protected]
22336 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
22337 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
22338 %
22339 % labels are in a tabular, globally aligned:
22340 % vertically with key l2 valign (default c)
22341 % c: center t: top b: bottom
22342 % horizontally with key l2 align (default l)
22343 % l: left c: centered r: right
22344 % you can switch sides using l2_=... and l2^=...
22345 % syntax is l2_ = line1 and line2 (same for l2^)
22346 %
22347 \ctikzset{%
22348 l2 valign/.store in=\ltwo@valign, l2 valign=c,
22349 l2 halign/.store in=\ltwo@halign, l2 halign=l,
22350 }
22351 \ctikzset{l2base/.code n args={2}{
22352 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
22353 \bgroup
22354 \setlength{\tabcolsep}{2pt}%
22355 \def\ltwo@tabu{\tabular[\ltwo@valign]}%
22356 \expandafter\ltwo@tabu\expandafter{\ltwo@halign}%
22357 #1\\ #2%
22358 \endtabular
22359 \egroup
22360 }%
22361 \ctikzsetvalof{bipole/label/unit}{}
22362 \ifpgf@circ@siunitx
22363 \pgf@circ@handleSI{#2}
22364 \ifpgf@circ@siunitx@res
22365 \edef\pgf@temp{\pgf@circ@handleSI@val}
22366 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
22367 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22368 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
22369 \else
22370 \fi
22371 \else
22372 \fi
22373 }}
22374 \ctikzset{l2/.style args={#1 and #2}{
22375 l2base={#1}{#2},
22376 \circuitikzbasekey/bipole/label/position=90 }
22377 }
22378 \ctikzset{l2 above/.style args={#1 and #2}{
22379 l2base={#1}{#2},
22380 \circuitikzbasekey/bipole/label/position=90 }
22381 }
22382 \ctikzset{l2^/.style args={#1 and #2}{
22383 l2base={#1}{#2},
22384 \circuitikzbasekey/bipole/label/position=90 }
22385 }
22386 \ctikzset{l2 below/.style args={#1 and #2}{
22387 l2base={#1}{#2},
22388 \circuitikzbasekey/bipole/label/position=-90 }
22389 }
22390 \ctikzset{l2_/.style args={#1 and #2}{
22391 l2base={#1}{#2},
22392 \circuitikzbasekey/bipole/label/position=-90 }
22393 }
22394
22395 %%%---------- close: tex/pgfcirclabel
22396 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
22397 %%%---------- open: tex/pgfcircvoltage.tex
22398 % Copyright 2018-2026 by Romano Giannetti
22399 % Copyright 2015-2026 by Stefan Lindner
22400 % Copyright 2013-2026 by Stefan Erhardt
22401 % Copyright 2007-2026 by Massimo Redaelli
22402 %
22403 % This file may be distributed and/or modified
22404 %
22405 % 1. under the LaTeX Project Public License and/or
22406 % 2. under the GNU Public License.
22407 %
22408 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22409
22410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22411 %% Voltage management
22412
22413 %% styles
22414 \ctikzset{bipole voltage style/.style={}}
22415 \tikzset{bipole voltage style/.code={
22416 \ctikzset{bipole voltage style/.style={#1}}
22417 }}
22418 \tikzset{bipole voltage append style/.code={
22419 \ctikzset{bipole voltage style/.append style={#1}}
22420 }}
22421
22422 \ctikzset{v^>/.style = {
22423 v = #1,
22424 \circuitikzbasekey/bipole/voltage/direction = forward,
22425 \circuitikzbasekey/bipole/voltage/position = above
22426 }
22427 }
22428
22429 \ctikzset{v^</.style = {
22430 v = #1,
22431 \circuitikzbasekey/bipole/voltage/direction = backward,
22432 \circuitikzbasekey/bipole/voltage/position = above
22433 }
22434 }
22435
22436 \ctikzset{v_>/.style = {
22437 v = #1,
22438 \circuitikzbasekey/bipole/voltage/direction = forward,
22439 \circuitikzbasekey/bipole/voltage/position = below
22440 }
22441 }
22442
22443 \ctikzset{v_</.style = {
22444 v = #1,
22445 \circuitikzbasekey/bipole/voltage/direction = backward,
22446 \circuitikzbasekey/bipole/voltage/position = below
22447 }
22448 }
22449
22450 \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
22451 \ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
22452 \ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
22453 \ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
22454
22455 % Default position varies whether the component is a voltage source
22456 % or not
22457 \ctikzset{v/.code = {
22458 \pgfcirc@has@vtrue
22459 \ifpgf@circuit@bipole@isvoltage
22460 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
22461 \circuitikzbasekey/bipole/voltage/direction=forward}
22462 \else
22463 \ifpgf@circ@oldvoltagedirection
22464 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22465 \circuitikzbasekey/bipole/voltage/direction=backward}
22466 \else
22467 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22468 \circuitikzbasekey/bipole/voltage/direction=forward}
22469 \fi
22470 \fi
22471 \ifpgf@circ@oldvoltagedirection
22472 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
22473 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22474 \circuitikzbasekey/bipole/voltage/direction=forward}
22475 \fi\fi
22476 \else
22477 \ifpgf@circuit@bipole@iscurrent
22478 \ifpgf@circuit@bipole@current@backward
22479 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22480 \circuitikzbasekey/bipole/voltage/direction=forward}
22481 \else
22482 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22483 \circuitikzbasekey/bipole/voltage/direction=backward}
22484 \fi\fi\fi
22485 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
22486 \ctikzsetvalof{bipole/voltage/label/unit}{}
22487 \ifpgf@circ@siunitx
22488 \pgf@circ@handleSI{#1}
22489 \ifpgf@circ@siunitx@res
22490 \edef\pgf@temp{\pgf@circ@handleSI@val}
22491 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
22492 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22493 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
22494 \else
22495 \fi
22496 \else
22497 \fi
22498 }
22499 }
22500
22501 % american voltage font selection and symbol definition
22502 % the default font command is {} --- nothing
22503 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
22504 %
22505 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
22506 %
22507 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
22508 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
22509
22510 %%
22511 \def\setscaledRlenforclass{%
22512 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
22513 \ifdefined\ctikzclass
22514 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
22515 \pgfkeysifdefined{\pgf@temp}
22516 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22517 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
22518 \else
22519 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
22520 \fi
22521 }
22522
22523 %% Output routine for generic bipoles
22524 % put this to true to see the voltage label coordinate anchors
22525 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
22526
22527 \def\pgf@circ@drawvoltagegeneric{
22528 \pgfextra{
22529 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
22530 \ifnum \ctikzvalof{mirror value}=-1
22531 \ifpgf@circuit@bipole@inverted
22532 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22533 \else
22534 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22535 \fi
22536 \else
22537 \ifpgf@circuit@bipole@inverted
22538 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22539 \else
22540 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22541 \fi
22542 \fi
22543 \ifpgf@circuit@bipole@voltage@below
22544 \def\pgf@circ@voltage@angle{90}
22545 \else
22546 \def\pgf@circ@voltage@angle{-90}
22547 \fi
22548 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
22549 \pgfkeysifdefined{\pgf@temp}
22550 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
22551 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
22552 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
22553 \pgfkeysifdefined{\pgf@temp}
22554 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
22555 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
22556 \edef\shiftv{\ctikzvalof{voltage/shift}}
22557 % additional per-bipole voltage shift (internal)
22558 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
22559 \pgfkeysifdefined{\pgf@temp}
22560 {
22561 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
22562 }
22563 {
22564 \edef\addvshift{0}
22565 }
22566 \newdimen{\absvshift}
22567 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
22568 % reset anchor if american and open
22569 \ifpgf@circuit@europeanvoltage
22570 \else
22571 \ifx\@@kind\@@open
22572 \def\pgf@circ@bipole@voltage@label@anchor{center}
22573 \fi
22574 \fi
22575 \ifpgf@circuit@bipole@voltage@raised
22576 \def\pgf@circ@bipole@voltage@label@anchor{center}
22577 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
22578 \fi
22579 }
22580 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
22581 %absolute move, minimum space is length of arrowhead
22582 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
22583 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
22584 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
22585 %absolute move, minimum space is length of arrowhead
22586 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
22587 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
22588 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
22589 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
22590
22591 \ifpgf@circuit@bipole@voltage@below
22592 % see comments for the "above" part (similar)
22593 \ifpgf@circuit@europeanvoltage
22594 \ifpgf@circuit@bipole@voltage@straight
22595 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
22596 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
22597 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
22598 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
22599 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
22600 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22601 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22602 \else
22603 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
22604 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
22605 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
22606 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
22607 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
22608 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
22609 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
22610 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
22611 \fi
22612 \else
22613 % we are in case of american here
22614 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
22615 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
22616 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
22617 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
22618 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
22619 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
22620 \ifpgf@circuit@bipole@voltage@raised
22621 % move the from and to up to the level of Vlab
22622 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
22623 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
22624 \fi
22625 \fi
22626 \else
22627 \ifpgf@circuit@europeanvoltage
22628 \ifpgf@circuit@bipole@voltage@straight
22629 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
22630 % move parallel to the component line at pgfcirc@top distance
22631 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
22632 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
22633 % add the extra distance
22634 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
22635 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
22636 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22637 % direction line to shift the label later
22638 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22639 \else
22640 % european voltages here
22641 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
22642 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
22643 % identify the two control points for the "arc" of the voltage
22644 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
22645 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
22646 % and shift them a bit
22647 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
22648 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
22649 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
22650 % direction line to shift the label later
22651 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
22652 \fi
22653 \else
22654 % we are in case of american here
22655 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
22656 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
22657 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
22658 % move parallel to the component line
22659 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
22660 % and add the extra distance
22661 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
22662 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
22663 \ifpgf@circuit@bipole@voltage@raised
22664 % move the from and to up to the level of Vlab
22665 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
22666 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
22667 \fi
22668 \fi
22669 \fi
22670 \ifx\@@kind\@@open
22671 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
22672 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
22673 \fi
22674 \ifpgf@circ@debugv
22675 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
22676 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
22677 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
22678 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
22679 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
22680 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
22681 \ifpgf@circuit@europeanvoltage
22682 \ifpgf@circuit@bipole@voltage@straight
22683 \else
22684 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
22685 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
22686 \fi
22687 \fi
22688 \fi
22689
22690 %
22691 % Now we draw the voltage things (only if not empty --- in which case we have been
22692 % called just to set the anchors)
22693 %
22694 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
22695 \ifpgf@circuit@europeanvoltage
22696 \ifpgf@circuit@bipole@voltage@straight
22697 \ifpgf@circuit@bipole@voltage@backward
22698 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
22699 \else
22700 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
22701 \fi
22702 \else
22703 \ifpgf@circuit@bipole@voltage@backward
22704 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
22705 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
22706 (\pgfcirc@a@prefix-Vfrom)
22707 \else
22708 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
22709 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
22710 (\pgfcirc@a@prefix-Vto)
22711 \fi
22712 \fi
22713 \else % american
22714 \ifpgf@circuit@bipole@voltage@backward
22715 \ifpgf@circ@oldvoltagedirection
22716 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22717 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22718 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22719 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22720 \else
22721 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22722 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22723 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22724 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22725 \fi
22726 \else
22727 \ifpgf@circ@oldvoltagedirection
22728 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22729 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22730 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22731 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22732 \else
22733 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22734 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22735 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22736 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22737 \fi
22738 \fi
22739 \fi
22740 \fi % Closing the ...ifempty
22741 }
22742
22743 %% Output routine for voltage sources
22744 \def\pgf@circ@drawvoltagegenerator{
22745 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
22746 % it's not perfect, but I can't find the way to do it correctly...
22747 \pgfextra{
22748 \edef\shiftv{\ctikzvalof{voltage/shift}}
22749 % distance along the 60-120 axis
22750 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
22751 \pgfkeysifdefined{\pgf@temp}
22752 {
22753 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
22754 }
22755 {
22756 \edef\bumpa{\ctikzvalof{voltage/bump a}}
22757 }
22758 % additional per-bipole voltage shift (internal)
22759 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
22760 \pgfkeysifdefined{\pgf@temp}
22761 {
22762 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
22763 }
22764 {
22765 \edef\addvshift{0}
22766 }
22767 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
22768 }
22769 \ifpgf@circuit@bipole@voltage@below
22770 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
22771 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
22772 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
22773 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
22774 \else
22775 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
22776 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
22777 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
22778 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
22779 \fi
22780 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22781 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22782 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
22783 \ifpgf@circuit@europeanvoltage
22784 \ifpgf@circuit@bipole@voltage@backward
22785 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
22786 \else
22787 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
22788 \fi
22789 \else% american voltage
22790 \ifpgf@circuit@bipole@voltageoutsideofsymbol
22791 % if it is a battery, must put + and -
22792
22793 \ifpgf@circ@fixbatteries
22794 \ifpgf@circuit@bipole@voltage@backward
22795 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22796 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22797 \else
22798 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22799 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22800 \fi
22801 \else
22802 \ifpgf@circuit@bipole@voltage@backward
22803 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22804 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22805 \else
22806 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22807 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22808 \fi
22809 \fi
22810 \fi
22811 \fi
22812 \fi % closes ...ifempty
22813 }
22814
22815 %% Output routine
22816 %% this is the entry point
22817 %%
22818 %% locally used dimensions
22819 \newdimen{\pgfcirc@labelshift}
22820 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
22821 \def\pgf@circ@drawvoltage{% node name
22822 \pgfextra{%
22823 % set the helper if...curved
22824 \ifpgf@circuit@europeanvoltage
22825 \ifpgf@circuit@bipole@voltage@straight
22826 \pgfcirc@v@curvedfalse
22827 \else
22828 \pgfcirc@v@curvedtrue
22829 \fi
22830 \else
22831 \pgfcirc@v@curvedfalse
22832 \fi
22833 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
22834 % Label anchors WARNING: indentation is probably wrong
22835 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
22836 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
22837 \ifpgf@circuit@bipole@voltage@below
22838 \def\pgf@circ@bipole@voltage@label@anchor{north west}
22839 \else
22840 \def\pgf@circ@bipole@voltage@label@anchor{south east}
22841 \fi
22842 \fi\fi
22843 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
22844 \ifpgf@circuit@bipole@voltage@below
22845 \def\pgf@circ@bipole@voltage@label@anchor{west}
22846 \else
22847 \def\pgf@circ@bipole@voltage@label@anchor{east}
22848 \fi
22849 \fi\fi
22850 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
22851 \ifpgf@circuit@bipole@voltage@below
22852 \def\pgf@circ@bipole@voltage@label@anchor{south west}
22853 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
22854 \fi
22855 \fi\fi
22856 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
22857 \ifpgf@circuit@bipole@voltage@below
22858 \def\pgf@circ@bipole@voltage@label@anchor{south}
22859 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
22860 \fi
22861 \fi\fi
22862 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
22863 \ifpgf@circuit@bipole@voltage@below
22864 \def\pgf@circ@bipole@voltage@label@anchor{south east}
22865 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
22866 \fi
22867 \fi\fi
22868 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
22869 \ifpgf@circuit@bipole@voltage@below
22870 \def\pgf@circ@bipole@voltage@label@anchor{east}
22871 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
22872 \fi
22873 \fi\fi
22874 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
22875 \ifpgf@circuit@bipole@voltage@below
22876 \def\pgf@circ@bipole@voltage@label@anchor{north east}
22877 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
22878 \fi
22879 \fi\fi
22880 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
22881 \ifpgf@circuit@bipole@voltage@below
22882 \def\pgf@circ@bipole@voltage@label@anchor{north}
22883 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
22884 \fi
22885 \fi\fi
22886 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
22887 \ifpgf@circuit@bipole@voltage@below
22888 \def\pgf@circ@bipole@voltage@label@anchor{north}
22889 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
22890 \fi
22891 \fi\fi
22892
22893 % export anchor position (if not needed, is always the same macro)
22894 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
22895 % this must be set *before* changing for mirroring and inverting; in that case
22896 % the xscale/yscale parameters take it into account
22897 \ifpgf@circuit@bipole@voltage@below
22898 \def\pgf@circ@bipole@voltage@label@where{-90}
22899 \else
22900 \def\pgf@circ@bipole@voltage@label@where{90}
22901 \fi
22902
22903 % magic to counteract the scale and yscale effects (there should be a better way...)
22904 \ifnum \ctikzvalof{mirror value}=-1
22905 \ifpgf@circuit@bipole@voltage@below
22906 \pgf@circuit@bipole@voltage@belowfalse
22907 \else
22908 \pgf@circuit@bipole@voltage@belowtrue
22909 \fi
22910 \fi
22911
22912 \ifpgf@circuit@bipole@inverted
22913 \ifpgf@circuit@bipole@voltage@below
22914 \pgf@circuit@bipole@voltage@belowfalse
22915 \else
22916 \pgf@circuit@bipole@voltage@belowtrue
22917 \fi
22918 \fi
22919
22920 % take into account scaling
22921 \setscaledRlenforclass
22922
22923 \ifpgf@circuit@europeanvoltage
22924 \ifpgf@circuit@bipole@voltage@straight
22925 % check for straight
22926 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
22927 \pgfkeysifdefined{\pgf@temp}{%
22928 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
22929 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
22930 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
22931 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
22932 \else
22933 % check for european
22934 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
22935 \pgfkeysifdefined{\pgf@temp}{%
22936 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
22937 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
22938 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
22939 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
22940 \fi
22941 \else
22942 % check for american
22943 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
22944 \pgfkeysifdefined{\pgf@temp}{%
22945 \ifpgf@circuit@bipole@voltage@raised
22946 % do not apply the shift if we are using raised american style
22947 \edef\labeldist{1.4}% default value
22948 \else
22949 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
22950 \fi
22951 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
22952 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
22953 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
22954 \fi
22955 % find the height of the bipole or use a default value
22956 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
22957 \pgfkeysifdefined{\pgf@temp}
22958 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
22959 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
22960 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
22961
22962 \ifpgf@circuit@bipole@isvoltage
22963 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
22964 \else
22965 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
22966 \fi
22967 % the value for the european was by default 1.4
22968 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
22969 % set the macro for detecting open
22970 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
22971 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
22972 % \typeout{KIND\space\@@kind}
22973 }%end pgfextra
22974
22975 \ifpgf@circuit@bipole@isvoltage
22976 \pgf@circ@drawvoltagegenerator
22977 % add fake cont1 and cont2 anchors for export
22978 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22979 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22980 \else
22981 \pgf@circ@drawvoltagegeneric
22982 \fi
22983 % % debugging
22984 % \pgfextra{%
22985 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
22986 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
22987 % \pgf@circ@debugvtrue}
22988
22989 % move a bit if requested
22990 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
22991
22992 % check for the case of american AND open
22993 \ifpgf@circuit@europeanvoltage
22994 \else
22995 \ifx\@@kind\@@open
22996 % override pgfcirc@Vlab
22997 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi
22998 \fi
22999
23000 \ifpgf@circ@debugv
23001 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
23002 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
23003 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
23004 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
23005 \fi
23006
23007 % put the node only if it's not empty
23008 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
23009 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
23010 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
23011 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
23012 \fi
23013
23014 \ifpgfcirc@v@curved\else
23015 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
23016 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
23017 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
23018 \fi
23019 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
23020 \ifpgf@circuit@bipole@voltage@backward
23021 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
23022 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
23023 \fi
23024
23025 }%end drawvoltages
23026 %%%---------- close: tex/pgfcircvoltage
23027 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
23028 %%%---------- open: tex/pgfcirccurrent.tex
23029 % Copyright 2018-2026 by Romano Giannetti
23030 % Copyright 2015-2026 by Stefan Lindner
23031 % Copyright 2013-2026 by Stefan Erhardt
23032 % Copyright 2007-2026 by Massimo Redaelli
23033 %
23034 % This file may be distributed and/or modified
23035 %
23036 % 1. under the LaTeX Project Public License and/or
23037 % 2. under the GNU Public License.
23038 %
23039 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
23040
23041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23042 %% Current handling
23043
23044 %% styles
23045 \ctikzset{bipole current style/.style={}}
23046 \tikzset{bipole current style/.code={
23047 \ctikzset{bipole current style/.style={#1}}
23048 }}
23049 \tikzset{bipole current append style/.code={
23050 \ctikzset{bipole current style/.append style={#1}}
23051 }}
23052
23053 %% Options
23054 \ctikzset{i^>/.style = {
23055 i = #1,
23056 \circuitikzbasekey/bipole/current/direction = forward,
23057 \circuitikzbasekey/bipole/current/x position = after,
23058 \circuitikzbasekey/bipole/current/y position = above
23059 }
23060 }
23061
23062 \ctikzset{i_>/.style = {
23063 i = #1,
23064 \circuitikzbasekey/bipole/current/direction = forward,
23065 \circuitikzbasekey/bipole/current/x position = after,
23066 \circuitikzbasekey/bipole/current/y position = below
23067 }
23068 }
23069
23070 \ctikzset{i>^/.style = {
23071 i = #1,
23072 \circuitikzbasekey/bipole/current/direction = forward,
23073 \circuitikzbasekey/bipole/current/x position = before,
23074 \circuitikzbasekey/bipole/current/y position = above
23075 }
23076 }
23077
23078 \ctikzset{i>_/.style = {
23079 i = #1,
23080 \circuitikzbasekey/bipole/current/direction = forward,
23081 \circuitikzbasekey/bipole/current/x position = before,
23082 \circuitikzbasekey/bipole/current/y position = below
23083 }
23084 }
23085
23086 \ctikzset{i^</.style = {
23087 i = #1,
23088 \circuitikzbasekey/bipole/current/direction = backward,
23089 \circuitikzbasekey/bipole/current/x position = after,
23090 \circuitikzbasekey/bipole/current/y position = above
23091 }
23092 }
23093
23094 \ctikzset{i_</.style = {
23095 i = #1,
23096 \circuitikzbasekey/bipole/current/direction = backward,
23097 \circuitikzbasekey/bipole/current/x position = after,
23098 \circuitikzbasekey/bipole/current/y position = below
23099 }
23100 }
23101
23102 \ctikzset{i<^/.style = {
23103 i = #1,
23104 \circuitikzbasekey/bipole/current/direction = backward,
23105 \circuitikzbasekey/bipole/current/x position = before,
23106 \circuitikzbasekey/bipole/current/y position = above
23107 }
23108 }
23109
23110 \ctikzset{i<_/.style = {
23111 i = #1,
23112 \circuitikzbasekey/bipole/current/direction = backward,
23113 \circuitikzbasekey/bipole/current/x position = before,
23114 \circuitikzbasekey/bipole/current/y position = below
23115 }
23116 }
23117
23118 \ctikzset{i/.code = {
23119 \pgfcirc@has@itrue
23120 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
23121 \circuitikzbasekey/bipole/current/x position = after,
23122 \circuitikzbasekey/bipole/current/y position = above }
23123 \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
23124 \ctikzsetvalof{bipole/current/label/unit}{}
23125 \ifpgf@circ@siunitx
23126 \pgf@circ@handleSI{#1}
23127 \ifpgf@circ@siunitx@res
23128 \edef\pgf@temp{\pgf@circ@handleSI@val}
23129 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
23130 \edef\pgf@temp{\pgf@circ@handleSI@unit}
23131 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
23132 \else
23133 \fi
23134 \else
23135 \fi
23136 %reverse current direction for voltage sources
23137 \ifpgf@circ@oldvoltagedirection\else
23138 \ifpgf@circuit@bipole@isvoltage
23139 \ifpgf@circuit@bipole@voltage@backward
23140 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
23141 \circuitikzbasekey/bipole/current/x position = after,
23142 \circuitikzbasekey/bipole/current/y position = below }
23143 \else
23144 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
23145 \circuitikzbasekey/bipole/current/x position = before,
23146 \circuitikzbasekey/bipole/current/y position = above }
23147 \fi\fi\fi
23148 }
23149 }
23150
23151 \ifpgf@circ@oldvoltagedirection
23152 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
23153 \else
23154 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
23155 \fi
23156 \ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
23157 \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
23158 \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
23159
23160 %% Output routine
23161 \def\pgf@circ@drawcurrent{
23162 \pgfextra{
23163 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
23164 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
23165
23166 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
23167 \ifpgf@circuit@bipole@current@below
23168 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
23169 \fi
23170 \fi\fi
23171 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
23172 \ifpgf@circuit@bipole@current@below
23173 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
23174 \fi
23175 \fi\fi
23176 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
23177 \ifpgf@circuit@bipole@current@below
23178 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
23179 \fi
23180 \fi\fi
23181 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
23182 \ifpgf@circuit@bipole@current@below
23183 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
23184 \fi
23185 \fi\fi
23186 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
23187 \ifpgf@circuit@bipole@current@below
23188 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
23189 \fi
23190 \fi\fi
23191 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
23192 \ifpgf@circuit@bipole@current@below
23193 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
23194 \fi
23195 \fi\fi
23196 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
23197 \ifpgf@circuit@bipole@current@below
23198 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
23199 \fi
23200 \fi\fi
23201 \ifnum\pgfcircmathresult <5
23202 \ifpgf@circuit@bipole@current@below
23203 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23204 \fi
23205 \fi
23206 \ifnum\pgfcircmathresult >355
23207 \ifpgf@circuit@bipole@current@below
23208 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23209 \fi
23210 \fi
23211 % export anchor position (if not needed, is always the same macro)
23212 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
23213
23214 \ifpgf@circuit@bipole@current@below
23215 \def\pgf@circ@bipole@current@label@where{-90}
23216 \else
23217 \def\pgf@circ@bipole@current@label@where{+90}
23218 \fi
23219 }
23220
23221 %
23222 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
23223 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
23224 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
23225 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
23226 \else% normal bipole or source
23227 \ifpgf@circuit@bipole@current@before
23228 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
23229 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
23230 \else
23231 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
23232 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
23233 \fi
23234 \fi
23235 \ifpgf@circuit@bipole@current@backward
23236 \pgfextra{
23237 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
23238 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
23239 }
23240 \fi
23241 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
23242 % if the current label is not empty (in which case we have already all the anchors)
23243 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
23244 % put the arrow node
23245 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
23246 % put the label
23247 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
23248 (\ctikzvalof{bipole/name}current)
23249 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
23250 \fi % end ifempty
23251 \ifpgf@circuit@bipole@current@backward
23252 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
23253 \fi
23254 }
23255
23256 %%%---------- close: tex/pgfcirccurrent
23257 %%%%%%%%%%% Springe nach tex/pgfcircflow
23258 %%%---------- open: tex/pgfcircflow.tex
23259 % Copyright 2018-2026 by Romano Giannetti
23260 % Copyright 2015-2026 by Stefan Lindner
23261 % Copyright 2013-2026 by Stefan Erhardt
23262 % Copyright 2007-2026 by Massimo Redaelli
23263 %
23264 % This file may be distributed and/or modified
23265 %
23266 % 1. under the LaTeX Project Public License and/or
23267 % 2. under the GNU Public License.
23268 %
23269 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
23270
23271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23272 %% flow handling
23273
23274
23275 %% styles
23276 \ctikzset{bipole flow style/.style={}}
23277 \tikzset{bipole flow style/.code={
23278 \ctikzset{bipole flow style/.style={#1}}
23279 }}
23280 \tikzset{bipole flow append style/.code={
23281 \ctikzset{bipole flow style/.append style={#1}}
23282 }}
23283
23284 %% Options
23285 \ctikzset{f^>/.style = {
23286 f = #1,
23287 \circuitikzbasekey/bipole/flow/direction = forward,
23288 \circuitikzbasekey/bipole/flow/x position = after,
23289 \circuitikzbasekey/bipole/flow/y position = above
23290 }
23291 }
23292
23293 \ctikzset{f_>/.style = {
23294 f = #1,
23295 \circuitikzbasekey/bipole/flow/direction = forward,
23296 \circuitikzbasekey/bipole/flow/x position = after,
23297 \circuitikzbasekey/bipole/flow/y position = below
23298 }
23299 }
23300
23301 \ctikzset{f>^/.style = {
23302 f = #1,
23303 \circuitikzbasekey/bipole/flow/direction = forward,
23304 \circuitikzbasekey/bipole/flow/x position = before,
23305 \circuitikzbasekey/bipole/flow/y position = above
23306 }
23307 }
23308
23309 \ctikzset{f>_/.style = {
23310 f = #1,
23311 \circuitikzbasekey/bipole/flow/direction = forward,
23312 \circuitikzbasekey/bipole/flow/x position = before,
23313 \circuitikzbasekey/bipole/flow/y position = below
23314 }
23315 }
23316
23317 \ctikzset{f^</.style = {
23318 f = #1,
23319 \circuitikzbasekey/bipole/flow/direction = backward,
23320 \circuitikzbasekey/bipole/flow/x position = after,
23321 \circuitikzbasekey/bipole/flow/y position = above
23322 }
23323 }
23324
23325 \ctikzset{f_</.style = {
23326 f = #1,
23327 \circuitikzbasekey/bipole/flow/direction = backward,
23328 \circuitikzbasekey/bipole/flow/x position = after,
23329 \circuitikzbasekey/bipole/flow/y position = below
23330 }
23331 }
23332
23333 \ctikzset{f<^/.style = {
23334 f = #1,
23335 \circuitikzbasekey/bipole/flow/direction = backward,
23336 \circuitikzbasekey/bipole/flow/x position = before,
23337 \circuitikzbasekey/bipole/flow/y position = above
23338 }
23339 }
23340
23341 \ctikzset{f<_/.style = {
23342 f = #1,
23343 \circuitikzbasekey/bipole/flow/direction = backward,
23344 \circuitikzbasekey/bipole/flow/x position = before,
23345 \circuitikzbasekey/bipole/flow/y position = below
23346 }
23347 }
23348
23349 \ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
23350 \ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
23351 \ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
23352 \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
23353
23354 \ctikzset{f/.code = {
23355 \pgfcirc@has@ftrue
23356 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
23357 \circuitikzbasekey/bipole/flow/x position = after,
23358 \circuitikzbasekey/bipole/flow/y position = above }
23359 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
23360 \ctikzsetvalof{bipole/flow/label/unit}{}
23361 \ifpgf@circ@siunitx
23362 \pgf@circ@handleSI{#1}
23363 \ifpgf@circ@siunitx@res
23364 \edef\pgf@temp{\pgf@circ@handleSI@val}
23365 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
23366 \edef\pgf@temp{\pgf@circ@handleSI@unit}
23367 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
23368 \else
23369 \fi
23370 \else
23371 \fi
23372 }
23373 }
23374
23375 %% Output routine
23376
23377 \def\pgf@circ@drawflow{
23378 \pgfextra{
23379 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
23380 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
23381
23382 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
23383 \ifpgf@circuit@bipole@flow@below
23384 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
23385 \fi
23386 \fi\fi
23387 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
23388 \ifpgf@circuit@bipole@flow@below
23389 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
23390 \fi
23391 \fi\fi
23392 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
23393 \ifpgf@circuit@bipole@flow@below
23394 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
23395 \fi
23396 \fi\fi
23397 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
23398 \ifpgf@circuit@bipole@flow@below
23399 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
23400 \fi
23401 \fi\fi
23402 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
23403 \ifpgf@circuit@bipole@flow@below
23404 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
23405 \fi
23406 \fi\fi
23407 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
23408 \ifpgf@circuit@bipole@flow@below
23409 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
23410 \fi
23411 \fi\fi
23412 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
23413 \ifpgf@circuit@bipole@flow@below
23414 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
23415 \fi
23416 \fi\fi
23417 \ifnum\pgfcircmathresult <5
23418 \ifpgf@circuit@bipole@flow@below
23419 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23420 \fi
23421 \fi
23422 \ifnum\pgfcircmathresult >355
23423 \ifpgf@circuit@bipole@flow@below
23424 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23425 \fi
23426 \fi
23427
23428 \ifpgf@circuit@bipole@flow@below
23429 \def\pgf@circ@bipole@flow@label@where{-90}
23430 \else
23431 \def\pgf@circ@bipole@flow@label@where{+90}
23432 \fi
23433 % export anchor position (if not needed, is always the same macro)
23434 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
23435 }
23436
23437 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
23438 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
23439 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
23440 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
23441 \else% normal bipole or source
23442 \ifpgf@circuit@bipole@flow@before
23443 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
23444 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
23445 \else
23446 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
23447 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
23448 \fi
23449 \fi
23450 \pgfextra{
23451 \newdimen{\absfshift}
23452 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
23453 \absfshift=\flow@offset
23454 \ifpgf@circuit@bipole@flow@backward
23455 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
23456 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
23457 \fi
23458 }
23459 \ifpgf@circuit@bipole@flow@below
23460 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
23461 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
23462 \else
23463 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
23464 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
23465 \fi
23466 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
23467 \pgfextra{
23468 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
23469 }
23470 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
23471 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
23472 %
23473 % coordinate (\pgfcirc@a@prefix-Fpos) at
23474 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
23475 % if the flow label is not empty (in which case we have already all the anchors)
23476 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
23477 % the flow arrow is really a node "flowarrow", not a real arrow
23478 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
23479
23480 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
23481 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
23482 \fi
23483
23484 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
23485 \ifpgf@circuit@bipole@flow@backward
23486 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
23487 \fi
23488
23489 }
23490
23491 %%%---------- close: tex/pgfcircflow
23492
23493 % notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning
23494 \ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels}
23495
23496 \ProcessOptions\relax
23497
23498 %%%%%%%%%%% Springe nach tex/pgfcircpath
23499 %%%---------- open: tex/pgfcircpath.tex
23500 % Copyright 2018-2026 by Romano Giannetti
23501 % Copyright 2015-2026 by Stefan Lindner
23502 % Copyright 2013-2026 by Stefan Erhardt
23503 % Copyright 2007-2026 by Massimo Redaelli
23504 %
23505 % This file may be distributed and/or modified
23506 %
23507 % 1. under the LaTeX Project Public License and/or
23508 % 2. under the GNU Public License.
23509 %
23510 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
23511
23512
23513 \def\pgf@circ@direction{0.0}
23514
23515 % swap two coordinates
23516 \def\pgfcirc@swap@coordinates#1#2{%
23517 coordinate (pgfcirc@tmp@swap) at (#1)
23518 coordinate (#1) at (#2)
23519 coordinate (#2) at (pgfcirc@tmp@swap)
23520 }
23521
23522 % Names
23523 \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
23524 \ctikzset{n/.code = {
23525 \pgfkeys{/tikz/circuitikz/bipole/name=#1}
23526 }}
23527
23528 % Reflect the node along
23529 \ctikzset{mirrored/.is choice}
23530 \ctikzset{mirror value/.initial=1}
23531 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
23532 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
23533 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
23534
23535 % Invert node along path
23536 \ctikzset{inverted/.is choice}
23537 \ctikzset{invert value/.initial=1}
23538 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
23539 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
23540 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
23541 \newif\ifpgf@circuit@bipole@inverted
23542 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
23543
23544 \newif\ifpgf@circuit@bipole@voltage@backward
23545 \ctikzset{bipole/voltage/direction/.is choice}
23546 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
23547 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
23548
23549 % Initialize paths
23550 \def\pgfcircresetpath{
23551 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
23552 bipole/inverted=false, bipole/kind=,
23553 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
23554 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
23555 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
23556 bipole/current/y position=above, bipole/current/direction=forward,
23557 mirrored=false
23558 }
23559 }
23560
23561 %
23562 % expandable IF for the extra nodes (thanks to Henri Menke)
23563 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
23564 %
23565 \def\pgfcirc@if@has@i{%
23566 \ifpgfcirc@has@i
23567 \expandafter\pgfutil@firstoftwo
23568 \else
23569 \expandafter\pgfutil@secondoftwo
23570 \fi}
23571 \def\pgfcirc@if@has@v{%
23572 \ifpgfcirc@has@v
23573 \expandafter\pgfutil@firstoftwo
23574 \else
23575 \expandafter\pgfutil@secondoftwo
23576 \fi}
23577 \def\pgfcirc@if@has@f{%
23578 \ifpgfcirc@has@f
23579 \expandafter\pgfutil@firstoftwo
23580 \else
23581 \expandafter\pgfutil@secondoftwo
23582 \fi}
23583
23584
23585
23586 %% Generic bipole path
23587 \def\pgf@circ@bipole@path#1#2{
23588 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
23589 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
23590 % appended to the main (path-style) name
23591 % #1 path-style node name
23592 % #2 the argument passed from the to-path structure; don't touch
23593 %
23594 % Example:
23595 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
23596 %
23597 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
23598 }
23599 %
23600 % this is used for components that are mainly node-style but have a path-style form
23601 %
23602 \def\pgfcirc@node@to@path#1#2#3{%
23603 % add a path-style component based on a node-style one without mangling the name
23604 % of the shape.
23605 % #1: node-type shape name (existing)
23606 % #2: path-type name (to be created)
23607 % #3: additional options to add to the path style
23608 %
23609 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
23610 \compattikzset{#2/.style = {\circuitikzbasekey,
23611 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
23612 #3}}%
23613 \ctikzset{bipoles/#1/height/.initial=1}%
23614 }
23615 %%
23616 %% ultra-generic bipole path
23617 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
23618 %%
23619 \def\pgf@circ@bipole@path@base#1#2#3#4{%
23620 %
23621 % Create a path-style component based on a node-style shape
23622 % #1: postfix to be added to the name path to obtain the main shape name
23623 % #2: text to be passed as text to the node
23624 % #3: name of the bipole component
23625 % #4: this will be filled by the argument of the to-path
23626 %
23627 \pgfextra{
23628 \ctikzset{bipole/kind = #3}
23629 \edef\pgf@temp{\ctikzvalof{bipole/name}}
23630 \def\pgf@circ@temp{}
23631 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
23632 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
23633 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
23634 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
23635 \else
23636 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
23637 \fi
23638 }
23639 % save start and stop values
23640 % notice that we DO NOT MOVE the path position at all!
23641 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
23642 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
23643 \pgfextra{
23644 % find the direction (angle) of the path
23645 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
23646 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
23647 \edef\pgf@circ@direction{\pgfmathresult}
23648 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
23649 }
23650 % position the component in the middle of the path. We DO NOT MOVE the current position!
23651 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
23652 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
23653 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
23654 % set start and end labels
23655 \ifpgf@circuit@bipole@inverted
23656 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
23657 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
23658 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
23659 \else
23660 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
23661 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
23662 \fi
23663 \else
23664 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
23665 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
23666 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
23667 \else
23668 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
23669 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
23670 \fi
23671 \fi
23672 % draw the leads unless it's an open circuit
23673 % stop at the component
23674 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
23675 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
23676 \else
23677 % it is important to start the path with -- to have correct line joins!
23678 -- (\tikztostart) -- (pgfcirc@anchorstartnode)
23679 \fi
23680 % Add all the "ornaments": labels, annotations, voltages, currents and flows
23681 \drawpoles
23682 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
23683 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
23684 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
23685 % it should be logically safe for older version too --- even if TikZ reverted the change
23686 % use explandable ifs too, thanks to Henri Menke
23687 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
23688 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
23689 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
23690 % finish the path from the component to the final target
23691 % you never know --- re-set \pgf@temp to detect open
23692 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
23693 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
23694 (\tikztotarget)
23695 \else
23696 (pgfcirc@anchorendnode) -- (\tikztotarget)
23697 \fi
23698 % reset internal circuit keys
23699 \pgfextra{\pgfcircresetpath}
23700 %draw pending nodes an path
23701 \tikztonodes
23702 }
23703
23704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23705 %% Handling of terminals
23706
23707 \ctikzset{bipole/nodes/.is family}
23708 \ctikzset{bipole/nodes/left/.initial=none}
23709 \ctikzset{bipole/nodes/right/.initial=none}
23710 \tikzset{bipole nodes/.style n args={2}{%
23711 \circuitikzbasekey/bipole/nodes/left=#1,
23712 \circuitikzbasekey/bipole/nodes/right=#2
23713 }
23714 }
23715
23716 %% Easily usable styles
23717
23718 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23719 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23720 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
23721 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23722 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
23723 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23724 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23725 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
23726 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
23727 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
23728 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23729 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
23730 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
23731 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23732 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23733
23734 % rectjoinfill workarounds
23735
23736 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
23737 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
23738 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23739 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23740 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23741 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23742 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23743 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23744 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23745
23746 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
23747
23748 \def\drawpoles{
23749 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
23750 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
23751 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
23752 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
23753 }
23754
23755 %% Path definitions
23756 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
23757 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
23758 \def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
23759 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
23760 \def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}}
23761 \def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}}
23762 \def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}}
23763 \def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}}
23764 \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
23765 \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}}
23766 \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}}
23767 %% polar capacitor is deprectaed, use curved capacitor instead
23768 \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}}
23769 \def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}}
23770 \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
23771 \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
23772 \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
23773 \def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
23774 \def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
23775 \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
23776 \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
23777 \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
23778 \def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}}
23779 \def\pgf@circ@inductor@path#1{%
23780 \pgfextra{
23781 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23782 \def\pgf@temp{european}%
23783 }
23784 \ifx\pgf@temp\pgf@circ@temp%
23785 \pgf@circ@europeaninductor@path{#1}%
23786 \else%
23787 \pgfextra{ \def\pgf@temp{cute} }%
23788 \ifx\pgf@temp\pgf@circ@temp%
23789 \pgf@circ@cuteinductor@path{#1}%
23790 \else%
23791 \pgf@circ@americaninductor@path{#1}%
23792 \fi%
23793 \fi%
23794 }
23795 \def\pgf@circ@vinductor@path#1{
23796 \pgfextra{
23797 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23798 \def\pgf@temp{european}%
23799 }
23800 \ifx\pgf@temp\pgf@circ@temp%
23801 \pgf@circ@veuropeaninductor@path{#1}%
23802 \else%
23803 \pgfextra{ \def\pgf@temp{cute} }%
23804 \ifx\pgf@temp\pgf@circ@temp%
23805 \pgf@circ@vcuteinductor@path{#1}%
23806 \else%
23807 \pgf@circ@vamericaninductor@path{#1}%
23808 \fi%
23809 \fi%
23810 }
23811 \def\pgf@circ@inductivesens@path#1{%
23812 \pgfextra{
23813 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23814 \def\pgf@temp{european}%
23815 }
23816 \ifx\pgf@temp\pgf@circ@temp%
23817 \pgf@circ@europeaninductivesens@path{#1}%
23818 \else%
23819 \pgfextra{ \def\pgf@temp{cute} }%
23820 \ifx\pgf@temp\pgf@circ@temp%
23821 \pgf@circ@cuteinductivesens@path{#1}%
23822 \else%
23823 \pgf@circ@americaninductivesens@path{#1}%
23824 \fi%
23825 \fi%
23826 }
23827 \def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
23828 \def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}}
23829 \def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}}
23830 \def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}}
23831 \def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}}
23832 \def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}}
23833 \def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}}
23834 \def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}}
23835 \def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}}
23836 \def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}}
23837 \def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}}
23838 \def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}}
23839 \def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}}
23840 \def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}}
23841 \def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}}
23842 \def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}}
23843 \def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}}
23844 \def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}}
23845 \def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}}
23846 \def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}}
23847 \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}}
23848 \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}}
23849 \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}}
23850 \def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}}
23851 \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}}
23852 \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}}
23853 \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}}
23854 \def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}}
23855 \def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}}
23856 \def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}}
23857 \def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}}
23858 \def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}}
23859 \def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}}
23860 \def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}}
23861 \def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}}
23862 \def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}}
23863 \def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}}
23864 \def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}}
23865 \def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}}
23866 \def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}}
23867 \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}}
23868 \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}}
23869 \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}}
23870 \def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}}
23871 \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
23872 \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
23873 \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}}
23874 \def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}}
23875 \def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}}
23876 \def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}}
23877 \def\pgf@circ@empty@path#1{}
23878 \def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}}
23879 \def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}}
23880 \def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}}
23881 \def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}}
23882 \def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}}
23883 \def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}}
23884 \def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}}
23885 \def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}}
23886 \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}}
23887 \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}}
23888 \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}}
23889 \def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}}
23890 \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}}
23891 \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}}
23892 \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}}
23893
23894 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
23895 \def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}}
23896 \def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}}
23897
23898 \def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
23899 \def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}}
23900 \def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
23901 \def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
23902 \def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
23903 \def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
23904 \def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
23905 \def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}}
23906 \def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
23907 \def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}}
23908 \def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}}
23909 \def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}}
23910 \def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}}
23911 \def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}}
23912 \def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}}
23913 \def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}}
23914 \def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}}
23915 \def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}}
23916 \def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}}
23917 \def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}}
23918 \def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}}
23919 %
23920 \def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}}
23921 \def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}}
23922 \def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}}
23923 \def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}}
23924
23925 %%Mechanical
23926 \def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
23927 \def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}}
23928 \def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
23929 \def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
23930 \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
23931
23932 %% Styles
23933
23934 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
23935 \def\compattikzset#1{%
23936 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
23937 \tikzset{\comnpatname#1}}
23938
23939 %\def\ctikzsetbipole#1#2{%
23940 % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
23941 %}
23942
23943 \compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
23944 \compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}}
23945 \compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
23946 \compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
23947 \compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
23948 \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}
23949 \compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}}
23950 \compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}}
23951 \compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}}
23952 \compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}}
23953 \compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}}
23954 \compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}}
23955 \compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}}
23956 \compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
23957 \compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}}
23958 \compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}}
23959 \compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}}
23960 \compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}}
23961 \compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}}
23962 \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}}
23963 \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
23964 \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
23965 % polar capacitor is deprecated, use curved capacitor instead
23966 \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}}
23967 \compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}}
23968 \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
23969 \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
23970 \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23971 \compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23972 \compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23973 \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
23974 \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
23975 \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
23976 \compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}}
23977 \compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
23978 \compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}}
23979 \compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}}
23980 \compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}}
23981 \compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}}
23982 \compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}}
23983 \compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}}
23984 \compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}}
23985 \compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}}
23986 \compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}}
23987 \compattikzset{transmission line/.style = {tline = #1}}
23988 \compattikzset{TL/.style = {tline = #1}}
23989 \compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}}
23990 \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}}
23991 \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23992 \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23993 \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23994 \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}}
23995 \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}}
23996 \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23997 \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23998 \compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23999 \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 }}
24000 \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 }}
24001 \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 }}
24002 \compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24003 \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}}
24004 \compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24005
24006 \compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
24007 \compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
24008 \compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
24009 \compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
24010
24011
24012 \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}}
24013 \compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}}
24014 \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}}
24015 \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}}
24016 \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}}
24017 \compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}}
24018 \compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}}
24019 \compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}}
24020
24021 \compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}}
24022 \compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}}
24023
24024 \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}}
24025 \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}}
24026 \compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}}
24027 \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}}
24028 \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}}
24029 \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}}
24030
24031 \compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
24032 \compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}}
24033 \compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
24034 \compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
24035 \compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
24036 \compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
24037 \compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
24038 \compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}}
24039 \compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}
24040 \compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}}
24041 \compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}}
24042 \compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}}
24043 \compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}}
24044 \compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}}
24045 \compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}}
24046 \compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}}
24047 \compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}}
24048 \compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}}
24049 \compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}}
24050 \compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}}
24051 \compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}}
24052 %
24053 \compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}}
24054 \compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}}
24055 \compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}}
24056 \compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}}
24057
24058 % % % % % %
24059 % % Begin of Diodes
24060 % % % % % %
24061
24062 \def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}}
24063 \def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}}
24064 \def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}}
24065 \def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}}
24066 \def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}}
24067 \def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}}
24068 \def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}}
24069 \def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}}
24070 \def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}}
24071 \def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}}
24072 \def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}}
24073 \def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}}
24074 \def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}}
24075 \def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}}
24076 \def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}}
24077 \def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}}
24078 \def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}}
24079 \def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}}
24080
24081 \compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}}
24082 \compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}}
24083 \compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}}
24084 \compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}}
24085 \compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}}
24086 \compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}}
24087 \compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}}
24088 \compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}}
24089 \compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}}
24090 \compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}}
24091 \compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}}
24092
24093 \compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}}
24094 \compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}}
24095 \compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}}
24096 \compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
24097 \compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}}
24098 \compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}}
24099 \compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}}
24100 \compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}}
24101 \compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}}
24102 \compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}}
24103 \compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}}
24104
24105 \compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}}
24106 \compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}}
24107 \compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}}
24108 \compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
24109 \compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}}
24110 \compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}}
24111 \compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}}
24112 \compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}}
24113 \compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}}
24114 %\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}}
24115
24116 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
24117
24118 \compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
24119 \compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
24120 \compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
24121 \compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
24122 \compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
24123 \compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
24124 \compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
24125 \compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
24126 \compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
24127 \compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
24128 \compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
24129
24130 %% Define Shortcuts
24131 \compattikzset{Do/.style = {\comnpatname empty diode}}
24132 \compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
24133 \compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
24134 \compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
24135 \compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
24136 \compattikzset{pDo/.style = {\comnpatname empty photodiode}}
24137 \compattikzset{leDo/.style = {\comnpatname empty led}}
24138 \compattikzset{VCo/.style = {\comnpatname empty varcap}}
24139 \compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
24140 \compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
24141 \compattikzset{Tro/.style = {\comnpatname empty triac}}
24142
24143 \compattikzset{D*/.style = {\comnpatname full diode}}
24144 \compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
24145 \compattikzset{zD*/.style = {\comnpatname full Zener diode}}
24146 \compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
24147 \compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
24148 \compattikzset{pD*/.style = {\comnpatname full photodiode}}
24149 \compattikzset{leD*/.style = {\comnpatname full led}}
24150 \compattikzset{VC*/.style = {\comnpatname full varcap}}
24151 \compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
24152 \compattikzset{Ty*/.style = {\comnpatname full thyristor}}
24153 \compattikzset{Tr*/.style = {\comnpatname full triac}}
24154
24155 \compattikzset{D/.style = {\comnpatname diode}}
24156 \compattikzset{tD/.style = {\comnpatname tunnel diode}}
24157 \compattikzset{zD/.style = {\comnpatname Zener diode}}
24158 \compattikzset{zzD/.style = {\comnpatname ZZener diode}}
24159 \compattikzset{sD/.style = {\comnpatname Schottky diode}}
24160 \compattikzset{pD/.style = {\comnpatname photodiode}}
24161 \compattikzset{leD/.style = {\comnpatname led}}
24162 \compattikzset{VC/.style = {\comnpatname varcap}}
24163 \compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
24164 \compattikzset{Ty/.style = {\comnpatname thyristor}}
24165 \compattikzset{Tr/.style = {\comnpatname triac}}
24166
24167 \compattikzset{D-/.style = {\comnpatname stroke diode}}
24168 \compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
24169 \compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
24170 \compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
24171 \compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
24172 \compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
24173 \compattikzset{leD-/.style = {\comnpatname stroke led}}
24174 \compattikzset{VC-/.style = {\comnpatname stroke varcap}}
24175 \compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
24176 \compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
24177 \compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
24178
24179 % % % % % %
24180 % % End of Diodes
24181 % % % % % %
24182
24183
24184 \compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}}
24185 \compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
24186 \compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}}
24187 \compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
24188 \compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
24189 \compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
24190 \compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
24191 \compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
24192 \compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
24193 \compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
24194 \compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
24195 \compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
24196 \compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
24197 \compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}}
24198 \compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}}
24199 \compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}}
24200 \compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}}
24201 \compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}}
24202
24203 \compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}}
24204 \compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}}
24205 \compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}}
24206 \tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}}
24207
24208 % cute switches
24209 %% closed cute switch
24210 \def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}}
24211 \compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}}
24212 \compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
24213
24214 %% open cute switch
24215 \def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}}
24216 \compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}}
24217 \compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
24218
24219 %% closing cute switch
24220 \def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}}
24221 \compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}}
24222 \compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
24223
24224 %% opening cute switch
24225 \def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}}
24226 \compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}}
24227 \compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
24228
24229
24230 % short forms
24231 \compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24232 \compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24233 \compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24234 \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}}
24235
24236 \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}}
24237 \compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}}
24238 \compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}}
24239 \compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}}
24240
24241 \compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
24242 \compattikzset{isource/.style = {\comnpatname current source = #1}}
24243 \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
24244 \compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
24245 \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
24246 \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
24247 \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
24248 \compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
24249 \compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
24250 \compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
24251 \compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24252
24253 \compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
24254 \compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
24255 \compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24256 \compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
24257
24258 \compattikzset{R/.style= {\comnpatname resistor = #1}}
24259 \compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
24260 \compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
24261 \compattikzset{thR/.style= {\comnpatname thermistor = #1}}
24262 \compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
24263 \compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
24264 \compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
24265 \compattikzset{C/.style = {\comnpatname capacitor = #1}}
24266 \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
24267 %% pC is deprecated, use cC instead
24268 \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
24269 \compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
24270 \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
24271 \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
24272 \compattikzset{L/.style = {\comnpatname inductor = #1}}
24273 \compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
24274 \compattikzset{V/.style = {\comnpatname voltage source = #1}}
24275 \compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
24276 \compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
24277 \compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
24278 \compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
24279 \compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24280 \def\pgf@temp#1{
24281 \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
24282 \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
24283 \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
24284 \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
24285 }
24286 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
24287 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
24288
24289 %current sources
24290 \compattikzset{I/.style = {\comnpatname current source = #1}}
24291 \compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
24292 \compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
24293 \compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
24294 \def\pgf@temp#1{
24295 \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
24296 \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
24297 \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
24298 \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
24299 }
24300 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
24301 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
24302 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
24303
24304 % cute sources
24305 \def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}}
24306 \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}}
24307 \compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
24308 \compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
24309
24310 \def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}}
24311 \compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24312 \compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
24313 \compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
24314
24315 \def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}}
24316 \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}}
24317 \compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
24318 \compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
24319
24320 \def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}}
24321 \compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24322 \compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
24323 \compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
24324
24325 % noise sources
24326 \def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}}
24327 \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}}
24328 \compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
24329 \compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
24330
24331 \def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}}
24332 \compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24333 \compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
24334 \compattikzset{nI/.style= {\comnpatname noise current source= #1}}
24335
24336 % resistive sensor american style
24337 \def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}}
24338 \compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}}
24339 \compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
24340 \compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}}
24341 \compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
24342
24343 \compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}}
24344 \compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
24345
24346 \compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}}
24347 \compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}}
24348 \compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}}
24349 \compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}}
24350 \compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
24351
24352 \compattikzset{Mr/.style = {\comnpatname memristor}}
24353
24354 \compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
24355 \compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
24356 \compattikzset{spst/.style = {\comnpatname switch = #1}}
24357
24358 \compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
24359
24360 \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
24361 \compattikzset{vss/.style = {\comnpatname vee = #1}}
24362
24363 % activate the to-style crossing
24364 \def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}}
24365 \compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}}
24366 \compattikzset{xing/.style= {\comnpatname crossing= #1}}
24367
24368 %% loudspeaker and microphone
24369
24370 \def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}}
24371 \compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}}
24372
24373 \def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}}
24374 \compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}}
24375
24376 % more instrument
24377 \def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}}
24378 \compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}}
24379 \def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}}
24380 \compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}}
24381 \def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}}
24382 \compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}}
24383 % current loop probes
24384 \def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}}
24385 \compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}}
24386 \def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}}
24387 \compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}}
24388 % qucs-style probes
24389 \def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}}
24390 \compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}}
24391 \def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}}
24392 \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}}
24393 \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}}
24394 \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}}
24395 % multiwire(s)
24396 \def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}}
24397 \compattikzset{bmultiwire/.style = {\circuitikzbasekey,
24398 /tikz/to path=\pgf@circ@bmultiwire@path, l=#1}}
24399 \def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}}
24400 \compattikzset{multiwire/.style = {\circuitikzbasekey,
24401 /tikz/to path=\pgf@circ@multiwire@path, l=#1}}
24402 \def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}}
24403 \compattikzset{tmultiwire/.style = {\circuitikzbasekey,
24404 /tikz/to path=\pgf@circ@tmultiwire@path, l=#1}}
24405
24406 % reed switches
24407 \def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}}
24408 \compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}}
24409
24410 % Transistor like bipoles
24411
24412 \def\pgf@circ@trans@path#1#2{
24413 \pgfextra{
24414 \edef\pgf@temp{\ctikzvalof{bipole/name}}
24415 \def\pgf@circ@temp{#2}
24416 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
24417 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
24418 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
24419 \fi
24420 }
24421 \ifpgf@circuit@bipole@inverted
24422 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
24423 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
24424 \else
24425 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
24426 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
24427 \fi
24428 \pgfextra{
24429 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
24430 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
24431 \pgfmathadd{\pgfmathresult}{-90}
24432 \pgfmathround{\pgfmathresult}
24433 \edef\pgf@circ@direction{\pgfmathresult}
24434 }
24435 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
24436 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
24437 (\ctikzvalof{bipole/name}) {}
24438 node {\ctikzvalof{bipole/label/name}}
24439 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
24440 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
24441 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
24442 \else
24443 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
24444 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
24445 \fi
24446 \drawpoles
24447 \pgfextra{
24448 \pgfcircresetpath
24449 }
24450 (\tikztotarget) \tikztonodes % e si continua
24451 }
24452
24453
24454 \def\pgf@circ@definetranspath#1{
24455 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
24456 }
24457
24458 \pgf@circ@definetranspath{elmech}
24459 \pgf@circ@definetranspath{nmos}
24460 \pgf@circ@definetranspath{pmos}
24461 \pgf@circ@definetranspath{nmosd}
24462 \pgf@circ@definetranspath{pmosd}
24463 \pgf@circ@definetranspath{hemt}
24464 \pgf@circ@definetranspath{npn}
24465 \pgf@circ@definetranspath{pnp}
24466 \pgf@circ@definetranspath{nfet}
24467 \pgf@circ@definetranspath{nigfete}
24468 \pgf@circ@definetranspath{nigfetd}
24469 \pgf@circ@definetranspath{nigfetebulk}
24470 \pgf@circ@definetranspath{pfet}
24471 \pgf@circ@definetranspath{pigfete}
24472 \pgf@circ@definetranspath{pigfetd}
24473 \pgf@circ@definetranspath{pigfetebulk}
24474 \pgf@circ@definetranspath{njfet}
24475 \pgf@circ@definetranspath{pjfet}
24476 \pgf@circ@definetranspath{pigbt}
24477 \pgf@circ@definetranspath{nigbt}
24478 \pgf@circ@definetranspath{Lpigbt}
24479 \pgf@circ@definetranspath{Lnigbt}
24480 %
24481 % Path-style logical ports
24482 %
24483 % create path-style element for one input --- one output logical ports
24484 %
24485 \def\pgfcirc@port@node@to@path#1#2{%
24486 %
24487 % add a logic port path style component --- we need to suppress leads
24488 % and use the correct center
24489 %
24490 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
24491 }
24492 \pgfcirc@port@node@to@path{not port}{inline not}
24493 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
24494 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
24495 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
24496
24497 \pgfcirc@port@node@to@path{tgate}{inline tgate}
24498 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
24499
24500 %%%---------- close: tex/pgfcircpath
24501
24502 \ifpgf@circ@siunitx
24503 \RequirePackage{xstring}[2009/03/13]
24504 %\expandafter\let\csname angstrom\endcsname\relax
24505 \RequirePackage{siunitx}
24506 \fi
24507
24508 \ifpgf@circ@explicitvdir\else
24509 \PackageWarningNoLine{circuitikz}{%
24510 You did not specify one of the voltage directions:\MessageBreak
24511 \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak
24512 \space\space RPvoltages or EFvoltages \MessageBreak
24513 Default directions may have changed, \MessageBreak
24514 please check the manual%
24515 }
24516 \fi
24517
24518 \newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}}
24519 %override (unused) circuitikz environment for compability to externalization)
24520 \let\circuitikz\tikzpicture
24521 \let\endcircuitikz\endtikzpicture
24522
24523 \endinput