Debian Codegraph @

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

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12
13 \def\pgfcircversion{1.2.7}
14 \def\pgfcircversiondate{2020/12/27}
15 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
16
17 \usemodule[tikz]
18
19 \startmodule[circuitikzgit-1.2.7]
20 \usetikzlibrary[calc]
21 \usetikzlibrary[arrows.meta, bending]
22 \usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
23
24 \unprotect
25
26 \edef\tikzatcode{\the\catcode`\@}
27 \edef\tikzbarcode{\the\catcode`\|}
28 \edef\tikzexclaimcode{\the\catcode`\!}
29 \catcode`\@=11
30 \catcode`\|=12
31 \catcode`\!=12
32
33 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
34 %%%---------- open: tex/pgfcirc.defines.tex
35 % Copyright 2018-2026 by Romano Giannetti
36 % Copyright 2015-2026 by Stefan Lindner
37 % Copyright 2013-2026 by Stefan Erhardt
38 % Copyright 2007-2026 by Massimo Redaelli
39 %
40 % This file may be distributed and/or modified
41 %
42 % 1. under the LaTeX Project Public License and/or
43 % 2. under the GNU Public License.
44 %
45 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
46 %
47 % This file has folding marks for vim (See last line).
48 %
49 %% Key managements%<<<1
50
51 \long\def\pgf@circ@comment#1{}
52
53 \def\circuitikzbasekey{/tikz/circuitikz}
54
55 \pgfkeys{\circuitikzbasekey/.is family}
56
57 \def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
58 \let\ctikzset\circuitikzset
59 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
60 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
61
62 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
63 %%>>>
64
65 %% Temporary Counters and dimensions%<<<1
66 %% Temporary Counters
67 \newcount\pgf@circ@count@a
68 \newcount\pgf@circ@count@b
69 \newcount\pgf@circ@count@c
70 %%%%%%%%%%%%
71 %% Dimensions
72 % coordinate
73 \newdimen\pgf@circ@res@up
74 \newdimen\pgf@circ@res@down
75 \newdimen\pgf@circ@res@zero
76 \newdimen\pgf@circ@res@left
77 \newdimen\pgf@circ@res@right
78 \newdimen\pgf@circ@res@other
79 \newdimen\pgf@circ@res@step
80 \newdimen\pgf@circ@res@temp
81 % Base len for all circuitikz
82 \newdimen\pgf@circ@Rlen
83 % scaled length for internal use in scalable shapes
84 \newdimen\pgf@circ@scaled@Rlen
85 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
86 \pgf@circ@Rlen = 1.4cm
87 % by default scale is 1.0
88 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
89 % inital thickness
90 \newdimen \pgfstartlinewidth
91 %%>>>
92
93 % arrow tips, ported over old arrows library (deprecated)%<<<1
94 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
95 % this was the original definition of latex' tips, renamed to avoid clashes
96 %
97 \pgfarrowsdeclare{latexslim}{latexslim}
98 {
99 \pgfutil@tempdima=0.28pt%
100 \advance\pgfutil@tempdima by.3\pgflinewidth%
101 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
102 \pgfarrowsrightextend{+6\pgfutil@tempdima}
103 }
104 {
105 \pgfutil@tempdima=0.28pt%
106 \advance\pgfutil@tempdima by.3\pgflinewidth%
107 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
108 \pgfpathcurveto
109 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
110 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
111 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
112 \pgfpathcurveto
113 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
114 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
115 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
116 \pgfpathcurveto
117 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
118 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
119 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
120 \pgfpathclose
121 \pgfusepathqfill
122 }
123
124 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
125 %%>>>
126
127 %% Macros to do things depending on the class%<<<1
128
129 \def\pgf@circ@setifdefinedfill#1#2{%
130 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
131 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
132 \ifdefined\ctikzclass
133 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
134 {% yes, it's defined
135 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
136 \ifx\@@tmp\@@none % but it's none
137 \pgfusepath{#2}%
138 \else
139 \pgfsetfillcolor{\@@tmp}%
140 \pgfusepath{#1}%
141 \fi
142 }{% the class is defined but the fill key not; use #2
143 \pgfusepath{#2}%
144 }
145 \else
146 \pgfusepath{#2}%
147 \fi
148 }
149
150 %% Macro to fill or draw
151
152 \def\pgf@circ@draworfill{%
153 \ifx\tikz@fillcolor\pgfutil@empty
154 \pgf@circ@setifdefinedfill{draw,fill}{draw}
155 \else
156 \pgfsetfillcolor{\tikz@fillcolor}
157 \pgfusepath{draw, fill}
158 \fi
159 }
160
161 \def\pgf@circ@draworfillandclip{%
162 \ifx\tikz@fillcolor\pgfutil@empty
163 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
164 \pgfusepath{draw, clip}
165 \else
166 \pgfsetfillcolor{\tikz@fillcolor}
167 \pgfusepath{draw, clip, fill}
168 \fi
169 }
170
171 \def\pgf@circ@maybefill{%
172 \ifx\tikz@fillcolor\pgfutil@empty
173 \pgf@circ@setifdefinedfill{fill}{discard}
174 \else
175 \pgfsetfillcolor{\tikz@fillcolor}
176 \pgfusepath{fill}
177 \fi
178 }
179
180 %% Macros for setting linewidth
181 % #1 is the legacy class (bipoles, tripoles) etc
182 % #2 is the reference linewidth
183 \def\pgf@circ@setlinewidth#1#2{%
184 \ifdefined\ctikzclass
185 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
186 {% yes, it's defined
187 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
188 \ifx\@@tmp\@@none % but it's none
189 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
190 \else
191 \pgfsetlinewidth{\@@tmp #2}%
192 \fi
193 }{ % key not defined, do the legacy thing
194 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
195 }% Ok, do nothing
196 \else % no class
197 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
198 \fi
199 }
200 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
201 \ctikzset{none/thickness/.initial=1.0} % do not touch
202 %%>>>
203
204 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
205 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
206
207 \ifpgfutil@format@is@latex
208 \long\def\pgf@circ@font@tiny{\tiny}
209 \long\def\pgf@circ@font@small{\small}
210 \long\def\pgf@circ@font@bold{\textbf}
211 \long\def\pgf@circ@font@boldmath{\boldmath}
212 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
213 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
214 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
215 \else\ifpgfutil@format@is@plain
216 \long\def\pgf@circ@font@tiny{\fiverm}
217 \long\def\pgf@circ@font@small{\sevenrm}
218 \long\def\pgf@circ@font@bold#1{{\bf#1}}
219 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
220 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
221 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
222 \long\def\pgf@circ@font@twelve{\twelverm} %
223 \else\ifpgfutil@format@is@context
224 \long\def\pgf@circ@font@tiny{\tfxx}
225 \long\def\pgf@circ@font@small{\tfx}
226 \long\def\pgf@circ@font@bold{\bold}
227 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
228 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
229 \long\def\pgf@circ@font@tenbm{\normal\bold}%
230 \long\def\pgf@circ@font@twelve{\tfa} %
231 \fi\fi\fi
232
233
234 %
235 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
236 %
237 % this is needed to avoid problems with \ConTeXt
238 \ifcsname normalunexpanded\endcsname
239 \let\pgfcircutil@unexpanded\normalunexpanded
240 \else
241 \let\pgfcircutil@unexpanded\unexpanded
242 \fi
243 % minimally expand a pgfkey to check if it's {}/undefined or filled.
244 \def\unexpandedvalueof#1{%
245 \pgfcircutil@unexpanded\expandafter\expandafter
246 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
247 \def\pgf@circ@valueof@chk#1{%
248 \ifx\relax#1%
249 \expandafter\pgfutil@firstoftwo
250 \else
251 \expandafter\pgfutil@secondoftwo
252 \fi
253 {{}}% #1 is \relax, so consider empty
254 {\expandafter{#1}}% otherwise, leave the key after one more expansion
255 }%
256 %>>>
257
258 % text position in some component.%<<<1
259 % (added with ieeestd logic ports. Maybe to be extended to other components,
260 % like amplifiers)
261 %
262 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
263 \tikzset{component text/.is choice}%
264 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
265 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
266 \ctikzset{component text/.is choice}%
267 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
268 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
269 \ctikzset{left text distance/.initial=0.3em}%
270 %>>>
271
272 % voltage direction options%<<<1
273
274 \newif\ifpgf@circ@siunitx
275 \newif\ifpgf@circuit@compat
276 \newif\ifpgf@circ@oldvoltagedirection % default false
277 \newif\ifpgf@circ@explicitvdir
278 \newif\ifpgf@circ@fixbatteries
279
280 \ctikzset{voltage dir/.is choice}
281 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
282 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
283 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
284 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
285 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
286 %>>>
287
288 % bipole definitions for path component and text decorations%%<<<1
289 %
290 % Option "t=*" for nodes
291 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
292 %
293 \ctikzset{bipole/.is family}
294 \ctikzset{bipole/kind/.initial=}
295 \ctikzset{bipole/name/.initial=}
296 \newif\ifpgf@circuit@bipole@isvoltage
297 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
298 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
299 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
300 \newif\ifpgf@circuit@bipole@strokedsymbol
301 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
302 \newif\ifpgf@circuit@bipole@iscurrent
303 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
304
305 \ctikzset{bipole/voltage/.is family}
306 \newif\ifpgf@circuit@bipole@voltage@backward
307 \ctikzset{bipole/voltage/direction/.is choice}
308 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
309 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
310 \newif\ifpgf@circuit@bipole@voltage@below
311 \ctikzset{bipole/voltage/position/.is choice}
312 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
313 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
314
315 \ctikzset{bipole/voltage/label/unit/.initial=}
316 \ctikzset{bipole/voltage/label/name/.initial=}
317
318 \ctikzset{bipole/current/.is family}
319 \newif\ifpgf@circuit@bipole@current@backward
320 \ctikzset{bipole/current/direction/.is choice}
321 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
322 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
323 \newif\ifpgf@circuit@bipole@current@before
324 \ctikzset{bipole/current/x position/.is choice}
325 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
326 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
327 \newif\ifpgf@circuit@bipole@current@below
328 \ctikzset{bipole/current/y position/.is choice}
329 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
330 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
331 \ctikzset{bipole/current/label/unit/.initial=}
332 \ctikzset{bipole/current/label/name/.initial=}
333
334 \ctikzset{bipole/flow/.is family}
335 \newif\ifpgf@circuit@bipole@flow@backward
336 \ctikzset{bipole/flow/direction/.is choice}
337 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
338 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
339 \newif\ifpgf@circuit@bipole@flow@before
340 \ctikzset{bipole/flow/x position/.is choice}
341 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
342 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
343 \newif\ifpgf@circuit@bipole@flow@below
344 \ctikzset{bipole/flow/y position/.is choice}
345 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
346 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
347 \ctikzset{bipole/flow/label/unit/.initial=}
348 \ctikzset{bipole/flow/label/name/.initial=}
349 \ctikzset{flow/distance/.initial = .5}
350 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
351
352 \ctikzset{bipole/label/.is family}
353 \ctikzset{bipole/label/position/.initial=90}
354 \ctikzset{bipole/label/unit/.initial=}
355 \ctikzset{bipole/label/name/.initial=}
356 \ctikzset{bipole/annotation/.is family}
357 \ctikzset{bipole/annotation/position/.initial=-90}
358 \ctikzset{bipole/annotation/unit/.initial=}
359 \ctikzset{bipole/annotation/name/.initial=}
360
361 \newif\ifpgf@circ@siunitx
362 \newif\ifpgf@circ@siunitx@res
363
364 \ctikzset{label/align/.is choice}
365 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
366 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
367 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
368 %%>>>
369
370 % traditional styles %<<<1
371 %
372 \ctikzset{thickness/.initial=2}
373 \ctikzset{color/.initial=black}
374 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
375 \ctikzset{bipoles/border margin/.initial=1.1}
376 \ctikzset{bipoles/thickness/.initial=2}
377 \ctikzset{tripoles/thickness/.initial=2}
378 \ctikzset{quadpoles/thickness/.initial=2}
379 \ctikzset{nodes width/.initial=.04}
380 %%>>>
381
382 % Styles definitions and macros%<<<1
383
384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
385 %% main style definitions
386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
387
388 % load a style file: search ctikzstyle-NAME.tex in path
389 \def\ctikzloadstyle#1{%
390 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
391 \tikzerror{I did not find the circuitikz style #1}}%
392 }
393
394 % load and enact a style
395 \def\ctikzsetstyle#1{%
396 \ctikzloadstyle{#1}%
397 \tikzset{#1 circuit style}%
398 }
399
400 % global style parameters
401 \ctikzset{default/scale/.initial=1.0} % do not touch
402 \ctikzset{default/fill/.initial=none} % do not touch
403 \ctikzset{default/thickness/.initial=none} % do not touch
404 % default is use as the generic default style for bipoles
405
406 % mostly bipoles:
407
408 \ctikzset{resistors/scale/.initial=1.0}
409 \ctikzset{resistors/fill/.initial=none}
410 \ctikzset{resistors/thickness/.initial=none}
411
412 \ctikzset{capacitors/scale/.initial=1.0}
413 \ctikzset{capacitors/fill/.initial=none}
414 \ctikzset{capacitors/thickness/.initial=none}
415
416 \ctikzset{inductors/scale/.initial=1.0}
417 \ctikzset{inductors/fill/.initial=none}
418 \ctikzset{inductors/thickness/.initial=none}
419
420 \ctikzset{diodes/scale/.initial=1.0}
421 \ctikzset{diodes/fill/.initial=none}
422 \ctikzset{diodes/thickness/.initial=none}
423
424 \ctikzset{batteries/scale/.initial=1.0}
425 \ctikzset{batteries/fill/.initial=none}
426 \ctikzset{batteries/thickness/.initial=none}
427
428 \ctikzset{sources/scale/.initial=1.0}
429 \ctikzset{sources/fill/.initial=none}
430 \ctikzset{sources/thickness/.initial=none}
431
432 \ctikzset{csources/scale/.initial=1.0}
433 \ctikzset{csources/fill/.initial=none}
434 \ctikzset{csources/thickness/.initial=none}
435
436 \ctikzset{instruments/scale/.initial=1.0}
437 \ctikzset{instruments/fill/.initial=none}
438 \ctikzset{instruments/thickness/.initial=none}
439
440 \ctikzset{mechanicals/scale/.initial=1.0}
441 \ctikzset{mechanicals/fill/.initial=none}
442 \ctikzset{mechanicals/thickness/.initial=none}
443
444 \ctikzset{misc/scale/.initial=1.0}
445 \ctikzset{misc/fill/.initial=none}
446 \ctikzset{misc/thickness/.initial=none}
447
448 \ctikzset{blocks/scale/.initial=1.0}
449 \ctikzset{blocks/fill/.initial=none}
450 \ctikzset{blocks/thickness/.initial=none}
451
452 % mostly nodes
453
454 \ctikzset{grounds/scale/.initial=1.0}
455 \ctikzset{grounds/fill/.initial=none}
456 \ctikzset{grounds/thickness/.initial=none}
457
458 \ctikzset{power supplies/scale/.initial=1.0}
459 \ctikzset{power supplies/fill/.initial=none}
460 \ctikzset{power supplies/thickness/.initial=none}
461
462 \ctikzset{transistors/scale/.initial=1.0}
463 \ctikzset{transistors/fill/.initial=none}
464 \ctikzset{transistors/thickness/.initial=none}
465
466 \ctikzset{tubes/scale/.initial=1.0}
467 \ctikzset{tubes/fill/.initial=none}
468 \ctikzset{tubes/thickness/.initial=none}
469
470 \ctikzset{RF/scale/.initial=1.0}
471 \ctikzset{RF/fill/.initial=none}
472 \ctikzset{RF/thickness/.initial=none}
473
474 \ctikzset{electromechanicals/scale/.initial=1.0}
475 \ctikzset{electromechanicals/fill/.initial=none}
476 \ctikzset{electromechanicals/thickness/.initial=none}
477
478 % transformers go with inductors
479 \ctikzset{amplifiers/scale/.initial=1.0}
480 \ctikzset{amplifiers/fill/.initial=none}
481 \ctikzset{amplifiers/thickness/.initial=none}
482
483 \ctikzset{switches/scale/.initial=1.0}
484 \ctikzset{switches/fill/.initial=none}
485 \ctikzset{switches/thickness/.initial=none}
486
487 \ctikzset{logic ports/scale/.initial=1.0}
488 \ctikzset{logic ports/fill/.initial=none}
489 \ctikzset{logic ports/thickness/.initial=none}
490
491 \ctikzset{flipflops/scale/.initial=1.0}
492 \ctikzset{flipflops/fill/.initial=none}
493 \ctikzset{flipflops/thickness/.initial=none}
494
495 \ctikzset{muxdemuxes/scale/.initial=1.0}
496 \ctikzset{muxdemuxes/fill/.initial=none}
497 \ctikzset{muxdemuxes/thickness/.initial=none}
498
499 \ctikzset{chips/scale/.initial=1.0}
500 \ctikzset{chips/fill/.initial=none}
501 \ctikzset{chips/thickness/.initial=none}
502
503 \ctikzset{displays/scale/.initial=1.0}
504 \ctikzset{displays/fill/.initial=none}
505 \ctikzset{displays/thickness/.initial=none}
506 %
507 % general styles
508 %
509 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
510 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
511 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
512 %%>>>
513
514 % grounds and power supplies%<<<1
515
516 \ctikzset{monopoles/.is family}
517 \ctikzset{monopoles/ground/width/.initial=.25}
518 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
519 \ctikzset{monopoles/ground/thickness/.initial=2}
520 \ctikzset{monopoles/rground/thickness/.initial=2}
521 \ctikzset{monopoles/tground/thickness/.initial=3}
522 \ctikzset{monopoles/vcc/width/.initial=.2}
523 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
524 \ctikzset{monopoles/vee/arrow/.initial=legacy}
525 \ctikzset{monopoles/match/width/.initial=.4}
526 \ctikzset{monopoles/chassis/width/.initial=.25}
527 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
528 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
529 \ctikzset{monopoles/antenna/width/.initial=.25}
530 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
531 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
532 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
533 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
534 \ctikzset{monopoles/txantenna/width/.initial=.25}
535 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
536 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
537 \ctikzset{monopoles/rxantenna/width/.initial=.25}
538 \ctikzset{monopoles/bareantenna/width/.initial=.25}
539 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
540 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
541 \ctikzset{monopoles/waves/width/.initial=0.5}%
542 %>>>
543
544 % microstrips %<<<1
545 \ctikzset{bipoles/mstline/height/.initial=0.3}
546 \ctikzset{bipoles/mstline/width/.initial=1.2}
547 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
548 \ctikzset{monopoles/msport/width/.initial=.5}
549 \ctikzset{monopoles/msrstub/height/.initial=1.0}
550 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
551 %>>>
552
553 % microphone and loudspeaker%<<<1
554 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
555 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
556 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
557 \ctikzset{bipoles/mic/height/.initial=1.2}
558 \ctikzset{bipoles/mic/depth/.initial=.1}
559 \ctikzset{bipoles/mic/width/.initial=.8}%
560 %>>>
561
562 % resistors%<<<1
563 % Zig Zag resistors
564 \ctikzset{resistors/zigs/.initial=3}
565 \ctikzset{resistors/width/.code={%
566 \ctikzset{bipoles/resistor/width=#1}%
567 \ctikzset{bipoles/vresistor/width=#1}%
568 \ctikzset{bipoles/potentiometer/width=#1}%
569 \ctikzset{bipoles/resistivesens/width=#1}%
570 \ctikzset{bipoles/photoresistor/width=#1}%
571 \ctikzset{bipoles/thermistor/width=#1}%
572 \ctikzset{bipoles/thermistorntc/width=#1}%
573 \ctikzset{bipoles/thermistorptc/width=#1}%
574 \ctikzset{bipoles/varistor/width=#1}%
575 \ctikzset{bipoles/generic/width=#1}%
576 \ctikzset{bipoles/generic potentiometer/width=#1}%
577 \ctikzset{bipoles/ageneric/width=#1}%
578 \ctikzset{bipoles/tgeneric/width=#1}%
579 }}
580 \ctikzset{wiper pos/.code={%
581 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
582 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
583 }}
584 % zigzag resistor
585 \ctikzset{bipoles/resistor/height/.initial=.3}
586 \ctikzset{bipoles/resistor/width/.initial=.8}
587 \ctikzset{bipoles/potentiometer/height/.initial=.8}
588 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
589 \ctikzset{bipoles/potentiometer/width/.initial=.8}
590 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
591 \ctikzset{bipoles/vresistor/height/.initial=.6}
592 \ctikzset{bipoles/vresistor/width/.initial=.8}
593 \ctikzset{bipoles/resistivesens/height/.initial=.6}
594 \ctikzset{bipoles/resistivesens/width/.initial=.8}
595 % square resistors
596 \ctikzset{bipoles/photoresistor/height/.initial=.6}
597 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
598 \ctikzset{bipoles/photoresistor/width/.initial=.8}
599 \ctikzset{bipoles/thermistor/main/.initial=.7}
600 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
601 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
602 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
603 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
604 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
605 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
606 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
607 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
608 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
609 \ctikzset{bipoles/thermistor/width/.initial=.8}
610 \ctikzset{bipoles/varistor/main/.initial=.7}
611 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
612 \ctikzset{bipoles/varistor/width/.initial=.8}
613 \ctikzset{bipoles/generic/height/.initial=.30}
614 \ctikzset{bipoles/generic/width/.initial=.80}
615 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
616 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
617 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
618 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
619 \ctikzset{bipoles/ageneric/height/.initial=.30}
620 \ctikzset{bipoles/tgeneric/height/.initial=.70}
621 \ctikzset{bipoles/tgeneric/width/.initial=.80}
622 \ctikzset{bipoles/ageneric/width/.initial=.80}
623 \ctikzset{bipoles/memristor/height/.initial=.30}
624 \ctikzset{bipoles/memristor/wave height/.initial=.5}
625 \ctikzset{bipoles/memristor/width/.initial=.80}
626
627 \newif\ifpgf@circuit@europeanresistor
628 \ctikzset{resistor/.is choice}
629 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
630 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
631 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
632 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
633 %%>>>
634
635 %% Capacitors%<<<1
636 \ctikzset{bipoles/capacitor/height/.initial=.6}
637 \ctikzset{bipoles/capacitor/width/.initial=.2}
638 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
639 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
640 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
641 %%% pcapacitor is deprecated
642 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
643 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
644 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
645 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
646 \ctikzset{bipoles/ccapacitor/width/.initial=.12}
647 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
648 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
649 \ctikzset{bipoles/vcapacitor/width/.initial=.5}
650 \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
651 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
652 \ctikzset{bipoles/piezoelectric/width/.initial=.5}%
653 %>>>
654
655 % Inductors%<<<1
656 \ctikzset{inductors/coils/.code={%
657 \ctikzset{bipoles/cuteinductor/coils=#1}%
658 \ctikzset{bipoles/cutechoke/coils=#1}%
659 \ctikzset{bipoles/americaninductor/coils=#1}%
660 \ctikzset{bipoles/vcuteinductor/coils=#1}%
661 \ctikzset{bipoles/vamericaninductor/coils=#1}%
662 }}
663 \ctikzset{inductors/width/.code={%
664 \ctikzset{bipoles/cuteinductor/width=#1}%
665 \ctikzset{bipoles/cutechoke/width=#1}%
666 \ctikzset{bipoles/americaninductor/width=#1}%
667 \ctikzset{bipoles/vcuteinductor/width=#1}%
668 \ctikzset{bipoles/vamericaninductor/width=#1}%
669 \ctikzset{bipoles/fullgeneric/width=#1}%
670 \ctikzset{bipoles/tfullgeneric/width=#1}%
671 }}
672 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
673 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
674 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
675 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
676 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
677 %% Cute choke settings
678 \ctikzset{bipoles/cutechoke/height/.initial=.3}
679 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
680 \ctikzset{bipoles/cutechoke/width/.initial=.6}
681 \ctikzset{bipoles/cutechoke/coils/.initial=5}
682 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
683 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
684 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
685 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
686 \newif\ifpgf@circuit@bipole@twolineschoke
687 \pgf@circuit@bipole@twolineschokefalse
688 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
689 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
690 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
691 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
692 %
693 \ctikzset{bipoles/americaninductor/height/.initial=.3}
694 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
695 \ctikzset{bipoles/americaninductor/width/.initial=.8}
696 \ctikzset{bipoles/americaninductor/coils/.initial=4}
697 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
698 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
699 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
700 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
701 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
702 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
703 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
704 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
705 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
706 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
707 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
708 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
709 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
710 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
711 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
712 \ctikzset{inductor/.is choice}
713 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
714 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
715 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
716
717 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
718 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
719 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
720 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
721 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
722
723 %%>>>
724
725 % Sources%<<<1
726
727 \ctikzset{bipoles/esource/height/.initial=.60}
728 \ctikzset{bipoles/esource/width/.initial=.60}
729 \ctikzset{bipoles/pvsource/height/.initial=.60}
730 \ctikzset{bipoles/pvsource/width/.initial=.60}
731 \ctikzset{bipoles/isource/height/.initial=.60}
732 \ctikzset{bipoles/isource/width/.initial=.60}
733 \ctikzset{bipoles/oosource/height/.initial=.60}
734 \ctikzset{bipoles/oosource/width/.initial=.60}
735 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
736 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
737 \ctikzset{bipoles/dcisource/angle/.initial=80}
738 \ctikzset{bipoles/dcisource/height/.initial=.60}
739 \ctikzset{bipoles/dcisource/width/.initial=.60}
740 \ctikzset{bipoles/dcvsource/height/.initial=.60}
741 \ctikzset{bipoles/dcvsource/width/.initial=.60}
742 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
743 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
744 \ctikzset{bipoles/isourceam/height/.initial=.60}
745 \ctikzset{bipoles/isourceam/width/.initial=.60}
746 \ctikzset{bipoles/vsource/height/.initial=.60}
747 \ctikzset{bipoles/vsource/width/.initial=.60}
748 \ctikzset{bipoles/vsourceam/height/.initial=.60}
749 \ctikzset{bipoles/vsourceam/width/.initial=.60}
750 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
751 \ctikzset{bipoles/isourcesin/height/.initial=.60}
752 \ctikzset{bipoles/isourcesin/width/.initial=.60}
753 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
754 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
755 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
756 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
757 \ctikzset{bipoles/cisource/height/.initial=.7}
758 \ctikzset{bipoles/cisource/width/.initial=.7}
759 \ctikzset{bipoles/cisourceam/height/.initial=.7}
760 \ctikzset{bipoles/cisourceam/width/.initial=.7}
761 \ctikzset{bipoles/ecsource/height/.initial=.7}
762 \ctikzset{bipoles/ecsource/width/.initial=.7}
763 \ctikzset{bipoles/cvsource/height/.initial=.7}
764 \ctikzset{bipoles/cvsource/width/.initial=.7}
765 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
766 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
767 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
768 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
769 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
770 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
771 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
772 \ctikzset{bipoles/battery/height/.initial=.6}
773 \ctikzset{bipoles/battery/width/.initial=.3}
774 \ctikzset{bipoles/battery1/height/.initial=.6}
775 \ctikzset{bipoles/battery1/width/.initial=.3}
776 \ctikzset{bipoles/battery2/height/.initial=.6}
777 \ctikzset{bipoles/battery2/width/.initial=.3}
778 % noise sources
779 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
780
781 %%>>>
782
783 % "oo" style transformers and power grid diagrams%<<<1
784 % % % ootransformer
785 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
786 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
787 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
788 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
789 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
790
791 % % % oootransformer
792 \ctikzset{bipoles/ooosource/height/.initial=.6}
793 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
794 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
795 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
796
797 % % % primary windings
798 \newif\ifpgf@circ@prim@delta
799 \newif\ifpgf@circ@prim@wye
800 \newif\ifpgf@circ@prim@zig
801 \pgfkeys{tikz/prim/.is choice}
802 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
803 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
804 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
805
806 % % % secondary windings
807 \newif\ifpgf@circ@sec@delta
808 \newif\ifpgf@circ@sec@wye
809 \newif\ifpgf@circ@sec@zig
810 \pgfkeys{tikz/sec/.is choice}
811 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
812 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
813 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
814
815 % % % tertiary windings (ooosource)
816 \newif\ifpgf@circ@tert@delta
817 \newif\ifpgf@circ@tert@wye
818 \newif\ifpgf@circ@tert@zig
819 \pgfkeys{tikz/tert/.is choice}
820 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
821 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
822 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
823 %>>>
824
825 % diodes%<<<1
826
827 \ctikzset{bipoles/diode/height/.initial=.50}
828 \ctikzset{bipoles/diode/width/.initial=.40}
829 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
830 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
831 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
832 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
833 \ctikzset{bipoles/varcap/height/.initial=.50}
834 \ctikzset{bipoles/varcap/width/.initial=.45}
835 \ctikzset{tripoles/thyristor/height/.initial=1.10}
836 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
837 \ctikzset{tripoles/thyristor/width/.initial=1.0}
838 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
839 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
840 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
841
842 \ctikzset{tripoles/triac/height/.initial=1.1}
843 \ctikzset{tripoles/triac/width/.initial=1}
844 \ctikzset{tripoles/triac/diode width left/.initial=.3}
845 \ctikzset{tripoles/triac/diode width right/.initial=.3}
846 %
847 % Flipping arrows in LED and photodiodes
848 %
849 \newif\ifpgf@led@fliparrows
850 \newif\ifpgf@pd@fliparrows
851 \pgf@led@fliparrowsfalse
852 \pgf@pd@fliparrowsfalse
853 %
854 % by default the arrows start (LED) and go (PD) to the anode.
855 %
856 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
857 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
858 %
859 % but they can start form the cathode (LED) or go to it (PD)
860 %
861 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
862 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
863
864 \newif\ifpgf@circuit@strokediode
865 \newif\ifpgf@circuit@fulldiode
866 \pgf@circuit@strokediodefalse
867 \pgf@circuit@fulldiodefalse
868
869 \ctikzset{diode/.is choice}
870 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
871 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
872 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
873
874 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
875 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
876 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
877
878 %%>>>
879
880 % switches%<<<1
881
882 \ctikzset{bipoles/spst/height/.initial=.35}
883 \ctikzset{bipoles/spst/width/.initial=.35}
884 \ctikzset{bipoles/spst/depth/.initial=.2}
885 \ctikzset{bipoles/nos/height/.initial=.3}
886 \ctikzset{bipoles/nos/width/.initial=.35}
887 \ctikzset{bipoles/nos/depth/.initial=.2}
888 \ctikzset{bipoles/ncs/height/.initial=.35}
889 \ctikzset{bipoles/ncs/width/.initial=.35}
890 \ctikzset{bipoles/ncs/depth/.initial=.2}
891 \ctikzset{bipoles/pushbutton/height/.initial=.5}
892 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
893 \ctikzset{bipoles/pushbutton/width/.initial=.50}
894 %%% reed switch
895 \ctikzset{bipoles/reed/height/.initial=.4}
896 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
897 \ctikzset{bipoles/reed/depth/.initial=.4}
898 %% Cute switches
899 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
900 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
901 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
902 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
903 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
904
905 \ctikzset{tripoles/spdt/width/.initial=.85}
906 \ctikzset{tripoles/spdt/height/.initial=.45}
907 \ctikzset{tripoles/spdt/margin/.initial=.45}
908
909 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
910 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
911 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
912 %%>>>
913
914 % arresters, fuses, lamps, etc%<<<1
915
916 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
917 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
918 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
919 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
920 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
921 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
922 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
923 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
924 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
925 \ctikzset{bipoles/fuse/height/.initial=.20}
926 \ctikzset{bipoles/fuse/width/.initial=.50}
927 \ctikzset{bipoles/afuse/height/.initial=.20}
928 \ctikzset{bipoles/afuse/width/.initial=.50}
929 \ctikzset{bipoles/lamp/height/.initial=.60}
930 \ctikzset{bipoles/lamp/width/.initial=.60}
931 \ctikzset{bipoles/bulb/height/.initial=.8}
932 \ctikzset{bipoles/bulb/width/.initial=.8}
933 \ctikzset{bipoles/tline/height/.initial=.3}
934 \ctikzset{bipoles/tline/width/.initial=.6}
935 \ctikzset{bipoles/squid/height/.initial=.60}
936 \ctikzset{bipoles/squid/width/.initial=.60}
937 \ctikzset{bipoles/barrier/height/.initial=.60}
938 \ctikzset{bipoles/barrier/width/.initial=.60}
939 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
940 \ctikzset{bipoles/thermocouple/height/.initial=.250}
941 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
942 \ctikzset{bipoles/thermocouple/width/.initial=.140}
943 \newif\ifpgf@circuit@europeangfsurgearrester
944 \ctikzset{gas filled surge arrester choice/.is choice}
945 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
946 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
947
948 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
949 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
950 %%>>>
951
952 % wires (open, shorts, ...)%<<<1
953
954 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
955 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
956 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
957 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
958 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
959 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
960 % multiwire
961 \ctikzset{bipoles/multiwire/height/.initial=0.4}
962 \ctikzset{bipoles/multiwire/width/.initial=0.2}
963 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
964 % crossing wires
965 \ctikzset{bipoles/crossing/size/.initial=.2}
966 %%>>>
967
968 % Instruments %<<<1
969 \ctikzset{bipoles/ammeter/height/.initial=.60}
970 \ctikzset{bipoles/ammeter/width/.initial=.60}
971 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
972 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
973 \ctikzset{bipoles/voltmeter/height/.initial=.60}
974 \ctikzset{bipoles/voltmeter/width/.initial=.60}
975 \ctikzset{bipoles/smeter/height/.initial=.60}
976 \ctikzset{bipoles/smeter/width/.initial=.60}
977 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
978 \ctikzset{bipoles/qmeter/depth/.initial=.40}
979 \ctikzset{bipoles/qmeter/height/.initial=.80}
980 \ctikzset{bipoles/qmeter/width/.initial=.60}
981 % this must be specified for each one
982 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
983 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
984 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
985 \ctikzset{bipoles/iloop/width/.initial=.40}
986 \ctikzset{bipoles/iloop/height/.initial=.60}
987
988 \ctikzset{bipoles/oscope/height/.initial=.60}
989 \ctikzset{bipoles/oscope/width/.initial=.60}
990 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
991
992
993 % option to not rotate the new (Romano's) instruments
994 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
995 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
996 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
997 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
998 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
999 %%>>>
1000
1001 % blocks (twoports and so)%<<<1
1002
1003 \ctikzset{bipoles/twoport/width/.initial=.7}
1004 \ctikzset{bipoles/twoport/height/.initial=.7}
1005 \ctikzset{bipoles/twoport/text/.initial=}
1006 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
1007 \ctikzset{bipoles/twoport/text in/.initial=}
1008 \ctikzset{bipoles/twoport/text out/.initial=}
1009 \ctikzset{text/.style={t=#1}}
1010 \ctikzset{t/.code={%
1011 \ctikzsetvalof{bipoles/twoport/text}{#1}%
1012 }}
1013 \ctikzset{text in/.style={t1=#1}}
1014 \ctikzset{t1/.code={%
1015 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
1016 }}
1017 \ctikzset{text out/.style={t2=#1}}
1018 \ctikzset{t2/.code={%
1019 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
1020 }}
1021 \ctikzset{bipoles/vco/width/.initial=.7}
1022 \ctikzset{bipoles/bandpass/width/.initial=.7}
1023 \ctikzset{bipoles/bandstop/width/.initial=.7}
1024 \ctikzset{bipoles/highpass/width/.initial=.7}
1025 \ctikzset{bipoles/lowpass/width/.initial=.7}
1026 \ctikzset{bipoles/allpass/width/.initial=.7}
1027 \ctikzset{bipoles/adc/width/.initial=.7}
1028 \ctikzset{bipoles/dac/width/.initial=.7}
1029 \ctikzset{bipoles/dsp/width/.initial=.7}
1030 \ctikzset{bipoles/fft/width/.initial=.7}
1031 \ctikzset{bipoles/amp/width/.initial=.7}
1032 \ctikzset{bipoles/vamp/width/.initial=.7}
1033 \ctikzset{bipoles/piattenuator/width/.initial=.7}
1034 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
1035 \ctikzset{bipoles/tattenuator/width/.initial=.7}
1036 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
1037 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
1038 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
1039 \ctikzset{bipoles/detector/width/.initial=.7}
1040 \ctikzset{tripoles/mixer/width/.initial=0.7}
1041 \ctikzset{tripoles/adder/width/.initial=0.7}
1042 \ctikzset{tripoles/circulator/width/.initial=.7}
1043 \ctikzset{tripoles/oscillator/width/.initial=.7}
1044
1045 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
1046 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
1047
1048 \ctikzset{tripoles/splitter/height/.initial=1.3}
1049 \ctikzset{tripoles/splitter/width/.initial=1.3}
1050
1051 \ctikzset{tripoles/mzm/height/.initial=1.3}
1052 \ctikzset{tripoles/mzm/width/.initial=1.3}
1053 %%>>>
1054
1055 % Transistors %<<<1
1056
1057 \newif\ifpgf@circuit@trans@depletiontype
1058 \pgf@circuit@trans@depletiontypefalse
1059
1060 \newif\ifpgf@circuit@mos@arrows
1061 \ctikzset{tripoles/mos style/.is choice}
1062 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
1063 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
1064 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
1065 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
1066
1067 % Fixed label positions
1068 \newif\ifpgf@circuit@transisors@fixlabels
1069 \pgf@circuit@transisors@fixlabelstrue
1070 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1071 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1072 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1073 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1074
1075 % Option solderdot for fet
1076 \newif\ifpgf@circuit@fet@solderdot
1077 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1078 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1079 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1080 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1081
1082 % Option bodydiode for fet
1083 \newif\ifpgf@circuit@fet@bodydiode
1084 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1085 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1086 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1087 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1088
1089 % Option draw fet without gate connection
1090 \newif\ifpgf@circuit@bpt@drawgate
1091 \pgf@circuit@bpt@drawgatetrue
1092 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1093 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1094 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1095 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1096
1097 % Option draw bpt with schottky base
1098 \newif\ifpgf@circuit@bpt@schottky
1099 \pgf@circuit@bpt@schottkyfalse
1100 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1101 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1102 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1103 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1104 \ctikzset{tripoles/schottky base size/.initial=0.05}
1105
1106 % Option draw bpt without base connection
1107 \newif\ifpgf@circuit@bpt@drawbase
1108 \pgf@circuit@bpt@drawbasetrue
1109 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1110 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1111 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1112 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1113
1114 % Option draw bpt with optical input
1115 \newif\ifpgf@circuit@bpt@drawphoto
1116 \pgf@circuit@bpt@drawphotofalse
1117 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1118 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1119 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1120 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1121
1122 % Option draw fet without bulk connection -- Added by Burak Kelleci
1123 \newif\ifpgf@circuit@bpt@drawbulk
1124 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1125 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1126 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1127 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1128
1129 % Option draw pmos with empty circle
1130 \newif\ifpgf@circuit@pmos@emptycircle
1131 \pgf@circuit@pmos@emptycirclefalse
1132 \ctikzset{tripoles/pmos style/.is choice}
1133 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1134 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1135 % Option draw pmos with no circle
1136 \newif\ifpgf@circuit@pmos@nocircle
1137 \pgf@circuit@pmos@nocirclefalse
1138 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1139 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1140 % back to normal
1141 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1142 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1143 % arrows at the end, the correct way
1144 \newif\ifpgf@circuit@trans@arrowatend
1145 \pgf@circuit@trans@arrowatendfalse
1146 \ctikzset{transistors/arrow pos/.is choice}
1147 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
1148 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
1149
1150 \newif\ifpgf@circuit@trans@ntype
1151 \pgf@circuit@trans@ntypetrue %default true
1152 %\newif\ifpgf@circuit@trans@ptype
1153 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
1154 \ctikzset{tripoles/nmos/width/.initial=.7}
1155 \ctikzset{tripoles/nmos/gate height/.initial=.35}
1156 \ctikzset{tripoles/nmos/base height/.initial=.5}
1157 \ctikzset{tripoles/nmos/conn height/.initial=0}
1158 \ctikzset{tripoles/nmos/height/.initial=1.1}
1159 \ctikzset{tripoles/nmos/base width/.initial=.5}
1160 \ctikzset{tripoles/nmos/gate width/.initial=.62}
1161 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
1162 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
1163 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
1164 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
1165 \ctikzset{tripoles/nmos/curr direction/.initial=1}
1166
1167 \ctikzset{tripoles/pmos/width/.initial=.7}
1168 \ctikzset{tripoles/pmos/gate height/.initial=.35}
1169 \ctikzset{tripoles/pmos/base height/.initial=.5}
1170 \ctikzset{tripoles/pmos/conn height/.initial=0}
1171 \ctikzset{tripoles/pmos/height/.initial=1.1}
1172 \ctikzset{tripoles/pmos/base width/.initial=.5}
1173 \ctikzset{tripoles/pmos/gate width/.initial=.62}
1174 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
1175 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
1176 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
1177 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
1178 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
1179
1180 \ctikzset{tripoles/nmosd/width/.initial=.7}
1181 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
1182 \ctikzset{tripoles/nmosd/base height/.initial=.5}
1183 \ctikzset{tripoles/nmosd/conn height/.initial=0}
1184 \ctikzset{tripoles/nmosd/height/.initial=1.1}
1185 \ctikzset{tripoles/nmosd/base width/.initial=.5}
1186 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
1187 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
1188 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
1189 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
1190 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
1191 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
1192 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
1193 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
1194
1195 \ctikzset{tripoles/pmosd/width/.initial=.7}
1196 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
1197 \ctikzset{tripoles/pmosd/base height/.initial=.5}
1198 \ctikzset{tripoles/pmosd/conn height/.initial=0}
1199 \ctikzset{tripoles/pmosd/height/.initial=1.1}
1200 \ctikzset{tripoles/pmosd/base width/.initial=.5}
1201 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
1202 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
1203 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
1204 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
1205 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
1206 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
1207 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
1208 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
1209 \ctikzset{tripoles/hemt/width/.initial=.7}
1210 \ctikzset{tripoles/hemt/gate height/.initial=.35}
1211 \ctikzset{tripoles/hemt/base height/.initial=.5}
1212 \ctikzset{tripoles/hemt/conn height/.initial=0}
1213 \ctikzset{tripoles/hemt/height/.initial=1.1}
1214 \ctikzset{tripoles/hemt/base width/.initial=.5}
1215 \ctikzset{tripoles/hemt/gate width/.initial=.62}
1216 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
1217 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
1218 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
1219 \ctikzset{tripoles/hemt/curr direction/.initial=1}
1220
1221 \ctikzset{tripoles/nfet/width/.initial=.7}
1222 \ctikzset{tripoles/nfet/gate height/.initial=.35}
1223 \ctikzset{tripoles/nfet/base height/.initial=.5}
1224 \ctikzset{tripoles/nfet/conn height/.initial=0}
1225 \ctikzset{tripoles/nfet/height/.initial=1.1}
1226 \ctikzset{tripoles/nfet/base width/.initial=.5}
1227 \ctikzset{tripoles/nfet/gate width/.initial=.62}
1228 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
1229 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
1230 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
1231 \ctikzset{tripoles/nfet/curr direction/.initial=1}
1232
1233 \ctikzset{tripoles/pfet/width/.initial=.7}
1234 \ctikzset{tripoles/pfet/gate height/.initial=.35}
1235 \ctikzset{tripoles/pfet/base height/.initial=.5}
1236 \ctikzset{tripoles/pfet/conn height/.initial=0}
1237 \ctikzset{tripoles/pfet/height/.initial=1.1}
1238 \ctikzset{tripoles/pfet/base width/.initial=.5}
1239 \ctikzset{tripoles/pfet/gate width/.initial=.62}
1240 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
1241 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
1242 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
1243 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
1244
1245 \ctikzset{tripoles/nfetd/width/.initial=.7}
1246 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
1247 \ctikzset{tripoles/nfetd/base height/.initial=.5}
1248 \ctikzset{tripoles/nfetd/conn height/.initial=0}
1249 \ctikzset{tripoles/nfetd/height/.initial=1.1}
1250 \ctikzset{tripoles/nfetd/base width/.initial=.5}
1251 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
1252 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
1253 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
1254 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
1255 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
1256
1257 \ctikzset{tripoles/pfetd/width/.initial=.7}
1258 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
1259 \ctikzset{tripoles/pfetd/base height/.initial=.5}
1260 \ctikzset{tripoles/pfetd/conn height/.initial=0}
1261 \ctikzset{tripoles/pfetd/height/.initial=1.1}
1262 \ctikzset{tripoles/pfetd/base width/.initial=.5}
1263 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
1264 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
1265 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
1266 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
1267 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
1268
1269 \ctikzset{tripoles/nigfete/width/.initial=.7}
1270 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
1271 \ctikzset{tripoles/nigfete/base height/.initial=.5}
1272 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
1273 \ctikzset{tripoles/nigfete/height/.initial=1.1}
1274 \ctikzset{tripoles/nigfete/base width/.initial=.5}
1275 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
1276 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
1277 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
1278 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
1279 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
1280
1281 \ctikzset{tripoles/nigfetd/width/.initial=.7}
1282 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
1283 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
1284 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
1285 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
1286 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
1287 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
1288 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
1289 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
1290 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
1291 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
1292
1293 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
1294 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
1295 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
1296 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
1297 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
1298 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
1299 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
1300 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
1301 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
1302 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
1303 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
1304
1305 \ctikzset{tripoles/pigfete/width/.initial=.7}
1306 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
1307 \ctikzset{tripoles/pigfete/base height/.initial=.5}
1308 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
1309 \ctikzset{tripoles/pigfete/height/.initial=1.1}
1310 \ctikzset{tripoles/pigfete/base width/.initial=.5}
1311 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
1312 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
1313 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
1314 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
1315 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
1316
1317 \ctikzset{tripoles/pigfetd/width/.initial=.7}
1318 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
1319 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
1320 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
1321 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
1322 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
1323 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
1324 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
1325 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
1326 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
1327 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
1328
1329 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
1330 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
1331 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
1332 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
1333 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
1334 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
1335 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
1336 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
1337 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
1338 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
1339 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
1340
1341 \ctikzset{tripoles/npn/width/.initial=.6}
1342 \ctikzset{tripoles/npn/base height/.initial=.45}
1343 \ctikzset{tripoles/npn/base height 2/.initial=.15}
1344 \ctikzset{tripoles/npn/base height/.initial=.4}
1345 \ctikzset{tripoles/npn/conn height/.initial=0}
1346 \ctikzset{tripoles/npn/height/.initial=1.1}
1347 \ctikzset{tripoles/npn/base width/.initial=.5}
1348 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
1349 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
1350 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
1351 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
1352 \ctikzset{tripoles/npn/curr direction/.initial=1}
1353
1354 \ctikzset{tripoles/pnp/width/.initial=.6}
1355 \ctikzset{tripoles/pnp/base height/.initial=.45}
1356 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
1357 \ctikzset{tripoles/pnp/base height/.initial=.4}
1358 \ctikzset{tripoles/pnp/conn height/.initial=0}
1359 \ctikzset{tripoles/pnp/height/.initial=1.1}
1360 \ctikzset{tripoles/pnp/base width/.initial=.5}
1361 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
1362 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
1363 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
1364 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
1365 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
1366
1367 \ctikzset{tripoles/pigbt/width/.initial=.6}
1368 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
1369 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
1370 \ctikzset{tripoles/pigbt/base height/.initial=.4}
1371 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
1372 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
1373 \ctikzset{tripoles/pigbt/conn height/.initial=0}
1374 \ctikzset{tripoles/pigbt/height/.initial=1.1}
1375 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
1376 \ctikzset{tripoles/pigbt/base width/.initial=.5}
1377 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
1378 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
1379 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
1380 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
1381
1382 \ctikzset{tripoles/nigbt/width/.initial=.6}
1383 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
1384 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
1385 \ctikzset{tripoles/nigbt/base height/.initial=.4}
1386 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
1387 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
1388 \ctikzset{tripoles/nigbt/conn height/.initial=0}
1389 \ctikzset{tripoles/nigbt/height/.initial=1.1}
1390 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
1391 \ctikzset{tripoles/nigbt/base width/.initial=.5}
1392 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
1393 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
1394 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
1395 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
1396
1397 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
1398 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
1399 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
1400 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
1401 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
1402 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
1403 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
1404 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
1405 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
1406 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
1407 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
1408 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
1409 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
1410 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
1411
1412 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
1413 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
1414 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
1415 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
1416 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
1417 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
1418 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
1419 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
1420 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
1421 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
1422 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
1423 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
1424 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
1425 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
1426
1427 \ctikzset{tripoles/igbt/outer base height/.code={
1428 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
1429 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
1430 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
1431 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
1432 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
1433 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
1434 }}
1435 \ctikzset{tripoles/igbt/outer base thickness/.code={
1436 \ctikzset{tripoles/nigbt/outer base thickness=#1}
1437 \ctikzset{tripoles/pigbt/outer base thickness=#1}
1438 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
1439 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
1440 }}
1441
1442 \ctikzset{tripoles/njfet/width/.initial=.7}
1443 \ctikzset{tripoles/njfet/gate height/.initial=.5}
1444 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
1445 \ctikzset{tripoles/njfet/gate width/.initial=.5}
1446 \ctikzset{tripoles/njfet/conn height/.initial=.35}
1447 \ctikzset{tripoles/njfet/height/.initial=1.1}
1448 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
1449 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
1450 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
1451 \ctikzset{tripoles/njfet/curr direction/.initial=1}
1452
1453 \ctikzset{tripoles/pjfet/width/.initial=.7}
1454 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
1455 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
1456 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
1457 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
1458 \ctikzset{tripoles/pjfet/height/.initial=1.1}
1459 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
1460 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
1461 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
1462 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
1463
1464 \ctikzset{tripoles/isfet/width/.initial=1}
1465 \ctikzset{tripoles/isfet/gate height/.initial=.35}
1466 \ctikzset{tripoles/isfet/base height/.initial=.5}
1467 \ctikzset{tripoles/isfet/height/.initial=1.1}
1468 \ctikzset{tripoles/isfet/base width/.initial=.3}
1469 \ctikzset{tripoles/isfet/gate width/.initial=.5}
1470 \ctikzset{tripoles/isfet/conn height/.initial=0}
1471 \ctikzset{tripoles/isfet/wave width/.initial=.16}
1472 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
1473 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
1474 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
1475 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
1476 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
1477 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
1478 \ctikzset{tripoles/isfet/curr direction/.initial=1}
1479 %
1480 % multi-emitter and multi-collector BJTs by Romano Giannetti
1481 %
1482 \ctikzset{tripoles/bjt/emitters/.initial=1}
1483 \ctikzset{tripoles/bjt/collectors/.initial=1}
1484 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
1485 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
1486 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
1487 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
1488 \ctikzset{tripoles/bjt/multi height/.initial=.5}
1489 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
1490 %
1491 \ctikzset{tripoles/bjt/width/.initial=.3}
1492 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
1493 \ctikzset{tripoles/bjt/base height/.initial=1.1}
1494 \ctikzset{tripoles/bjt/height/.initial=.4}
1495 \ctikzset{tripoles/bjt/base width/.initial=1}
1496 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
1497 % do NOT touch these two!
1498 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
1499 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
1500
1501 %% transistors stop here
1502 %%>>>
1503
1504 % Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
1505 \ctikzset{tubes/width/.initial=1} % relative width
1506 \ctikzset{tubes/height/.initial=1.4} % relative height
1507 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
1508 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
1509 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
1510 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
1511 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
1512 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
1513 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
1514 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
1515 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
1516 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
1517 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
1518 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
1519 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
1520
1521 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
1522 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1523 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
1524 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
1525 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1526 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
1527 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
1528 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
1529 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
1530 %>>>
1531
1532 %% Logic ports%<<<1
1533 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
1534
1535 % switches for logic gates
1536 %
1537 \pgfkeys{/tikz/number inputs/.initial=0}
1538 \pgfkeys{/tikz/number inputs/.default=0}
1539
1540 \newif\ifpgf@circuit@europeanlogicport
1541 \ctikzset{logic ports/.is choice}
1542 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
1543 \tikzset{and port/.style={shape=european and port}}%
1544 \tikzset{or port/.style={shape=european or port}}%
1545 \tikzset{xor port/.style={shape=european xor port}}%
1546 \tikzset{buffer port/.style={shape=european buffer port}}%
1547 \tikzset{not port/.style={shape=european not port}}%
1548 \tikzset{nand port/.style={shape=european nand port}}%
1549 \tikzset{nor port/.style={shape=european nor port}}%
1550 \tikzset{xnor port/.style={shape=european xnor port}}%
1551 % there is no Schmitt ports in european style (yet)
1552 \tikzset{schmitt port/.style={shape=schmitt}}%
1553 \tikzset{invschmitt port/.style={shape=invschmitt}}%
1554 }}
1555 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
1556 \tikzset{and port/.style={shape=american and port}}%
1557 \tikzset{or port/.style={shape=american or port}}%
1558 \tikzset{xor port/.style={shape=american xor port}}%
1559 \tikzset{buffer port/.style={shape=american buffer port}}%
1560 \tikzset{not port/.style={shape=american not port}}%
1561 \tikzset{nand port/.style={shape=american nand port}}%
1562 \tikzset{nor port/.style={shape=american nor port}}%
1563 \tikzset{xnor port/.style={shape=american xnor port}}%
1564 \tikzset{schmitt port/.style={shape=schmitt}}%
1565 \tikzset{invschmitt port/.style={shape=invschmitt}}%
1566 }}
1567
1568 \ctikzset{logic ports origin/.is choice}
1569 \ctikzset{logic ports origin/legacy/.code={
1570 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
1571 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
1572 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
1573 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
1574 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
1575 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
1576 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
1577 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
1578 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
1579 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
1580 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
1581 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
1582 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
1583 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
1584 }%
1585 }
1586 \ctikzset{logic ports origin/center/.code={%
1587 \ctikzset{tripoles/american and port/origin/.initial=0}%
1588 \ctikzset{tripoles/american nand port/origin/.initial=0}%
1589 \ctikzset{tripoles/american nor port/origin/.initial=0}%
1590 \ctikzset{tripoles/american or port/origin/.initial=0}%
1591 \ctikzset{tripoles/american xor port/origin/.initial=0}%
1592 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
1593 \ctikzset{tripoles/european and port/origin/.initial=0}%
1594 \ctikzset{tripoles/european nand port/origin/.initial=0}%
1595 \ctikzset{tripoles/european or port/origin/.initial=0}%
1596 \ctikzset{tripoles/european nor port/origin/.initial=0}%
1597 \ctikzset{tripoles/european xor port/origin/.initial=0}%
1598 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
1599 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
1600 \ctikzset{tripoles/european not port/origin/.initial=0}%
1601 }%
1602 }
1603
1604 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
1605 \ctikzset{american or shape/.is choice}
1606 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
1607 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
1608
1609 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
1610 \ctikzset{logic ports draw input leads/.is choice}
1611 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
1612 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
1613 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
1614 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
1615
1616 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
1617 \ctikzset{logic ports draw output leads/.is choice}
1618 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
1619 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
1620 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
1621 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
1622
1623 \ctikzset{logic ports draw leads/.is choice}
1624 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
1625 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
1626 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
1627 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
1628
1629 % adding a different style of xnor port
1630 % see https://github.com/circuitikz/circuitikz/issues/467
1631 \ctikzset{european xnor style/.is choice}
1632 \ctikzset{european xnor style/default/.code={%
1633 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
1634 }
1635 \ctikzset{european xnor style/direct/.code={%
1636 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
1637 }
1638
1639
1640 % old, legacy keys that should be killed over
1641 \ctikzset{bipoles/buffer/height/.initial=1}
1642 \ctikzset{bipoles/buffer/width/.initial=1}
1643 \ctikzset{bipoles/not port/width/.initial=1}
1644 \ctikzset{bipoles/not port/height/.initial=.8}
1645 \ctikzset{bipoles/not port/circle width/.initial=.15}
1646
1647 \ctikzset{tripoles/american and port/width/.initial=1.1}
1648 \ctikzset{tripoles/american and port/height/.initial=.8}
1649 \ctikzset{tripoles/american and port/port width/.initial=.7}
1650 \ctikzset{tripoles/american and port/input height/.initial=.5}
1651 \ctikzset{tripoles/american nand port/width/.initial=1.1}
1652 \ctikzset{tripoles/american nand port/height/.initial=.8}
1653 \ctikzset{tripoles/american nand port/port width/.initial=.7}
1654 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
1655 \ctikzset{tripoles/american nand port/input height/.initial=.5}
1656 \ctikzset{tripoles/american or port/width/.initial=1.1}
1657 \ctikzset{tripoles/american or port/height/.initial=.8}
1658 \ctikzset{tripoles/american or port/port width/.initial=.7}
1659 \ctikzset{tripoles/american or port/input height/.initial=.5}
1660 \ctikzset{tripoles/american or port/input skip/.initial=.25}
1661 \ctikzset{tripoles/american or port/aaa/.initial=.6}
1662 \ctikzset{tripoles/american or port/bbb/.initial=.4}
1663 \ctikzset{tripoles/american or port/ccc/.initial=.5}
1664 \ctikzset{tripoles/american or port/ddd/.initial=.0}
1665 \ctikzset{tripoles/american nor port/width/.initial=1.1}
1666 \ctikzset{tripoles/american nor port/height/.initial=.8}
1667 \ctikzset{tripoles/american nor port/port width/.initial=.7}
1668 \ctikzset{tripoles/american nor port/input height/.initial=.5}
1669 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
1670 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
1671 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
1672 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
1673 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
1674 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
1675 \ctikzset{tripoles/american xor port/width/.initial=1.1}
1676 \ctikzset{tripoles/american xor port/height/.initial=.8}
1677 \ctikzset{tripoles/american xor port/port width/.initial=.7}
1678 \ctikzset{tripoles/american xor port/input height/.initial=.5}
1679 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
1680 \ctikzset{tripoles/american xor port/distance/.initial=.1}
1681 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
1682 \ctikzset{tripoles/american xnor port/height/.initial=.8}
1683 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
1684 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
1685 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
1686 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
1687 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
1688 \ctikzset{tripoles/american and port/origin/.initial=0.8}
1689 \ctikzset{tripoles/american and port/inputs/.initial=2}
1690 % variable number of inputs
1691 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
1692 \ctikzset{tripoles/american nand port/inputs/.initial=2}
1693 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
1694 \ctikzset{tripoles/american nor port/inputs/.initial=2}
1695 \ctikzset{tripoles/american nor port/angle/.initial=70}
1696 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
1697 \ctikzset{tripoles/american or port/origin/.initial=0.8}
1698 \ctikzset{tripoles/american or port/inputs/.initial=2}
1699 \ctikzset{tripoles/american or port/angle/.initial=70}
1700 \ctikzset{tripoles/american or port/inner/.initial=0.3}
1701 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
1702 \ctikzset{tripoles/american xor port/inputs/.initial=2}
1703 \ctikzset{tripoles/american xor port/angle/.initial=70}
1704 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
1705 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
1706 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
1707 \ctikzset{tripoles/american xnor port/angle/.initial=70}
1708 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
1709
1710 \ctikzset{tripoles/european and port/width/.initial=1.4}
1711 \ctikzset{tripoles/european and port/height/.initial=.65}
1712 \ctikzset{tripoles/european and port/reserved/.initial=.6}
1713 \ctikzset{tripoles/european and port/input height/.initial=.6}
1714 \ctikzset{tripoles/european or port/width/.initial=1.4}
1715 \ctikzset{tripoles/european or port/height/.initial=.65}
1716 \ctikzset{tripoles/european or port/reserved/.initial=.6}
1717 \ctikzset{tripoles/european or port/input height/.initial=.6}
1718 \ctikzset{tripoles/european xor port/width/.initial=1.4}
1719 \ctikzset{tripoles/european xor port/height/.initial=.65}
1720 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
1721 \ctikzset{tripoles/european xor port/input height/.initial=.6}
1722 \ctikzset{tripoles/european nand port/width/.initial=1.4}
1723 \ctikzset{tripoles/european nand port/not height/.initial=.3}
1724 \ctikzset{tripoles/european nand port/not width/.initial=.8}
1725 \ctikzset{tripoles/european nand port/height/.initial=.65}
1726 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
1727 \ctikzset{tripoles/european nand port/input height/.initial=.6}
1728 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
1729 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
1730 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
1731 \ctikzset{tripoles/european buffer port/height/.initial=.65}
1732 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
1733 \ctikzset{tripoles/european buffer port/input height/.initial=0}
1734 \ctikzset{tripoles/european not port/width/.initial=1.4}
1735 \ctikzset{tripoles/european not port/not height/.initial=.3}
1736 \ctikzset{tripoles/european not port/not width/.initial=.8}
1737 \ctikzset{tripoles/european not port/height/.initial=.65}
1738 \ctikzset{tripoles/european not port/reserved/.initial=.6}
1739 \ctikzset{tripoles/european not port/input height/.initial=0}
1740 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
1741 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
1742 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
1743 \ctikzset{tripoles/european xnor port/height/.initial=.65}
1744 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
1745 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
1746 \ctikzset{tripoles/european nor port/width/.initial=1.4}
1747 \ctikzset{tripoles/european nor port/not height/.initial=.3}
1748 \ctikzset{tripoles/european nor port/not width/.initial=.8}
1749 \ctikzset{tripoles/european nor port/height/.initial=.65}
1750 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
1751 \ctikzset{tripoles/european nor port/input height/.initial=.6}
1752 % variable number of inputs
1753 \ctikzset{tripoles/european and port/origin/.initial=0.8}
1754 \ctikzset{tripoles/european and port/inputs/.initial=2}
1755 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
1756 \ctikzset{tripoles/european nand port/inputs/.initial=2}
1757 \ctikzset{tripoles/european or port/origin/.initial=0.8}
1758 \ctikzset{tripoles/european or port/inputs/.initial=2}
1759 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
1760 \ctikzset{tripoles/european nor port/inputs/.initial=2}
1761 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
1762 \ctikzset{tripoles/european xor port/inputs/.initial=2}
1763 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
1764 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
1765 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
1766 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
1767 \ctikzset{tripoles/european not port/origin/.initial=0.8}
1768 \ctikzset{tripoles/european not port/inputs/.initial=1}%
1769 %%% parameters that are not used anymore after multi-input
1770 %%% gates --- left for compatibility of source code.
1771 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
1772 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
1773 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
1774 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
1775 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
1776 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
1777 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
1778 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
1779 %%>>>
1780
1781 % flip flops and muxdemxes%<<<1
1782
1783 %% flip-flop specific keys (most others are the same as chips)
1784
1785 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
1786 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
1787 \ctikzset{multipoles/flipflop/width/.initial=1.2}
1788 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
1789 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
1790
1791 %% muxdemuxes keys
1792
1793 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
1794 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
1795 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
1796 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
1797 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
1798 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
1799 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
1800 \ctikzset{multipoles/muxdemux/NL/.initial=8}
1801 \ctikzset{multipoles/muxdemux/NR/.initial=1}
1802 \ctikzset{multipoles/muxdemux/NB/.initial=3}
1803 \ctikzset{multipoles/muxdemux/NT/.initial=0}
1804 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
1805 %>>>
1806
1807 % Amplifiers%<<<1
1808 %
1809 % switches for op amps
1810 % changing input polarity
1811 %
1812 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
1813 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1814 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1815 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1816 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1817 %
1818 % changing output polarity (for fully diff objects)
1819 %
1820 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
1821 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1822 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1823 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1824 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1825
1826 % Operational amplifier
1827 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
1828 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
1829 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
1830 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
1831 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
1832 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1833
1834 % Fully differential operational amplifier
1835 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
1836 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
1837 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
1838 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
1839 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
1840 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
1841 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1842
1843 \ctikzset{tripoles/en amp/width/.initial=1.7}
1844 \ctikzset{tripoles/en amp/port width/.initial=.7}
1845 \ctikzset{tripoles/en amp/height/.initial=1.6}
1846 \ctikzset{tripoles/en amp/input height/.initial=.3}
1847 \ctikzset{tripoles/en amp/up pos/.initial=.45}
1848 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1849 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
1850 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
1851 \tikzset{
1852 en amp text/.code = {%
1853 \ctikzsetvalof{tripoles/en amp/text}{#1}%
1854 },
1855 en amp text A/.code = {%
1856 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
1857 },
1858 }
1859
1860 % Transconductance amplifier
1861 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
1862 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
1863 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
1864 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
1865 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
1866 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
1867 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1868
1869 % Instrumentation amplifier
1870 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
1871 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
1872 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
1873 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1874 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
1875 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
1876 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1877 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1878
1879 % Instrumentation amplifier with differential output
1880 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
1881 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
1882 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
1883 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1884 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
1885 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
1886 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
1887 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1888 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1889
1890 % Instrumentation amplifier with gain resistor terminals
1891 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
1892 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
1893 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
1894 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
1895 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
1896 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
1897 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
1898 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
1899 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1900
1901 % Plain amplifier
1902 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
1903 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
1904 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
1905 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
1906 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
1907
1908 % changing fonts and symbols of amplifiers
1909 \ctikzset{amplifiers/symbol font/.code={%
1910 \ctikzset{tripoles/inst amp ra/font=#1}%
1911 \ctikzset{tripoles/fd inst amp/font=#1}%
1912 \ctikzset{tripoles/inst amp/font=#1}%
1913 \ctikzset{tripoles/gm amp/font=#1}%
1914 \ctikzset{tripoles/en amp/font=#1}%
1915 \ctikzset{tripoles/fd op amp/font=#1}%
1916 \ctikzset{tripoles/op amp/font=#1}%
1917 }}
1918 \ctikzset{amplifiers/plus/.initial={$+$}}
1919 \ctikzset{amplifiers/minus/.initial={$-$}}
1920 \tikzset{amp symbol font/.code={%
1921 \ctikzset{amplifiers/symbol font={#1}}%
1922 }
1923 }
1924 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
1925 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
1926 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
1927 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
1928 %%>>>
1929
1930 % Transformers%<<<1
1931
1932 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
1933 \ctikzset{quadpoles/transformer/width/.initial=1.5}
1934 \ctikzset{quadpoles/transformer/width1/.initial=.4}
1935 \ctikzset{quadpoles/transformer/height/.initial=1.5}
1936 \ctikzset{quadpoles/transformer/height1/.initial=.8}
1937 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
1938 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
1939 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
1940 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
1941 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
1942 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
1943 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
1944 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
1945 \ctikzset{quadpoles/fourport/width/.initial=1.3}
1946 \ctikzset{quadpoles/fourport/height/.initial=1.3}
1947 \ctikzset{quadpoles/coupler/width/.initial=1.3}
1948 \ctikzset{quadpoles/coupler/height/.initial=1.3}
1949 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
1950 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
1951
1952 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
1953
1954 \ctikzset{quadpoles style/.is choice}
1955 \ctikzset{quadpoles style/inward/.code={% default value
1956 \ctikzset{quadpoles/transformer/inner=0.4}%
1957 \ctikzset{quadpoles/transformer/width=1.5}%
1958 \ctikzset{quadpoles/transformer core/inner=0.4}%
1959 \ctikzset{quadpoles/transformer core/width=1.5}%
1960 \ctikzset{quadpoles/gyrator/inner=0.4}%
1961 \ctikzset{quadpoles/gyrator/width=1.5}%
1962 }%
1963 }
1964 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
1965 \ctikzset{quadpoles/transformer/inner=1}%
1966 \ctikzset{quadpoles/transformer/width=0.6}%
1967 \ctikzset{quadpoles/transformer core/inner=1}%
1968 \ctikzset{quadpoles/transformer core/width=0.6}%
1969 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
1970 \ctikzset{quadpoles/gyrator/width=0.6}%
1971 }%
1972 }
1973 %%>>>
1974
1975 % seven segment displays by RGtti%<<<1
1976
1977 \newif\ifpgf@circ@sevenseg@dot
1978 \newif\ifpgf@circ@sevenseg@box
1979 \def\pgf@circ@sevenseg@dotstate{empty}
1980 \ctikzset{seven seg/.is family}
1981 \ctikzset{seven seg/dot/.is choice}
1982 % none means no dot, not space for it. Empty means no dot, but space
1983 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
1984 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
1985 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
1986 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
1987 %
1988 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
1989 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
1990 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
1991 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
1992 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
1993 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
1994 \ctikzset{seven seg/box/.is choice}
1995 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
1996 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
1997
1998 \ctikzset{seven seg/bits/.initial=0000000}
1999
2000 \ctikzset{seven seg/value/.code={%
2001 \edef\@@tmp{#1}%
2002 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
2003 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
2004 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
2005 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
2006 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
2007 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
2008 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
2009 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
2010 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
2011 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
2012 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2013 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2014 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2015 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2016 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2017 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2018 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2019 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2020 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2021 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2022 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2023 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2024 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2025 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2026 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2027 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2028 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2029 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2030 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
2031 }}
2032
2033 \tikzset{%
2034 seven segment val/.style args={#1dot#2box#3}{%
2035 shape=bare7seg,
2036 /tikz/circuitikz/seven seg/value=#1,
2037 /tikz/circuitikz/seven seg/dot=#2,
2038 /tikz/circuitikz/seven seg/box=#3,
2039 },
2040 seven segment bits/.style args={#1dot#2box#3}{%
2041 shape=bare7seg,
2042 /tikz/circuitikz/seven seg/bits=#1,
2043 /tikz/circuitikz/seven seg/dot=#2,
2044 /tikz/circuitikz/seven seg/box=#3,
2045 },
2046 }
2047 %%>>>
2048
2049 % Options for twoports and blocks%<<<1
2050
2051 % Option ">" for twoports
2052 \newif\ifpgf@circuit@inputarrow
2053 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
2054 \ctikzset{inputarrow/.is choice}
2055 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
2056 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
2057
2058 % Option "boxed" for nodes and twoports
2059 \newif\ifpgf@circuit@boxed
2060 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
2061 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
2062 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
2063 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
2064
2065 % Option "dashed" for nodes and twoports
2066 \newif\ifpgf@circuit@dashed
2067 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
2068 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
2069 %>>>
2070
2071 % Chips and Rotary switches (multipoles) %<<<1
2072 %
2073 \ctikzset{multipoles/thickness/.initial=2}
2074 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
2075 % DIP (dual in line package) chips
2076 \ctikzset{multipoles/dipchip/width/.initial=1.2}
2077 \ctikzset{multipoles/dipchip/num pins/.initial=8}
2078 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
2079 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
2080 % QFP (quad flat package) chips
2081 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
2082 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
2083 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
2084 % chip numbers
2085 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
2086 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2087 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2088 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2089 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2090 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
2091 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2092 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2093 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2094 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2095 % external chip pins
2096 \ctikzset{multipoles/external pins thickness/.initial=1}
2097 \ctikzset{multipoles/external pins width/.initial=0.2}
2098 \ctikzset{multipoles/external pad fraction/.initial=0}
2099 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
2100 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
2101 % topmarks
2102 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
2103 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2104 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2105 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2106 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2107
2108 % rotary switch by Romano
2109 \ctikzset{multipoles/rotary/thickness/.initial=1}
2110 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
2111 \ctikzset{multipoles/rotary/channels/.initial=5}
2112 \ctikzset{multipoles/rotary/angle/.initial=60}
2113 \ctikzset{multipoles/rotary/wiper/.initial=20}
2114 \ctikzset{multipoles/rotary/arrow/.is choice}
2115 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
2116 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
2117 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
2118 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
2119 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
2120 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
2121 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
2122
2123 \tikzset{%
2124 rotary switch/.style args={#1in#2wiper#3}{%
2125 shape=rotaryswitch,
2126 /tikz/circuitikz/multipoles/rotary/channels=#1,
2127 /tikz/circuitikz/multipoles/rotary/angle=#2,
2128 /tikz/circuitikz/multipoles/rotary/wiper=#3,
2129 },
2130 rotary switch -/.style args={#1in#2wiper#3}{
2131 rotary switch=#1 in #2 wiper #3,
2132 /tikz/circuitikz/multipoles/rotary/arrow=none,
2133 },
2134 rotary switch <-/.style args={#1in#2wiper#3}{
2135 rotary switch=#1 in #2 wiper #3,
2136 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
2137 },
2138 rotary switch ->/.style args={#1in#2wiper#3}{
2139 rotary switch=#1 in #2 wiper #3,
2140 /tikz/circuitikz/multipoles/rotary/arrow=cw,
2141 },
2142 rotary switch <->/.style args={#1in#2wiper#3}{
2143 rotary switch=#1 in #2 wiper #3,
2144 /tikz/circuitikz/multipoles/rotary/arrow=both,
2145 },
2146 % Notice that these should be the same as the initial values of the keys
2147 rotary switch/.default={5 in 60 wiper 20},
2148 rotary switch -/.default={5 in 60 wiper 20},
2149 rotary switch <-/.default={5 in 60 wiper 20},
2150 rotary switch ->/.default={5 in 60 wiper 20},
2151 rotary switch <->/.default={5 in 60 wiper 20},
2152 }
2153 %%>>>
2154
2155 % %Mechanical section%<<<1
2156 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
2157 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
2158 \ctikzset{bipoles/spring/height/.initial=.5}
2159 \ctikzset{bipoles/spring/width/.initial=.5}
2160 \ctikzset{bipoles/inerter/height/.initial=.7}
2161 \ctikzset{bipoles/inerter/width/.initial=.175}
2162 \ctikzset{bipoles/mass/height/.initial=.55}
2163 \ctikzset{bipoles/mass/box height/.initial=.4}
2164 \ctikzset{bipoles/mass/width/.initial=.5}
2165
2166 \ctikzset{bipoles/damper/height/.initial=.35}
2167 \ctikzset{bipoles/damper/length/.initial=.3}
2168 \ctikzset{bipoles/damper/width/.initial=.4}
2169 %%>>>
2170
2171 % powerelectronic blocks%<<<1
2172 \ctikzset{bipoles/sacdc/width/.initial=.7}
2173 \ctikzset{bipoles/sdcac/width/.initial=.7}
2174 \ctikzset{bipoles/tacdc/width/.initial=.7}
2175 \ctikzset{bipoles/tdcac/width/.initial=.7}
2176 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
2177 %>>>
2178
2179 % voltage and current options%<<<1
2180 %
2181 \ctikzset{current arrow scale/.initial=16}
2182 \ctikzset{current/distance/.initial = .5}
2183
2184 \newif\ifpgf@circuit@europeancurrent
2185 \newif\ifpgf@circuit@europeanvoltage
2186 \newif\ifpgf@circuit@bipole@voltage@straight
2187 \newif\ifpgf@circuit@bipole@voltage@raised
2188
2189 \ctikzset{voltage/.is choice}
2190 %
2191 % straight is expected to be a subset of european, so disable it in american style
2192 %
2193 \ctikzset{voltage/american/.code = {%
2194 \pgf@circuit@europeanvoltagefalse
2195 \pgf@circuit@bipole@voltage@straightfalse
2196 \pgf@circuit@bipole@voltage@raisedfalse
2197 }}
2198 \ctikzset{voltage/raised/.code = {%
2199 \pgf@circuit@europeanvoltagefalse
2200 \pgf@circuit@bipole@voltage@straightfalse
2201 \pgf@circuit@bipole@voltage@raisedtrue
2202 }}
2203 \ctikzset{voltage/european/.code = {%
2204 \pgf@circuit@europeanvoltagetrue
2205 \pgf@circuit@bipole@voltage@straightfalse
2206 \pgf@circuit@bipole@voltage@raisedfalse
2207 }}
2208 \ctikzset{voltage/straight/.code = {%
2209 \pgf@circuit@europeanvoltagetrue
2210 \pgf@circuit@bipole@voltage@straighttrue
2211 \pgf@circuit@bipole@voltage@raisedfalse
2212 }}
2213 \ctikzset{voltage/curved/.code = {%
2214 \pgf@circuit@europeanvoltagetrue
2215 \pgf@circuit@bipole@voltage@straightfalse
2216 \pgf@circuit@bipole@voltage@raisedfalse
2217 }}
2218 % are these used?
2219 \ctikzset{current/.is choice}
2220 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
2221 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
2222
2223 % this is left for backward compatibility...
2224 \ctikzset{straight/.is choice}
2225 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
2226 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
2227 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
2228 %
2229 % voltage is used also to set parameters, apart for the /.is choice
2230 % above. I hope it is ok --- would be a mess otherwise
2231 %
2232 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
2233 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
2234 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
2235 %
2236 % keys for exporting voltage, current, flow anchors
2237 %
2238 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
2239 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
2240 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
2241 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
2242 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
2243 %
2244 % shaping the +/- sign, see pgfcircvoltage.tex
2245 \ctikzset{voltage/american font/.initial={}}
2246 \ctikzset{voltage/american plus/.initial={$+$}}
2247 \ctikzset{voltage/american minus/.initial={$-$}}
2248 % here we start the voltage adjustments for special components.
2249 % default values:
2250 %
2251 % this is the distance of the "point" marking the voltage along the line
2252 % 0.0 is on the external nodes of the to path
2253 % 1.0 is cramped on the object
2254 % this can be overriden component by component
2255 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
2256 %
2257 % this is the distance from the line (perpendicular to) where the voltage is drawn.
2258 % It is global, and not adjustable by component (use the "label distance" or locally
2259 % if you need it)
2260 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
2261 %
2262 % bend paramenters for european arc. You can override them component-based
2263 \ctikzset{voltage/bump b/.initial=1.5}
2264 %
2265 % generator voltages symbols or arrows (always straight) are put along the
2266 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
2267 % center..angle line. It's called bump a because I don't know...
2268 %
2269 \ctikzset{voltage/bump a/.initial=1.2}
2270 %
2271 % these are the label distances FROM the drawings.
2272 % You can override them component by component.
2273 \ctikzset{voltage/european label distance/.initial=1.4}
2274 \ctikzset{voltage/straight label distance/.initial=1.4}
2275 \ctikzset{voltage/american label distance/.initial=1.4}
2276 % american open voltage adjusting
2277 %
2278 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
2279 \ctikzset{open voltage position/.is choice}
2280 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
2281 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
2282 % bad names, kept for compatibility, don't use
2283 \ctikzset{american open voltage/.is choice}
2284 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
2285 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
2286 %
2287 % voltage and current styles
2288 %
2289 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
2290 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
2291 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
2292 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
2293 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
2294 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
2295 %%>>>
2296
2297 % special cases for voltage positions%<<<1
2298 % the KIND is the node name without SHAPE
2299 % See the definition above for meaning
2300 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
2301 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
2302 %
2303 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
2304 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
2305 %
2306 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
2307 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
2308 %
2309 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
2310 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
2311 %
2312 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
2313 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
2314 %
2315 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
2316 %
2317 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
2318 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
2319 %
2320 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
2321 %
2322 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
2323 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
2324 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
2325 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
2326 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
2327 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
2328 %
2329 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
2330 %
2331 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
2332 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
2333 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
2334 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
2335 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
2336 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
2337 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
2338 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
2339 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
2340 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
2341 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
2342 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
2343 %
2344 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
2345 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
2346 %
2347 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
2348 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
2349 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
2350 %%>>>
2351
2352 % vim: set fdm=marker fmr=%<<<,%>>>:
2353 %%%---------- close: tex/pgfcirc.defines
2354 %%%%%%%%%%% Springe nach tex/pgfcircutils
2355 %%%---------- open: tex/pgfcircutils.tex
2356 % Copyright 2018-2026 by Romano Giannetti
2357 % Copyright 2015-2026 by Stefan Lindner
2358 % Copyright 2013-2026 by Stefan Erhardt
2359 % Copyright 2007-2026 by Massimo Redaelli
2360 %
2361 % This file may be distributed and/or modified
2362 %
2363 % 1. under the LaTeX Project Public License and/or
2364 % 2. under the GNU Public License.
2365 %
2366 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2367
2368 \def\pgf@circ@handleSI#1{
2369 \noexpandarg
2370 \def\pgf@temp{}
2371 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
2372 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
2373
2374 \ifnum\pgf@circ@handleSI@unit@len=0
2375 \pgf@circ@siunitx@resfalse
2376 \else
2377 \IfEndWith{#1}{>}{
2378 \pgf@circ@siunitx@restrue
2379 \noexpandarg
2380 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
2381 %\typeout{si |#1|}
2382 }{
2383 \pgf@circ@siunitx@resfalse
2384 %\typeout{no si |#1|}
2385 }
2386 \fi
2387 }
2388
2389 \def\pgf@circ@ifkeyempty#1{
2390 \pgfextra{
2391 \ctikzset{#1/.get=\pgf@circ@temp}
2392 \edef\pgf@temp{}
2393 }
2394 \ifx\pgf@circ@temp\pgf@temp
2395 }
2396
2397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2398 %% Math routines
2399
2400 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
2401
2402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2403 %% useful commands
2404
2405 \ifpgfutil@format@is@latex
2406 %% flipping text
2407 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
2408 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
2409 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
2410 % text mode overbar
2411 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2412 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
2413 \else\ifpgfutil@format@is@plain
2414 % text mode overbar
2415 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2416 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2417 \else\ifpgfutil@format@is@context
2418 % text mode overbar
2419 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2420 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2421 \fi\fi\fi
2422
2423 %%%%%%%%%%%%%%%%%%%%%%%%%%%
2424 %% switch to use fpu in reciprocal scale transformations
2425 %%
2426 %% this code has been contributed by Schrödinger's cat
2427 %% https://tex.stackexchange.com/a/529159/38080
2428 %%
2429 %% Use the official key to use the fpu if installed, see
2430 %% https://github.com/pgf-tikz/pgf/issues/861
2431 %%
2432 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
2433 %%
2434 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
2435 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
2436 }{%
2437 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
2438 \def\pgfmathreciprocal@##1{%
2439 \begingroup
2440 \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
2441 \pgfmathparse{1/##1}%
2442 \pgfmath@smuggleone\pgfmathresult
2443 \endgroup
2444 }}}%
2445 }
2446
2447 %%%---------- close: tex/pgfcircutils
2448
2449 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2450 %%%---------- open: tex/pgfcircshapes.tex
2451 % Copyright 2018-2026 by Romano Giannetti
2452 % Copyright 2015-2026 by Stefan Lindner
2453 % Copyright 2013-2026 by Stefan Erhardt
2454 % Copyright 2007-2026 by Massimo Redaelli
2455 %
2456 % This file may be distributed and/or modified
2457 %
2458 % 1. under the LaTeX Project Public License and/or
2459 % 2. under the GNU Public License.
2460 %
2461 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2462
2463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464 %% Other shapes
2465
2466 %% Nothing
2467
2468 \pgfdeclareshape{emptyshape}{
2469 \savedanchor{\northeast}{%
2470 \pgf@x=.5\wd\pgfnodeparttextbox%
2471 \pgf@y=.5\ht\pgfnodeparttextbox%
2472 }
2473 \anchor{north}{\northeast\pgf@x=0cm\relax}
2474 \anchor{east}{\northeast\pgf@y=0cm\relax}
2475 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2476 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2477 \anchor{north east}{\northeast}
2478 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2479 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2480 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2481 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2482 \anchor{center}{
2483 \pgfpointorigin
2484 }
2485 }
2486 %
2487 % Provision for changing opacity. Only expert use, see the manual.
2488 %
2489 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2490 \tikzset{open poles opacity/.code={%
2491 \ctikzset{poles/open fill opacity=#1}%
2492 }}
2493 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2494 \tikzset{full poles opacity/.code={%
2495 \ctikzset{poles/full fill opacity=#1}%
2496 }}
2497
2498 %
2499 % Provision for changing default background
2500 %
2501
2502 \ctikzset{open poles fill/.initial={white}}
2503
2504 %% Full terminal
2505
2506 \pgfdeclareshape{circ}{
2507 \anchor{center}{
2508 \pgfpointorigin
2509 }
2510 \savedanchor\northwest{%
2511 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2512 \pgf@x=-\pgf@y
2513 }
2514 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2515 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2516 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2517 \anchor{west}{ \northwest \pgf@y=0pt }
2518 \anchor{w}{ \northwest \pgf@y=0pt }
2519 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2520 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2521 \anchor{north}{ \northwest \pgf@x=0pt }
2522 \anchor{n}{ \northwest \pgf@x=0pt }
2523 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2524 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2525 \anchor{north west}{ \northwest }
2526 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2527 \anchorborder{
2528 \pgf@circ@res@left=\pgf@x
2529 \pgf@circ@res@up=\pgf@y
2530 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2531 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2532 }
2533 \behindforegroundpath{
2534
2535 \pgfscope
2536 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2537 \pgfsetcolor{\ctikzvalof{color}}
2538 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2539 \pgfusepath{draw,fill}
2540 \endpgfscope
2541
2542 }
2543 }
2544
2545 %% Empty round terminal
2546
2547 \pgfdeclareshape{ocirc}{
2548 \anchor{center}{
2549 \pgfpointorigin
2550 }
2551 \savedanchor\northwest{%
2552 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2553 \pgf@x=-\pgf@y
2554 }
2555 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2556 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2557 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2558 \anchor{west}{ \northwest \pgf@y=0pt }
2559 \anchor{w}{ \northwest \pgf@y=0pt }
2560 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2561 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2562 \anchor{north}{ \northwest \pgf@x=0pt }
2563 \anchor{n}{ \northwest \pgf@x=0pt }
2564 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2565 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2566 \anchor{north west}{ \northwest }
2567 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2568 \anchorborder{
2569 \pgf@circ@res@left=\pgf@x
2570 \pgf@circ@res@up=\pgf@y
2571 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2572 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2573 }
2574
2575 \behindforegroundpath{
2576
2577 \pgfscope
2578 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2579 \pgfsetcolor{\ctikzvalof{color}}
2580 \ifx\tikz@fillcolor\pgfutil@empty
2581 % set the default fill color to white
2582 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2583 % ...but override it if the class is defined!
2584 % note that this element has no class, but will inherit it when used
2585 % into another component
2586 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2587 \else
2588 \pgfsetfillcolor{\tikz@fillcolor}
2589 \fi
2590 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2591 \pgfusepath{draw,fill}
2592 \endpgfscope
2593
2594 }
2595 }
2596
2597 %% Diamond terminal
2598
2599 \pgfdeclareshape{diamondpole}{
2600 \anchor{center}{
2601 \pgfpointorigin
2602 }
2603 \savedanchor\northwest{%
2604 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2605 \pgf@x=-\pgf@y
2606 }
2607 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2608 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2609 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2610 \anchor{west}{ \northwest \pgf@y=0pt }
2611 \anchor{w}{ \northwest \pgf@y=0pt }
2612 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2613 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2614 \anchor{north}{ \northwest \pgf@x=0pt }
2615 \anchor{n}{ \northwest \pgf@x=0pt }
2616 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2617 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2618 \anchor{north west}{ \northwest }
2619 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2620 \anchorborder{
2621 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2622 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2623 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2624 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2625 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2626 \pgfextracty{\pgf@circ@res@up}{\northwest}
2627 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2628 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2629 \pgfpointintersectionoflines
2630 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2631 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2632 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2633 \pgf@x=\@@switchx\pgf@x
2634 \pgf@y=\@@switchy\pgf@y
2635 }
2636 \behindforegroundpath{
2637 \pgfscope
2638 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2639 \pgftransformrotate{45}
2640 \pgfpathrectanglecorners
2641 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2642 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2643 \pgfsetcolor{\ctikzvalof{color}}
2644 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2645 \pgfusepath{draw,fill}
2646 \endpgfscope
2647 }
2648 }
2649
2650 %% Diamond terminal, unfilled
2651
2652 \pgfdeclareshape{odiamondpole}{
2653 \anchor{center}{
2654 \pgfpointorigin
2655 }
2656 \savedanchor\northwest{%
2657 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2658 \pgf@x=-\pgf@y
2659 }
2660 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2661 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2662 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2663 \anchor{west}{ \northwest \pgf@y=0pt }
2664 \anchor{w}{ \northwest \pgf@y=0pt }
2665 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2666 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2667 \anchor{north}{ \northwest \pgf@x=0pt }
2668 \anchor{n}{ \northwest \pgf@x=0pt }
2669 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2670 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2671 \anchor{north west}{ \northwest }
2672 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2673 \anchorborder{
2674 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2675 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2676 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2677 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2678 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2679 \pgfextracty{\pgf@circ@res@up}{\northwest}
2680 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2681 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2682 \pgfpointintersectionoflines
2683 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2684 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2685 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2686 \pgf@x=\@@switchx\pgf@x
2687 \pgf@y=\@@switchy\pgf@y
2688 }
2689 \behindforegroundpath{
2690 \pgfscope
2691 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2692 \pgftransformrotate{45}
2693 \pgfpathrectanglecorners
2694 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2695 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2696 \pgfsetcolor{\ctikzvalof{color}}
2697 \ifx\tikz@fillcolor\pgfutil@empty
2698 % set the default fill color to white
2699 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2700 % ...but override it if the class is defined!
2701 % note that this element has no class, but will inherit it when used
2702 % into another component
2703 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2704 \else
2705 \pgfsetfillcolor{\tikz@fillcolor}
2706 \fi
2707 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2708 \pgfusepath{draw,fill}
2709 \endpgfscope
2710 }
2711 }
2712
2713 %% square terminal, filled
2714
2715 \pgfdeclareshape{squarepole}{
2716 \anchor{center}{
2717 \pgfpointorigin
2718 }
2719 \savedanchor\northwest{%
2720 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2721 \pgf@x=-\pgf@y
2722 }
2723 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2724 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2725 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2726 \anchor{west}{ \northwest \pgf@y=0pt }
2727 \anchor{w}{ \northwest \pgf@y=0pt }
2728 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2729 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2730 \anchor{north}{ \northwest \pgf@x=0pt }
2731 \anchor{n}{ \northwest \pgf@x=0pt }
2732 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2733 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2734 \anchor{north west}{ \northwest }
2735 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2736 \anchorborder{
2737 \pgf@xa=\pgf@x
2738 \pgf@ya=\pgf@y
2739 \pgfextracty{\pgf@circ@res@up}{\northwest}
2740 \pgfpointborderrectangle
2741 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2742 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2743 }
2744 \behindforegroundpath{
2745 \pgfscope
2746 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2747 \pgfpathrectanglecorners
2748 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2749 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2750 \pgfsetcolor{\ctikzvalof{color}}
2751 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2752 \pgfusepath{draw,fill}
2753 \endpgfscope
2754 }
2755 }
2756 %% square terminal, unfilled
2757
2758 \pgfdeclareshape{osquarepole}{
2759 \anchor{center}{
2760 \pgfpointorigin
2761 }
2762 \savedanchor\northwest{%
2763 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2764 \pgf@x=-\pgf@y
2765 }
2766 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2767 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2768 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2769 \anchor{west}{ \northwest \pgf@y=0pt }
2770 \anchor{w}{ \northwest \pgf@y=0pt }
2771 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2772 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2773 \anchor{north}{ \northwest \pgf@x=0pt }
2774 \anchor{n}{ \northwest \pgf@x=0pt }
2775 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2776 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2777 \anchor{north west}{ \northwest }
2778 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2779 \anchorborder{
2780 \pgf@xa=\pgf@x
2781 \pgf@ya=\pgf@y
2782 \pgfextracty{\pgf@circ@res@up}{\northwest}
2783 \pgfpointborderrectangle
2784 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2785 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2786 }
2787 \behindforegroundpath{
2788 \pgfscope
2789 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2790 \pgfpathrectanglecorners
2791 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2792 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2793 \pgfsetcolor{\ctikzvalof{color}}
2794 \ifx\tikz@fillcolor\pgfutil@empty
2795 % set the default fill color to white
2796 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2797 % ...but override it if the class is defined!
2798 % note that this element has no class, but will inherit it when used
2799 % into another component
2800 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2801 \else
2802 \pgfsetfillcolor{\tikz@fillcolor}
2803 \fi
2804 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2805 \pgfusepath{draw,fill}
2806 \endpgfscope
2807 }
2808 }
2809 % BNC connector
2810
2811 \pgfdeclareshape{bnc}{
2812 \anchor{center}{
2813 \pgfpointorigin
2814 }
2815 % BNC size is 2.5 times the size of the internal "ocirc"
2816 \savedanchor\northwest{%
2817 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2818 \pgf@y=2.5\pgf@y
2819 \pgf@x=-\pgf@y
2820 }
2821 % center is on the opening
2822 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2823 \anchor{zero}{ \pgfpointorigin }
2824 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2825 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2826 % geo-anchors
2827 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2828 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2829 \anchor{west}{ \northwest \pgf@y=0pt }
2830 \anchor{left}{ \northwest \pgf@y=0pt }
2831 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2832 \anchor{north}{ \northwest \pgf@x=0pt }
2833 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2834 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2835 \anchor{north west}{ \northwest }
2836 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2837 % put the node text above and centered
2838 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2839 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2840 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2841 }
2842 }
2843 \anchorborder{
2844 \pgf@circ@res@left=\pgf@x
2845 \pgf@circ@res@up=\pgf@y
2846 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2847 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2848 }
2849 \behindforegroundpath{
2850 \pgfextracty{\pgf@circ@res@other}{\northwest}
2851 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2852 \pgfscope
2853 \pgfstartlinewidth=\pgflinewidth
2854 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2855 \pgfsetcolor{\ctikzvalof{color}}
2856 % external circle
2857 \pgfscope
2858 % clipping path: first a rectangle bigger then the shape
2859 % to avoid problems with the line thickness
2860 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2861 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2862 % next the opening to the right
2863 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2864 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2865 % do the difference and clip before drawing
2866 \pgfseteorule
2867 \pgfusepath{clip}
2868 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2869 \pgfusepath{draw}
2870 \endpgfscope
2871 % internal circle
2872 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2873 \pgf@circ@draworfill
2874 % and the contact line to the right
2875 \pgfsetlinewidth{\pgfstartlinewidth}
2876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2877 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2878 \pgfusepath{draw}
2879 \endpgfscope
2880 }
2881 }
2882
2883 %% Fill for correct rectangular joins
2884
2885 \pgfdeclareshape{rectjoinfill}{
2886 \savedanchor{\northeast}{%
2887 \pgf@x=.5\pgflinewidth%
2888 \pgf@y=.5\pgflinewidth%
2889 }
2890 \anchor{north}{\northeast\pgf@x=0cm\relax}
2891 \anchor{east}{\northeast\pgf@y=0cm\relax}
2892 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2893 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2894 \anchor{north east}{\northeast}
2895 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2896 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2897 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2898 \anchor{center}{
2899 \pgfpointorigin
2900 }
2901 \anchorborder{
2902 \pgf@circ@res@left=\pgf@x
2903 \pgf@circ@res@up=\pgf@y
2904 }
2905 \behindforegroundpath{
2906 \pgfscope
2907 \pgfpathrectanglecorners
2908 {\pgfpoint{0}{.5\pgflinewidth}}
2909 {\pgfpoint{0}{-.5\pgflinewidth}}
2910 \pgfsetcolor{\ctikzvalof{color}}
2911 \pgfusepath{draw,fill}
2912 \endpgfscope
2913 }
2914 }
2915
2916 %% transistor arrow
2917
2918 \def\pgf@circ@find@linescale{
2919 % find the scale inverse of the scale factor: line width do not scale
2920 % with scale=..., transform shape so we have to counteract it.
2921 \iftikz@fullytransformed % this is true if `transform shape` is active
2922 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2923 % Note that this trick is not working inside a `spy` environment...
2924 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2925 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2926 \else
2927 \pgfmathsetmacro{\@@factor}{1.0}
2928 \fi
2929 }
2930
2931 \pgfdeclareshape{trarrow}{%
2932 % this arrow is only filled but grows with the linewidth, more or less
2933 % like currarrow do
2934 \savedanchor{\northeast}{%
2935 \pgf@circ@res@step = \pgf@circ@Rlen
2936 \pgf@circ@find@linescale
2937 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2938 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2939 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2940 }
2941 % The arrow size should be more or less the same of a currarrow, which is
2942 % both filled and stroke, for backward output compatibility (more or less)
2943 %
2944 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2945 % |-\__ currarrow as the tip at (W,0)
2946 % | | and the upper tail at (-0.7*W, 0.8*W)
2947 % | \__ it then "overshoot" do to the linew width L
2948 % | \__ xangle \alpha
2949 % ---0------->
2950 %
2951 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2952 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2953 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2954 %
2955 \savedanchor{\northwest}{%
2956 \pgf@circ@res@step = \pgf@circ@Rlen
2957 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2958 \pgf@circ@find@linescale
2959 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2960 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2961 }
2962 \savedanchor{\tip}{%
2963 \pgf@circ@res@step = \pgf@circ@Rlen
2964 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2965 \pgf@circ@find@linescale
2966 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2967 }
2968 \anchor{north}{\northeast\pgf@x=0cm\relax}
2969 \anchor{east}{\northeast\pgf@y=0cm\relax}
2970 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2971 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2972 \anchor{north east}{\northeast}
2973 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2974 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2975 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2976 \anchor{center}{
2977 \pgfpointorigin
2978 }
2979 \anchor{tip}{
2980 \tip
2981 }
2982 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2983 \tip
2984 \pgf@circ@find@linescale
2985 \pgf@circ@res@temp=\@@factor\pgflinewidth
2986 \advance\pgf@x by -.5\pgf@circ@res@temp
2987 }
2988 \behindforegroundpath{
2989 \pgfscope
2990 \northwest
2991 \pgf@circ@res@up=\pgf@y
2992 \pgf@circ@res@left=\pgf@x
2993 \tip
2994 \pgf@circ@res@step = \pgf@x
2995 %
2996 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2997 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2998 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2999 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
3000 \pgfpathclose
3001 \pgfsetcolor{\ctikzvalof{color}}
3002 \pgfusepath{fill} % just fill
3003 \endpgfscope
3004 }
3005 }
3006
3007 %% Current arrow
3008
3009 \pgfdeclareshape{currarrow}{
3010 \savedanchor{\northeast}{%
3011 \pgf@circ@res@step = \pgf@circ@Rlen
3012 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3013 \pgf@x=.5\pgf@circ@res@step
3014 \pgf@y=\pgf@x%
3015 }
3016 \anchor{north}{\northeast\pgf@x=0cm\relax}
3017 \anchor{east}{\northeast\pgf@y=0cm\relax}
3018 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3019 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3020 \anchor{north east}{\northeast}
3021 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3022 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3023 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3024 \anchor{center}{
3025 \pgfpointorigin
3026 }
3027 \anchor{tip}{
3028 \pgfpointorigin
3029 \pgf@circ@res@step = \pgf@circ@Rlen
3030 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3031 \pgf@x =\pgf@circ@res@step
3032 }
3033 \behindforegroundpath{
3034 \pgfscope
3035 \pgf@circ@res@step = \pgf@circ@Rlen
3036 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3037
3038 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3039 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3040 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
3041 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3042 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3043 \pgfsetcolor{\ctikzvalof{color}}
3044 \pgfusepath{draw,fill}
3045
3046 \endpgfscope
3047 }
3048 }
3049
3050 %% Flow arrow
3051
3052 \pgfdeclareshape{flowarrow}{
3053 \savedanchor{\northeast}{%
3054 \pgf@circ@res@step = \pgf@circ@Rlen
3055 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3056 \pgf@y=.5\pgf@circ@res@step
3057 \pgf@circ@res@step = \pgf@circ@Rlen
3058 \divide \pgf@circ@res@step by 4
3059 \pgf@x=\pgf@circ@res@step%
3060 }
3061 \anchor{north}{\northeast\pgf@x=0cm\relax}
3062 \anchor{east}{\northeast\pgf@y=0cm\relax}
3063 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3064 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3065 \anchor{north east}{\northeast}
3066 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3067 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3068 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3069 \anchor{text}{% text centered above
3070 \pgfpointorigin
3071 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
3072 }
3073 \anchor{center}{
3074 \pgfpointorigin
3075 }
3076 \anchor{tip}{
3077 \pgfpointorigin
3078 \pgf@circ@res@step = \pgf@circ@Rlen
3079 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3080 \pgf@x =\pgf@circ@res@step
3081 }
3082 \behindforegroundpath{
3083 \pgfscope
3084 \pgf@circ@res@step = \pgf@circ@Rlen
3085 \divide \pgf@circ@res@step by 4
3086 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
3087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3088 \pgfsetcolor{\ctikzvalof{color}}
3089 \pgfusepath{draw}
3090 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
3091 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
3092 \endpgfscope
3093 }
3094 }
3095
3096 %% Input arrow
3097
3098 \pgfdeclareshape{inputarrow}{
3099 \savedanchor{\northeast}{% this is really not northeast, really -northwest
3100 \pgf@circ@res@step = \pgf@circ@Rlen
3101 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3102 \pgf@y=.5\pgf@circ@res@step
3103 \pgf@x=1.7\pgf@circ@res@step
3104 }
3105 \anchor{north}{\northeast\pgf@x=0cm\relax}
3106 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
3107 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3108 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3109 \anchor{north east}{\northeast\pgf@x=0cm\relax}
3110 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3111 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
3112 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3113 \savedanchor{\tip}{
3114 \pgfpointorigin
3115 }
3116 \anchor{center}{
3117 \tip
3118 }
3119 \anchor{tip}{
3120 \tip
3121 }
3122 \behindforegroundpath{
3123
3124 \pgfscope
3125 \pgf@circ@res@step = \pgf@circ@Rlen
3126 \divide \pgf@circ@res@step by 16
3127
3128 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3129 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3130 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
3131 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3132 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3133 \pgfsetcolor{\ctikzvalof{color}}
3134 \pgfusepath{fill}
3135
3136 \endpgfscope
3137 }
3138 }
3139
3140
3141 %% box
3142
3143 \pgfdeclareshape{box}{
3144 \anchor{center}{
3145 \pgfpointorigin
3146 }
3147 \behindforegroundpath{
3148
3149 \pgfscope
3150 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
3151 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3152 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3153 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3154 \pgf@circ@draworfill
3155 \endpgfscope
3156 }
3157 }
3158
3159 %% box scaled with blocks
3160
3161 \pgfdeclareshape{blockbox}{
3162 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
3163 \anchor{center}{
3164 \pgfpointorigin
3165 }
3166 \behindforegroundpath{
3167 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
3168 \pgfscope
3169 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
3170 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3171 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3172 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3173 \pgf@circ@draworfill
3174 \endpgfscope
3175 }
3176 }
3177
3178 % full nodes for wire crossing
3179
3180 \pgfdeclareshape{jump crossing}
3181 {
3182 \savedanchor\northwest{%
3183 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3184 \pgf@y=.5\pgf@y
3185 \pgf@x=-\pgf@y
3186 }
3187 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3188 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3189 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3190 \anchor{west}{ \northwest \pgf@y=0pt }
3191 \anchor{w}{ \northwest \pgf@y=0pt }
3192 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3193 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3194 \anchor{north}{ \northwest \pgf@x=0pt }
3195 \anchor{n}{ \northwest \pgf@x=0pt }
3196 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3197 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3198 \anchor{north west}{ \northwest }
3199 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3200 \behindbackgroundpath{
3201 \northwest
3202 \pgf@circ@res@up = \pgf@y
3203 \pgf@circ@res@down = -\pgf@y
3204 \pgf@circ@res@right = -\pgf@x
3205 \pgf@circ@res@left = \pgf@x
3206 % horizontal jumper
3207 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3208 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
3209 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
3210 \pgfsetbeveljoin
3211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3212 % vertical, broken path
3213 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3214 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3215 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
3216 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3217 \pgfusepath{draw}
3218
3219 }
3220 }
3221 \pgfdeclareshape{plain crossing}
3222 {
3223 \savedanchor\northwest{%
3224 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3225 \pgf@y=.5\pgf@y
3226 \pgf@x=-\pgf@y
3227 }
3228 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3229 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3230 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3231 \anchor{west}{ \northwest \pgf@y=0pt }
3232 \anchor{w}{ \northwest \pgf@y=0pt }
3233 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3234 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3235 \anchor{north}{ \northwest \pgf@x=0pt }
3236 \anchor{n}{ \northwest \pgf@x=0pt }
3237 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3238 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3239 \anchor{north west}{ \northwest }
3240 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3241 \behindbackgroundpath{
3242 \northwest
3243 \pgf@circ@res@up = \pgf@y
3244 \pgf@circ@res@down = -\pgf@y
3245 \pgf@circ@res@right = -\pgf@x
3246 \pgf@circ@res@left = \pgf@x
3247 % horizontal jumper
3248 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3249 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3250 % vertical, broken path
3251 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3252 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
3253 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
3254 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3255 \pgfusepath{draw}
3256
3257 }
3258 }
3259
3260 %%%---------- close: tex/pgfcircshapes
3261 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
3262 %%%---------- open: tex/pgfcircmonopoles.tex
3263 % Copyright 2018-2026 by Romano Giannetti
3264 % Copyright 2015-2026 by Stefan Lindner
3265 % Copyright 2013-2026 by Stefan Erhardt
3266 % Copyright 2007-2026 by Massimo Redaelli
3267 %
3268 % This file may be distributed and/or modified
3269 %
3270 % 1. under the LaTeX Project Public License and/or
3271 % 2. under the GNU Public License.
3272 %
3273 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3274
3275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3276 %% Monopoles
3277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3278
3279 %%%%%%%%%%%%%
3280 %% Grounds
3281 %%%%%%%%%%%%%
3282
3283
3284 %% Ground symbol
3285 % #1 -> name
3286 % #2 -> width
3287 % #3 -> depth
3288 % #4 -> code
3289 \long\def\pgf@circ@declareground#1#2#3#4{
3290 \pgfdeclareshape{#1}{
3291 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3292 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3293 \savedanchor{\southeast}{
3294 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3295 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3296 \pgf@x=#2\pgf@x
3297 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3298 \pgf@y=-#3\pgf@y
3299 }
3300 \anchor{north}{\pgfpointorigin}
3301 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3302 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3303 \anchor{south east}{\southeast}
3304 \anchor{south}{\southeast\pgf@x=0pt\relax}
3305 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3306 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3307 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3308 \anchor{left}{\pgfpointorigin}
3309 \anchor{right}{\pgfpointorigin}
3310 \anchor{center}{\pgfpointorigin}
3311 \behindforegroundpath{
3312 \pgf@circ@scaled@Rlen=\scaledRlen
3313 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3314 \pgfscope
3315 \pgfstartlinewidth=\pgflinewidth
3316 #4
3317 \endpgfscope
3318 }
3319 }
3320 }
3321
3322
3323 \pgf@circ@declareground{ground}{0.6}{1.6}{
3324 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3325 \pgfpathmoveto{\pgfpointorigin}
3326 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3327 \pgfusepath{draw}
3328 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3329 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3330 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3331 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3332 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3333 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3334 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3335 \pgfusepath{draw}
3336 }
3337
3338 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3339 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3340 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3341 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3342 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3343 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3344 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3345 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3346 \pgfusepath{draw}
3347 }
3348
3349
3350 \pgf@circ@declareground{rground}{0.6}{1}{
3351 \pgfpathmoveto{\pgfpointorigin}
3352 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3353 \pgfusepath{draw}
3354
3355 \pgfstartlinewidth=\pgflinewidth
3356 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3357
3358 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3359 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3360 \pgfsetroundcap\pgfusepath{draw}
3361 }
3362
3363 \pgf@circ@declareground{tground}{0.6}{0}{
3364 \pgfpathmoveto{\pgfpointorigin}
3365 \pgfusepath{draw}
3366
3367 \pgfstartlinewidth=\pgflinewidth
3368 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3369
3370 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3371 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3372 \pgfusepath{draw}
3373 }
3374
3375 \pgf@circ@declareground{sground}{0.6}{1.8}{
3376 \pgfpathmoveto{\pgfpointorigin}
3377 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3378 \pgfusepath{draw}
3379
3380 \pgfstartlinewidth=\pgflinewidth
3381 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3382
3383 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3384 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3385 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3386 \pgfpathclose
3387 \pgf@circ@draworfill
3388 }
3389
3390 % noiseless ground
3391 \pgf@circ@declareground{nground}{0.9}{1.6}{
3392 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3393 \pgfpathmoveto{\pgfpointorigin}
3394 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3395 \pgfusepath{draw}
3396 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3397 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3398 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3399 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3400 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3401 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3402 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3403 \pgfusepath{draw}
3404 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3405 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3406 \pgfusepath{draw}
3407 }
3408
3409 % protective ground
3410 \pgf@circ@declareground{pground}{0.9}{1.8}{
3411 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3412 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3413 \pgf@circ@draworfill
3414 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3415 \pgfpathmoveto{\pgfpointorigin}
3416 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3417 \pgfusepath{draw}
3418 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3419 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3420 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3421 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3422 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3423 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3424 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3425 \pgfusepath{draw}
3426 }
3427
3428 % chassis ground
3429 \pgf@circ@declareground{cground}{1}{2}{
3430 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3431 \pgfpathmoveto{\pgfpointorigin}
3432 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3433 \pgfusepath{draw}
3434 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3435 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3436 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3437 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3438 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3439 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3440 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3441 \pgfusepath{draw}
3442 }
3443
3444 % Contributed by @fotesan https://github.com/fotesan
3445 % european ground
3446 \pgf@circ@declareground{eground}{1.1}{1.7}{
3447 \pgfpathmoveto{\pgfpointorigin}
3448 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3449 \pgfusepath{draw}
3450
3451 \pgfstartlinewidth=\pgflinewidth
3452 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3453
3454 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3455 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3456 \pgfusepath{draw}
3457
3458 \pgfsetlinewidth{\pgfstartlinewidth}
3459 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3460 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3461 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3462 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3463 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3464 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3465 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3466 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3467 \pgfusepath{draw}
3468 }
3469
3470 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3471 \pgfpathmoveto{\pgfpointorigin}
3472 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3473 \pgfusepath{draw}
3474
3475 \pgfstartlinewidth=\pgflinewidth
3476 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3477
3478 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3479 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3480 \pgfusepath{draw}
3481
3482 \pgfsetlinewidth{\pgfstartlinewidth}
3483 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3484 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3485 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3486 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3487 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3488 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3489 \pgfusepath{draw}
3490 }
3491
3492 %%%%%%%%%%%%%%%%%%
3493 %% Power supplies
3494 %%%%%%%%%%%%%%%%%%
3495
3496 % Vcc
3497 \pgfdeclareshape{vcc}{
3498 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3499 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3500 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3501 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3502 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3503 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3504 }
3505 \savedanchor{\northeast}{%
3506 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3507 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3508 \pgf@x=.5\pgf@circ@res@step
3509 \pgf@y=3\pgf@x%
3510 }
3511 \anchor{north}{\northeast\pgf@x=0cm\relax}
3512 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3513 \anchor{south}{\pgfpointorigin}
3514 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3515 \anchor{north east}{\northeast}
3516 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3517 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3518 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3519 \anchor{center}{\pgfpointorigin}
3520 \anchor{left}{\pgfpointorigin}
3521 \anchor{right}{\pgfpointorigin}
3522 \anchor{text}{
3523 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3524 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3525 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3526 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3527 \pgf@x=0pt
3528 \pgf@y=2\pgf@circ@res@step
3529 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3530 \pgf@x=-.5\wd\pgfnodeparttextbox
3531 }
3532 \behindforegroundpath{
3533 \pgf@circ@scaled@Rlen=\scaledRlen
3534 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3535 \pgfscope
3536 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3537 \ifx\pgf@temp\pgf@circ@temp
3538 \pgfstartlinewidth=\pgflinewidth
3539 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3540
3541 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3542 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3543 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3544 \pgfusepath{draw}
3545
3546 \pgfsetlinewidth{\pgfstartlinewidth}
3547 \else
3548 \pgfsetarrowsend{\pgf@circ@temp}
3549 \fi
3550 \pgfpathmoveto{\pgfpointorigin}
3551 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3552 \pgfusepath{draw}
3553 \endpgfscope
3554 }
3555 }
3556
3557 % Vee
3558 \pgfdeclareshape{vee}{
3559 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3560 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3561 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3562 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3563 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3564 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3565 }
3566 \savedanchor{\northeast}{%
3567 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3568 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3569 \pgf@x=.5\pgf@circ@res@step
3570 \pgf@y=-3\pgf@x%
3571 }
3572 \anchor{south}{\northeast\pgf@x=0cm\relax}
3573 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3574 \anchor{north}{\pgfpointorigin}
3575 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3576 \anchor{south east}{\northeast}
3577 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3578 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3579 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3580 \anchor{center}{\pgfpointorigin}
3581 \anchor{left}{\pgfpointorigin}
3582 \anchor{right}{\pgfpointorigin}
3583 \anchor{text}{
3584 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3585 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3586 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3587 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3588 \pgf@x=0pt
3589 \pgf@y=-2\pgf@circ@res@step
3590 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3591 \pgf@x=-.5\wd\pgfnodeparttextbox
3592 }
3593
3594 \behindforegroundpath{
3595 \pgf@circ@scaled@Rlen=\scaledRlen
3596 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3597 \pgfscope
3598 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3599 \ifx\pgf@temp\pgf@circ@temp
3600
3601 \pgfstartlinewidth=\pgflinewidth
3602 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3603
3604 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3605 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3606 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3607 \pgfusepath{draw}
3608 \pgfsetlinewidth{\pgfstartlinewidth}
3609 \else
3610 \pgfsetarrowsend{\pgf@circ@temp}
3611 \fi
3612 \pgfpathmoveto{\pgfpointorigin}
3613 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3614 \pgfusepath{draw}
3615 \endpgfscope
3616 }
3617 }
3618
3619 %%%%%%%%%%%%%%%%
3620 %% RF elements
3621 %%%%%%%%%%%%%%%%
3622
3623 % Legacy tlinestub
3624 % Contributed by Leonardo Azzinnari
3625 \pgfdeclareshape{tlinestub}{
3626 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3627 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3628 \savedanchor{\northeast}{%
3629 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3630 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3631 \pgf@x=1.2\pgf@circ@res@step
3632 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3633 \pgf@y=.2\pgf@circ@res@step%
3634 }
3635 % the center is on the left side of the shape for facility of usage
3636 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3637 \anchor{east}{\northeast\pgf@y=0cm\relax}
3638 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3639 \anchor{west}{\pgfpointorigin}
3640 \anchor{north east}{\northeast}
3641 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3642 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3643 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3644 \anchor{center}{\pgfpointorigin}
3645 % this is not exact, but it's better than nothing
3646 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3647 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3648 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3649 \behindforegroundpath{
3650 \pgfstartlinewidth=\pgflinewidth
3651
3652 \pgf@circ@scaled@Rlen=\scaledRlen
3653 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3654
3655 \pgfscope\begin{pgftransparencygroup}
3656 \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}}
3657 \pgf@circ@maybefill
3658 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3659 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3660 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3661 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3662 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3663 \pgf@circ@draworfill
3664 \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}}
3665 \pgfusepath{draw}
3666 \end{pgftransparencygroup} \endpgfscope
3667 \pgfpathmoveto{\pgfpointorigin}
3668 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3669 \pgfusepath{draw}
3670 }
3671 }
3672
3673 %% New antennas without tails
3674
3675 % main body of antennas
3676 \def\pgf@circ@antennabody{%
3677 \pgfstartlinewidth=\pgflinewidth
3678 \pgf@circ@scaled@Rlen=\scaledRlen
3679 \pgfsetcolor{\ctikzvalof{color}}
3680 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3681 \pgfscope
3682 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3683 \pgfpathmoveto{\pgfpointorigin}
3684 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3685 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3686 \pgfsetbeveljoin
3687 \pgfpathclose
3688 \pgf@circ@draworfill
3689 \endpgfscope
3690 \pgfsetlinewidth{\pgfstartlinewidth}
3691 \pgfpathmoveto{\pgfpointorigin}
3692 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3693 \pgfusepath{draw}
3694 }
3695
3696 % Waves for the antennas.
3697 \def\pgf@circ@antennawaves{%
3698 \pgfscope
3699 % define a triangle for clipping the waves
3700 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3701 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3702 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3703 \pgfpathclose
3704 \pgfusepath{clip}
3705 % ...and build the waves as clipped circles
3706 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3707 \pgfmathloop%
3708 \ifnum\pgf@circ@count@a>2
3709 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3710 \advance\pgf@circ@count@a-1\relax%
3711 \repeatpgfmathloop
3712 \pgfusepath{draw}
3713 \endpgfscope
3714 }
3715
3716 % additional shape with the waves
3717 \pgfdeclareshape{waves}{
3718 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3719 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3720 \anchor{center}{\pgfpointorigin}
3721 \savedanchor{\northeast}{
3722 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3723 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3724 \pgf@x=\pgf@circ@res@step
3725 \pgf@y=\pgf@circ@res@step
3726 }
3727 \anchor{text}{
3728 \northeast
3729 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3730 }
3731 \anchor{top}{\northeast\pgf@x=0pt}
3732 \anchor{right}{\northeast\pgf@y=0pt}
3733 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3734 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3735 \anchor{north}{\northeast\pgf@x=0pt}
3736 \anchor{north east}{\northeast}
3737 \anchor{east}{\northeast\pgf@y=0pt}
3738 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3739 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3740 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3741 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3742 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3743 \behindforegroundpath{
3744 \pgf@circ@scaled@Rlen=\scaledRlen
3745 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3746 \pgf@circ@res@step=0.5\pgf@circ@res@step
3747 \pgfsetcolor{\ctikzvalof{color}}
3748 \pgfscope
3749 % define a triangle for clipping the waves
3750 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3751 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3752 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3753 \pgfpathclose
3754 \pgfusepath{clip}
3755 % ...and build the waves as clipped circles
3756 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3757 \pgfmathloop%
3758 \ifnum\c@pgf@counta>1
3759 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3760 \advance\c@pgf@counta-1\relax%
3761 \repeatpgfmathloop
3762 \pgfusepath{draw}
3763 \endpgfscope
3764 }
3765 }
3766
3767 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3768
3769 \pgfdeclareshape{bareantenna}{
3770 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3771 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3772 \anchor{center}{\pgfpointorigin}
3773 \savedanchor{\northeast}{
3774 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3775 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3776 \pgf@x=\pgf@circ@res@step
3777 \pgf@y=2\pgf@circ@res@step
3778 }
3779 \anchor{text}{
3780 \northeast
3781 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3782 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3783 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3784 }
3785 \anchor{top}{\northeast\pgf@x=0pt}
3786 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3787 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3788 \anchor{bottom}{\pgfpointorigin}
3789 \anchor{north}{\northeast\pgf@x=0pt}
3790 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3791 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3792 \anchor{south}{\pgfpointorigin}
3793 \anchor{north east}{\northeast}
3794 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3795 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3796 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3797 \behindforegroundpath{
3798 \pgf@circ@antennabody
3799 }
3800 }
3801
3802 \pgfdeclareshape{bareTXantenna}{
3803 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3804 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3805 \anchor{center}{\pgfpointorigin}
3806 \savedanchor{\northeast}{
3807 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3808 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3809 \pgf@x=\pgf@circ@res@step
3810 \pgf@y=2\pgf@circ@res@step
3811 }
3812 \savedanchor{\savedwaves}{
3813 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3814 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3815 \pgf@x=4.2\pgf@circ@res@step
3816 \pgf@y=\pgf@circ@res@step
3817 }
3818 \anchor{text}{
3819 \northeast
3820 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3821 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3822 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3823 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3824 }
3825 \anchor{waves}{\savedwaves}
3826 \anchor{top}{\northeast\pgf@x=0pt}
3827 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3828 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3829 \anchor{bottom}{\pgfpointorigin}
3830 \anchor{north}{\northeast\pgf@x=0pt}
3831 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3832 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3833 \anchor{south}{\pgfpointorigin}
3834 \anchor{north east}{\northeast}
3835 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3836 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3837 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3838 \behindforegroundpath{
3839 \pgf@circ@antennabody
3840 \pgf@circ@antennawaves
3841 }
3842 }
3843
3844 \pgfdeclareshape{bareRXantenna}{
3845 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3846 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3847 \anchor{center}{\pgfpointorigin}
3848 \savedanchor{\northeast}{
3849 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3850 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3851 \pgf@x=\pgf@circ@res@step
3852 \pgf@y=2\pgf@circ@res@step
3853 }
3854 \savedanchor{\savedwaves}{
3855 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3856 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3857 \pgf@x=-4.2\pgf@circ@res@step
3858 \pgf@y=\pgf@circ@res@step
3859 }
3860 \anchor{text}{
3861 \northeast
3862 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3863 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3864 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3865 }
3866 \anchor{waves}{\savedwaves}
3867 \anchor{top}{\northeast\pgf@x=0pt}
3868 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3869 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3870 \anchor{bottom}{\pgfpointorigin}
3871 \anchor{north}{\northeast\pgf@x=0pt}
3872 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3873 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3874 \anchor{south}{\pgfpointorigin}
3875 \anchor{north east}{\northeast}
3876 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3877 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3878 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3879 \behindforegroundpath{
3880 \pgf@circ@antennabody
3881 \pgftransformxshift{-5.2\pgf@circ@res@step}
3882 \pgf@circ@antennawaves
3883 }
3884 }
3885
3886 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
3887 \ctikzset{monopoles/dynode/width/.initial=0.4}
3888 \ctikzset{monopoles/dynode/height/.initial=0.8}
3889 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
3890 \ctikzset{monopoles/dynode/arc angle/.initial=30}
3891 \ctikzset{monopoles/dynode/top width/.initial=1.0}
3892
3893 \pgfdeclareshape{dynode}{
3894 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
3895 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3896 \anchor{center}{\pgfpointorigin}
3897 \savedanchor{\northeast}{
3898 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3899 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3900 \pgf@x=0.5\pgf@x
3901 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3902 }
3903 \savedanchor{\arcpos}{% bottom part of the arc pos
3904 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3905 \pgf@x=0pt
3906 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3907 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
3908 }
3909 \savedanchor{\topright}{%
3910 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3911 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3912 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
3913 \pgf@x=0.5\pgf@x
3914 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3915 }
3916 \anchor{arc}{\arcpos}
3917 \anchor{top right}{\topright}
3918 \anchor{top left}{\topright\pgf@x=-\pgf@x}
3919 \anchor{text}{
3920 \northeast
3921 \advance\pgf@x by 4pt\relax
3922 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3923 }
3924 \anchor{top}{\northeast\pgf@x=0pt}
3925 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3926 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3927 \anchor{bottom}{\pgfpointorigin}
3928 \anchor{north}{\northeast\pgf@x=0pt}
3929 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3930 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3931 \anchor{south}{\pgfpointorigin}
3932 \anchor{north east}{\northeast}
3933 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3934 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3935 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3936 \behindforegroundpath{
3937 \pgfstartlinewidth=\pgflinewidth
3938 \pgf@circ@scaled@Rlen=\scaledRlen
3939 \pgfsetcolor{\ctikzvalof{color}}
3940 \northeast
3941 \pgf@circ@res@right=\pgf@x
3942 \pgf@circ@res@up=\pgf@y
3943 \arcpos
3944 \pgf@circ@res@step=\pgf@y
3945 % top
3946 \pgfscope
3947 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3948 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3949 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3950 \pgfusepath{draw}
3951 \endpgfscope
3952 % arc
3953 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
3954 \ifnum90=\@@angle\else % avoid divisions by zero
3955 % radius
3956 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
3957 % start angle y position
3958 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
3959 \pgfsetlinewidth{\pgfstartlinewidth}
3960 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
3961 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
3962 \fi
3963 % tail
3964 \pgfpathmoveto{\pgfpointorigin}
3965 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3966 \pgfusepath{draw}
3967 }
3968 }
3969 % Microstrip monopoles
3970
3971 \pgfdeclareshape{mslstub}{
3972 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3973 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3974 \savedanchor{\southeast}{
3975 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3976 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3977 \pgf@x=.5\pgf@x
3978 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3979 \pgf@y=-.5\pgf@y
3980 }
3981 \savedanchor{\northwest}{
3982 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3983 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3984 \pgf@x=-.5\pgf@x
3985 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3986 \pgf@y=.5\pgf@y
3987 }
3988 \anchor{north}{\northwest\pgf@x=0pt\relax}
3989 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3990 \anchor{east}{\southeast\pgf@y=0pt\relax}
3991 \anchor{south east}{\southeast}
3992 \anchor{south}{\southeast\pgf@x=0pt\relax}
3993 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3994 \anchor{west}{\northwest\pgf@y=0pt\relax}
3995 \anchor{north west}{\northwest}
3996 %
3997 \anchor{center}{\northwest\pgf@y=0pt\relax}
3998 \anchor{left}{\northwest\pgf@y=0pt\relax}
3999 \anchor{right}{\southeast\pgf@y=0pt\relax}
4000 % put the node text above and centered
4001 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4002 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4003 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4004 }
4005 }
4006 \behindbackgroundpath{
4007 \pgfextracty{\pgf@circ@res@up}{\northwest}
4008 \pgfextractx{\pgf@circ@res@right}{\southeast}
4009 \pgfextractx{\pgf@circ@res@left}{\northwest}
4010 \pgfextracty{\pgf@circ@res@down}{\southeast}
4011 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4012 \pgfstartlinewidth=\pgflinewidth
4013 \pgfscope
4014 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4015 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4016 \pgf@circ@draworfill
4017 \endpgfscope
4018 }
4019 }
4020
4021 \pgfdeclareshape{msrstub}{
4022 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4023 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4024 \savedanchor{\southeast}{
4025 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4026 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4027 \pgf@x=.5\pgf@x
4028 \pgf@y=0pt\relax
4029 }
4030 \savedanchor{\northwest}{
4031 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4032 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4033 \pgf@x=-.5\pgf@x
4034 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
4035 \pgf@y=.5\pgf@y
4036 }
4037 \anchor{north}{\northwest\pgf@x=0pt\relax}
4038 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4039 \anchor{east}{\southeast\pgf@y=0pt\relax}
4040 \anchor{south east}{\southeast}
4041 \anchor{south}{\southeast\pgf@x=0pt\relax}
4042 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4043 \anchor{west}{\northwest\pgf@y=0pt\relax}
4044 \anchor{north west}{\northwest}
4045 %
4046 \anchor{center}{\pgfpointorigin}
4047 \anchor{left}{\pgfpointorigin}
4048 \anchor{right}{\pgfpointorigin}
4049 % put the node text above and centered
4050 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4051 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4052 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4053 }
4054 }
4055 \behindbackgroundpath{
4056 \pgfextracty{\pgf@circ@res@up}{\northwest}
4057 \pgfextractx{\pgf@circ@res@right}{\southeast}
4058 \pgfextractx{\pgf@circ@res@left}{\northwest}
4059 \pgfextracty{\pgf@circ@res@down}{\southeast}
4060 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4061 \pgfstartlinewidth=\pgflinewidth
4062 \pgfscope
4063 \pgfpathmoveto{\pgfpointorigin}
4064 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
4065 \pgfusepath{draw}
4066 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4067 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
4068 \pgfpatharc{135}{45}{\pgf@circ@res@step}
4069 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
4070 \pgfpatharc{45}{135}{\pgf@circ@res@up}
4071 \pgfclosepath
4072 \pgf@circ@draworfill
4073 \endpgfscope
4074 }
4075 }
4076
4077 \pgfdeclareshape{msport}{
4078 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4079 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4080 \savedanchor{\southeast}{
4081 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4082 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4083 \pgf@x=.5\pgf@x
4084 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4085 \pgf@y=-.5\pgf@y
4086 }
4087 \savedanchor{\northwest}{
4088 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4089 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4090 \pgf@x=-.5\pgf@x
4091 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4092 \pgf@y=.5\pgf@y
4093 }
4094 \anchor{north}{\northwest\pgf@x=0pt\relax}
4095 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4096 \anchor{east}{\southeast\pgf@y=0pt\relax}
4097 \anchor{south east}{\southeast}
4098 \anchor{south}{\southeast\pgf@x=0pt\relax}
4099 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4100 \anchor{west}{\northwest\pgf@y=0pt\relax}
4101 \anchor{north west}{\northwest}
4102 %
4103 \anchor{center}{\northwest\pgf@y=0pt\relax}
4104 \anchor{left}{\northwest\pgf@y=0pt\relax}
4105 \anchor{right}{\southeast\pgf@y=0pt\relax}
4106 % put the node text above and centered
4107 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4108 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4109 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4110 }
4111 }
4112 \behindbackgroundpath{
4113 \pgfextracty{\pgf@circ@res@up}{\northwest}
4114 \pgfextractx{\pgf@circ@res@right}{\southeast}
4115 \pgfextractx{\pgf@circ@res@left}{\northwest}
4116 \pgfextracty{\pgf@circ@res@down}{\southeast}
4117 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
4118 \pgfstartlinewidth=\pgflinewidth
4119 \pgfscope
4120 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4122 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
4123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4124 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
4126 \pgfpathclose
4127 \pgf@circ@draworfill
4128 \endpgfscope
4129 }
4130 }
4131
4132 % Legacy antennas (with tails)
4133 \def\pgf@circ@shift@antenna@xy#1#2{%
4134 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
4135 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
4136 \relax}
4137
4138 % Legacy antenna
4139 \pgfdeclareshape{antenna}{
4140 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4141 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4142 \anchor{center}{\pgfpointorigin}
4143 \savedanchor{\northeast}{
4144 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4145 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4146 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4147 \pgf@y=4\pgf@circ@res@step
4148 }
4149 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
4150 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
4151 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
4152 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
4153 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4154 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4155 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
4156 \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}}
4157 \anchor{text}{
4158 \northeast
4159 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
4160 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
4161 }
4162 \behindforegroundpath{
4163 \pgfstartlinewidth=\pgflinewidth
4164 \pgf@circ@scaled@Rlen=\scaledRlen
4165 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4166
4167 \pgftransformxshift{ -4\pgf@circ@res@step }
4168
4169 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4170 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4171
4172 \pgfusepath{draw}
4173
4174 \pgfscope
4175 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4176 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4177 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4178 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4179 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4180 \pgfsetcolor{\ctikzvalof{color}}
4181 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4182 \pgfusepath{draw}
4183 \endpgfscope
4184 \pgfsetlinewidth{\pgfstartlinewidth}
4185
4186 }
4187 }
4188
4189 % Legacy TX antenna
4190 \pgfdeclareshape{txantenna}{
4191 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4192 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4193 \anchor{center}{\pgfpointorigin}
4194 \savedanchor{\northeast}{
4195 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4196 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4197 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4198 \pgf@y=4\pgf@circ@res@step
4199 }
4200 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4201 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4202 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4203 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4204 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4205 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4206 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4207 \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}}
4208 \anchor{text}{
4209 \northeast
4210 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
4211 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
4212 }
4213 \behindforegroundpath{
4214 \pgfstartlinewidth=\pgflinewidth
4215 \pgf@circ@scaled@Rlen=\scaledRlen
4216 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
4217
4218 \pgfpathmoveto{\pgfpointorigin}
4219 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4220 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4221 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4222
4223 \pgfusepath{draw}
4224
4225 \pgfscope
4226 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4227 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4228 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4229 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4230 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4231 \pgfsetcolor{\ctikzvalof{color}}
4232 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4233 \pgfusepath{draw}
4234 \endpgfscope
4235 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
4236 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4237 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4238 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
4239 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4240 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
4241 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4242 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
4243 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
4244 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
4245 \pgfusepath{draw}
4246 \pgfsetlinewidth{\pgfstartlinewidth}
4247
4248 }
4249 }
4250
4251 % Legacy RX antenna
4252 \pgfdeclareshape{rxantenna}{
4253 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4254 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4255 \anchor{center}{\pgfpointorigin}
4256 \savedanchor{\northeast}{
4257 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4258 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4259 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4260 \pgf@y=4\pgf@circ@res@step
4261 }
4262 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4263 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4264 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4265 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4266 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4267 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4268 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4269 \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}}
4270 \anchor{text}{
4271 \northeast
4272 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
4273 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
4274 }
4275 \behindforegroundpath{
4276 \pgfstartlinewidth=\pgflinewidth
4277 \pgf@circ@scaled@Rlen=\scaledRlen
4278 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
4279
4280 \pgfpathmoveto{\pgfpointorigin}
4281 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4282 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4283 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4284
4285 \pgfusepath{draw}
4286
4287 \pgfscope
4288 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4289 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4290 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4291 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4292 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4293 \pgfsetcolor{\ctikzvalof{color}}
4294 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4295 \pgfusepath{draw}
4296 \endpgfscope
4297
4298 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
4299 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4300 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4301 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
4302 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4303 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
4304 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4305 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
4306 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
4307 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
4308 \pgfusepath{draw}
4309 \pgfsetlinewidth{\pgfstartlinewidth}
4310 }
4311 }
4312
4313 % Legacy match
4314 \pgfdeclareshape{match}{
4315 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4316 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4317 \savedanchor{\northeast}{%
4318 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4319 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4320 \pgf@x=2\pgf@circ@res@step
4321 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4322 \pgf@y=.5\pgf@circ@res@step%
4323 }
4324 % the center is on the left side of the shape for facility of usage
4325 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4326 \anchor{east}{\northeast\pgf@y=0cm\relax}
4327 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4328 \anchor{west}{\pgfpointorigin}
4329 \anchor{north east}{\northeast}
4330 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4331 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4332 \anchor{south west}{\pgfpointorigin}
4333 \anchor{center}{
4334 \pgfpointorigin
4335 }
4336 \anchor{text}{
4337 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4338 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4339 \pgf@x=1.5\pgf@x
4340 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4341 \pgf@y=-1.5\ht\pgfnodeparttextbox
4342 }
4343 \behindforegroundpath{
4344 \pgf@circ@scaled@Rlen=\scaledRlen
4345 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4346
4347 \pgfscope
4348 \pgfpathmoveto{\pgfpointorigin}
4349 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4350 \pgfusepath{draw}
4351
4352 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4353 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4354 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4355 \pgfusepath{fill}
4356
4357 \pgfsetlinewidth{\pgfstartlinewidth}
4358 \endpgfscope
4359 }
4360 }
4361
4362 %%%---------- close: tex/pgfcircmonopoles
4363 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4364 %%%---------- open: tex/pgfcircbipoles.tex
4365 % Copyright 2018-2026 by Romano Giannetti
4366 % Copyright 2015-2026 by Stefan Lindner
4367 % Copyright 2013-2026 by Stefan Erhardt
4368 % Copyright 2007-2026 by Massimo Redaelli
4369 %
4370 % This file may be distributed and/or modified
4371 %
4372 % 1. under the LaTeX Project Public License and/or
4373 % 2. under the GNU Public License.
4374 %
4375 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4376
4377 %% Generic macro for defining a bipole shape
4378 % #1 - additional anchors
4379 % #2 - lower y-size of the bipole (from the center).
4380 % #3 - #shape is the name of the shape
4381 % #4 - upper y-size of the bipole (from the center)
4382 % #5 - width of the bipole
4383 % #6 - macros drawing the bipole
4384 %
4385 \long\def\pgfcircdeclarebipole{%
4386 \pgfcircdeclarebipolescaled{default}}
4387
4388 %% Generic macro for defining a bipole shape
4389 % #1 - scale factor
4390 % #2 - additional anchors
4391 % #3 - lower y-size of the bipole (from the center).
4392 % #4 - #shape is the name of the shape
4393 % #5 - upper y-size of the bipole (from the center)
4394 % #6 - width of the bipole
4395 % #7 - macros drawing the bipole
4396 %
4397 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
4398 \pgfdeclareshape{#4shape}{
4399 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
4400 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4401 \savedanchor{\northeast}{
4402 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4403 \pgf@y=#5\pgf@circ@scaled@Rlen
4404 \pgf@y=.5\pgf@y
4405 \pgf@x=#6\pgf@circ@scaled@Rlen
4406 \pgf@x=.5\pgf@x
4407 }
4408 \savedanchor{\northeastborder}{
4409 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4410 \pgf@y=#5\pgf@circ@scaled@Rlen
4411 \pgf@y=.5\pgf@y
4412 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4413 \pgf@x=#6\pgf@circ@scaled@Rlen
4414 \pgf@x=.5\pgf@x
4415 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4416 }
4417 \savedanchor{\southwestborder}{
4418 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4419 \pgf@y=-#3\pgf@circ@scaled@Rlen
4420 \pgf@y=.5\pgf@y
4421 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4422 \pgf@x=-#6\pgf@circ@scaled@Rlen
4423 \pgf@x=.5\pgf@x
4424 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4425 }
4426 \savedanchor{\southwest}{
4427 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4428 \pgf@y=-#3\pgf@circ@scaled@Rlen
4429 \pgf@y=.5\pgf@y
4430 \pgf@x=-#6\pgf@circ@scaled@Rlen
4431 \pgf@x=.5\pgf@x
4432 }
4433 \savedanchor{\centerpoint}{
4434 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4435 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
4436 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
4437 \pgfpointorigin
4438 \pgf@y=\pgf@circ@res@up
4439 \advance\pgf@y by\pgf@circ@res@down
4440 \pgf@y=.5\pgf@y
4441 }
4442 \anchor{center}{\pgfpointorigin}
4443 \anchor{n}{
4444 \northeast
4445 \pgf@x=0cm
4446 }
4447 \anchor{north east}{
4448 \northeast
4449 }
4450 \anchor{north west}{
4451 \northeast
4452 \pgf@x=-\pgf@x
4453 }
4454 \anchor{ne}{
4455 \northeast
4456 }
4457 \anchor{nw}{
4458 \northeast
4459 \pgf@x=-\pgf@x
4460 }
4461 \anchor{e}{
4462 \northeast
4463 \pgf@y=0cm
4464 }
4465 \anchor{s}{
4466 \southwest
4467 \pgf@x=0cm
4468 }
4469 \anchor{south east}{
4470 \southwest
4471 \pgf@x=-\pgf@x
4472 }
4473 \anchor{south west}{
4474 \southwest
4475 }
4476 \anchor{se}{
4477 \southwest
4478 \pgf@x=-\pgf@x
4479 }
4480 \anchor{sw}{
4481 \southwest
4482 }
4483 \anchor{w}{
4484 \southwest
4485 \pgf@y=0cm
4486 }
4487 \anchor{north}{
4488 \northeast
4489 \pgf@x=0cm
4490 }
4491 \anchor{east}{
4492 \northeast
4493 \pgf@y=0cm
4494 }
4495 \anchor{south}{
4496 \southwest
4497 \pgf@x=0cm
4498 }
4499 \anchor{west}{
4500 \southwest
4501 \pgf@y=0cm
4502 }
4503 \anchor{right}{
4504 \northeast
4505 \pgf@y=0cm
4506 }
4507 \anchor{above}{
4508 \northeast
4509 \pgf@x=0cm
4510 }
4511 \anchor{left}{
4512 \southwest
4513 \pgf@y=0cm
4514 }
4515 \anchor{below}{
4516 \southwest
4517 \pgf@x=0cm
4518 }
4519 \anchor{a}{
4520 \northeast
4521 \pgf@y=0cm
4522 }
4523 \anchor{b}{
4524 \southwest
4525 \pgf@y=0cm
4526 }
4527 \savedanchor{\textanchor}{%
4528 \pgf@y=\ht\pgfnodeparttextbox
4529 \pgf@x=-.5\wd\pgfnodeparttextbox
4530 }
4531 \anchor{text}{
4532 \textanchor
4533 }
4534 \anchorborder{%
4535 \ifpgf@circuit@bipole@inverted
4536 \pgf@circ@res@left=-\pgf@x
4537 \pgf@circ@res@up=-\pgf@y
4538 \else
4539 \pgf@circ@res@left=\pgf@x
4540 \pgf@circ@res@up=\pgf@y
4541 \fi
4542 \ifdim\pgf@circ@res@up>0cm
4543 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
4544 \else
4545 \southwestborder
4546 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
4547 \fi
4548 }
4549
4550 #2
4551
4552 \backgroundpath{
4553 \pgfsetcolor{\ctikzvalof{color}}
4554
4555 \northeast
4556 \pgf@circ@res@up = \pgf@y
4557 \pgf@circ@res@zero = 0cm
4558 \pgf@circ@res@left = -\pgf@x
4559 \pgf@circ@res@right = \pgf@x
4560 \southwest
4561 \pgf@circ@res@down = \pgf@y
4562 \pgf@circ@scaled@Rlen=\scaledRlen
4563 \pgfstartlinewidth=\pgflinewidth
4564 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
4565 #7
4566
4567 \pgfsetlinewidth{\pgfstartlinewidth}
4568 }
4569 }
4570 }
4571
4572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4573 %% anchor adjustment macros
4574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4575
4576 % Extend the border anchor position by the specified factors on the right-top (north east corner)
4577 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
4578
4579 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
4580 \anchorborder{%
4581 \ifpgf@circuit@bipole@inverted
4582 \pgf@circ@res@left=-\pgf@x
4583 \pgf@circ@res@up=-\pgf@y
4584 \else
4585 \pgf@circ@res@left=\pgf@x
4586 \pgf@circ@res@up=\pgf@y
4587 \fi
4588 \ifdim\pgf@circ@res@up>0cm
4589 \northeastborder
4590 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
4591 \else
4592 \southwestborder
4593 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
4594 \fi
4595 }
4596 }
4597
4598 % Just up and down (very common)
4599 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}
4600
4601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4602 %% Standard bipole shapes declarations
4603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4604
4605 %%%%%%%%%%%%%%%%%%%%%%%%
4606 % Resistive components
4607 %%%%%%%%%%%%%%%%%%%%%%%%
4608
4609 %% Short circuit
4610
4611 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4612 %%% natural length is zero.
4613 \pgfcircdeclarebipole
4614 {% fix the anchor border to add a bit of space for voltage and labels
4615 % it uses the dummy width and height
4616 \anchorborder{%
4617 \ifpgf@circuit@bipole@inverted
4618 \pgf@circ@res@left=-\pgf@x
4619 \pgf@circ@res@up=-\pgf@y
4620 \else
4621 \pgf@circ@res@left=\pgf@x
4622 \pgf@circ@res@up=\pgf@y
4623 \fi
4624 \ifdim\pgf@circ@res@up>0cm
4625 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4626 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4627 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4628 {\pgfpoint{\pgf@x}{\pgf@y}}
4629 \else
4630 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4631 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4632 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4633 {\pgfpoint{-\pgf@x}{-\pgf@y}}
4634 \fi
4635 }
4636 }
4637 {0}
4638 {short}
4639 {0}
4640 {0}
4641 {}
4642
4643 %% Open circuit
4644 \pgfcircdeclarebipole
4645 {}
4646 {\ctikzvalof{bipoles/open/height}}
4647 {open}
4648 {\ctikzvalof{bipoles/open/height}}
4649 {\ctikzvalof{bipoles/open/width}}
4650 {}
4651
4652 % multiwire(s)
4653 \pgfcircdeclarebipole
4654 {}
4655 {\ctikzvalof{bipoles/multiwire/height}}
4656 {multiwire}
4657 {\ctikzvalof{bipoles/multiwire/height}}
4658 {\ctikzvalof{bipoles/multiwire/width}}
4659 {
4660 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4661 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4662 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4663 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4664 \pgfusepath{draw}
4665 }
4666
4667 \pgfcircdeclarebipole
4668 {}
4669 {\ctikzvalof{bipoles/multiwire/height}}
4670 {bmultiwire}
4671 {\ctikzvalof{bipoles/multiwire/height}}
4672 {\ctikzvalof{bipoles/multiwire/width}}
4673 {
4674 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4675 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4676 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4677 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4678 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4679 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4680 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4681 \pgfusepath{draw}
4682 }
4683
4684 \pgfcircdeclarebipole
4685 {}
4686 {\ctikzvalof{bipoles/multiwire/height}}
4687 {tmultiwire}
4688 {\ctikzvalof{bipoles/multiwire/height}}
4689 {\ctikzvalof{bipoles/multiwire/width}}
4690 {
4691 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4692 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4693 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4694 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4695 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4696 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4697 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4700 \pgfusepath{draw}
4701 }
4702
4703 %
4704 %
4705 %% Generic bipole - used as resistor by some (bleah)
4706 \pgfcircdeclarebipolescaled{resistors}
4707 {}
4708 {\ctikzvalof{bipoles/generic/height}}
4709 {generic}
4710 {\ctikzvalof{bipoles/generic/height}}
4711 {\ctikzvalof{bipoles/generic/width}}
4712 {
4713 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4714 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4715 \pgf@circ@draworfill
4716 }
4717
4718 %
4719 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4720 % inherit "generic" properties
4721 %
4722 \pgfcircdeclarebipolescaled{resistors}
4723 {}
4724 {\ctikzvalof{bipoles/generic/height}}
4725 {xgeneric}
4726 {\ctikzvalof{bipoles/generic/height}}
4727 {\ctikzvalof{bipoles/generic/width}}
4728 {
4729 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4730 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4731 \pgf@circ@draworfill
4732 % cross it
4733 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4737 \pgfusepath{draw}
4738 }
4739 %% Generic empty tunable
4740 \pgfcircdeclarebipolescaled{resistors}
4741 {}
4742 {\ctikzvalof{bipoles/tgeneric/height}}
4743 {tgeneric}
4744 {\ctikzvalof{bipoles/tgeneric/height}}
4745 {\ctikzvalof{bipoles/tgeneric/width}}
4746 {
4747 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4748 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4749 \pgf@circ@draworfill
4750 \pgfscope
4751 \pgfsetarrowsend{latexslim}
4752 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4753 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4754 \pgfusepath{draw}
4755 \endpgfscope
4756 }
4757
4758 %% Generic asymmetric bipole
4759 \pgfcircdeclarebipolescaled{resistors}
4760 {}
4761 {\ctikzvalof{bipoles/ageneric/height}}
4762 {ageneric}
4763 {\ctikzvalof{bipoles/ageneric/height}}
4764 {\ctikzvalof{bipoles/ageneric/width}}
4765 {
4766 \pgfscope
4767 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4768 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4769 \pgf@circ@draworfill
4770 \endpgfscope
4771
4772 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4773 \pgfusepath{stroke,fill}
4774 }
4775
4776 %% Memristor
4777 \pgfcircdeclarebipolescaled{resistors}
4778 {}
4779 {\ctikzvalof{bipoles/memristor/height}}
4780 {memristor}
4781 {\ctikzvalof{bipoles/memristor/height}}
4782 {\ctikzvalof{bipoles/memristor/width}}
4783 {
4784 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4785 \divide \pgf@circ@res@step by 14
4786
4787 \pgfscope
4788 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4789 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4790 \pgf@circ@draworfill
4791 \endpgfscope
4792 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4793 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4794 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4795 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4796 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4797 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4798 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4799 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4800 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4801 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4802
4803 \pgfusepath{draw}
4804
4805 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4806 \pgfusepath{stroke,fill}
4807 }
4808
4809 %% Photoresistor
4810 \pgfcircdeclarebipolescaled{resistors}
4811 {}
4812 {\ctikzvalof{bipoles/photoresistor/height 2}}
4813 {photoresistor}
4814 {\ctikzvalof{bipoles/photoresistor/height}}
4815 {\ctikzvalof{bipoles/photoresistor/width}}
4816 {
4817 \pgfscope
4818 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4819 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4820 \pgf@circ@draworfill
4821 \endpgfscope
4822
4823 \pgfscope
4824 \pgfsetarrowsend{latexslim}
4825 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4826 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4827 \pgfusepath{draw}
4828 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4829 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4830 \pgfusepath{draw}
4831 \endpgfscope
4832 }
4833
4834 %% Thermistor
4835 \pgfcircdeclarebipolescaled{resistors}
4836 {% anchor for labelling the type of dependency
4837 \anchor{label}{%
4838 \southwest
4839 \pgf@x=0.4\pgf@x
4840 \pgf@y=1.2\pgf@y
4841 }%
4842 \pgfcirc@border@extend@updown{1}{1.2}
4843 }
4844 {\ctikzvalof{bipoles/thermistor/height}}
4845 {thermistor}
4846 {\ctikzvalof{bipoles/thermistor/height}}
4847 {\ctikzvalof{bipoles/thermistor/width}}
4848 {
4849 \pgfscope
4850 \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}}
4851 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4852 \pgf@circ@draworfill
4853 \endpgfscope
4854
4855 %\pgfscope
4856 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4857 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4858 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4859 \pgfusepath{draw}
4860 %\endpgfscope
4861 }
4862
4863 %% Thermistor PTC
4864 \pgfcircdeclarebipolescaled{resistors}
4865 {}
4866 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4867 {thermistorptc}
4868 {\ctikzvalof{bipoles/thermistorptc/height}}
4869 {\ctikzvalof{bipoles/thermistorptc/width}}
4870 {
4871 \pgfscope
4872 \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}}
4873 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4874 \pgf@circ@draworfill
4875 \endpgfscope
4876 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4877 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4878 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4879 \pgfusepath{draw}
4880
4881 \pgfsetlinewidth{\pgfstartlinewidth}
4882 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4883 \pgfsetarrowsend{latexslim}
4884 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4885 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4886 \pgfusepath{draw}
4887 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4888 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4889 \pgfusepath{draw}
4890 }
4891
4892 %% Thermistor NTC
4893 \pgfcircdeclarebipolescaled{resistors}
4894 {}
4895 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4896 {thermistorntc}
4897 {\ctikzvalof{bipoles/thermistorntc/height}}
4898 {\ctikzvalof{bipoles/thermistorntc/width}}
4899 {
4900 \pgfscope
4901 \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}}
4902 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4903 \pgf@circ@draworfill
4904 \endpgfscope
4905
4906 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4907 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4908 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4909 \pgfusepath{draw}
4910
4911 \pgfsetlinewidth{\pgfstartlinewidth}
4912 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4913 \pgfsetarrowsend{latexslim}
4914 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4915 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4916 \pgfusepath{draw}
4917 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4918 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4919 \pgfusepath{draw}
4920 }
4921
4922 %% Generic tunable
4923 \pgfcircdeclarebipolescaled{resistors}
4924 {
4925 \savedanchor{\wiper}{
4926 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4927 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4928 \pgf@y=.5\pgf@ya
4929 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4930 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4931 }
4932 \anchor{wiper}{\wiper}
4933 \anchor{W}{\wiper}
4934 }
4935 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4936 {genericpotentiometer}
4937 {\ctikzvalof{bipoles/generic potentiometer/height}}
4938 {\ctikzvalof{bipoles/generic potentiometer/width}}
4939 {
4940
4941 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4942 \divide \pgf@circ@res@step by 14
4943
4944 \pgfscope
4945 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4946 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4947 \pgf@circ@draworfill
4948 \endpgfscope
4949 \pgfscope
4950 %\pgfsetlinewidth{\pgfstartlinewidth}
4951 \pgfsetarrowsend{latexslim}
4952 \pgfextractx{\pgf@circ@res@other}{\wiper}
4953 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4954 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4955 \pgfusepath{draw}
4956 \endpgfscope
4957 }
4958
4959 %% Zig zag resistores
4960 \def\pgf@circ@zigzag#1{%
4961 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4962
4963 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4964 \pgf@circ@res@other = \pgf@circ@res@left
4965 \pgf@circ@count@a=\zigs\relax
4966 % first half zig
4967 \advance\pgf@circ@res@other by \pgf@circ@res@step
4968 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4969 \pgfmathloop%
4970 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4971 \ifnum\pgf@circ@count@a>0
4972 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4973 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4974 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4975 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4976 \repeatpgfmathloop%
4977 % last zig and a half
4978 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4980 \advance\pgf@circ@res@other by \pgf@circ@res@step
4981 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4982 \pgfsetbeveljoin
4983 \pgfusepath{draw}
4984 }
4985
4986 %% Resistor
4987 \pgfcircdeclarebipolescaled{resistors}
4988 {
4989 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4990 }
4991 {\ctikzvalof{bipoles/resistor/height}}
4992 {resistor}
4993 {\ctikzvalof{bipoles/resistor/height}}
4994 {\ctikzvalof{bipoles/resistor/width}}
4995 {
4996 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4997 \pgftransformationadjustments
4998 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4999 \pgf@circ@zigzag{1}
5000 }
5001
5002
5003 %% Variable resistor
5004 \pgfcircdeclarebipolescaled{resistors}
5005 {
5006 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5007 }
5008 {\ctikzvalof{bipoles/vresistor/height}}
5009 {vresistor}
5010 {\ctikzvalof{bipoles/vresistor/height}}
5011 {\ctikzvalof{bipoles/vresistor/width}}
5012 {
5013 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5014 \pgftransformationadjustments
5015 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5016 \pgf@circ@zigzag{.5}
5017
5018 \pgfscope
5019 \pgfsetarrowsend{latexslim}
5020 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
5021 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
5022 \pgfusepath{draw}
5023 \endpgfscope
5024 }
5025
5026 %% Potentiometer
5027 \pgfcircdeclarebipolescaled{resistors}
5028 {
5029 \savedanchor{\wiper}{
5030 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5031 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
5032 \pgf@y=.5\pgf@ya
5033 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
5034 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
5035 }
5036 \anchor{wiper}{\wiper}
5037 \anchor{W}{\wiper}
5038 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5039 }
5040 {\ctikzvalof{bipoles/potentiometer/height 2}}
5041 {potentiometer}
5042 {\ctikzvalof{bipoles/potentiometer/height}}
5043 {\ctikzvalof{bipoles/potentiometer/width}}
5044 {
5045 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5046 \pgftransformationadjustments
5047 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5048 \pgf@circ@zigzag{1}
5049
5050 \pgfscope
5051 %\pgfsetlinewidth{\pgfstartlinewidth}
5052 \pgfsetarrowsend{latexslim}
5053 \pgfextractx{\pgf@circ@res@other}{\wiper}
5054 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5055 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5056 \pgfusepath{draw}
5057 \endpgfscope
5058 }
5059
5060 %% Resistive sensor
5061 \pgfcircdeclarebipolescaled{resistors}
5062 {% anchor for labelling the type of dependency
5063 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
5064 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5065 }
5066 {\ctikzvalof{bipoles/resistivesens/height}}
5067 {resistivesens}
5068 {\ctikzvalof{bipoles/resistivesens/height}}
5069 {\ctikzvalof{bipoles/resistivesens/width}}
5070 {%
5071 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5072 \pgftransformationadjustments
5073 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5074 \pgf@circ@zigzag{.5}
5075
5076 \pgfscope
5077 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
5078 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
5079 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
5080 \pgfusepath{draw}
5081 \endpgfscope
5082 }
5083
5084 %%%%%%%%%%%%%%
5085 %% Capacitors
5086 %%%%%%%%%%%%%
5087
5088 %% Plain Capacitor
5089 \pgfcircdeclarebipolescaled{capacitors}
5090 {}
5091 {\ctikzvalof{bipoles/capacitor/height}}
5092 {capacitor}
5093 {\ctikzvalof{bipoles/capacitor/height}}
5094 {\ctikzvalof{bipoles/capacitor/width}}
5095 {
5096 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5097 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5099
5100 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5101 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5102 \pgfusepath{draw}
5103
5104 }
5105
5106 %% Capacitive sensor
5107 \pgfcircdeclarebipolescaled{capacitors}
5108 {
5109 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
5110 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
5111 }
5112 {\ctikzvalof{bipoles/capacitor/height}}
5113 {capacitivesens}
5114 {\ctikzvalof{bipoles/capacitor/height}}
5115 {\ctikzvalof{bipoles/capacitor/width}}
5116 {
5117 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5118 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5119 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5120
5121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5122 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5123 \pgfusepath{draw}
5124 \pgfscope
5125 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
5126 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5127 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5128 \pgfusepath{draw}
5129 \endpgfscope
5130 }
5131
5132 %% Polar Capacitor (DEPRECATED)
5133 \pgfcircdeclarebipolescaled{capacitors}
5134 {}
5135 {\ctikzvalof{bipoles/pcapacitor/height}}
5136 {polarcapacitor}
5137 {\ctikzvalof{bipoles/pcapacitor/height}}
5138 {\ctikzvalof{bipoles/pcapacitor/width}}
5139 {
5140 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5141
5142 \pgfscope
5143 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
5144 \pgftransformrotate{-90}
5145 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5146 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5147 \pgfusepath{draw}
5148 \endpgfscope
5149
5150 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5151 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5152 \pgfusepath{draw}
5153 }
5154
5155
5156 %% Curved capacitor
5157 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
5158 % for a rationale
5159 %
5160 \pgfcircdeclarebipolescaled{capacitors}
5161 {}
5162 {\ctikzvalof{bipoles/ccapacitor/height}}
5163 {ccapacitor}
5164 {\ctikzvalof{bipoles/ccapacitor/height}}
5165 {\ctikzvalof{bipoles/ccapacitor/width}}
5166 {
5167 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5168
5169 \pgfscope
5170 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}}
5171 \pgftransformrotate{-90}
5172 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5173 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5174 \pgfusepath{draw}
5175 \endpgfscope
5176
5177 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5178 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5179 \pgfusepath{draw}
5180 }
5181
5182
5183
5184
5185 %% Electrolytic Capacitor
5186 \pgfcircdeclarebipolescaled{capacitors}
5187 {}
5188 {\ctikzvalof{bipoles/ecapacitor/height}}
5189 {ecapacitor}
5190 {\ctikzvalof{bipoles/ecapacitor/height}}
5191 {\ctikzvalof{bipoles/ecapacitor/width}}
5192 {
5193 \pgfsetrectcap
5194 % % % Draw plus pole
5195 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5197 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5198 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5201 \pgf@circ@draworfill
5202 % % Draw minus pole
5203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5204 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5205 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5206 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5207 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5208 \pgfsetfillcolor{\ctikzvalof{color}}
5209 \pgfusepath{draw,fill}
5210 \pgfsetfillcolor{\ctikzvalof{color}}
5211 % % plus pole annotation
5212 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
5213 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
5214 }
5215
5216 %% Variable Capacitor
5217 \pgfcircdeclarebipolescaled{capacitors}
5218 {}
5219 {\ctikzvalof{bipoles/vcapacitor/height}}
5220 {vcapacitor}
5221 {\ctikzvalof{bipoles/vcapacitor/height}}
5222 {\ctikzvalof{bipoles/vcapacitor/width}}
5223 {
5224 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right
5225
5226 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5227 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5228 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5229
5230 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5231 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5232 \pgfusepath{draw}
5233
5234 \pgfscope
5235 \pgfsetarrowsend{latexslim}
5236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5238 \pgfusepath{draw}
5239 \endpgfscope
5240
5241 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5242 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
5243 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5244 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
5245 \pgfsetlinewidth{\pgfstartlinewidth}
5246 \pgfusepath{draw}
5247 }
5248
5249
5250 %% Piezoelectric Element
5251
5252 \pgfcircdeclarebipolescaled{capacitors}
5253 {}
5254 {\ctikzvalof{bipoles/piezoelectric/height}}
5255 {piezoelectric}
5256 {\ctikzvalof{bipoles/piezoelectric/height}}
5257 {\ctikzvalof{bipoles/piezoelectric/width}}
5258 {
5259 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
5260 % \divide \pgf@circ@res@step by 5
5261
5262 %% Outer markings
5263 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5264 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5265 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5266
5267 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5268 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5269 \pgfusepath{draw}
5270
5271 %% Inner Box
5272 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5273 \pgfscope
5274 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5275 \pgfpathrectanglecorners
5276 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5277 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5278 \pgf@circ@draworfill
5279 \endpgfscope
5280 }
5281
5282 %%%%%%%%%%%%%%%
5283 %% Inductors
5284 %%%%%%%%%%%%%%%
5285
5286 %% cute inductor
5287 \pgfcircdeclarebipolescaled{inductors}
5288 {
5289 \savedanchor{\midtap}{%
5290 \pgf@x=0pt\relax
5291 \pgfmathsetlength{\pgf@y}{%
5292 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5293 \ctikzvalof{bipoles/cuteinductor/height} :% even
5294 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5295 *\pgf@circ@scaled@Rlen/2
5296 }
5297 }
5298 \anchor{midtap}{\midtap}
5299 }
5300 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5301 {cuteinductor}
5302 {\ctikzvalof{bipoles/cuteinductor/height}}
5303 {\ctikzvalof{bipoles/cuteinductor/width}}
5304 {
5305 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5306 \pgftransformationadjustments
5307
5308 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5309 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5310
5311
5312 \pgfmathsetlength{\pgf@circ@res@step}
5313 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5314
5315 \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
5316 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5317 {
5318 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5319 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5320 }
5321 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5322 \pgfsetbuttcap
5323 \pgfsetbeveljoin
5324 \pgfusepath{stroke}
5325 }
5326
5327 %% cute inductive sensor
5328 \pgfcircdeclarebipolescaled{inductors}
5329 {% anchor for labelling the type of dependency
5330 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5331 \savedanchor{\midtap}{%
5332 \pgf@x=0pt\relax
5333 \pgfmathsetlength{\pgf@y}{%
5334 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5335 \ctikzvalof{bipoles/cuteinductor/height} :% even
5336 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5337 *\pgf@circ@scaled@Rlen/2
5338 }
5339 }
5340 \anchor{midtap}{\midtap}
5341 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5342 }
5343 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5344 {scuteinductor}
5345 {\ctikzvalof{bipoles/cuteinductor/height}}
5346 {\ctikzvalof{bipoles/cuteinductor/width}}
5347 {
5348 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5349 \pgftransformationadjustments
5350
5351 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5352 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5353
5354
5355 \pgfmathsetlength{\pgf@circ@res@step}
5356 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5357
5358 \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
5359 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5360 {
5361 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5362 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5363 }
5364 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5365 \pgfsetbuttcap
5366 \pgfsetbeveljoin
5367 \pgfusepath{stroke}
5368 \pgfscope
5369 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5370 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5371 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5372 \pgfusepath{draw}
5373 \endpgfscope
5374 }
5375
5376 %% cute choke
5377 \pgfcircdeclarebipolescaled{inductors}
5378 {
5379 \savedanchor{\midtap}{%
5380 \pgf@x=0pt\relax
5381 \pgfmathsetlength{\pgf@y}{%
5382 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5383 \ctikzvalof{bipoles/cuteinductor/height} :% even
5384 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5385 *\pgf@circ@scaled@Rlen/2
5386 }
5387 }
5388 \anchor{midtap}{\midtap}
5389 }
5390 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5391 {cutechoke}
5392 {\ctikzvalof{bipoles/cutechoke/height}}
5393 {\ctikzvalof{bipoles/cutechoke/width}}
5394 {
5395 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5396 \pgftransformationadjustments
5397
5398 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5399 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5400
5401
5402 \pgfmathsetlength{\pgf@circ@res@step}
5403 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5404
5405 \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
5406 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5407 {
5408 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5409 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5410 }
5411 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5412 \pgfsetbuttcap
5413 \pgfsetbeveljoin
5414 \pgfusepath{stroke}
5415
5416 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5418 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5419 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5420 \pgfusepath{stroke}
5421
5422 \ifpgf@circuit@bipole@twolineschoke
5423 \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}}
5424 \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}}
5425 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5426 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5427 \pgfusepath{stroke}
5428 \fi
5429 }
5430
5431 %% variable cute inductor
5432 \pgfcircdeclarebipolescaled{inductors}
5433 {
5434 \savedanchor{\midtap}{%
5435 \pgf@x=0pt\relax
5436 \pgfmathsetlength{\pgf@y}{%
5437 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5438 \ctikzvalof{bipoles/cuteinductor/height} :% even
5439 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5440 *\pgf@circ@scaled@Rlen/2
5441 }
5442 }
5443 \anchor{midtap}{\midtap}
5444 }
5445 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5446 {vcuteinductor}
5447 {\ctikzvalof{bipoles/vcuteinductor/height}}
5448 {\ctikzvalof{bipoles/vcuteinductor/width}}
5449 {
5450 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5451 \pgftransformationadjustments
5452
5453 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5454 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5455
5456
5457 \pgfmathsetlength{\pgf@circ@res@step}
5458 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5459
5460 \pgfscope
5461 \pgfsetarrowsend{latexslim}
5462 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5463 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5464 \pgfusepath{draw}
5465 \endpgfscope
5466
5467 \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
5468 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5469 {
5470 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5471 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5472 }
5473 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5474 \pgfsetbuttcap
5475 \pgfsetbeveljoin
5476 \pgfusepath{stroke}
5477 }
5478
5479 %% american inductor
5480 \pgfcircdeclarebipolescaled{inductors}
5481 {
5482 \savedanchor{\midtap}{%
5483 \pgf@x=0pt\relax
5484 \pgfmathsetlength{\pgf@y}{%
5485 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5486 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5487 0) %odd
5488 *\pgf@circ@scaled@Rlen/2
5489 }
5490 }
5491 \anchor{midtap}{\midtap}
5492 }
5493 {\ctikzvalof{bipoles/americaninductor/height 2}}
5494 {americaninductor}
5495 {\ctikzvalof{bipoles/americaninductor/height}}
5496 {\ctikzvalof{bipoles/americaninductor/width}}
5497 {
5498 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5499 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5500 \pgftransformationadjustments
5501 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5502 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5503 \divide \pgf@circ@res@step by 2
5504 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5505
5506 \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
5507 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5508 {
5509 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5510 }
5511 \pgfsetbuttcap
5512 \pgfsetbeveljoin
5513 \pgfusepath{stroke}
5514 }
5515
5516
5517 %% american inductive sensor
5518 \pgfcircdeclarebipolescaled{inductors}
5519 {% anchor for labelling the type of dependency
5520 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5521 \savedanchor{\midtap}{%
5522 \pgf@x=0pt\relax
5523 \pgfmathsetlength{\pgf@y}{%
5524 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5525 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5526 0) %odd
5527 *\pgf@circ@scaled@Rlen/2
5528 }
5529 }
5530 \anchor{midtap}{\midtap}
5531 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5532 }
5533 {\ctikzvalof{bipoles/americaninductor/height 2}}
5534 {samericaninductor}
5535 {\ctikzvalof{bipoles/americaninductor/height}}
5536 {\ctikzvalof{bipoles/americaninductor/width}}
5537 {
5538 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5539 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5540 \pgftransformationadjustments
5541 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5542 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5543 \divide \pgf@circ@res@step by 2
5544 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5545
5546 \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
5547 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5548 {
5549 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5550 }
5551 \pgfsetbuttcap
5552 \pgfsetbeveljoin
5553 \pgfusepath{stroke}
5554 \pgfscope
5555 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5556 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5557 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5558 \pgfusepath{draw}
5559 \endpgfscope
5560 }
5561
5562 %% variable american inductor
5563 \pgfcircdeclarebipolescaled{inductors}
5564 {
5565 \savedanchor{\midtap}{%
5566 \pgf@x=0pt\relax
5567 \pgfmathsetlength{\pgf@y}{%
5568 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5569 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5570 0) %odd
5571 *\pgf@circ@scaled@Rlen/2
5572 }
5573 }
5574 \anchor{midtap}{\midtap}
5575 }
5576 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5577 {vamericaninductor}
5578 {\ctikzvalof{bipoles/vamericaninductor/height}}
5579 {\ctikzvalof{bipoles/vamericaninductor/width}}
5580 {
5581 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5582 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5583 \pgftransformationadjustments
5584 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5585 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5586 \divide \pgf@circ@res@step by 2
5587 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5588
5589 \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
5590 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5591 {
5592 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5593 }
5594 \pgfsetbuttcap
5595 \pgfsetbeveljoin
5596 \pgfusepath{stroke}
5597
5598 \pgfscope
5599 \pgfsetarrowsend{latexslim}
5600 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5601 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5602 \pgfusepath{draw}
5603 \endpgfscope
5604 }
5605
5606 %% Generic bipole, filled - used as inductor by some
5607 \pgfcircdeclarebipolescaled{inductors}
5608 {
5609 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5610 }
5611 {\ctikzvalof{bipoles/fullgeneric/height}}
5612 {fullgeneric}
5613 {\ctikzvalof{bipoles/fullgeneric/height}}
5614 {\ctikzvalof{bipoles/fullgeneric/width}}
5615 {
5616 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5617 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5618
5619 \pgfusepath{draw,fill}
5620 }
5621
5622 %% Generic sensor, filled - used as inductive sensor by some
5623 \pgfcircdeclarebipolescaled{inductors}
5624 {% anchor for labelling the type of dependency
5625 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5626 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5627 \pgfcirc@border@extend@full{1}{2}{1}{2}
5628 }
5629 {\ctikzvalof{bipoles/fullgeneric/height}}
5630 {sfullgeneric}
5631 {\ctikzvalof{bipoles/fullgeneric/height}}
5632 {\ctikzvalof{bipoles/fullgeneric/width}}
5633 {
5634
5635 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5636 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5637 \pgfusepath{draw,fill}
5638 %\pgfscope
5639 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5640 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5641 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5642 \pgfusepath{draw}
5643 %\endpgfscope
5644 }
5645
5646 %% Generic full tunable
5647 \pgfcircdeclarebipolescaled{inductors}
5648 {
5649 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5650 }
5651 {\ctikzvalof{bipoles/tfullgeneric/height}}
5652 {tfullgeneric}
5653 {\ctikzvalof{bipoles/tfullgeneric/height}}
5654 {\ctikzvalof{bipoles/tfullgeneric/width}}
5655 {
5656 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5657 \divide \pgf@circ@res@step by 14
5658
5659 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5660 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5661 \pgfusepath{draw,fill}
5662
5663 \pgfscope
5664 \pgfsetarrowsend{latexslim}
5665 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5666 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5667 \pgfusepath{draw}
5668 \endpgfscope
5669 }
5670
5671 %%%%%%%%%%%
5672 %% Battery
5673 %%%%%%%%%%%
5674
5675 %% Battery
5676 \pgfcircdeclarebipolescaled{batteries}
5677 {}
5678 {\ctikzvalof{bipoles/battery/height}}
5679 {battery}
5680 {\ctikzvalof{bipoles/battery/height}}
5681 {\ctikzvalof{bipoles/battery/width}}
5682 {
5683 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5684 \divide \pgf@circ@res@step by 6
5685
5686 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5687
5688 \ifpgf@circ@fixbatteries
5689 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5690 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5691
5692 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5693 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5694
5695 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5697
5698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5700 \else
5701 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5702 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5703
5704 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5705 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5706
5707 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5708 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5709
5710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5711 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5712 \fi
5713 \pgfusepath{draw}
5714 }
5715
5716
5717 %% Battery 1 % poles with equl thickness
5718
5719 \pgfcircdeclarebipolescaled{batteries}
5720 {}
5721 {\ctikzvalof{bipoles/battery1/height}}
5722 {battery1}
5723 {\ctikzvalof{bipoles/battery1/height}}
5724 {\ctikzvalof{bipoles/battery1/width}}
5725 {
5726 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5727 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5728 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5729 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5730 \pgfusepath{draw}
5731
5732 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5733 \ifpgf@circ@fixbatteries
5734 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5735 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5736
5737 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5738 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5739 \else
5740 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5741 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5742
5743 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5744 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5745 \fi
5746 \pgfusepath{draw}
5747 }
5748
5749 %% Battery 2 % negative pole thicker
5750
5751 \pgfcircdeclarebipolescaled{batteries}
5752 {}
5753 {\ctikzvalof{bipoles/battery2/height}}
5754 {battery2}
5755 {\ctikzvalof{bipoles/battery2/height}}
5756 {\ctikzvalof{bipoles/battery2/width}}
5757 {
5758 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5760 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5762 \pgfusepath{draw}
5763
5764 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5765 \ifpgf@circ@fixbatteries
5766 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5767 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5768 \pgfusepath{draw}
5769 \pgfsetlinewidth{3\pgflinewidth}
5770 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5771 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5772 \else
5773 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5774 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5775 \pgfusepath{draw}
5776 \pgfsetlinewidth{3\pgflinewidth}
5777 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5778 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5779 \fi
5780 \pgfusepath{draw}
5781 }
5782
5783 %%%%%%%%%%%
5784 %% Round and diamond sources
5785 %%%%%%%%%%%
5786
5787 %% Independent voltage source
5788 \pgfcircdeclarebipolescaled{sources}
5789 {}
5790 {\ctikzvalof{bipoles/vsource/height}}
5791 {vsource}
5792 {\ctikzvalof{bipoles/vsource/height}}
5793 {\ctikzvalof{bipoles/vsource/width}}
5794 {
5795
5796 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5797
5798 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5799 \pgf@circ@draworfill
5800 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5802 \pgfusepath{draw}
5803 }
5804
5805 %% To change the internal symbols of the voltage source american style
5806 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
5807 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
5808 %% Independent voltage source - American style
5809 \pgfcircdeclarebipolescaled{sources}
5810 {}
5811 {\ctikzvalof{bipoles/vsourceam/height}}
5812 {vsourceAM}
5813 {\ctikzvalof{bipoles/vsourceam/height}}
5814 {\ctikzvalof{bipoles/vsourceam/width}}
5815 {
5816
5817 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5818 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5819 \pgf@circ@draworfill
5820 \pgfsetcolor{\ctikzvalof{color}}
5821 \ifpgf@circ@oldvoltagedirection
5822 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5823 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5824 \else
5825 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5826 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5827 \fi
5828 }
5829
5830 %% Independent sinusoidal voltage source
5831 \pgfcircdeclarebipolescaled{sources}
5832 {}
5833 {\ctikzvalof{bipoles/vsourcesin/height}}
5834 {vsourcesin}
5835 {\ctikzvalof{bipoles/vsourcesin/height}}
5836 {\ctikzvalof{bipoles/vsourcesin/width}}
5837 {
5838
5839 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5840 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5841 \pgf@circ@draworfill
5842
5843 \pgf@circ@res@up = .5\pgf@circ@res@up
5844 \pgfscope
5845 \pgftransformrotate{90}
5846 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5847 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5848 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5849 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5850 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5851 \pgfusepath{draw}
5852 \endpgfscope
5853 }
5854
5855 % Square Voltage source - contributed by Alistair Kwan
5856 \pgfcircdeclarebipolescaled{sources}
5857 {}
5858 {\ctikzvalof{bipoles/vsourcesquare/height}}
5859 {vsourcesquare}
5860 {\ctikzvalof{bipoles/vsourcesquare/height}}
5861 {\ctikzvalof{bipoles/vsourcesquare/width}}
5862 {
5863 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5864 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5865 \pgf@circ@draworfill
5866 \pgf@circ@res@up = .5\pgf@circ@res@up
5867 \pgfscope
5868 \pgftransformrotate{90}
5869 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5870 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
5871 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
5872 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5873 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5874 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5875 \pgfusepath{draw}
5876 \endpgfscope
5877 }
5878
5879 % Triangle Voltage source - contributed by Ralf Farkas
5880 \pgfcircdeclarebipolescaled{sources}
5881 {}
5882 {\ctikzvalof{bipoles/vsourcetri/height}}
5883 {vsourcetri}
5884 {\ctikzvalof{bipoles/vsourcetri/height}}
5885 {\ctikzvalof{bipoles/vsourcetri/width}}
5886 {
5887
5888 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5889 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5890 \pgf@circ@draworfill
5891
5892 \pgf@circ@res@up = .5\pgf@circ@res@up
5893 \pgfscope
5894 \pgftransformrotate{90}
5895 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5896 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
5897 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
5898 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5899 \pgfusepath{draw}
5900 \endpgfscope
5901 }
5902
5903
5904 %% PV Source
5905 \pgfcircdeclarebipolescaled{sources}
5906 {}
5907 {\ctikzvalof{bipoles/pvsource/height}}
5908 {pvsource}
5909 {\ctikzvalof{bipoles/pvsource/height}}
5910 {\ctikzvalof{bipoles/pvsource/width}}
5911 {
5912 \pgfpointorigin
5913 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5914 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5916 \pgf@circ@draworfill
5917
5918 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
5919 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5920 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
5921 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5922 \pgfusepath{draw}
5923
5924 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5925 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
5926 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
5927
5928 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
5929 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
5930 \pgfusepath{draw}
5931
5932 %Arrow Part
5933 \pgfscope
5934 \pgfsetarrowsend{latex}
5935 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5936 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5937 \pgfusepath{draw}
5938 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5939 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5940 \pgfusepath{draw}
5941 \endpgfscope
5942
5943 }
5944
5945 %% Empty Source
5946 \pgfcircdeclarebipolescaled{sources}
5947 {}
5948 {\ctikzvalof{bipoles/esource/height}}
5949 {esource}
5950 {\ctikzvalof{bipoles/esource/height}}
5951 {\ctikzvalof{bipoles/esource/width}}
5952 {
5953 \pgfpointorigin
5954 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5955 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5956 \pgf@circ@draworfill
5957 }
5958
5959 %% DC Current Source with open shape
5960 \pgfcircdeclarebipolescaled{sources}
5961 {}
5962 {\ctikzvalof{bipoles/dcisource/height}}
5963 {dcisource}
5964 {\ctikzvalof{bipoles/dcisource/height}}
5965 {\ctikzvalof{bipoles/dcisource/width}}
5966 {
5967 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5968 \pgfpathmoveto{\pgfpointorigin}
5969 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5970 \pgf@circ@maybefill
5971 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
5972 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
5973 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
5974 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
5975 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
5976 \pgfusepath{draw}
5977
5978 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5979 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5980 \pgfusepath{draw}
5981 \pgfscope
5982 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5983 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5984 \endpgfscope
5985 }
5986
5987 %% DC-Voltage source
5988 \pgfcircdeclarebipolescaled{sources}
5989 {}
5990 {\ctikzvalof{bipoles/dcvsource/height}}
5991 {dcvsource}
5992 {\ctikzvalof{bipoles/dcvsource/height}}
5993 {\ctikzvalof{bipoles/dcvsource/width}}
5994 {
5995 \pgfpointorigin
5996 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5997 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5998 \pgf@circ@draworfill
5999 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
6000 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
6001 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
6002 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
6003 \pgfusepath{draw}
6004 }
6005
6006 %% Independent current source
6007 \pgfcircdeclarebipolescaled{sources}
6008 {}
6009 {\ctikzvalof{bipoles/isource/height}}
6010 {isource}
6011 {\ctikzvalof{bipoles/isource/height}}
6012 {\ctikzvalof{bipoles/isource/width}}
6013 {
6014 \pgfpointorigin
6015 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6016 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6018 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6019 \pgf@circ@draworfill
6020 }
6021
6022 %% Independent double oo source
6023 \pgfcircdeclarebipolescaled{sources}
6024 {}
6025 {\ctikzvalof{bipoles/oosource/height}}
6026 {oosource}
6027 {\ctikzvalof{bipoles/oosource/height}}
6028 {\ctikzvalof{bipoles/oosource/width}}
6029 {
6030 \pgfpointorigin
6031 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6032 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6033 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6034 \pgf@circ@maybefill
6035 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
6036 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
6037 \pgf@circ@draworfill
6038 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6039 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6040 \pgfusepath{draw}
6041 }
6042
6043 % % % winding symbols
6044 % triangle
6045 \def\pgf@circ@delta#1{
6046 \pgfscope
6047 \pgftransformscale{-.01\pgf@circ@res@left*#1}
6048 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6049 \pgftransformrotate{-\pgfcircmathresult}
6050
6051 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6052 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6053 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6054 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
6055 \pgfpathclose
6056 \pgfusepath{stroke}
6057 \endpgfscope
6058 }
6059
6060 % star
6061 \def\pgf@circ@wye#1{
6062 \pgfscope
6063 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6064 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6065 \pgftransformrotate{-\pgfcircmathresult}
6066
6067 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6068 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
6069 \pgfpathlineto{\pgfpointorigin}
6070 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
6071 \pgfpathmoveto{\pgfpointorigin}
6072 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
6073 \pgfusepath{stroke}
6074 \endpgfscope
6075 }
6076
6077 % zigzag
6078 \def\pgf@circ@zig#1{
6079 \pgfscope
6080 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6081 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6082 \pgftransformrotate{-\pgfcircmathresult}
6083
6084 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6085 \pgfpathmoveto{\pgfpointorigin}
6086 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
6087 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
6088
6089 \pgfpathmoveto{\pgfpointorigin}
6090 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
6091 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
6092
6093 \pgfpathmoveto{\pgfpointorigin}
6094 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
6095 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
6096 \pgfusepath{stroke}
6097 \endpgfscope
6098 }
6099
6100 % % % % round three-phase transformer
6101 \pgfcircdeclarebipolescaled{sources}
6102 {}
6103 {\ctikzvalof{bipoles/oosourcetrans/height}}
6104 {oosourcetrans}
6105 {\ctikzvalof{bipoles/oosourcetrans/height}}
6106 {\ctikzvalof{bipoles/oosourcetrans/width}}
6107 {
6108
6109 \pgfpointorigin
6110 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6111 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6112 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6113 \pgf@circ@maybefill
6114 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
6115 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6116 \pgf@circ@draworfill
6117 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6118 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6119 \pgfusepath{draw}
6120
6121
6122 % % % % draw inner symbols
6123
6124 %%primary winding
6125 \ifpgf@circ@prim@delta
6126 \pgfscope
6127 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6128 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6129 \endpgfscope
6130
6131 \else\ifpgf@circ@prim@wye
6132 \pgfscope
6133 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6134 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6135 \endpgfscope
6136
6137 \else\ifpgf@circ@prim@zig
6138 \pgfscope
6139 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6140 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6141 \endpgfscope
6142 \fi\fi\fi
6143
6144 %%secondary winding
6145 \ifpgf@circ@sec@delta
6146 \pgfscope
6147 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6148 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6149 \endpgfscope
6150
6151 \else\ifpgf@circ@sec@wye
6152 \pgfscope
6153 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6154 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6155 \endpgfscope
6156
6157 \else\ifpgf@circ@sec@zig
6158 \pgfscope
6159 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6160 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6161 \endpgfscope
6162 \fi\fi\fi
6163 }
6164
6165
6166 % % % % ooosource for three phase transformer
6167 \pgfcircdeclarebipolescaled{sources}
6168 {
6169 \anchor{right}{
6170 \northeast
6171 \pgf@y=0pt
6172 \pgfmathparse{
6173 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
6174 %%the sqrt must be > 0, the circles have to intersect
6175 sqrt(
6176 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
6177 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
6178 )
6179 }
6180 \pgf@x=\pgfmathresult\pgf@x
6181 }
6182 \anchor{east}{
6183 \northeast
6184 \pgf@y=0pt
6185 }
6186 \savedanchor{\centerprim}{
6187 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6188 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6189 \pgf@y=0pt
6190 \pgf@x=.5\pgf@circ@scaled@Rlen
6191 }
6192 \anchor{centerprim}{
6193 \centerprim
6194 }
6195 \savedanchor{\centersec}{
6196 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6197 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6198 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6199 \pgf@y=-\pgf@y
6200 \pgf@x=-\pgf@x
6201 }
6202 \anchor{centersec}{
6203 \centersec
6204 }
6205 \savedanchor{\centertert}{
6206 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6207 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6208 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6209 \pgf@y=\pgf@y
6210 \pgf@x=-\pgf@x
6211 }
6212 \anchor{centertert}{
6213 \centertert
6214 }
6215
6216 % add some anchors in case the are needed :)
6217 \anchor{prim1}{
6218 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6219 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6220 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}}
6221 }
6222 \anchor{prim2}{
6223 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6224 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6225 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}}
6226 }
6227 \anchor{sec1}{
6228 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6229 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6230 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6231 }
6232 \anchor{sec2}{
6233 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6234 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6235 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}}
6236 }
6237 \anchor{sec3}{
6238 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6239 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6240 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}}
6241 }
6242 \anchor{tert1}{
6243 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6244 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6245 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6246 }
6247 \anchor{tert2}{
6248 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6249 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6250 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}}
6251 }
6252 \anchor{tert3}{
6253 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6254 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6255 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}}
6256 }
6257 }
6258 {\ctikzvalof{bipoles/ooosource/height}}
6259 {ooosource}
6260 {\ctikzvalof{bipoles/ooosource/height}}
6261 {\ctikzvalof{bipoles/ooosource/height}}
6262 {
6263 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
6264
6265 % % filling
6266 % left
6267 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6268 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6269 \pgf@circ@maybefill
6270
6271 % up
6272 \pgfscope
6273 \pgfpointorigin
6274 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6275 \pgf@circ@maybefill
6276 \endpgfscope
6277 % down
6278 \pgfscope
6279 \pgfpointorigin
6280 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6281 \pgf@circ@draworfill
6282 \endpgfscope
6283
6284 % drawing
6285 % left
6286 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6287 \pgfusepath{draw}
6288
6289 % up
6290 \pgfscope
6291 \pgfpointorigin
6292 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6293 \pgfusepath{draw}
6294 \endpgfscope
6295
6296 % % % draw inner symbols
6297
6298 % % primary winding
6299 \ifpgf@circ@prim@delta
6300 \pgfscope
6301 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6302 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6303 \endpgfscope
6304
6305 \else\ifpgf@circ@prim@wye
6306 \pgfscope
6307 \pgftransformxshift{.6\pgf@circ@res@left}
6308 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6309 \endpgfscope
6310
6311 \else\ifpgf@circ@prim@zig
6312 \pgfscope
6313 \pgftransformxshift{.6\pgf@circ@res@left}
6314 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6315 \endpgfscope
6316 \fi\fi\fi
6317
6318 % % secondary winding
6319 \ifpgf@circ@sec@delta
6320 \pgfscope
6321 \pgfpointorigin
6322 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6323 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6324 \endpgfscope
6325
6326 \else\ifpgf@circ@sec@wye
6327 \pgfscope
6328 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6329 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6330 \endpgfscope
6331
6332 \else\ifpgf@circ@sec@zig
6333 \pgfscope
6334 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6335 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6336 \endpgfscope
6337 \fi\fi\fi
6338
6339 % % tertiary winding
6340 \ifpgf@circ@tert@delta
6341 \pgfscope
6342 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6343 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6344 \endpgfscope
6345
6346 \else\ifpgf@circ@tert@wye
6347 \pgfscope
6348 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6349 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6350 \endpgfscope
6351
6352 \else\ifpgf@circ@tert@zig
6353 \pgfscope
6354 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6355 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6356 \endpgfscope
6357 \fi\fi\fi
6358 }
6359
6360 %% Independent current source - American
6361 \pgfcircdeclarebipolescaled{sources}
6362 {}
6363 {\ctikzvalof{bipoles/isourceam/height}}
6364 {isourceAM}
6365 {\ctikzvalof{bipoles/isourceam/height}}
6366 {\ctikzvalof{bipoles/isourceam/width}}
6367 {
6368 \pgfpointorigin
6369 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6370 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6371 \pgf@circ@draworfill
6372
6373 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6374 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6375 \pgfusepath{draw}
6376 \pgfscope
6377 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6378 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6379 \endpgfscope
6380 }
6381
6382 %% Independent sinusoidal current source
6383 \pgfcircdeclarebipolescaled{sources}
6384 {}
6385 {\ctikzvalof{bipoles/isource/height}}
6386 {isourcesin}
6387 {\ctikzvalof{bipoles/isource/height}}
6388 {\ctikzvalof{bipoles/isource/width}}
6389 {
6390 \pgfpointorigin
6391 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6392 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6393 \pgf@circ@draworfill
6394
6395 \pgf@circ@res@up = .5\pgf@circ@res@up
6396 \pgfscope
6397 \pgftransformrotate{90}
6398 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6399 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6400 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6401 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6402 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6403 \pgfusepath{draw}
6404 \endpgfscope
6405 }
6406
6407 %% Empty controlled source
6408 \pgfcircdeclarebipolescaled{csources}
6409 {}
6410 {\ctikzvalof{bipoles/ecsource/height}}
6411 {ecsource}
6412 {\ctikzvalof{bipoles/ecsource/height}}
6413 {\ctikzvalof{bipoles/ecsource/width}}
6414 {
6415
6416 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6417
6418 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6421 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6422 \pgfpathclose
6423 \pgf@circ@draworfill
6424 }
6425
6426 %% Controlled voltage source
6427 \pgfcircdeclarebipolescaled{csources}
6428 {}
6429 {\ctikzvalof{bipoles/cvsource/height}}
6430 {cvsource}
6431 {\ctikzvalof{bipoles/cvsource/height}}
6432 {\ctikzvalof{bipoles/cvsource/width}}
6433 {
6434
6435 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6436
6437 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6438 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6439 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6440 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6441 \pgfpathclose
6442 \pgf@circ@draworfill
6443
6444 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6445 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6446 \pgfusepath{draw}
6447 }
6448
6449 %% To change the internal symbols of the controlled voltage source american style
6450 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6451 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6452 %% Controlled voltage source - American
6453 \pgfcircdeclarebipolescaled{csources}
6454 {}
6455 {\ctikzvalof{bipoles/cvsourceam/height}}
6456 {cvsourceAM}
6457 {\ctikzvalof{bipoles/cvsourceam/height}}
6458 {\ctikzvalof{bipoles/cvsourceam/width}}
6459 {
6460 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6461 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6462 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6463 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6465 \pgfpathclose
6466 \pgf@circ@draworfill
6467
6468 \pgfsetcolor{\ctikzvalof{color}}
6469 \ifpgf@circ@oldvoltagedirection
6470 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6471 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6472 \else
6473 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6474 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6475 \fi
6476 }
6477
6478 %% Controlled sinusoidal voltage source
6479 \pgfcircdeclarebipolescaled{csources}
6480 {}
6481 {\ctikzvalof{bipoles/cvsourcesin/height}}
6482 {cvsourcesin}
6483 {\ctikzvalof{bipoles/cvsourcesin/height}}
6484 {\ctikzvalof{bipoles/cvsourcesin/width}}
6485 {
6486
6487 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6488
6489 \pgfscope
6490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6492 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6493 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6494 \pgfpathclose
6495 \pgf@circ@draworfill
6496 \endpgfscope
6497
6498 \pgf@circ@res@up = .5\pgf@circ@res@up
6499 \pgfscope
6500 \pgftransformrotate{90}
6501 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6502 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6503 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6504 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6505 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6506 \pgfusepath{draw}
6507 \endpgfscope
6508 }
6509
6510 %% Controlled sinusoidal current source
6511 \pgfcircdeclarebipolescaled{csources}
6512 {}
6513 {\ctikzvalof{bipoles/cvsourcesin/height}}
6514 {cisourcesin}
6515 {\ctikzvalof{bipoles/cvsourcesin/height}}
6516 {\ctikzvalof{bipoles/cvsourcesin/width}}
6517 {
6518
6519 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6520
6521 \pgfscope
6522 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6523 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6524 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6526 \pgfpathclose
6527 \pgf@circ@draworfill
6528 \endpgfscope
6529
6530 \pgf@circ@res@up = .5\pgf@circ@res@up
6531 \pgfscope
6532 \pgftransformrotate{90}
6533 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6534 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6535 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6536 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6537 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6538 \pgfusepath{draw}
6539 \endpgfscope
6540 }
6541
6542 %% Controlled current source
6543 \pgfcircdeclarebipolescaled{csources}
6544 {}
6545 {\ctikzvalof{bipoles/cisource/height}}
6546 {cisource}
6547 {\ctikzvalof{bipoles/cisource/height}}
6548 {\ctikzvalof{bipoles/cisource/width}}
6549 {
6550
6551 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6552
6553 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6554 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6555 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6556 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6557 \pgfpathclose
6558 \pgf@circ@draworfill
6559
6560 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6561 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6562 \pgfusepath{draw}
6563 }
6564
6565 %% Controlled current source - American
6566 \pgfcircdeclarebipolescaled{csources}
6567 {}
6568 {\ctikzvalof{bipoles/cisourceam/height}}
6569 {cisourceAM}
6570 {\ctikzvalof{bipoles/cisourceam/height}}
6571 {\ctikzvalof{bipoles/cisourceam/width}}
6572 {
6573 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6574
6575 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6576 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6577 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6578 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6579 \pgfpathclose
6580 \pgf@circ@draworfill
6581 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6582 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6583 \pgfusepath{draw}
6584 \pgfscope
6585 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6586 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6587 \endpgfscope
6588 }
6589
6590 %% Cute Independent voltage source
6591 \pgfcircdeclarebipolescaled{sources}
6592 {}
6593 {\ctikzvalof{bipoles/vsource/height}}
6594 {vsourceC}
6595 {\ctikzvalof{bipoles/vsource/height}}
6596 {\ctikzvalof{bipoles/vsource/width}}
6597 {
6598 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6599 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6600 \pgf@circ@draworfill
6601 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6602 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6603 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6604 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6605 \pgfsetroundcap\pgfusepath{draw}
6606 }
6607
6608 %% Cute Independent current source
6609 \pgfcircdeclarebipolescaled{sources}
6610 {}
6611 {\ctikzvalof{bipoles/isource/height}}
6612 {isourceC}
6613 {\ctikzvalof{bipoles/isource/height}}
6614 {\ctikzvalof{bipoles/isource/width}}
6615 {
6616 \pgfpointorigin
6617 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6618 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6619 \pgf@circ@draworfill
6620 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6621 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6622 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6623 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6624 \pgfsetroundcap\pgfusepath{draw}
6625 }
6626
6627 %% Cute Controlled voltage source
6628 \pgfcircdeclarebipolescaled{csources}
6629 {}
6630 {\ctikzvalof{bipoles/cvsource/height}}
6631 {cvsourceC}
6632 {\ctikzvalof{bipoles/cvsource/height}}
6633 {\ctikzvalof{bipoles/cvsource/width}}
6634 {
6635 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6636 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6637 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6639 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6641 \pgf@circ@draworfill
6642 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6643 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6644 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6645 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6646 \pgfsetroundcap\pgfusepath{draw}
6647 }
6648
6649 %% Cute Controlled current source
6650 \pgfcircdeclarebipolescaled{csources}
6651 {}
6652 {\ctikzvalof{bipoles/cisource/height}}
6653 {cisourceC}
6654 {\ctikzvalof{bipoles/cisource/height}}
6655 {\ctikzvalof{bipoles/cisource/width}}
6656 {
6657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6658 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6659 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6660 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6661 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6662 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6663 \pgf@circ@draworfill
6664 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6665 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6667 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6668 \pgfsetroundcap\pgfusepath{draw}
6669 }
6670
6671 %% Noise voltage source
6672 \pgfcircdeclarebipolescaled{sources}
6673 {}
6674 {\ctikzvalof{bipoles/vsource/height}}
6675 {vsourceN}
6676 {\ctikzvalof{bipoles/vsource/height}}
6677 {\ctikzvalof{bipoles/vsource/width}}
6678 {
6679 \pgfscope
6680 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6681 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6682 %
6683 \pgf@circ@scaled@Rlen=\scaledRlen
6684 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6685 \edef\pgf@noise@temp{dashed}
6686 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6687 \ifx\pgf@noise@temp\pgf@noise@fill
6688 % fillable in this case
6689 \pgf@circ@draworfillandclip
6690 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6691 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6692 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6693 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6694 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6695 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6697 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6700 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6701 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6702 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6703 %
6704 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6705 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6706 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6707 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6708 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6709 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6710 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6711 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6712 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6713 \pgfusepath{draw}
6714 \else
6715 \pgfsetfillcolor{\pgf@noise@fill}
6716 \pgfusepath{draw,fill}
6717 \fi
6718 \endpgfscope
6719 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6720 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6721 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6722 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6723 \pgfsetroundcap\pgfusepath{draw}
6724 }
6725 %% Noise current source
6726
6727 \pgfcircdeclarebipolescaled{sources}
6728 {}
6729 {\ctikzvalof{bipoles/isource/height}}
6730 {isourceN}
6731 {\ctikzvalof{bipoles/isource/height}}
6732 {\ctikzvalof{bipoles/isource/width}}
6733 {
6734 \pgfpointorigin
6735 \pgfscope
6736 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6737 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6738 %
6739 \pgf@circ@scaled@Rlen=\scaledRlen
6740 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6741 \edef\pgf@noise@temp{dashed}
6742 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6743 \ifx\pgf@noise@temp\pgf@noise@fill
6744 % fillable in this case
6745 \pgf@circ@draworfillandclip
6746 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6747 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6748 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6749 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6750 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6751 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6752 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6753 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6754 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6755 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6756 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6758 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6759 %
6760 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6763 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6766 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6767 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6768 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6769 \pgfusepath{draw}
6770 \else
6771 \pgfsetfillcolor{\pgf@noise@fill}
6772 \pgfusepath{draw,fill}
6773 \fi
6774 \endpgfscope
6775 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6776 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6779 \pgfsetroundcap\pgfusepath{draw}
6780 }
6781
6782 %%%%%%%%%%%%%%
6783 %% Diodes
6784 %%%%%%%%%%%%%%
6785
6786 %% Black generic diode
6787 \pgfcircdeclarebipolescaled{diodes}
6788 {}
6789 {\ctikzvalof{bipoles/diode/height}}
6790 {fulldiode}
6791 {\ctikzvalof{bipoles/diode/height}}
6792 {\ctikzvalof{bipoles/diode/width}}
6793 {
6794
6795 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6796
6797 \pgfscope
6798 \pgftransformxshift{\pgf@circ@res@left}
6799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6800 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6801 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6803 \pgfusepath{draw,fill}
6804 \endpgfscope
6805 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6807 \pgfusepath{draw}
6808 }
6809
6810 %% Black Zener diode
6811 \pgfcircdeclarebipolescaled{diodes}
6812 {}
6813 {\ctikzvalof{bipoles/diode/height}}
6814 {fullzdiode}
6815 {\ctikzvalof{bipoles/diode/height}}
6816 {\ctikzvalof{bipoles/diode/width}}
6817 {
6818
6819 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6820
6821 \pgfscope
6822 \pgftransformxshift{\pgf@circ@res@left}
6823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6824 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6825 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6826 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6827 \pgfusepath{draw,fill}
6828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6829 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6830 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6831 \pgfusepath{draw}
6832 \endpgfscope
6833 }
6834
6835 %% Black alternative zigzag Zener diode
6836 \pgfcircdeclarebipolescaled{diodes}
6837 {% fix the anchor border
6838 \pgfcirc@border@extend@updown{1.3}{1.3}
6839 }
6840 {\ctikzvalof{bipoles/diode/height}}
6841 {fullzzdiode}
6842 {\ctikzvalof{bipoles/diode/height}}
6843 {\ctikzvalof{bipoles/diode/width}}
6844 {
6845
6846 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6847
6848 \pgfscope
6849 \pgftransformxshift{\pgf@circ@res@left}
6850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6851 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6852 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6853 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6854 \pgfusepath{draw,fill}
6855 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
6856 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6857 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6858 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
6859 \pgfusepath{draw}
6860 \endpgfscope
6861 }
6862
6863 %% Black Schottky diode
6864 \pgfcircdeclarebipolescaled{diodes}
6865 {}
6866 {\ctikzvalof{bipoles/diode/height}}
6867 {fullsdiode}
6868 {\ctikzvalof{bipoles/diode/height}}
6869 {\ctikzvalof{bipoles/diode/width}}
6870 {
6871
6872 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6873 \pgfscope
6874 \pgftransformxshift{\pgf@circ@res@left}
6875 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6876 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6877 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6878 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6879 \pgfusepath{draw,fill}
6880
6881 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
6882 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6884 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6886 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6887 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
6888 \pgfusepath{draw}
6889 \endpgfscope
6890
6891 }
6892
6893 %% Black tunnel diode
6894 \pgfcircdeclarebipolescaled{diodes}
6895 {}
6896 {\ctikzvalof{bipoles/diode/height}}
6897 {fulltdiode}
6898 {\ctikzvalof{bipoles/diode/height}}
6899 {\ctikzvalof{bipoles/diode/width}}
6900 {
6901
6902 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6903 \pgfscope
6904 \pgftransformxshift{\pgf@circ@res@left}
6905 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6906 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6907 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6908 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6909 \pgfusepath{draw,fill}
6910
6911 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6912 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6913 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6914 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6915 \pgfusepath{draw}
6916 \endpgfscope
6917 }
6918
6919 %
6920 % draw LED arrows
6921 %
6922 \def\pgf@circ@draw@ledarrows{%
6923 \pgfsetlinewidth{\pgfstartlinewidth}
6924 \pgfsetarrowsend{latexslim}
6925 \ifpgf@led@fliparrows
6926 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6927 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6928 \pgfusepath{draw}
6929 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6930 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6931 \pgfusepath{draw}
6932 \else
6933 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6934 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6935 \pgfusepath{draw}
6936 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6937 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6938 \pgfusepath{draw}
6939 \fi
6940 }
6941 %
6942 % ---and photodiode arrows
6943 %
6944 \def\pgf@circ@draw@pdarrows{%
6945 \pgfsetlinewidth{\pgfstartlinewidth}
6946 \pgfsetarrowsstart{latexslim}
6947 \ifpgf@pd@fliparrows
6948 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6949 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6950 \pgfusepath{draw}
6951 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6952 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6953 \pgfusepath{draw}
6954 \else
6955 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6956 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6957 \pgfusepath{draw}
6958 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6959 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6960 \pgfusepath{draw}
6961 \fi
6962 }
6963 %% Black light emitting diode
6964 \pgfcircdeclarebipolescaled{diodes}
6965 {% fix the anchor border
6966 \pgfcirc@border@extend@updown{1.8}{1}
6967 }
6968 {\ctikzvalof{bipoles/diode/height}}
6969 {fulllediode}
6970 {\ctikzvalof{bipoles/diode/height}}
6971 {\ctikzvalof{bipoles/diode/width}}
6972 {
6973
6974 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6975 \pgfscope
6976 \pgftransformxshift{\pgf@circ@res@left}
6977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6978 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6979 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6980 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6981 \pgfusepath{draw,fill}
6982 \endpgfscope
6983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6985 \pgfusepath{draw}
6986
6987 \pgf@circ@draw@ledarrows
6988 }
6989
6990 %% Black photodiode
6991 \pgfcircdeclarebipolescaled{diodes}
6992 {% fix the anchor border
6993 \pgfcirc@border@extend@updown{1.8}{1}
6994 }
6995 {\ctikzvalof{bipoles/diode/height}}
6996 {fullpdiode}
6997 {\ctikzvalof{bipoles/diode/height}}
6998 {\ctikzvalof{bipoles/diode/width}}
6999 {
7000
7001 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7002 \pgfscope
7003 \pgftransformxshift{\pgf@circ@res@left}
7004 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7005 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7006 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7007 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7008 \pgfusepath{draw,fill}
7009 \endpgfscope
7010 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7011 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7012 \pgfusepath{draw}
7013
7014 \pgf@circ@draw@pdarrows
7015 }
7016
7017 %% Black varcap
7018 \pgfcircdeclarebipolescaled{diodes}
7019 {}
7020 {\ctikzvalof{bipoles/varcap/height}}
7021 {fullvarcap}
7022 {\ctikzvalof{bipoles/varcap/height}}
7023 {\ctikzvalof{bipoles/varcap/width}}
7024 {
7025 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7026 \pgfsetlinewidth{\pgf@circ@res@temp}
7027 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7028 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7029 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7030 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7031 \pgfusepath{draw,fill}
7032 %
7033 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7035 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7036 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7037 \pgfusepath{draw}
7038 }
7039
7040 %% Code for the diode triangle
7041 \def\pgf@circ@basicdiodeshape{
7042 % \pgfscope
7043 \pgftransformxshift{\pgf@circ@res@left}
7044 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7045 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7046 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7047 \pgfpathclose
7048 \pgf@circ@draworfill
7049 \pgfscope
7050 % to allow filling, we need to draw explicitly the stroke here.
7051 \pgfsetlinewidth{\pgfstartlinewidth}
7052 \ifpgf@circuit@bipole@strokedsymbol
7053 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7054 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7055 \pgfusepath{draw}
7056 \fi
7057 \endpgfscope
7058 % \endpgfscope
7059 }
7060
7061 %% Empty generic diode
7062 \pgfcircdeclarebipolescaled{diodes}
7063 {}
7064 {\ctikzvalof{bipoles/diode/height}}
7065 {emptydiode}
7066 {\ctikzvalof{bipoles/diode/height}}
7067 {\ctikzvalof{bipoles/diode/width}}
7068 {
7069 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7070 \pgfscope
7071 \pgf@circ@basicdiodeshape
7072 \endpgfscope
7073 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7074 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7075 \pgfusepath{draw}
7076 }
7077
7078 %% Empty Zener diode
7079 \pgfcircdeclarebipolescaled{diodes}
7080 {}
7081 {\ctikzvalof{bipoles/diode/height}}
7082 {emptyzdiode}
7083 {\ctikzvalof{bipoles/diode/height}}
7084 {\ctikzvalof{bipoles/diode/width}}
7085 {
7086
7087 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7088
7089 \pgfscope
7090 \pgf@circ@basicdiodeshape
7091 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7093 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7094 \pgfusepath{draw}
7095 \endpgfscope
7096 }
7097
7098 %% Empty alternative zigzag Zener diode
7099 \pgfcircdeclarebipolescaled{diodes}
7100 {% fix the anchor border
7101 \pgfcirc@border@extend@updown{1.3}{1.3}
7102 }
7103 {\ctikzvalof{bipoles/diode/height}}
7104 {emptyzzdiode}
7105 {\ctikzvalof{bipoles/diode/height}}
7106 {\ctikzvalof{bipoles/diode/width}}
7107 {
7108
7109 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7110
7111 \pgfscope
7112 \pgf@circ@basicdiodeshape
7113 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7114 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7115 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7116 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7117 \pgfusepath{draw}
7118 \endpgfscope
7119 }
7120 %% Empty Schottky diode
7121 \pgfcircdeclarebipolescaled{diodes}
7122 {}
7123 {\ctikzvalof{bipoles/diode/height}}
7124 {emptysdiode}
7125 {\ctikzvalof{bipoles/diode/height}}
7126 {\ctikzvalof{bipoles/diode/width}}
7127 {
7128
7129 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7130 \pgfscope
7131 \pgf@circ@basicdiodeshape
7132 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7133 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7134 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7136 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7137 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7138 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7139 \pgfusepath{draw}
7140 \endpgfscope
7141
7142 }
7143
7144 %% Empty tunnel diode
7145 \pgfcircdeclarebipolescaled{diodes}
7146 {}
7147 {\ctikzvalof{bipoles/diode/height}}
7148 {emptytdiode}
7149 {\ctikzvalof{bipoles/diode/height}}
7150 {\ctikzvalof{bipoles/diode/width}}
7151 {
7152
7153 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7154 \pgfscope
7155 \pgf@circ@basicdiodeshape
7156 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7158 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7159 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7160 \pgfusepath{draw}
7161 \endpgfscope
7162 }
7163
7164 %% Empty light emitting diode
7165 \pgfcircdeclarebipolescaled{diodes}
7166 {% fix the anchor border
7167 \pgfcirc@border@extend@updown{1.8}{1}
7168 }
7169 {\ctikzvalof{bipoles/diode/height}}
7170 {emptylediode}
7171 {\ctikzvalof{bipoles/diode/height}}
7172 {\ctikzvalof{bipoles/diode/width}}
7173 {
7174
7175 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7176 \pgfscope
7177 \pgf@circ@basicdiodeshape
7178 \endpgfscope
7179 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7180 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7181 \pgfusepath{draw}
7182
7183 \pgf@circ@draw@ledarrows
7184 }
7185
7186 %% Empty photodiode
7187 \pgfcircdeclarebipolescaled{diodes}
7188 {% fix the anchor border
7189 \pgfcirc@border@extend@updown{1.8}{1}
7190 }
7191 {\ctikzvalof{bipoles/diode/height}}
7192 {emptypdiode}
7193 {\ctikzvalof{bipoles/diode/height}}
7194 {\ctikzvalof{bipoles/diode/width}}
7195 {
7196
7197 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7198 \pgfscope
7199 \pgf@circ@basicdiodeshape
7200 \endpgfscope
7201 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7202 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7203 \pgfusepath{draw}
7204
7205 \pgf@circ@draw@pdarrows
7206 }
7207
7208 %% Empty varcap
7209 \pgfcircdeclarebipolescaled{diodes}
7210 {}
7211 {\ctikzvalof{bipoles/varcap/height}}
7212 {emptyvarcap}
7213 {\ctikzvalof{bipoles/varcap/height}}
7214 {\ctikzvalof{bipoles/varcap/width}}
7215 {
7216 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7217 \pgfsetlinewidth{\pgf@circ@res@temp}
7218 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7219 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7220 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7221 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7222 \pgfpathclose
7223 \pgf@circ@draworfill
7224 \pgfscope
7225 % to allow filling, we need to draw explicitily the stroke here.
7226 \pgfsetlinewidth{\pgfstartlinewidth}
7227 \ifpgf@circuit@bipole@strokedsymbol
7228 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7229 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7230 \pgfusepath{draw}
7231 \fi
7232 \endpgfscope
7233 %
7234 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7235 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7238 \pgfusepath{draw}
7239 }
7240
7241 %% Empty bidirectionaldiode
7242 \pgfcircdeclarebipolescaled{diodes}
7243 {}
7244 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7245 {emptybidirectionaldiode}
7246 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7247 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7248 {
7249
7250 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7251
7252 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7253 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7254
7255 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7256 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7258 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7259
7260 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7261 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7262 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7263 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7264
7265 \pgf@circ@draworfill
7266
7267 \pgfsetlinewidth{\pgfstartlinewidth}
7268
7269 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7270 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7271
7272 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7273 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7274
7275 \pgfusepath{draw}
7276 }
7277
7278 %% Full bidirectionaldiode
7279 \pgfcircdeclarebipolescaled{diodes}
7280 {}
7281 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7282 {fullbidirectionaldiode}
7283 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7284 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7285 {
7286
7287 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7288
7289 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7290 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7291
7292 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7293 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7294 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7296
7297 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7298 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7299 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7300 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7301
7302 \pgfusepath{draw, fill}
7303
7304 \pgfsetlinewidth{\pgfstartlinewidth}
7305
7306 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7307 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7308
7309 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7310 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7311
7312 \pgfusepath{draw}
7313 }
7314
7315 %% Black thyristor
7316 \pgfcircdeclarebipolescaled{diodes}
7317 {
7318 \anchor{gate}{\northeast}
7319 \anchor{anode}{\southwest\pgf@y=0cm}
7320 \anchor{G}{\northeast}
7321 \anchor{cathode}{\northeast\pgf@y=0cm }
7322 }
7323 {\ctikzvalof{tripoles/thyristor/height 2}}
7324 {fullthyristor}
7325 {\ctikzvalof{tripoles/thyristor/height}}
7326 {\ctikzvalof{tripoles/thyristor/width}}
7327 {
7328
7329 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7330
7331 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7332 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7333
7334 \pgfscope
7335 \pgftransformxshift{\pgf@circ@res@other}
7336 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7337
7338 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7339 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7340 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7341 \pgfusepath{draw,fill}
7342
7343 \pgfsetlinewidth{\pgfstartlinewidth}
7344
7345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7346 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7347 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7348 \pgfusepath{draw}
7349 \endpgfscope
7350
7351 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7352 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7353
7354 \pgfusepath{draw}
7355
7356 \pgfsetlinewidth{\pgfstartlinewidth}
7357
7358 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7359 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7360
7361 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7363
7364 \pgfusepath{draw}
7365
7366 }
7367
7368 %% Empty thyristor
7369
7370 \pgfcircdeclarebipolescaled{diodes}
7371 {
7372 \anchor{gate}{\northeast}
7373 \anchor{anode}{\southwest\pgf@y=0cm}
7374 \anchor{G}{\northeast}
7375 \anchor{cathode}{\northeast\pgf@y=0cm }
7376 }
7377 {\ctikzvalof{tripoles/thyristor/height 2}}
7378 {emptythyristor}
7379 {\ctikzvalof{tripoles/thyristor/height}}
7380 {\ctikzvalof{tripoles/thyristor/width}}
7381 {
7382
7383 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7384
7385 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7386 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7387
7388 \pgfscope
7389 \pgftransformxshift{\pgf@circ@res@other}
7390 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7391
7392 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7393 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7394 \pgfpathclose
7395 \pgf@circ@draworfill
7396 \pgfscope
7397 % to allow filling, we need to draw explicitily the stroke here.
7398 \pgfsetlinewidth{\pgfstartlinewidth}
7399 \ifpgf@circuit@bipole@strokedsymbol
7400 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7401 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7402 \pgfusepath{draw}
7403 \fi
7404 \endpgfscope
7405
7406 \pgfsetlinewidth{\pgfstartlinewidth}
7407
7408 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7409 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7410 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7411 \pgfusepath{draw}
7412 \endpgfscope
7413
7414 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7416
7417 \pgfusepath{draw}
7418
7419 \pgfsetlinewidth{\pgfstartlinewidth}
7420
7421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7422 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7423
7424 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7426
7427 \pgfusepath{draw}
7428 }
7429
7430 %% Empty triac
7431 \pgfcircdeclarebipolescaled{diodes}
7432 {
7433 \anchor{gate}{\northeast}
7434 \anchor{anode}{\southwest\pgf@y=0cm}
7435 \anchor{G}{\northeast}
7436 \anchor{cathode}{\northeast\pgf@y=0cm }
7437 }
7438 {\ctikzvalof{tripoles/triac/height}}
7439 {emptytriac}
7440 {\ctikzvalof{tripoles/triac/height}}
7441 {\ctikzvalof{tripoles/triac/width}}
7442 {
7443
7444 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7445
7446 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7447 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7448
7449 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7450 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7451 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7452 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7453
7454 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7455 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7456 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7457 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7458
7459 \pgf@circ@draworfill
7460
7461 \pgfsetlinewidth{\pgfstartlinewidth}
7462
7463 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7465 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7466
7467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7469
7470 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7471 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7472
7473 \pgfusepath{draw}
7474 }
7475
7476 %% Full triac
7477 \pgfcircdeclarebipolescaled{diodes}
7478 {
7479 \anchor{gate}{\northeast}
7480 \anchor{anode}{\southwest\pgf@y=0cm}
7481 \anchor{G}{\northeast}
7482 \anchor{cathode}{\northeast\pgf@y=0cm }
7483 }
7484 {\ctikzvalof{tripoles/triac/height}}
7485 {fulltriac}
7486 {\ctikzvalof{tripoles/triac/height}}
7487 {\ctikzvalof{tripoles/triac/width}}
7488 {
7489 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7490
7491 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7492 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7493
7494 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7495 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7496 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7497 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7498
7499 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7500 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7501 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7503
7504 \pgfusepath{draw,fill}
7505
7506 \pgfsetlinewidth{\pgfstartlinewidth}
7507
7508 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7510 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7511
7512 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7513 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7514
7515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7516 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7517
7518 \pgfusepath{draw}
7519 }
7520
7521 %%%%%%%%%%%%%
7522 %% switches
7523 %%%%%%%%%%%%%
7524
7525 %% (Closing) SPST
7526 \pgfcircdeclarebipolescaled{switches}
7527 {}
7528 {\ctikzvalof{bipoles/spst/depth}}
7529 {cspst}
7530 {\ctikzvalof{bipoles/spst/height}}
7531 {\ctikzvalof{bipoles/spst/width}}
7532 {
7533 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7534 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7535 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7536 \pgfusepath{draw}
7537
7538 \pgfscope
7539 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7540 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
7541 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
7542 \pgfsetarrowsend{latexslim}
7543 \pgfsetbeveljoin
7544 \pgfusepath{draw}
7545 \endpgfscope
7546 }
7547
7548 %% Opening SPST
7549 \pgfcircdeclarebipolescaled{switches}
7550 {}
7551 {\ctikzvalof{bipoles/spst/depth}}
7552 {ospst}
7553 {\ctikzvalof{bipoles/spst/height}}
7554 {\ctikzvalof{bipoles/spst/width}}
7555 {
7556
7557 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7558 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7559 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7560 \pgfusepath{draw}
7561
7562 \pgfscope
7563 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7564 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7565 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
7566 \pgfsetarrowsend{latexslim}
7567 \pgfsetbeveljoin
7568 \pgfusepath{draw}
7569 \endpgfscope
7570 }
7571
7572 %% Normal open Switch
7573 \pgfcircdeclarebipolescaled{switches}
7574 {}
7575 {\ctikzvalof{bipoles/nos/depth}}
7576 {nos}
7577 {\ctikzvalof{bipoles/nos/height}}
7578 {\ctikzvalof{bipoles/nos/width}}
7579 {
7580
7581 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7582 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7583 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7584 \pgfsetbuttcap
7585 \pgfusepath{draw}
7586 }
7587
7588 %% Normal closed Switch
7589 \pgfcircdeclarebipolescaled{switches}
7590 {}
7591 {\ctikzvalof{bipoles/ncs/depth}}
7592 {ncs}
7593 {\ctikzvalof{bipoles/ncs/height}}
7594 {\ctikzvalof{bipoles/ncs/width}}
7595 {
7596 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7598 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7599 \pgfusepath{draw}
7600 \pgfsetlinewidth{\pgfstartlinewidth}
7601 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7602 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
7603 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
7604 \pgfusepath{draw}
7605 }
7606
7607 %% Push Button
7608 \pgfcircdeclarebipolescaled{switches}
7609 {
7610 \anchor{tip}{\northeast\pgf@x=0pt\relax}
7611 }
7612 {\ctikzvalof{bipoles/pushbutton/height 2}}
7613 {pushbutton}
7614 {\ctikzvalof{bipoles/pushbutton/height}}
7615 {\ctikzvalof{bipoles/pushbutton/width}}
7616 {
7617 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7618 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
7619 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
7620 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
7621 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7622 \pgfusepath{draw}
7623
7624 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7625 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7626 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7627 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7628 }
7629
7630 %% Normally closed Push Button
7631 \pgfcircdeclarebipolescaled{switches}
7632 {
7633 \anchor{tip}{\northeast\pgf@x=0pt\relax}
7634 }
7635 {\ctikzvalof{bipoles/pushbutton/height 2}}
7636 {ncpushbutton}
7637 {\ctikzvalof{bipoles/pushbutton/height}}
7638 {\ctikzvalof{bipoles/pushbutton/width}}
7639 {
7640 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7641 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7642 % Warning, if the nodes will have a class, we have to touch this.
7643 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7644 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
7645 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
7646 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
7647 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7648 \pgfusepath{draw}
7649 %
7650 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7651 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7652 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7653 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7654 }
7655 %% Push Button (normally closed but now open :-) see
7656 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
7657 \pgfcircdeclarebipolescaled{switches}
7658 {
7659 \anchor{tip}{
7660 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7661 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
7662 \pgf@x=0pt\relax
7663 }
7664 }
7665 {\ctikzvalof{bipoles/pushbutton/height 2}}
7666 {pushbuttonc}
7667 {\ctikzvalof{bipoles/pushbutton/height}}
7668 {\ctikzvalof{bipoles/pushbutton/width}}
7669 {
7670 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7671 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
7673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
7674 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
7675 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
7676 \pgfusepath{draw}
7677
7678 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7679 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7680 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7681 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7682 }
7683
7684 %% Normally closed Push Button now open
7685 \pgfcircdeclarebipolescaled{switches}
7686 {
7687 \anchor{tip}{
7688 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7689 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
7690 \pgf@x=0pt\relax
7691 }
7692 }
7693 {\ctikzvalof{bipoles/pushbutton/height 2}}
7694 {ncpushbuttono}
7695 {\ctikzvalof{bipoles/pushbutton/height}}
7696 {\ctikzvalof{bipoles/pushbutton/width}}
7697 {
7698 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7699 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7700 % Warning, if the nodes will have a class, we have to touch this.
7701 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7702 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
7703 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
7704 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
7705 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
7706 \pgfusepath{draw}
7707 %
7708 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7709 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7710 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7711 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7712 }
7713 %%% reed switches
7714 \pgfcircdeclarebipolescaled{switches}
7715 {}
7716 {\ctikzvalof{bipoles/reed/depth}}
7717 {reed}
7718 {\ctikzvalof{bipoles/reed/height}}
7719 {\ctikzvalof{bipoles/reed/width}}
7720 {
7721 % this is designed to be the same as a "nos".
7722 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
7723 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
7724 \pgfscope
7725 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7726 % eclosure
7727 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
7728 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
7729 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
7730 \pgfpatharc{270}{90}{\pgf@circ@res@up}
7731 \pgfpathclose
7732 \pgf@circ@draworfill
7733 % switch
7734 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7735 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
7736 % connection lines
7737 \pgfsetbuttcap
7738 \pgfusepath{draw}
7739 \endpgfscope
7740 % connection lines
7741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7742 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7743 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7744 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
7745 \pgfusepath{draw}
7746 }
7747
7748 % cute switch "to" shapes help function
7749 % #1 -> name
7750 % #2 -> barposition
7751 % #3 -> arrowcode
7752 \long\def\pgfcircdeclarecutesw#1#2#3{
7753 \pgfcircdeclarebipolescaled{switches}
7754 {
7755 \savedanchor\midlever{
7756 % these values are calculated when we create the definition of the shape.
7757 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
7758 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
7759 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
7760 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7761 \pgf@circ@res@down = -.5\pgf@y
7762 \pgf@circ@res@up = .5\pgf@y
7763 \pgfextracty{\pgf@circ@res@other}{#2}
7764 \pgf@x=0pt
7765 \pgf@y=.5\pgf@circ@res@other
7766 }
7767 % radius of the connector
7768 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7769 % If cnnecting nodes are scaled, we have to modify this
7770 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
7771 % shapename
7772 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
7773 % shape type
7774 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
7775 % mid of the lever, to stack switches
7776 \anchor{mid}{\midlever}
7777 \anchor{cout}{\northeast \pgf@y=0cm}
7778 \anchor{cin}{\southwest\pgf@y=0cm}
7779 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
7780 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
7781 }
7782 {\ctikzvalof{bipoles/cuteswitch/height 2}}
7783 {#1}
7784 {\ctikzvalof{bipoles/cuteswitch/height}}
7785 {\ctikzvalof{bipoles/cuteswitch/width}}{
7786 \pgfscope
7787 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7788 % If cnnecting nodes are scaled, we have to modify this
7789 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7790 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7791 \pgfsetlinewidth{2\pgf@circ@res@temp}
7792 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7793 \pgfpathlineto{#2}
7794 \pgfsetroundcap\pgfusepath{draw}
7795 \endpgfscope
7796 \pgfscope % arrow
7797 #3
7798 \endpgfscope
7799 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7800 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
7801 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7802 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
7803 }
7804 }
7805
7806 %% closed cute switch
7807 \pgfcircdeclarecutesw{cuteclosedswitch}
7808 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7809 {}
7810
7811 %% open cute switch
7812 \pgfcircdeclarecutesw{cuteopenswitch}
7813 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7814 {}
7815
7816 %% closing cute switch
7817 \pgfcircdeclarecutesw{cuteclosingswitch}
7818 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7819 {
7820 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7821 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7822 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
7823 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
7824 \pgfsetarrowsend{latexslim}
7825 \pgfusepath{draw}
7826 }
7827
7828 %% opening cute switch
7829 \pgfcircdeclarecutesw{cuteopeningswitch}
7830 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7831 {
7832 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7833 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7834 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7835 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
7836 \pgfsetarrowsend{latexslim}
7837 \pgfusepath{draw}
7838 }
7839
7840 %%%%%%%%%%%%%%%%%
7841 %% Instruments
7842 %%%%%%%%%%%%%%%%%
7843
7844 % % METERINGSHAPE
7845 \long\def\drawmeteringcircle{
7846 \def\pgf@circ@temp{right}
7847 \ifx\tikz@res@label@pos\pgf@circ@temp
7848 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7849 \else
7850 \def\pgf@circ@temp{below}
7851 \ifx\tikz@res@label@pos\pgf@circ@temp
7852 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7853 \else
7854 \pgf@circ@res@step=1.2\pgf@circ@res@up
7855 \fi
7856 \fi
7857 %draw connections to circle
7858 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7859 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
7860 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
7861 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7862 \pgfusepath{draw}
7863 %draw circle
7864 \pgfscope
7865 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7866 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
7867 \pgf@circ@draworfill
7868 \endpgfscope
7869 %draw arrow
7870 \pgfscope
7871 \pgfsetarrowsend{latex}
7872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7873 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
7874 \pgfusepath{draw}
7875 \endpgfscope
7876 }
7877
7878 %AMPEREMETER
7879 \pgfcircdeclarebipolescaled{instruments}
7880 {}
7881 {\ctikzvalof{bipoles/ammeter/height}}
7882 {ammeter}
7883 {\ctikzvalof{bipoles/ammeter/height}}
7884 {\ctikzvalof{bipoles/ammeter/width}}
7885 {
7886 \drawmeteringcircle
7887 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
7888 }
7889 %OHMMETER
7890 \pgfcircdeclarebipolescaled{instruments}
7891 {}
7892 {\ctikzvalof{bipoles/ohmmeter/height}}
7893 {ohmmeter}
7894 {\ctikzvalof{bipoles/ohmmeter/height}}
7895 {\ctikzvalof{bipoles/ohmmeter/width}}
7896 {
7897 \drawmeteringcircle
7898 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
7899 }
7900 %VOLTMETER
7901 \pgfcircdeclarebipolescaled{instruments}
7902 {}
7903 {\ctikzvalof{bipoles/voltmeter/height}}
7904 {voltmeter}
7905 {\ctikzvalof{bipoles/voltmeter/height}}
7906 {\ctikzvalof{bipoles/voltmeter/width}}
7907 {
7908 \drawmeteringcircle
7909 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
7910
7911 }
7912
7913 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
7914 \pgfcircdeclarebipolescaled{instruments}
7915 {
7916 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7917 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7918 % put the node text above and centered
7919 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7920 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7921 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7922 }
7923 }
7924 }
7925 {\ctikzvalof{bipoles/oscope/height}}
7926 {oscope}
7927 {\ctikzvalof{bipoles/oscope/height}}
7928 {\ctikzvalof{bipoles/oscope/width}}
7929 {
7930 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7931 \pgfextracty{\pgf@circ@res@up}{\northeast}
7932 \pgfextractx{\pgf@circ@res@right}{\northeast}
7933 \pgfextractx{\pgf@circ@res@left}{\southwest}
7934 \pgfextracty{\pgf@circ@res@down}{\southwest}
7935 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7936 \pgfscope
7937 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7938 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7939 % this would create a round (analog?) scope...
7940 % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7941 \pgf@circ@draworfill
7942 \endpgfscope
7943 % get the rotation
7944 \ifpgf@circuit@straightinstruments
7945 \pgfgettransformentries\a\b\temp\temp\temp\temp
7946 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7947 \else
7948 \edef\rot{0}
7949 \fi
7950 % and unrotate the scope
7951 \pgfscope
7952 \pgftransformrotate{\rot}
7953 % grid
7954 \pgfscope
7955 \pgfsetlinewidth{0.5\pgfstartlinewidth}
7956 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7957 \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]%
7958 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
7959 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
7960 \pgfsetstrokeopacity{0.5}
7961 \pgfusepath{draw}
7962 \endpgfscope
7963 % function displayed, thanks to
7964 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7965 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7966 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
7967 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7968 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
7969 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
7970 \pgfusepath{draw}
7971 \endpgfscope
7972 }
7973
7974 % generic round meter with always horizontal text, no arrow
7975 \pgfcircdeclarebipolescaled{instruments}
7976 {}
7977 {\ctikzvalof{bipoles/esource/height}}
7978 {rmeter}
7979 {\ctikzvalof{bipoles/esource/height}}
7980 {\ctikzvalof{bipoles/esource/width}}
7981 {
7982 \pgfpointorigin
7983 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7984 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7985 \pgf@circ@draworfill
7986 % draw the text label
7987 % get the rotation
7988 \ifpgf@circuit@straightinstruments
7989 \pgfgettransformentries\a\b\temp\temp\temp\temp
7990 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7991 \else
7992 \edef\rot{0}
7993 \fi
7994 % and unrotate the scope
7995 \pgfscope
7996 \pgfsetcolor{\ctikzvalof{color}}
7997 \pgftransformrotate{\rot}
7998 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
7999 \endpgfscope
8000 }
8001
8002 % generic round meter with always horizontal text, with arrow
8003 \pgfcircdeclarebipolescaled{instruments}
8004 {}
8005 {\ctikzvalof{bipoles/esource/height}}
8006 {rmeterwa}
8007 {\ctikzvalof{bipoles/esource/height}}
8008 {\ctikzvalof{bipoles/esource/width}}
8009 {
8010 \pgfpointorigin
8011 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8012 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8013 \pgf@circ@draworfill
8014 % draw the text label
8015 % get the rotation
8016 \ifpgf@circuit@straightinstruments
8017 \pgfgettransformentries\a\b\temp\temp\temp\temp
8018 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8019 \else
8020 \edef\rot{0}
8021 \fi
8022 % and unrotate the scope
8023 \pgfscope
8024 \pgftransformrotate{\rot}
8025 \pgfsetcolor{\ctikzvalof{color}}
8026 \pgfsetlinewidth{\pgfstartlinewidth}
8027 % arrow: create a center hole to have better visual
8028 \pgfscope
8029 % clipping path: first a rectangle bigger then the shape
8030 % to avoid problems with the line thickness
8031 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8032 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8033 % next open a circle into it
8034 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
8035 % do the difference and clip before drawing
8036 \pgfseteorule
8037 \pgfusepath{clip}
8038 \pgfsetarrowsend{latexslim}
8039 % the arrow is better if it has a bit of breath and it's not 45º
8040 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
8041 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
8042 \pgfusepath{draw}
8043 \endpgfscope
8044 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
8045 \endpgfscope
8046 }
8047
8048 % generic square meter with always horizontal text
8049 \pgfcircdeclarebipolescaled{instruments}
8050 {
8051 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
8052 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
8053 % put the node text above and centered
8054 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8055 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8056 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8057 }
8058 }
8059 }
8060 {\ctikzvalof{bipoles/smeter/height}}
8061 {smeter}
8062 {\ctikzvalof{bipoles/smeter/height}}
8063 {\ctikzvalof{bipoles/smeter/width}}
8064 {
8065 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8066 \pgfextracty{\pgf@circ@res@up}{\northeast}
8067 \pgfextractx{\pgf@circ@res@right}{\northeast}
8068 \pgfextractx{\pgf@circ@res@left}{\southwest}
8069 \pgfextracty{\pgf@circ@res@down}{\southwest}
8070 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8071 \pgfscope
8072 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8073 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8074 \pgf@circ@draworfill
8075 \endpgfscope
8076 % get the rotation
8077 \ifpgf@circuit@straightinstruments
8078 \pgfgettransformentries\a\b\temp\temp\temp\temp
8079 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8080 \else
8081 \edef\rot{0}
8082 \fi
8083 % and unrotate the scope
8084 \pgfscope
8085 \pgftransformrotate{\rot}
8086 % the metering window
8087 \pgfscope
8088 \def\@starta{105}\def\@stopa{75}
8089 \pgfsetlinewidth{\pgfstartlinewidth}
8090 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
8091 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
8092 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
8093 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8094 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8095 \pgfclosepath
8096 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
8097 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
8098 \pgfusepath{draw}
8099 \endpgfscope
8100 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
8101 \endpgfscope
8102 }
8103
8104 % probes qucs style:
8105 % #1 : name
8106 % #2 : extra code
8107 \long\def\pgfcirc@qucsprobe#1#2{
8108 \pgfcircdeclarebipolescaled{instruments}
8109 {
8110 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
8111 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
8112 % put the node text above and centered
8113 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8114 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8115 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8116 }
8117 }
8118 }
8119 {\ctikzvalof{bipoles/qmeter/depth}}
8120 {#1}
8121 {\ctikzvalof{bipoles/qmeter/height}}
8122 {\ctikzvalof{bipoles/qmeter/width}}
8123 {
8124 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8125 \pgfextracty{\pgf@circ@res@up}{\northeast}
8126 \pgfextractx{\pgf@circ@res@right}{\northeast}
8127 \pgfextractx{\pgf@circ@res@left}{\southwest}
8128 \pgfextracty{\pgf@circ@res@down}{\southwest}
8129 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8130 \pgfscope
8131 \pgfscope
8132 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8133 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8134 \pgf@circ@draworfill
8135 \endpgfscope
8136 \def\@starta{103}\def\@stopa{77}
8137 \pgfsetlinewidth{\pgfstartlinewidth}
8138 \pgfscope
8139 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
8140 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
8141 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
8142 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8143 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8144 \pgfclosepath
8145 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
8146 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
8147 \pgfusepath{draw}
8148 \pgf@circ@draworfill
8149 \endpgfscope
8150 #2
8151 \endpgfscope
8152 }
8153 }
8154
8155 \pgfcirc@qucsprobe{qiprobe}{
8156 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8158 \pgfusepath{draw}
8159 \pgfnode{currarrow}{center}{}{}{}
8160 }
8161
8162 \pgfcirc@qucsprobe{qvprobe}{
8163 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8164 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8165 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
8166 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8167 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
8168 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8169 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8170 \pgfusepath{draw}
8171 \pgfscope
8172 % "+" and "-", drawn so that they scale correctly
8173 \pgfsetlinewidth{2\pgfstartlinewidth}
8174 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
8175 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
8176 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8177 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8178 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8179 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8180 \pgfusepath{draw}
8181 \endpgfscope
8182 }
8183
8184 \pgfcirc@qucsprobe{qpprobe}{
8185 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8186 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8187 \pgfusepath{draw}
8188 \pgfnode{currarrow}{center}{}{}{}
8189 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8190 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8191 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
8192 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
8193 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8194 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
8195 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
8196 \pgfusepath{draw}
8197 \pgfscope
8198 % "+" and "-", drawn so that they scale correctly
8199 \pgfsetlinewidth{2\pgfstartlinewidth}
8200 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
8201 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
8202 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8203 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8204 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8205 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8206 \pgfusepath{draw}
8207 \endpgfscope
8208 }
8209
8210 % current loop for oscope and similar: stylized
8211 \pgfcircdeclarebipolescaled{instruments}
8212 {
8213 \anchor{i}{\northeast\pgf@x=0pt\relax}
8214 \anchor{text}{
8215 \pgfextracty{\pgf@circ@res@up}{\northeast}
8216 \pgfextractx{\pgf@circ@res@left}{\northeast}
8217 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8218 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8219 }
8220 }
8221 }
8222 {\ctikzvalof{bipoles/iloop/height}}
8223 {iloop}
8224 {\ctikzvalof{bipoles/iloop/height}}
8225 {\ctikzvalof{bipoles/iloop/width}}
8226 {
8227 \pgfextracty{\pgf@circ@res@up}{\northeast}
8228 \pgfextractx{\pgf@circ@res@right}{\northeast}
8229 \pgf@circ@res@down=-\pgf@circ@res@up
8230 \pgf@circ@res@left=-\pgf@circ@res@right
8231 \pgfscope
8232 \pgfstartlinewidth=\pgflinewidth
8233 \pgfsetcolor{\ctikzvalof{color}}
8234 % external ellipse
8235 \pgfscope
8236 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8237 % clipping path: first a rectangle bigger then the shape
8238 % to avoid problems with the line thickness
8239 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8240 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8241 % next the opening to the left
8242 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8243 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8244 % do the difference and clip before drawing
8245 \pgfseteorule
8246 \pgfusepath{clip}
8247 \pgfpathellipse{\pgfpointorigin}{
8248 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
8249 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
8250 \pgfusepath{draw}
8251 \endpgfscope
8252 % internal wire
8253 \pgfsetlinewidth{\pgfstartlinewidth}
8254 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8255 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8256 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8258 % and the contact line up
8259 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8260 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8261 \pgfusepath{draw}
8262 \endpgfscope
8263 }
8264
8265 % current loop for oscope and similar: real (double connection)
8266 \pgfcircdeclarebipolescaled{instruments}
8267 {
8268 \anchor{i+}{
8269 \pgfextracty{\pgf@circ@res@up}{\northeast}
8270 \pgfextractx{\pgf@circ@res@right}{\northeast}
8271 \pgf@circ@res@step=0.4\pgf@circ@res@right
8272 \pgf@circ@res@other=0.8\pgf@circ@res@up
8273 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
8274 \pgf@y=\pgf@circ@res@up
8275 }
8276 \anchor{i-}{
8277 \pgfextracty{\pgf@circ@res@up}{\northeast}
8278 \pgfextractx{\pgf@circ@res@right}{\northeast}
8279 \pgf@circ@res@step=0.4\pgf@circ@res@right
8280 \pgf@circ@res@other=0.8\pgf@circ@res@up
8281 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
8282 \pgf@y=\pgf@circ@res@up
8283 }
8284 \anchor{text}{
8285 \pgfextracty{\pgf@circ@res@up}{\northeast}
8286 \pgfextractx{\pgf@circ@res@left}{\northeast}
8287 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8288 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8289 }
8290 }
8291 }
8292 {\ctikzvalof{bipoles/iloop/height}}
8293 {iloop2}
8294 {\ctikzvalof{bipoles/iloop/height}}
8295 {\ctikzvalof{bipoles/iloop/width}}
8296 {
8297 \pgfextracty{\pgf@circ@res@up}{\northeast}
8298 \pgfextractx{\pgf@circ@res@right}{\northeast}
8299 \pgf@circ@res@down=-\pgf@circ@res@up
8300 \pgf@circ@res@left=-\pgf@circ@res@right
8301 % must be the same than internal i+ and i- anchors definition
8302 \pgf@circ@res@step=0.4\pgf@circ@res@right
8303 \pgf@circ@res@other=0.8\pgf@circ@res@up
8304 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
8305 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
8306 \pgfscope
8307 \pgfstartlinewidth=\pgflinewidth
8308 \pgfsetcolor{\ctikzvalof{color}}
8309 % external ellipse
8310 \pgfscope
8311 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8312 % clipping path: first a rectangle bigger then the shape
8313 % to avoid problems with the line thickness
8314 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8315 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8316 % next the opening to the left
8317 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8318 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8319 % do the difference and clip before drawing
8320 \pgfseteorule
8321 \pgfusepath{clip}
8322 \pgfpathmoveto{\@plus}
8323 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
8324 \pgfusepath{draw}
8325 \endpgfscope
8326 % internal wire
8327 \pgfsetlinewidth{\pgfstartlinewidth}
8328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8329 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8330 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8331 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8332 % and the contact line up
8333 % I use ...left and ---right as temporal lengths here to avoid defining more
8334 \pgfextractx{\pgf@circ@res@left}{\@plus}
8335 \pgfextractx{\pgf@circ@res@right}{\@minus}
8336 \pgfpathmoveto{\@plus}
8337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8338 \pgfpathmoveto{\@minus}
8339 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8340 \pgfusepath{draw}
8341 \endpgfscope
8342 }
8343
8344
8345 %% Varistor
8346 \pgfcircdeclarebipolescaled{resistors}
8347 {
8348 \pgfcirc@border@extend@updown{1}{1.4}
8349 }
8350 {\ctikzvalof{bipoles/varistor/height}}
8351 {varistor}
8352 {\ctikzvalof{bipoles/varistor/height}}
8353 {\ctikzvalof{bipoles/varistor/width}}
8354 {
8355 \pgfscope
8356 \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}}
8357 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8358 \pgf@circ@draworfill
8359 \endpgfscope
8360
8361 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
8362 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
8363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8364 \pgfusepath{draw}
8365
8366 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
8367 }
8368
8369 %%%%%%%%%%%%%%
8370 %% RF bipoles
8371 %%%%%%%%%%%%%%
8372
8373 % transmission line
8374 \pgfcircdeclarebipolescaled{RF}
8375 {}
8376 {\ctikzvalof{bipoles/tline/height}}
8377 {tline}
8378 {\ctikzvalof{bipoles/tline/height}}
8379 {\ctikzvalof{bipoles/tline/width}}
8380 {
8381 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
8382 \begin{pgftransparencygroup}
8383 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8384 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
8385 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
8386 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
8387 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
8388 \pgf@circ@draworfill
8389 \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8390 {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
8391 \pgf@circ@draworfill
8392 \end{pgftransparencygroup}
8393 \pgfsetlinewidth{\pgfstartlinewidth}
8394 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8396 \pgfusepath{stroke}
8397 }
8398
8399 % microstrip transmission line
8400 \pgfcircdeclarebipolescaled{RF}
8401 {}
8402 {\ctikzvalof{bipoles/mstline/height}}
8403 {mstline}
8404 {\ctikzvalof{bipoles/mstline/height}}
8405 {\ctikzvalof{bipoles/mstline/width}}
8406 {
8407 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8408 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8409 \pgf@circ@draworfill
8410 }
8411
8412 %%%%%%%%%%%%%%%%%%%
8413 %% Block diagrams
8414 %%%%%%%%%%%%%%%%%%%
8415
8416 %% Draw the two-port fillable box
8417 \def\pgf@circ@twoportbox{
8418 \pgfscope
8419 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8420 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8421 \pgf@circ@draworfill
8422 \endpgfscope
8423 }
8424
8425 %% Generic two port box
8426 \pgfcircdeclarebipolescaled{blocks}
8427 {}
8428 {\ctikzvalof{bipoles/twoport/height}}
8429 {twoport}
8430 {\ctikzvalof{bipoles/twoport/height}}
8431 {\ctikzvalof{bipoles/twoport/width}}
8432 {
8433 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
8434 \divide \pgf@circ@res@step by 2
8435
8436 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8437 \pgf@circ@res@other = \pgf@circ@res@left
8438 \advance\pgf@circ@res@other by \pgf@circ@res@step
8439 \ifpgf@circuit@dashed
8440 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8441 \fi
8442 % draw outer box
8443 \pgf@circ@twoportbox
8444 \ifpgf@circuit@inputarrow
8445 {
8446 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8447 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8448 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8449 }
8450 \fi
8451
8452 % rotate inner symbol
8453 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8454 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8455 \pgftransformrotate{270}
8456 \fi\fi
8457 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8458 \pgftransformrotate{180}
8459 \fi\fi
8460 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8461 \pgftransformrotate{90}
8462 \fi\fi
8463
8464 % draw inner symbol
8465 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8466
8467 }
8468
8469 %% twoport split
8470 \pgfcircdeclarebipolescaled{blocks}
8471 {}
8472 {\ctikzvalof{bipoles/twoportsplit/width}}
8473 {twoportsplit}
8474 {\ctikzvalof{bipoles/twoportsplit/width}}
8475 {\ctikzvalof{bipoles/twoportsplit/width}}
8476 {
8477 \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen
8478 \divide \pgf@circ@res@step by 2
8479
8480 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8481 \pgf@circ@res@other = \pgf@circ@res@left
8482 \advance\pgf@circ@res@other by \pgf@circ@res@step
8483
8484 \ifpgf@circuit@dashed
8485 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8486 \fi
8487
8488 % draw outer box
8489 \pgf@circ@twoportbox
8490
8491 \ifpgf@circuit@inputarrow
8492 {
8493 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8494 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8495 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8496 }
8497 \fi
8498
8499 %get texts
8500 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
8501 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
8502
8503 % rotate inner symbol
8504 \def\texti{\pgfcirc@tin}
8505 \def\textii{\pgfcirc@tout}
8506 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8507 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8508 \def\texti{\pgfcirc@tout}
8509 \def\textii{\pgfcirc@tin}
8510 \pgftransformrotate{270}
8511 \fi\fi
8512 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8513 \def\texti{\pgfcirc@tout}
8514 \def\textii{\pgfcirc@tin}
8515 \pgftransformrotate{180}
8516 \fi\fi
8517 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8518 \pgftransformrotate{90}
8519 \def\texti{\pgfcirc@tin}
8520 \def\textii{\pgfcirc@tout}
8521 \fi\fi
8522
8523 % draw inner symbol
8524 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8525 \pgfsetarrows{-} %never draw arrows
8526 \pgfsetlinewidth{\pgfstartlinewidth}
8527 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8528 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8529 \pgfusepath{draw}
8530
8531 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti}
8532 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii}
8533 }
8534
8535 %% voltage controled oscillator
8536 \pgfcircdeclarebipolescaled{blocks}
8537 {}
8538 {\ctikzvalof{bipoles/vco/width}}
8539 {vco}
8540 {\ctikzvalof{bipoles/twoport/width}}
8541 {\ctikzvalof{bipoles/vco/width}}
8542 {
8543 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
8544 \divide \pgf@circ@res@step by 2
8545
8546 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8547 \pgf@circ@res@other = \pgf@circ@res@left
8548 \advance\pgf@circ@res@other by \pgf@circ@res@step
8549
8550 \ifpgf@circuit@dashed
8551 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8552 \fi
8553 % draw circle
8554 \pgfscope
8555 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8556 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
8557 \pgf@circ@draworfill
8558 \endpgfscope
8559 \ifpgf@circuit@inputarrow
8560 {
8561 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8562 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8563 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8564 }
8565 \fi
8566
8567 % rotate inner symbol
8568 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8569 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8570 \pgftransformrotate{270}
8571 \fi\fi
8572 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8573 \pgftransformrotate{180}
8574 \fi\fi
8575 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8576 \pgftransformrotate{90}
8577 \fi\fi
8578
8579 % draw inner sine waves
8580 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8581 \pgfsetlinewidth{\pgfstartlinewidth}
8582 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
8583 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8584 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8585 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8586 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8587 \pgfusepath{draw}
8588 }
8589
8590 %% bandpass filter
8591 \pgfcircdeclarebipolescaled{blocks}
8592 {}
8593 {\ctikzvalof{bipoles/bandpass/width}}
8594 {bandpass}
8595 {\ctikzvalof{bipoles/bandpass/width}}
8596 {\ctikzvalof{bipoles/bandpass/width}}
8597 {
8598
8599 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
8600 \divide \pgf@circ@res@step by 2
8601
8602 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8603 \pgf@circ@res@other = \pgf@circ@res@left
8604 \advance\pgf@circ@res@other by \pgf@circ@res@step
8605
8606 \ifpgf@circuit@dashed
8607 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8608 \fi
8609
8610 % draw outer box
8611 \pgf@circ@twoportbox
8612
8613 \ifpgf@circuit@inputarrow
8614 {
8615 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8616 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8617 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8618 }
8619 \fi
8620
8621 % rotate inner symbol
8622 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8623 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8624 \pgftransformrotate{270}
8625 \fi\fi
8626 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8627 \pgftransformrotate{180}
8628 \fi\fi
8629 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8630 \pgftransformrotate{90}
8631 \fi\fi
8632
8633 % draw inner symbol
8634 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8635 \pgfsetarrows{-} %never draw arrows
8636 \pgfsetlinewidth{\pgfstartlinewidth}
8637 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8638 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8639 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8640 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8641 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8642 \pgfusepath{draw}
8643 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8644 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8645 \pgfusepath{draw}
8646
8647 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8648 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8649 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8650 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8651 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8652 \pgfusepath{draw}
8653
8654 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8655 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8656 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8657 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8658 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8659 \pgfusepath{draw}
8660 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8661 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8662 \pgfusepath{draw}
8663 }
8664
8665 %% bandstop filter
8666 \pgfcircdeclarebipolescaled{blocks}
8667 {}
8668 {\ctikzvalof{bipoles/bandstop/width}}
8669 {bandstop}
8670 {\ctikzvalof{bipoles/bandstop/width}}
8671 {\ctikzvalof{bipoles/bandstop/width}}
8672 {
8673 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
8674 \divide \pgf@circ@res@step by 2
8675
8676 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8677 \pgf@circ@res@other = \pgf@circ@res@left
8678 \advance\pgf@circ@res@other by \pgf@circ@res@step
8679
8680 \ifpgf@circuit@dashed
8681 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8682 \fi
8683
8684 % draw outer box
8685 \pgf@circ@twoportbox
8686
8687 \ifpgf@circuit@inputarrow
8688 {
8689 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8690 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8691 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8692 }
8693 \fi
8694
8695 % rotate inner symbol
8696 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8697 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8698 \pgftransformrotate{270}
8699 \fi\fi
8700 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
8701 \pgftransformrotate{180}
8702 \fi\fi
8703 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8704 \pgftransformrotate{90}
8705 \fi\fi
8706
8707 % draw inner symbol
8708 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
8709 \pgfsetarrows{-}%never draw arrows
8710 \pgfsetlinewidth{\pgfstartlinewidth}
8711 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8712 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8713 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8714 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8715 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8716 \pgfusepath{draw}
8717
8718 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8719 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8720 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8721 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8722 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8723 \pgfusepath{draw}
8724 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8725 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8726 \pgfusepath{draw}
8727
8728 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8729 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8730 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8731 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8732 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8733 \pgfusepath{draw}
8734 }
8735
8736 %% highpass filter
8737 \pgfcircdeclarebipolescaled{blocks}
8738 {}
8739 {\ctikzvalof{bipoles/highpass/width}}
8740 {highpass}
8741 {\ctikzvalof{bipoles/highpass/width}}
8742 {\ctikzvalof{bipoles/highpass/width}}
8743 {
8744 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
8745 \divide \pgf@circ@res@step by 2
8746
8747 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8748 \pgf@circ@res@other = \pgf@circ@res@left
8749 \advance\pgf@circ@res@other by \pgf@circ@res@step
8750
8751 \ifpgf@circuit@dashed
8752 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8753 \fi
8754
8755 % draw outer box
8756 \pgf@circ@twoportbox
8757
8758 \ifpgf@circuit@inputarrow
8759 {
8760 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8761 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8762 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8763 }
8764 \fi
8765
8766 % rotate inner symbol
8767 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8768 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8769 \pgftransformrotate{270}
8770 \fi\fi
8771 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8772 \pgftransformrotate{180}
8773 \fi\fi
8774 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8775 \pgftransformrotate{90}
8776 \fi\fi
8777
8778 % draw inner symbol
8779 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8780 \pgfsetarrows{-} %never draw arrows
8781 \pgfsetlinewidth{\pgfstartlinewidth}
8782 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8783 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8784 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8785 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8786 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8787 \pgfusepath{draw}
8788
8789 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8790 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8791 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8792 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8793 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8794 \pgfusepath{draw}
8795 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8796 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8797 \pgfusepath{draw}
8798
8799 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8800 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8801 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8802 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8803 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8804 \pgfusepath{draw}
8805 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8806 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8807 \pgfusepath{draw}
8808 }
8809
8810 %% lowpass filter
8811 \pgfcircdeclarebipolescaled{blocks}
8812 {}
8813 {\ctikzvalof{bipoles/lowpass/width}}
8814 {lowpass}
8815 {\ctikzvalof{bipoles/lowpass/width}}
8816 {\ctikzvalof{bipoles/lowpass/width}}
8817 {
8818 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
8819 \divide \pgf@circ@res@step by 2
8820
8821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8822 \pgf@circ@res@other = \pgf@circ@res@left
8823 \advance\pgf@circ@res@other by \pgf@circ@res@step
8824
8825 \ifpgf@circuit@dashed
8826 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8827 \fi
8828
8829 % draw outer box
8830 \pgf@circ@twoportbox
8831
8832 \ifpgf@circuit@inputarrow
8833 {
8834 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8835 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8836 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8837 }
8838 \fi
8839
8840 % rotate inner symbol
8841 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8842 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8843 \pgftransformrotate{270}
8844 \fi\fi
8845 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8846 \pgftransformrotate{180}
8847 \fi\fi
8848 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8849 \pgftransformrotate{90}
8850 \fi\fi
8851
8852 % draw inner symbol
8853 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8854 \pgfsetarrows{-} %never draw arrows
8855 \pgfsetlinewidth{\pgfstartlinewidth}
8856 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8857 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8858 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8859 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8860 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8861 \pgfusepath{draw}
8862 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8863 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8864 \pgfusepath{draw}
8865
8866 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8867 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8868 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8869 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8870 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8871 \pgfusepath{draw}
8872 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8873 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8874 \pgfusepath{draw}
8875
8876 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8877 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8878 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8879 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8880 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8881 \pgfusepath{draw}
8882 }
8883
8884 %% allpass filter
8885 \pgfcircdeclarebipolescaled{blocks}
8886 {}
8887 {\ctikzvalof{bipoles/allpass/width}}
8888 {allpass}
8889 {\ctikzvalof{bipoles/allpass/width}}
8890 {\ctikzvalof{bipoles/allpass/width}}
8891 {
8892 \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen
8893 \divide \pgf@circ@res@step by 2
8894
8895 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8896 \pgf@circ@res@other = \pgf@circ@res@left
8897 \advance\pgf@circ@res@other by \pgf@circ@res@step
8898
8899 \ifpgf@circuit@dashed
8900 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8901 \fi
8902
8903 % draw outer box
8904 \pgf@circ@twoportbox
8905
8906 \ifpgf@circuit@inputarrow
8907 {
8908 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8909 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8910 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8911 }
8912 \fi
8913
8914 % rotate inner symbol
8915 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8916 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8917 \pgftransformrotate{270}
8918 \fi\fi
8919 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8920 \pgftransformrotate{180}
8921 \fi\fi
8922 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8923 \pgftransformrotate{90}
8924 \fi\fi
8925
8926 % draw inner symbol
8927 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8928 \pgfsetarrows{-} %never draw arrows
8929 \pgfsetlinewidth{\pgfstartlinewidth}
8930 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8931 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8932 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8933 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8934 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8935 \pgfusepath{draw}
8936
8937 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
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 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8941 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8942 \pgfusepath{draw}
8943
8944 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\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 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8948 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8949 \pgfusepath{draw}
8950 }
8951
8952 %% ADC
8953 \pgfcircdeclarebipolescaled{blocks}
8954 {}
8955 {\ctikzvalof{bipoles/adc/width}}
8956 {adc}
8957 {\ctikzvalof{bipoles/adc/width}}
8958 {\ctikzvalof{bipoles/adc/width}}
8959 {
8960 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
8961 \divide \pgf@circ@res@step by 2
8962
8963 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8964 \pgf@circ@res@other = \pgf@circ@res@left
8965 \advance\pgf@circ@res@other by \pgf@circ@res@step
8966
8967 \ifpgf@circuit@dashed
8968 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8969 \fi
8970
8971 % draw outer box
8972 \pgf@circ@twoportbox
8973
8974 \ifpgf@circuit@inputarrow
8975 {
8976 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8977 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8978 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8979 }
8980 \fi
8981
8982 % rotate inner symbol
8983 \def\texti{A}
8984 \def\textii{D}
8985 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8986 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8987 \def\texti{D}
8988 \def\textii{A}
8989 \pgftransformrotate{270}
8990 \fi\fi
8991 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8992 \def\texti{D}
8993 \def\textii{A}
8994 \pgftransformrotate{180}
8995 \fi\fi
8996 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8997 \pgftransformrotate{90}
8998 \def\texti{A}
8999 \def\textii{D}
9000 \fi\fi
9001
9002 % draw inner symbol
9003 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9004 \pgfsetarrows{-} %never draw arrows
9005 \pgfsetlinewidth{\pgfstartlinewidth}
9006 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9007 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9008 \pgfusepath{draw}
9009
9010 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
9011 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
9012 }
9013
9014 %% DAC
9015 \pgfcircdeclarebipolescaled{blocks}
9016 {}
9017 {\ctikzvalof{bipoles/dac/width}}
9018 {dac}
9019 {\ctikzvalof{bipoles/dac/width}}
9020 {\ctikzvalof{bipoles/dac/width}}
9021 {
9022 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
9023 \divide \pgf@circ@res@step by 2
9024
9025 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9026 \pgf@circ@res@other = \pgf@circ@res@left
9027 \advance\pgf@circ@res@other by \pgf@circ@res@step
9028
9029 \ifpgf@circuit@dashed
9030 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9031 \fi
9032
9033 % draw outer box
9034 \pgf@circ@twoportbox
9035
9036 \ifpgf@circuit@inputarrow
9037 {
9038 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9039 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9040 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9041 }
9042 \fi
9043
9044 % rotate inner symbol
9045 \def\texti{D}
9046 \def\textii{A}
9047 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9048 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9049 \def\texti{A}
9050 \def\textii{D}
9051 \pgftransformrotate{270}
9052 \fi\fi
9053 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9054 \def\texti{A}
9055 \def\textii{D}
9056 \pgftransformrotate{180}
9057 \fi\fi
9058 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9059 \pgftransformrotate{90}
9060 \def\texti{D}
9061 \def\textii{A}
9062 \fi\fi
9063
9064 % draw inner symbol
9065 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9066 \pgfsetarrows{-} %never draw arrows
9067 \pgfsetlinewidth{\pgfstartlinewidth}
9068 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9069 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9070 \pgfusepath{draw}
9071
9072 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
9073 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
9074 }
9075
9076 %% DSP
9077 \pgfcircdeclarebipolescaled{blocks}
9078 {}
9079 {\ctikzvalof{bipoles/dsp/width}}
9080 {dsp}
9081 {\ctikzvalof{bipoles/dsp/width}}
9082 {\ctikzvalof{bipoles/dsp/width}}
9083 {
9084 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
9085 \divide \pgf@circ@res@step by 2
9086
9087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9088 \pgf@circ@res@other = \pgf@circ@res@left
9089 \advance\pgf@circ@res@other by \pgf@circ@res@step
9090
9091 \ifpgf@circuit@dashed
9092 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9093 \fi
9094
9095 % draw outer box
9096 \pgf@circ@twoportbox
9097
9098 \ifpgf@circuit@inputarrow
9099 {
9100 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9101 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9102 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9103 }
9104 \fi
9105
9106 % rotate inner symbol
9107 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9108 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9109 \pgftransformrotate{270}
9110 \fi\fi
9111 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9112 \pgftransformrotate{180}
9113 \fi\fi
9114 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9115 \pgftransformrotate{90}
9116 \fi\fi
9117
9118 % draw inner symbol
9119 \pgftext[center,x=0,y=0]{\textsf{DSP}}
9120 }
9121
9122 %% FFT
9123 \pgfcircdeclarebipolescaled{blocks}
9124 {}
9125 {\ctikzvalof{bipoles/fft/width}}
9126 {fft}
9127 {\ctikzvalof{bipoles/fft/width}}
9128 {\ctikzvalof{bipoles/fft/width}}
9129 {
9130 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
9131 \divide \pgf@circ@res@step by 2
9132
9133 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9134 \pgf@circ@res@other = \pgf@circ@res@left
9135 \advance\pgf@circ@res@other by \pgf@circ@res@step
9136
9137 \ifpgf@circuit@dashed
9138 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9139 \fi
9140
9141 % draw outer box
9142 \pgf@circ@twoportbox
9143
9144 \ifpgf@circuit@inputarrow
9145 {
9146 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9147 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9148 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9149 }
9150 \fi
9151
9152 % rotate inner symbol
9153 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9154 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9155 \pgftransformrotate{270}
9156 \fi\fi
9157 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9158 \pgftransformrotate{180}
9159 \fi\fi
9160 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9161 \pgftransformrotate{90}
9162 \fi\fi
9163
9164 % draw inner symbol
9165 \pgftext[center,x=0,y=0]{\textsf{FFT}}
9166 }
9167
9168 %% Amplifier
9169 \pgfcircdeclarebipolescaled{blocks}
9170 {}
9171 {
9172 \ifpgf@circuit@boxed
9173 \ctikzvalof{bipoles/twoport/width}
9174 \else
9175 \ctikzvalof{bipoles/amp/width}
9176 \fi
9177 }
9178 {amp}
9179 {
9180 \ifpgf@circuit@boxed
9181 \ctikzvalof{bipoles/twoport/width}
9182 \else
9183 \ctikzvalof{bipoles/amp/width}
9184 \fi
9185 }
9186 {
9187 \ifpgf@circuit@boxed
9188 \ctikzvalof{bipoles/twoport/width}
9189 \else
9190 \ctikzvalof{bipoles/amp/width}
9191 \fi
9192 }
9193 {
9194 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
9195
9196 \ifpgf@circuit@dashed
9197 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9198 \fi
9199
9200 % draw outer box
9201 \ifpgf@circuit@boxed
9202 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9203 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
9204 \pgf@circ@draworfill
9205 \fi
9206
9207 % draw input arrow
9208 \ifpgf@circuit@inputarrow
9209 {
9210 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9211 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9212 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9213 }
9214 \fi
9215
9216 \ifpgf@circuit@boxed
9217 \pgfsetlinewidth{\pgfstartlinewidth}
9218 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
9219 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
9220 \else
9221 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9222 \fi
9223
9224 \pgfsetarrows{-} %never draw arrows
9225
9226 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
9227 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
9228 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
9229
9230 \pgfpathclose
9231 \pgf@circ@draworfill
9232
9233 % draw inner text
9234 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
9235 }
9236
9237
9238 %% variable amplifier
9239 \pgfcircdeclarebipolescaled{blocks}
9240 {}
9241 {
9242 \ifpgf@circuit@boxed
9243 \ctikzvalof{bipoles/twoport/width}
9244 \else
9245 \ctikzvalof{bipoles/amp/width}
9246 \fi
9247 }
9248 {vamp}
9249 {
9250 \ifpgf@circuit@boxed
9251 \ctikzvalof{bipoles/twoport/width}
9252 \else
9253 \ctikzvalof{bipoles/amp/width}
9254 \fi
9255 }
9256 {
9257 \ifpgf@circuit@boxed
9258 \ctikzvalof{bipoles/twoport/width}
9259 \else
9260 \ctikzvalof{bipoles/amp/width}
9261 \fi
9262 }
9263 {
9264 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
9265
9266 \ifpgf@circuit@dashed
9267 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9268 \fi
9269
9270 % draw outer box
9271 \ifpgf@circuit@boxed
9272 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
9273 \fi
9274
9275 % draw input arrow
9276 \ifpgf@circuit@inputarrow
9277 {
9278 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9279 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9280 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9281 }
9282 \fi
9283
9284 \ifpgf@circuit@boxed
9285 \pgfsetlinewidth{\pgfstartlinewidth}
9286 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
9287 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
9288 \else
9289 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9290 \fi
9291
9292
9293 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9294 \pgfsetarrows{-} %never draw arrows
9295
9296 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
9297 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
9298 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
9299
9300 \pgfpathclose
9301 \pgf@circ@draworfill
9302
9303 % draw inner text
9304 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
9305
9306 % draw arrow
9307 \pgfsetlinewidth{\pgfstartlinewidth}
9308 \pgfsetarrowsend{latex}
9309 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9310 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
9311 \pgfusepath{draw}
9312 }
9313
9314 %% pi attenuator
9315 \pgfcircdeclarebipolescaled{blocks}
9316 {}
9317 {\ctikzvalof{bipoles/piattenuator/width}}
9318 {piattenuator}
9319 {\ctikzvalof{bipoles/piattenuator/width}}
9320 {\ctikzvalof{bipoles/piattenuator/width}}
9321 {
9322 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
9323 \divide \pgf@circ@res@step by 2
9324
9325 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9326 \pgf@circ@res@other = \pgf@circ@res@left
9327 \advance\pgf@circ@res@other by \pgf@circ@res@step
9328
9329 \ifpgf@circuit@dashed
9330 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9331 \fi
9332
9333 % draw outer box
9334 \pgf@circ@twoportbox
9335
9336 \ifpgf@circuit@inputarrow
9337 {
9338 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9339 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9340 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9341 }
9342 \fi
9343
9344 % rotate inner symbol
9345 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9346 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9347 \pgftransformrotate{270}
9348 \fi\fi
9349 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9350 \pgftransformrotate{90}
9351 \fi\fi
9352
9353 % draw inner symbol
9354 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9355 \pgfsetarrows{-} %never draw arrows
9356 \pgfsetlinewidth{\pgfstartlinewidth}
9357 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9358 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9359 \pgfusepath{draw}
9360 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9361 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9362 \pgfusepath{draw}
9363 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9364 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9365 \pgfusepath{draw}
9366 }
9367
9368 %% variable pi attenuator
9369 \pgfcircdeclarebipolescaled{blocks}
9370 {}
9371 {\ctikzvalof{bipoles/vpiattenuator/width}}
9372 {vpiattenuator}
9373 {\ctikzvalof{bipoles/vpiattenuator/width}}
9374 {\ctikzvalof{bipoles/vpiattenuator/width}}
9375 {
9376 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
9377 \divide \pgf@circ@res@step by 2
9378
9379 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9380 \pgf@circ@res@other = \pgf@circ@res@left
9381 \advance\pgf@circ@res@other by \pgf@circ@res@step
9382
9383 \ifpgf@circuit@dashed
9384 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9385 \fi
9386
9387 % draw outer box
9388 \pgf@circ@twoportbox
9389
9390 \ifpgf@circuit@inputarrow
9391 {
9392 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9393 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9394 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9395 }
9396 \fi
9397
9398 % rotate inner symbol
9399 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9400 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9401 \pgftransformrotate{270}
9402 \fi\fi
9403 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9404 \pgftransformrotate{90}
9405 \fi\fi
9406
9407 % draw inner symbol
9408 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9409 \pgfsetarrows{-} %never draw arrows
9410 \pgfsetlinewidth{\pgfstartlinewidth}
9411 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9412 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9413 \pgfusepath{draw}
9414 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9415 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9416 \pgfusepath{draw}
9417 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9418 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9419 \pgfusepath{draw}
9420
9421 \pgfsetarrowsend{latex}
9422 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9423 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9424 \pgfusepath{draw}
9425 }
9426
9427 %% T attenuator
9428 \pgfcircdeclarebipolescaled{blocks}
9429 {}
9430 {\ctikzvalof{bipoles/tattenuator/width}}
9431 {tattenuator}
9432 {\ctikzvalof{bipoles/tattenuator/width}}
9433 {\ctikzvalof{bipoles/tattenuator/width}}
9434 {
9435 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
9436 \divide \pgf@circ@res@step by 2
9437
9438 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9439 \pgf@circ@res@other = \pgf@circ@res@left
9440 \advance\pgf@circ@res@other by \pgf@circ@res@step
9441
9442 \ifpgf@circuit@dashed
9443 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9444 \fi
9445
9446 % draw outer box
9447 \pgf@circ@twoportbox
9448
9449 \ifpgf@circuit@inputarrow
9450 {
9451 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9452 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9453 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9454 }
9455 \fi
9456
9457 % rotate inner symbol
9458 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9459 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9460 \pgftransformrotate{270}
9461 \fi\fi
9462 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9463 \pgftransformrotate{90}
9464 \fi\fi
9465
9466 % draw inner symbol
9467 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9468 \pgfsetarrows{-} %never draw arrows
9469 \pgfsetlinewidth{\pgfstartlinewidth}
9470 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9471 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9472 \pgfusepath{draw}
9473 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9474 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9475 \pgfusepath{draw}
9476 }
9477
9478 %% variable T attenuator
9479 \pgfcircdeclarebipolescaled{blocks}
9480 {}
9481 {\ctikzvalof{bipoles/vtattenuator/width}}
9482 {vtattenuator}
9483 {\ctikzvalof{bipoles/vtattenuator/width}}
9484 {\ctikzvalof{bipoles/vtattenuator/width}}
9485 {
9486 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
9487 \divide \pgf@circ@res@step by 2
9488
9489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9490 \pgf@circ@res@other = \pgf@circ@res@left
9491 \advance\pgf@circ@res@other by \pgf@circ@res@step
9492
9493 \ifpgf@circuit@dashed
9494 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9495 \fi
9496
9497 % draw outer box
9498 \pgf@circ@twoportbox
9499
9500 \ifpgf@circuit@inputarrow
9501 {
9502 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9503 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9504 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9505 }
9506 \fi
9507
9508 % rotate inner symbol
9509 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9510 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9511 \pgftransformrotate{270}
9512 \fi\fi
9513 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9514 \pgftransformrotate{90}
9515 \fi\fi
9516
9517 % draw inner symbol
9518 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9519 \pgfsetarrows{-} %never draw arrows
9520 \pgfsetlinewidth{\pgfstartlinewidth}
9521 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9522 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9523 \pgfusepath{draw}
9524 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9525 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9526 \pgfusepath{draw}
9527
9528 \pgfsetarrowsend{latex}
9529 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9530 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9531 \pgfusepath{draw}
9532 }
9533
9534 %% phase shifter
9535 \pgfcircdeclarebipolescaled{blocks}
9536 {}
9537 {\ctikzvalof{bipoles/phaseshifter/width}}
9538 {phaseshifter}
9539 {\ctikzvalof{bipoles/phaseshifter/width}}
9540 {\ctikzvalof{bipoles/phaseshifter/width}}
9541 {
9542 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
9543 \divide \pgf@circ@res@step by 2
9544
9545 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9546 \pgf@circ@res@other = \pgf@circ@res@left
9547 \advance\pgf@circ@res@other by \pgf@circ@res@step
9548
9549 \ifpgf@circuit@dashed
9550 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9551 \fi
9552
9553 % draw outer box
9554 \pgf@circ@twoportbox
9555
9556 \ifpgf@circuit@inputarrow
9557 {
9558 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9559 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9560 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9561 }
9562 \fi
9563
9564 % rotate inner symbol
9565 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9566 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9567 \pgftransformrotate{270}
9568 \fi\fi
9569 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9570 \pgftransformrotate{180}
9571 \fi\fi
9572 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9573 \pgftransformrotate{90}
9574 \fi\fi
9575
9576 % inner symbol
9577 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9578 }
9579
9580 %% variable phase shifter
9581 \pgfcircdeclarebipolescaled{blocks}
9582 {}
9583 {\ctikzvalof{bipoles/phaseshifter/width}}
9584 {vphaseshifter}
9585 {\ctikzvalof{bipoles/vphaseshifter/width}}
9586 {\ctikzvalof{bipoles/vphaseshifter/width}}
9587 {
9588 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
9589 \divide \pgf@circ@res@step by 2
9590
9591 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9592 \pgf@circ@res@other = \pgf@circ@res@left
9593 \advance\pgf@circ@res@other by \pgf@circ@res@step
9594
9595 \ifpgf@circuit@dashed
9596 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9597 \fi
9598
9599 % draw outer box
9600 \pgf@circ@twoportbox
9601
9602 \ifpgf@circuit@inputarrow
9603 {
9604 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9605 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9606 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9607 }
9608 \fi
9609
9610 % rotate inner symbol
9611 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9612 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9613 \pgftransformrotate{270}
9614 \fi\fi
9615 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9616 \pgftransformrotate{180}
9617 \fi\fi
9618 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9619 \pgftransformrotate{90}
9620 \fi\fi
9621
9622 % inner symbol
9623 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9624
9625 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9626 \pgfsetlinewidth{\pgfstartlinewidth}
9627 \pgfsetarrowsend{latex}
9628 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
9629 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
9630 \pgfusepath{draw}
9631 }
9632
9633 %% detector
9634 \pgfcircdeclarebipolescaled{blocks}
9635 {}
9636 {\ctikzvalof{bipoles/detector/width}}
9637 {detector}
9638 {\ctikzvalof{bipoles/detector/width}}
9639 {\ctikzvalof{bipoles/detector/width}}
9640 {
9641 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
9642 \divide \pgf@circ@res@step by 2
9643
9644 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9645 \pgf@circ@res@other = \pgf@circ@res@left
9646 \advance\pgf@circ@res@other by \pgf@circ@res@step
9647
9648 \ifpgf@circuit@dashed
9649 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9650 \fi
9651
9652 % draw outer box
9653 \pgf@circ@twoportbox
9654
9655 \ifpgf@circuit@inputarrow
9656 {
9657 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9658 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9659 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9660 }
9661 \fi
9662
9663 % draw inner stuff
9664 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9665 \pgfsetarrows{-} %never draw arrows
9666 \pgfsetlinewidth{0.8\pgfstartlinewidth}
9667 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
9668 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
9669 \pgfusepath{draw}
9670
9671 \ifpgf@circuit@fulldiode
9672 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
9673 \pgftransformscale{\pgfmathresult}
9674 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
9675 \else
9676 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
9677 \pgftransformscale{\pgfmathresult}
9678 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
9679 \fi
9680
9681 }
9682
9683 %% single phase ac/dc converter
9684 \pgfcircdeclarebipolescaled{blocks}
9685 {
9686 \anchor{dc1}{
9687 \northeast
9688 \pgf@y=.4\pgf@y
9689 }
9690 \anchor{dc2}{
9691 \northeast
9692 \pgf@y=-.4\pgf@y
9693 }
9694 }
9695 {\ctikzvalof{bipoles/sacdc/width}}
9696 {sacdc}
9697 {\ctikzvalof{bipoles/sacdc/width}}
9698 {\ctikzvalof{bipoles/sacdc/width}}
9699 {
9700 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
9701 \divide \pgf@circ@res@step by 2
9702
9703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9704 \pgf@circ@res@other = \pgf@circ@res@left
9705 \advance\pgf@circ@res@other by \pgf@circ@res@step
9706
9707 \ifpgf@circuit@dashed
9708 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9709 \fi
9710
9711 % draw outer box
9712 \pgf@circ@twoportbox
9713
9714 \ifpgf@circuit@inputarrow
9715 {
9716 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9717 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9718 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9719 }
9720 \fi
9721
9722 % rotate inner symbol
9723 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9724 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9725 \pgftransformrotate{270}
9726 \fi\fi
9727 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9728 \pgftransformrotate{180}
9729 \fi\fi
9730 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9731 \pgftransformrotate{90}
9732 \fi\fi
9733
9734 % draw inner symbol
9735 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9736 \pgfsetarrows{-} %never draw arrows
9737 \pgfsetlinewidth{\pgfstartlinewidth}
9738 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9739 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9740 \pgfusepath{draw}
9741
9742 % draw sin wave
9743 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9744 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9745 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9746 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9747 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9748 \pgfusepath{draw}
9749
9750 % draw equal sign
9751 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9752 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9753 \pgfusepath{draw}
9754 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9755 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9756 \pgfusepath{draw}
9757 }
9758
9759
9760
9761 %% single phase dc/ac converter
9762 \pgfcircdeclarebipolescaled{blocks}
9763 {
9764 \anchor{dc1}{
9765 \northeast
9766 \pgf@y=.4\pgf@y
9767 \pgf@x=-\pgf@x
9768 }
9769 \anchor{dc2}{
9770 \northeast
9771 \pgf@y=-.4\pgf@y
9772 \pgf@x=-\pgf@x
9773 }
9774 }
9775 {\ctikzvalof{bipoles/sdcac/width}}
9776 {sdcac}
9777 {\ctikzvalof{bipoles/sdcac/width}}
9778 {\ctikzvalof{bipoles/sdcac/width}}
9779 {
9780 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
9781 \divide \pgf@circ@res@step by 2
9782
9783 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9784 \pgf@circ@res@other = \pgf@circ@res@left
9785 \advance\pgf@circ@res@other by \pgf@circ@res@step
9786
9787 \ifpgf@circuit@dashed
9788 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9789 \fi
9790
9791 % draw outer box
9792 \pgf@circ@twoportbox
9793
9794 \ifpgf@circuit@inputarrow
9795 {
9796 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9797 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9798 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9799 }
9800 \fi
9801
9802 % rotate inner symbol
9803 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9804 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9805 \pgftransformrotate{270}
9806 \fi\fi
9807 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9808 \pgftransformrotate{180}
9809 \fi\fi
9810 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9811 \pgftransformrotate{90}
9812 \fi\fi
9813
9814 % draw inner symbol
9815 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9816 \pgfsetarrows{-} %never draw arrows
9817 \pgfsetlinewidth{\pgfstartlinewidth}
9818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9820 \pgfusepath{draw}
9821
9822 % draw sin wave
9823 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
9824 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9825 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9826 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9827 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9828 \pgfusepath{draw}
9829
9830 % draw equal sign
9831 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
9832 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
9833 \pgfusepath{draw}
9834 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
9835 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
9836 \pgfusepath{draw}
9837 }
9838
9839
9840 %% threephase ac/dc converter
9841 \pgfcircdeclarebipolescaled{blocks}
9842 {
9843 \anchor{dc1}{
9844 \northeast
9845 \pgf@y=.4\pgf@y
9846 }
9847 \anchor{dc2}{
9848 \northeast
9849 \pgf@y=-.4\pgf@y
9850 }
9851 \anchor{ac1}{
9852 \northeast
9853 \pgf@y=.6\pgf@y
9854 \pgf@x=-\pgf@x
9855 }
9856 \anchor{ac2}{
9857 \northeast
9858 \pgf@y=0\pgf@y
9859 \pgf@x=-\pgf@x
9860 }
9861 \anchor{ac3}{
9862 \northeast
9863 \pgf@y=-.6\pgf@y
9864 \pgf@x=-\pgf@x
9865 }
9866 }
9867 {\ctikzvalof{bipoles/tacdc/width}}
9868 {tacdc}
9869 {\ctikzvalof{bipoles/tacdc/width}}
9870 {\ctikzvalof{bipoles/tacdc/width}}
9871 {
9872 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
9873 \divide \pgf@circ@res@step by 2
9874
9875 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9876 \pgf@circ@res@other = \pgf@circ@res@left
9877 \advance\pgf@circ@res@other by \pgf@circ@res@step
9878
9879 \ifpgf@circuit@dashed
9880 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9881 \fi
9882
9883 % draw outer box
9884 \pgf@circ@twoportbox
9885
9886 \ifpgf@circuit@inputarrow
9887 {
9888 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9889 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9890 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9891 }
9892 \fi
9893
9894 % rotate inner symbol
9895 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9896 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9897 \pgftransformrotate{270}
9898 \fi\fi
9899 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9900 \pgftransformrotate{180}
9901 \fi\fi
9902 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9903 \pgftransformrotate{90}
9904 \fi\fi
9905
9906 % draw inner symbol
9907 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9908 \pgfsetarrows{-} %never draw arrows
9909 \pgfsetlinewidth{\pgfstartlinewidth}
9910 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9912 \pgfusepath{draw}
9913
9914 % draw sin waves
9915 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
9916 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9917 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9918 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9919 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9920 \pgfusepath{draw}
9921 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9922 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9923 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9924 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9925 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9926 \pgfusepath{draw}
9927 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
9928 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9929 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9930 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9931 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9932 \pgfusepath{draw}
9933
9934
9935
9936
9937 % draw equal sign
9938 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9939 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9940 \pgfusepath{draw}
9941 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9942 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9943 \pgfusepath{draw}
9944 }
9945
9946
9947 %% threephase dc/ac converter
9948 \pgfcircdeclarebipolescaled{blocks}
9949 {
9950 \anchor{dc1}{
9951 \northeast
9952 \pgf@y=.4\pgf@y
9953 \pgf@x=-\pgf@x
9954 }
9955 \anchor{dc2}{
9956 \northeast
9957 \pgf@y=-.4\pgf@y
9958 \pgf@x=-\pgf@x
9959 }
9960 \anchor{ac1}{
9961 \northeast
9962 \pgf@y=.6\pgf@y
9963 }
9964 \anchor{ac2}{
9965 \northeast
9966 \pgf@y=0\pgf@y
9967 }
9968 \anchor{ac3}{
9969 \northeast
9970 \pgf@y=-.6\pgf@y
9971 }
9972 }
9973 {\ctikzvalof{bipoles/tdcac/width}}
9974 {tdcac}
9975 {\ctikzvalof{bipoles/tdcac/width}}
9976 {\ctikzvalof{bipoles/tdcac/width}}
9977 {
9978 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
9979 \divide \pgf@circ@res@step by 2
9980
9981 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9982 \pgf@circ@res@other = \pgf@circ@res@left
9983 \advance\pgf@circ@res@other by \pgf@circ@res@step
9984
9985 \ifpgf@circuit@dashed
9986 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9987 \fi
9988
9989 % draw outer box
9990 \pgf@circ@twoportbox
9991
9992 \ifpgf@circuit@inputarrow
9993 {
9994 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9995 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9996 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9997 }
9998 \fi
9999
10000 % rotate inner symbol
10001 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
10002 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
10003 \pgftransformrotate{270}
10004 \fi\fi
10005 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
10006 \pgftransformrotate{180}
10007 \fi\fi
10008 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
10009 \pgftransformrotate{90}
10010 \fi\fi
10011
10012 % draw inner symbol
10013 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
10014 \pgfsetarrows{-} %never draw arrows
10015 \pgfsetlinewidth{\pgfstartlinewidth}
10016 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10017 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10018 \pgfusepath{draw}
10019
10020 % draw sin waves
10021 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
10022 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10023 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10024 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10025 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10026 \pgfusepath{draw}
10027 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
10028 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10029 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10030 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10031 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10032 \pgfusepath{draw}
10033 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\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 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
10037 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
10038 \pgfusepath{draw}
10039
10040
10041
10042
10043 % draw equal sign
10044 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
10045 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
10046 \pgfusepath{draw}
10047 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
10048 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
10049 \pgfusepath{draw}
10050 }
10051
10052
10053 %%%%%%%%%%%%%%%%%%%%%%%
10054 %% MECHANICAL SYMBOLS
10055 %%%%%%%%%%%%%%%%%%%%%%%
10056
10057 %% mechanical capacitance - stiffness/spring
10058
10059 \pgfcircdeclarebipolescaled{mechanicals}
10060 {}
10061 {\ctikzvalof{bipoles/spring/height}}
10062 {spring}
10063 {\ctikzvalof{bipoles/spring/height}}
10064 {\ctikzvalof{bipoles/spring/width}}{
10065 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10066 \pgftransformationadjustments
10067
10068 \pgfmathsetlength{\pgf@circ@res@step}
10069 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
10070
10071 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
10072 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
10073 \pgf@circ@res@other = \pgf@circ@res@left
10074 \advance\pgf@circ@res@other by \pgf@circ@res@step
10075 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10076 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10077 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10078 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10079 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10080 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10082 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10083 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10084 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10085 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10086 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10088 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
10089 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10090 \advance\pgf@circ@res@other by \pgf@circ@res@step
10091 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10092 \pgfsetbuttcap
10093 \pgfsetbeveljoin
10094 \pgfusepath{stroke}
10095 }
10096
10097 %% mechanical capacitance - inerter
10098 \pgfcircdeclarebipolescaled{mechanicals}
10099 {}
10100 {\ctikzvalof{bipoles/inerter/height}}
10101 {inerter}
10102 {\ctikzvalof{bipoles/inerter/height}}
10103 {\ctikzvalof{bipoles/inerter/width}}
10104 {
10105 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10106 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10107 \pgf@circ@draworfill
10108 }
10109
10110
10111 %% mechanical inductance - mass
10112 \pgfcircdeclarebipolescaled{mechanicals}
10113 {}
10114 {\ctikzvalof{bipoles/mass/box height}}
10115 {mass}
10116 {\ctikzvalof{bipoles/mass/height}}
10117 {\ctikzvalof{bipoles/mass/width}}
10118 {
10119 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10120 \pgftransformationadjustments
10121 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10122 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
10123 \pgf@circ@draworfill
10124
10125 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10126 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10127 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10128 \pgfsetrectcap
10129 \pgfsetmiterjoin
10130 \pgfusepath{stroke}
10131 }
10132
10133 %% mechanical resistor - damper
10134 \pgfcircdeclarebipolescaled{mechanicals}
10135 {}
10136 {\ctikzvalof{bipoles/damper/height}}
10137 {damper}
10138 {\ctikzvalof{bipoles/damper/height}}
10139 {\ctikzvalof{bipoles/damper/width}}
10140 {
10141 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10142 \pgf@circ@maybefill
10143
10144 % line into the damper
10145 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10146 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10147 {\pgf@circ@res@zero}}
10148 \pgfusepath{stroke}
10149
10150 % damper box
10151 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10152 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10154 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10155 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10156
10157 \pgfsetrectcap
10158 \pgfsetmiterjoin
10159 \pgfusepath{stroke}
10160
10161 % damper vertical element
10162 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10163 {.8\pgf@circ@res@down}}
10164 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10165 {.8\pgf@circ@res@up}}
10166 \pgfsetbuttcap
10167 \pgfusepath{stroke}
10168
10169 }
10170 %% mechanical viscoelastic element, suggested by @alex
10171 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
10172 \pgfcircdeclarebipolescaled{mechanicals}
10173 {} % extra anchors
10174 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
10175 {viscoe} % name
10176 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
10177 {\ctikzvalof{bipoles/damper/width}} % width
10178 { % draw the bipole
10179 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10180 \pgf@circ@maybefill
10181
10182 % spring into the damper
10183 \pgfscope
10184 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10185 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10186 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
10187 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
10188 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
10189 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
10190 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
10191 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
10192 \pgfusepath{stroke}
10193 \endpgfscope
10194 % damper box
10195 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10198 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10200
10201 \pgfsetrectcap
10202 \pgfsetmiterjoin
10203 \pgfusepath{stroke}
10204
10205 % damper vertical element
10206 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10207 {.8\pgf@circ@res@down}}
10208 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
10209 {.8\pgf@circ@res@up}}
10210 \pgfsetbuttcap
10211 \pgfusepath{stroke}
10212
10213 }
10214
10215 %%%%%%%%%%%%%%%%
10216 %% Crossing
10217 %%%%%%%%%%%%%%%%
10218
10219 %% crossing bipole (but see also nodes)
10220 \pgfcircdeclarebipole
10221 {}
10222 {\ctikzvalof{bipoles/crossing/size}}
10223 {crossing}
10224 {\ctikzvalof{bipoles/crossing/size}}
10225 {\ctikzvalof{bipoles/crossing/size}}{
10226 \pgfscope
10227 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10228 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
10229 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
10230 \pgfsetbeveljoin
10231 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10232 \pgfusepath{draw}
10233 \endpgfscope
10234 }
10235
10236 %%%%%%%%%%%%%%%%%%%%%%%%%
10237 %% Miscellaneous bipoles
10238 %%%%%%%%%%%%%%%%%%%%%%%%%
10239
10240 %% loudspeaker and microphone
10241
10242 \pgfcircdeclarebipolescaled{misc}
10243 {}
10244 {\ctikzvalof{bipoles/loudspeaker/depth}}
10245 {loudspeaker}
10246 {\ctikzvalof{bipoles/loudspeaker/height}}
10247 {\ctikzvalof{bipoles/loudspeaker/width}}{
10248
10249 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
10250 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10251 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
10252 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
10253 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
10254 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
10255 \pgfpathclose
10256 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10257 \pgf@circ@draworfill
10258 }
10259
10260 \pgfcircdeclarebipolescaled{misc}
10261 {}
10262 {\ctikzvalof{bipoles/mic/depth}}
10263 {mic}
10264 {\ctikzvalof{bipoles/mic/height}}
10265 {\ctikzvalof{bipoles/mic/width}}{
10266
10267 \pgfscope
10268 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10269 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
10270 \pgf@circ@draworfill
10271 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
10272 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
10273 \pgfusepath{draw}
10274 \endpgfscope
10275 \pgfscope
10276 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10277 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
10278 % 0.25358 is 0.6-0.4*cos(30)
10279 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10280 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10281 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
10282 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10283 \pgfusepath{draw}
10284
10285 \pgfusepath{draw}
10286 \endpgfscope
10287 }
10288
10289 %% european gas filled surge arrester
10290 \pgfcircdeclarebipolescaled{misc}
10291 {}
10292 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10293 {european gas filled surge arrester}
10294 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10295 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
10296 {
10297
10298 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10299 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10300
10301 \pgf@circ@draworfill
10302
10303 \pgfscope
10304 \pgfsetarrowsend{latexslim}
10305 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10306 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
10307 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10308 \pgfusepath{draw}
10309
10310 \endpgfscope
10311 }
10312
10313 %% american gas filled surge arrester
10314 \pgfcircdeclarebipolescaled{misc}
10315 {}
10316 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10317 {american gas filled surge arrester}
10318 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10319 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
10320
10321 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10322 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
10323 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10324 \pgfusepath{draw}
10325
10326 \pgfscope
10327 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10328 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10329 \pgf@circ@draworfill
10330 \endpgfscope
10331
10332 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
10333 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10334 \pgfusepath{draw}
10335
10336 \pgfscope
10337 \pgfsetarrowsend{latex}
10338
10339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10340 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
10341 \pgfusepath{draw}
10342
10343 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10344 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
10345 \pgfusepath{draw}
10346 \endpgfscope{}
10347
10348 \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}
10349 \pgfusepath{fill}
10350 }
10351
10352 %% thermocouple
10353 \pgfcircdeclarebipolescaled{misc}
10354 {}
10355 {\ctikzvalof{bipoles/thermocouple/height 2}}
10356 {thermocouple}
10357 {\ctikzvalof{bipoles/thermocouple/height}}
10358 {\ctikzvalof{bipoles/thermocouple/width}}
10359 {
10360 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10361 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10362 \pgfusepath{draw}
10363 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10364 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10365 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
10366 \pgfusepath{draw}
10367 \pgfsetlinewidth{\pgfstartlinewidth}
10368 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
10369 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
10370 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10371 \pgfusepath{draw}
10372 }
10373
10374 %% fuse
10375 \pgfcircdeclarebipolescaled{misc}
10376 {}
10377 {\ctikzvalof{bipoles/fuse/height}}
10378 {fuse}
10379 {\ctikzvalof{bipoles/fuse/height}}
10380 {\ctikzvalof{bipoles/fuse/width}}
10381 {
10382 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10383 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10384 \pgfusepath{draw}
10385
10386 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10387 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10388
10389 \pgf@circ@draworfill
10390 }
10391
10392 %% asymmetric fuse
10393 \pgfcircdeclarebipolescaled{misc}
10394 {}
10395 {\ctikzvalof{bipoles/afuse/height}}
10396 {afuse}
10397 {\ctikzvalof{bipoles/afuse/height}}
10398 {\ctikzvalof{bipoles/afuse/width}}
10399 {
10400 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10401 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10402 \pgfusepath{draw}
10403
10404 \pgfscope
10405 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10406 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10407 \pgf@circ@draworfill
10408 \endpgfscope
10409
10410 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10411 \pgfusepath{stroke,fill}
10412 }
10413
10414 %% SQUID added by Cor Molenaar 5 March 2010
10415 \pgfcircdeclarebipolescaled{misc}
10416 {}
10417 {\ctikzvalof{bipoles/squid/height}}
10418 {squid}
10419 {\ctikzvalof{bipoles/squid/height}}
10420 {\ctikzvalof{bipoles/squid/width}}
10421 {
10422 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10423
10424 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10425 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
10426 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
10427 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
10428 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
10429 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
10430 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
10431 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
10432 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
10433
10434 \pgfusepath{draw}
10435 }
10436
10437 % Generic barrier added by Cor Molenaar 5 March 2010
10438 \pgfcircdeclarebipolescaled{misc}
10439 {}
10440 {\ctikzvalof{bipoles/barrier/height}}
10441 {barrier}
10442 {\ctikzvalof{bipoles/barrier/height}}
10443 {\ctikzvalof{bipoles/barrier/width}}
10444 {
10445 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10446
10447 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
10448 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
10449 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10450 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10451 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10452 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10453
10454 \pgfusepath{draw}
10455 }
10456
10457 %
10458 % open version of the barrier symbol
10459 % suggested by Radványi Patrik Tamás <[email protected]>
10460 %
10461 \pgfcircdeclarebipolescaled{misc}
10462 {}
10463 {\ctikzvalof{bipoles/barrier/height}}
10464 {openbarrier}
10465 {\ctikzvalof{bipoles/barrier/height}}
10466 {\ctikzvalof{bipoles/barrier/width}}
10467 {
10468 % this is set with normal wire linewidth
10469 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10470 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
10471 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10472 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
10473 \pgfusepath{draw}
10474
10475 % do the cross part
10476 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10477
10478 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10479 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10480 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10481 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10482
10483 \pgfusepath{draw}
10484 }
10485 %% Lamp
10486 \pgfcircdeclarebipolescaled{misc}
10487 {}
10488 {\ctikzvalof{bipoles/lamp/height}}
10489 {lamp}
10490 {\ctikzvalof{bipoles/lamp/height}}
10491 {\ctikzvalof{bipoles/lamp/width}}
10492 {
10493 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10494
10495 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10496 \pgf@circ@draworfill
10497 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
10498 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
10499 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
10500 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
10501 \pgfusepath{draw}
10502 }
10503
10504 %% bulb
10505 \pgfcircdeclarebipolescaled{misc}
10506 {}
10507 {\ctikzvalof{bipoles/bulb/height}}
10508 {bulb}
10509 {\ctikzvalof{bipoles/bulb/height}}
10510 {\ctikzvalof{bipoles/bulb/width}}
10511 {%
10512 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10513 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
10514 \pgf@circ@draworfill
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 }
10522
10523
10524 % end of pgfcircbipoles.tex
10525 %%%---------- close: tex/pgfcircbipoles
10526 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
10527 %%%---------- open: tex/pgfcirctripoles.tex
10528 % Copyright 2018-2026 by Romano Giannetti
10529 % Copyright 2015-2026 by Stefan Lindner
10530 % Copyright 2013-2026 by Stefan Erhardt
10531 % Copyright 2007-2026 by Massimo Redaelli
10532 %
10533 % This file may be distributed and/or modified
10534 %
10535 % 1. under the LaTeX Project Public License and/or
10536 % 2. under the GNU Public License.
10537 %
10538 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
10539
10540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10541 %% Tripoles
10542
10543 %%%%%%%%%%%%%
10544 %% switches
10545 %%%%%%%%%%%%%
10546
10547 % Legacy spdt
10548 \pgfdeclareshape{spdt}{
10549 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10550 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10551 \savedanchor\northwest{%
10552 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10553 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
10554 \pgf@y=.5\pgf@y
10555 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10556 \pgf@x=.5\pgf@x
10557 }
10558 \anchor{left}{%
10559 \northwest
10560 \pgf@y=0pt
10561 }
10562 \anchor{in}{
10563 \northwest
10564 \pgf@y=0pt
10565 }
10566 \anchor{out 1}{
10567 \northwest
10568 \pgf@x=-\pgf@x
10569 }
10570 \anchor{out 2}{
10571 \northwest
10572 \pgf@x=-\pgf@x
10573 \pgf@y=-\pgf@y
10574 }
10575 \anchor{center}{
10576 \pgf@y=0pt
10577 \pgf@x=0pt
10578 }
10579 \anchor{east}{
10580 \northwest
10581 \pgf@y=0pt
10582 \pgf@x=-\pgf@x
10583 }
10584 \anchor{west}{
10585 \northwest
10586 \pgf@y=0pt
10587 }
10588 \anchor{south}{
10589 \northwest
10590 \pgf@x=0pt
10591 \pgf@y=-\pgf@y
10592 }
10593 \anchor{north}{
10594 \northwest
10595 \pgf@x=0pt
10596 }
10597 \anchor{south west}{
10598 \northwest
10599 \pgf@y=-\pgf@y
10600 }
10601 \anchor{north east}{
10602 \northwest
10603 \pgf@x=-\pgf@x
10604 }
10605 \anchor{north west}{
10606 \northwest
10607 }
10608 \anchor{south east}{
10609 \northwest
10610 \pgf@x=-\pgf@x
10611 \pgf@y=-\pgf@y
10612 }
10613 \backgroundpath{
10614 \pgfsetcolor{\ctikzvalof{color}}
10615
10616 \northwest
10617 \pgf@circ@res@up = \pgf@y
10618 \pgf@circ@res@down = -\pgf@y
10619 \pgf@circ@res@right = -\pgf@x
10620 \pgf@circ@res@left = \pgf@x
10621 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
10622
10623
10624 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10625 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10627 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10628
10629 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10630 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10631
10632 \pgfusepath{draw}
10633
10634 \pgfscope
10635 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10636 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
10637 \endpgfscope
10638 \pgfscope
10639 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10640 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
10641 \endpgfscope
10642 \pgfscope
10643 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
10644 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
10645 \endpgfscope
10646
10647 \pgfscope
10648 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
10649 \pgfpathlineto{
10650 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
10651 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
10652 }
10653 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10654 \pgfusepath{draw}
10655 \endpgfscope
10656 }
10657 }
10658
10659
10660 % cute switch "node" shapes, matching with cute "to" shapes
10661 % #1 -> name
10662 % #2 -> barposition
10663 % #3 -> arrowcode
10664 \long\def\pgfcircdeclarecutespdt#1#2#3{
10665 \pgfdeclareshape{#1}
10666 {
10667 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10668 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10669 \savedanchor\northwest{%
10670 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10671 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10672 \pgf@y=.5\pgf@y
10673 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10674 \pgf@x=.25\pgf@x
10675 }
10676 \savedanchor\midlever{
10677 % these values are calculated when we create the definition of the shape.
10678 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10679 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10680 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
10681 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10682 \pgf@circ@res@down = -.5\pgf@y
10683 \pgf@circ@res@up = .5\pgf@y
10684 \pgfextracty{\pgf@circ@res@other}{#2}
10685 \pgf@x=0pt
10686 \pgf@y=.5\pgf@circ@res@other
10687 }
10688 % radius of the connector
10689 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10690 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10691 % shapename
10692 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10693 % shape type
10694 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
10695 % mid of the lever, to stack switches
10696 \anchor{mid}{\midlever}
10697 % center anchors
10698 \anchor{cin}{ \northwest \pgf@y=0pt}
10699 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
10700 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10701 % horizontal angles
10702 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
10703 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
10704 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
10705
10706 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
10707 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
10708 \anchor{west}{ \northwest \pgf@y=0pt }
10709 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
10710 \anchor{north}{ \northwest \pgf@x=0pt }
10711 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
10712 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
10713 \anchor{north west}{ \northwest }
10714 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10715
10716 \backgroundpath{
10717 \pgfsetcolor{\ctikzvalof{color}}
10718 \northwest
10719 \pgf@circ@res@up = \pgf@y
10720 \pgf@circ@res@down = -\pgf@y
10721 \pgf@circ@res@right = -\pgf@x
10722 \pgf@circ@res@left = \pgf@x
10723
10724 \pgfscope
10725 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10726 \pgf@circ@res@temp=\radius\relax
10727 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10728 \pgfsetlinewidth{2\pgf@circ@res@temp}
10729 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10730 \pgfpathlineto{#2}
10731 \pgfsetroundcap\pgfusepath{draw}
10732 \endpgfscope
10733 \pgfscope % arrow
10734 #3
10735 \endpgfscope
10736 % terminals
10737 \pgfscope
10738 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10739 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
10740 \endpgfscope
10741 \pgfscope
10742 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10743 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
10744 \endpgfscope
10745 \pgfscope
10746 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10747 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
10748 \endpgfscope
10749
10750 }
10751 }
10752 }
10753
10754 \pgfcircdeclarecutespdt{cute spdt up}
10755 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10756 {}
10757
10758 \pgfcircdeclarecutespdt{cute spdt mid}
10759 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10760 {}
10761
10762 \pgfcircdeclarecutespdt{cute spdt down}
10763 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10764 {}
10765
10766 \pgfcircdeclarecutespdt{cute spdt up arrow}
10767 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10768 {
10769 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10770 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10771 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
10772 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
10773 \pgfsetarrowsend{latexslim}
10774 \pgfusepath{draw}
10775 }
10776
10777 \pgfcircdeclarecutespdt{cute spdt mid arrow}
10778 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10779 {
10780 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10781 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10782 \pgfsetarrowsstart{latexslim}
10783 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
10784 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
10785 \pgfsetarrowsend{latexslim}
10786 \pgfusepath{draw}
10787 }
10788
10789 \pgfcircdeclarecutespdt{cute spdt down arrow}
10790 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10791 {
10792 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10793 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10794 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
10795 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
10796 \pgfsetarrowsend{latexslim}
10797 \pgfusepath{draw}
10798 }
10799
10800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10802 %%
10803 %% Logic ports
10804 %%
10805 %% Code from John Kormylo at tex.stackexchange.com
10806 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
10807 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
10808 %%
10809
10810 \newcount\pgf@circ@res@count% reserve global register
10811
10812 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
10813 {%
10814 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10815 \step
10816 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10817 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10818 }%
10819
10820 % #1 = \pgfmathcounter #2=type #3 specificic port
10821 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
10822 \def\pgf@circ@logicport@baseinput#1#2#3%
10823 {%
10824 % and and nand
10825 \ifnum #2=1\relax
10826 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10827 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10828 \step
10829 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10830 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10831 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
10832 \fi
10833 % or and nor
10834 \ifnum #2=2\relax
10835 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10836 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10837 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10838 \step
10839 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10840 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10841 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
10842 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10843 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10844 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10845 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10846 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10847 \pgf@circ@res@temp=\pgf@y
10848 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10849 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10850 \pgf@x=\pgf@circ@res@other
10851 \fi
10852 % xor and xnor
10853 \ifnum #2=3\relax
10854 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10855 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10856 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10857 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
10858 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10859 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10860 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10861 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10862 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10863 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
10864 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10865 % this compensates for the effect of the line width on the gap between the arcs
10866 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10867 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10868
10869 \step
10870 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10871 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10872 \pgf@circ@res@temp=\pgf@y
10873 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10874 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10875 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10876 \pgf@x=\pgf@circ@res@other
10877 \fi
10878 % european
10879 \ifnum #2=4\relax
10880 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10881 \pgfextractx{\pgf@circ@res@other}{\left}%
10882 \step
10883 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10884 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10885 \pgf@x=\pgf@circ@res@other
10886 \fi
10887 }%
10888
10889 %%% american
10890 \long\def\pgfcircdeclarelogicport#1#2#3{%
10891 \pgfdeclareshape{american #1 port}%
10892 {%
10893 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10894 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10895 \savedmacro\resize{% automatic
10896 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10897 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10898 \pgf@circ@res@up = .5\pgf@circ@res@up
10899 \pgf@circ@res@down = -\pgf@circ@res@up
10900 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
10901 \pgf@circ@res@right = .5\pgf@circ@res@right
10902 \pgf@circ@res@left = -\pgf@circ@res@right
10903 }%
10904 \savedmacro\inputs{% get number of inputs
10905 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10906 \ifnum\pgf@circ@res@count=0
10907 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
10908 \fi
10909 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10910 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10911 \def\inputs{\the\pgf@circ@res@count}%
10912 }%
10913 \savedanchor\step{% 1/2 gap at edges
10914 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10915 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10916 \divide\pgf@circ@res@step by \pgf@circ@res@count
10917 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10918 }%
10919 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10920 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10921 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
10922 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
10923 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
10924
10925 \anchor{center}{\origin}% for backwards compatibility
10926 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
10927
10928 % create input anchors
10929 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
10930 \pgfmathloop%
10931 \ifnum\pgfmathcounter>\pgf@circ@res@count%
10932 \else%
10933 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
10934 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
10935 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10936 }%
10937 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
10938 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
10939 }%
10940 %}{}%
10941 \repeatpgfmathloop%
10942 }
10943
10944 \anchor{out}{\northeast\pgf@y=0pt}
10945 \anchor{bout}{\right\pgf@y=0pt}
10946
10947
10948 \anchor{left}{\left}% edges of component minus leads
10949 \anchor{right}{\right}
10950
10951 \anchor{north east}{\northeast}% see \Compass macro
10952 \anchor{south west}{\southwest}
10953 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10954 \pgfpoint{0cm}{\pgf@circ@res@up}}
10955 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10956 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10957 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10958 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10959 \pgfpoint{\pgf@circ@res@left}{0cm}}
10960 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10961 \pgfpoint{0cm}{\pgf@circ@res@down}}
10962 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10963 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10964 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10965 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10966 \pgfpoint{\pgf@circ@res@right}{0cm}}
10967
10968 \backgroundpath{
10969 \pgfsetcolor{\ctikzvalof{color}}
10970 #3
10971 }
10972 }
10973 }
10974 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10975 \pgfcircdeclarelogicport{and}{1}{
10976 \pgfextracty{\pgf@circ@res@temp}{\step}%
10977 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10978 \pgf@circ@res@count = \inputs\relax
10979 \ifpgfcirc@draw@input@leads
10980 %input leads
10981 \loop\ifnum\pgf@circ@res@count>0
10982 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10984 \pgfpathlineto{\pgfpoint
10985 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
10986 {\pgf@circ@res@temp}}
10987 \advance\pgf@circ@res@count by -1
10988 \repeat
10989 \fi
10990 % output lead
10991 \ifpgfcirc@draw@output@leads
10992 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10993 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
10994 \pgfusepath{draw}
10995 \fi
10996
10997
10998 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10999 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
11000
11001 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11002 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11003 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
11004 \pgfpathclose
11005 \pgf@circ@draworfill
11006 }
11007 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11008 \pgfcircdeclarelogicport{nand}{1}{
11009 \pgfextracty{\pgf@circ@res@temp}{\step}%
11010 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11011 \pgf@circ@res@count = \inputs\relax
11012 \ifpgfcirc@draw@input@leads
11013 %input leads
11014 \loop\ifnum\pgf@circ@res@count>0
11015 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11016 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11017 \pgfpathlineto{\pgfpoint
11018 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
11019 {\pgf@circ@res@temp}}
11020 \advance\pgf@circ@res@count by -1
11021 \repeat
11022 \fi
11023
11024 \ifpgfcirc@draw@output@leads
11025 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11026 \pgfpathlineto{\pgfpoint
11027 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
11028 \pgfusepath{draw}
11029 \fi
11030 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11031 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
11032 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
11033 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11034
11035 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
11036 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
11037 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
11038 \pgfpathclose
11039
11040 \pgfpathellipse
11041 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
11042 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11043 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11044
11045 \pgf@circ@draworfill
11046 }
11047 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11048 \pgfcircdeclarelogicport{nor}{2}{
11049 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
11050 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
11051 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11052 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
11053 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
11054 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11055
11056 \pgfextracty{\pgf@circ@res@temp}{\step}%
11057 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11058 \pgf@circ@res@count = \inputs\relax
11059 \ifpgfcirc@draw@input@leads
11060 %input leads
11061 \loop\ifnum\pgf@circ@res@count>0
11062 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11063 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11064 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
11065 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11066 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11067 \advance\pgf@circ@res@count by -1
11068 \repeat
11069 \fi
11070
11071 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
11072 \ifpgfcirc@draw@output@leads
11073 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11074 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11075 \pgfusepath{draw}
11076 \fi
11077
11078 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11079
11080 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
11081 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
11082 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11083 \advance\pgf@circ@res@other by -\pgf@circ@res@step
11084
11085 % main shape
11086 \ifpgfcirc@roundy@or@shapes
11087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11088 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11089 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11090 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11091 \pgfpathclose
11092 \else
11093 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11094 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11095 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11096 \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}}
11097 \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}}
11098 \pgfpathclose
11099 \fi
11100
11101 % not dot
11102 \pgfpathellipse
11103 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11104 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11105 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11106
11107 \pgf@circ@draworfill
11108 }
11109 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11110 \pgfcircdeclarelogicport{or}{2}{
11111 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
11112 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
11113 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11114 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
11115 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
11116 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11117
11118 \pgfextracty{\pgf@circ@res@temp}{\step}%
11119 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11120 \pgf@circ@res@count = \inputs\relax
11121 \ifpgfcirc@draw@input@leads
11122 %input leads
11123 \loop\ifnum\pgf@circ@res@count>0
11124 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11125 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11126 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
11127 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11128 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11129 \advance\pgf@circ@res@count by -1
11130 \repeat
11131 \fi
11132
11133 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
11134 \ifpgfcirc@draw@output@leads
11135 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11136 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11137 \pgfusepath{draw}
11138 \fi
11139
11140 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11141
11142 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
11143
11144 % main shape
11145 \ifpgfcirc@roundy@or@shapes
11146 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11147 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11148 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11149 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11150 \pgfpathclose
11151 \else
11152 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11153 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11154 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11155 \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}}
11156 \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}}
11157 \pgfpathclose
11158 \fi
11159
11160 \pgf@circ@draworfill
11161 }
11162 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11163 \pgfcircdeclarelogicport{xor}{3}{
11164 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
11165 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
11166 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11167 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
11168 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
11169 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11170 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
11171 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
11172 % this compensates for the effect of the line width on the gap between the arcs
11173 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
11174 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
11175
11176 \pgfextracty{\pgf@circ@res@temp}{\step}%
11177 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11178 \pgf@circ@res@count = \inputs\relax
11179 \ifpgfcirc@draw@input@leads
11180 %input leads
11181 \loop\ifnum\pgf@circ@res@count>0
11182 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11183 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11184 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
11185 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11186 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
11187 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11188 \advance\pgf@circ@res@count by -1
11189 \repeat
11190 \fi
11191
11192 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
11193 \ifpgfcirc@draw@output@leads
11194 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11195 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11196 \pgfusepath{draw}
11197 \fi
11198
11199 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11200
11201 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
11202
11203 % main shape
11204 \ifpgfcirc@roundy@or@shapes
11205 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11206 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11207 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11208 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
11209 \pgfpathclose
11210 \else
11211 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11212 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11213 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11214 \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}}
11215 \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}}
11216 \pgfpathclose
11217 \fi
11218 \pgf@circ@draworfill
11219
11220 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11221
11222 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11223 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11224
11225 \pgfusepath{draw}
11226 }
11227 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11228 \pgfcircdeclarelogicport{xnor}{3}{
11229 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
11230 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
11231 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
11232 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
11233 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
11234 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
11235 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
11236 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
11237 % this compensates for the effect of the line width on the gap between the arcs
11238 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
11239 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
11240
11241 \pgfextracty{\pgf@circ@res@temp}{\step}%
11242 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11243 \pgf@circ@res@count = \inputs\relax
11244 \ifpgfcirc@draw@input@leads
11245 %input leads
11246 \loop\ifnum\pgf@circ@res@count>0
11247 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11248 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11249 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
11250 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11251 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
11252 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
11253 \advance\pgf@circ@res@count by -1
11254 \repeat
11255 \fi
11256
11257 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
11258 \ifpgfcirc@draw@output@leads
11259 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11260 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
11261 \pgfusepath{draw}
11262 \fi
11263
11264 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11265
11266 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
11267 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
11268 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
11269 \advance\pgf@circ@res@other by -\pgf@circ@res@step
11270
11271 % main shape
11272 \ifpgfcirc@roundy@or@shapes
11273 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
11274 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11275 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11276 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11277 \pgfpathclose
11278 \else
11279 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11280 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11281 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11282 \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}}
11283 \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}}
11284 \pgfpathclose
11285 \fi
11286
11287 \pgfpathellipse
11288 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11289 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11290 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11291 \pgf@circ@draworfill
11292
11293 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
11294 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11295
11296 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11297 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11298
11299 \pgfusepath{draw}
11300 }
11301
11302 %%% Original one-input ports
11303
11304 \pgfdeclareshape{american not port}{
11305 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11306 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11307 \anchor{center}{\pgfpointorigin}
11308 \savedanchor\northwest{%
11309 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11310 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11311 \pgf@y=.5\pgf@y
11312 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11313 \pgf@x=.5\pgf@x
11314 }
11315 \anchor{in}{
11316 \northwest
11317 \pgf@y=0pt
11318 }
11319 \anchor{in 1}{
11320 \northwest
11321 \pgf@y=0pt
11322 }
11323 \anchor{left}{
11324 \northwest
11325 \pgf@x=0.7\pgf@x
11326 \pgf@y=0pt
11327 }
11328 \anchor{bin}{
11329 \northwest
11330 \pgf@x=0.7\pgf@x
11331 \pgf@y=0pt
11332 }
11333 \anchor{bin 1}{
11334 \northwest
11335 \pgf@y=0pt
11336 \pgf@x=0.7\pgf@x
11337 }
11338 \anchor{out}{
11339 \northwest
11340 \pgf@y=0pt
11341 \pgf@x=-\pgf@x
11342 }
11343 \anchor{right}{
11344 \northwest
11345 \pgf@y=0pt
11346 \pgf@x=-0.7\pgf@x
11347 }
11348 \anchor{bout}{
11349 \northwest
11350 \pgf@y=0pt
11351 \pgf@x=-0.7\pgf@x
11352 }
11353 \anchor{center}{
11354 \pgfpointorigin
11355 }
11356 \anchor{east}{
11357 \northwest
11358 \pgf@y=0pt
11359 \pgf@x=-\pgf@x
11360 }
11361 \anchor{west}{
11362 \northwest
11363 \pgf@y=0pt
11364 }
11365 \anchor{south}{
11366 \northwest
11367 \pgf@x=0pt
11368 \pgf@y=-\pgf@y
11369 }
11370 \anchor{north}{
11371 \northwest
11372 \pgf@x=0pt
11373 }
11374 \anchor{south west}{
11375 \northwest
11376 \pgf@y=-\pgf@y
11377 }
11378 \anchor{north east}{
11379 \northwest
11380 \pgf@x=-\pgf@x
11381 }
11382 \anchor{north west}{
11383 \northwest
11384 }
11385 \anchor{south east}{
11386 \northwest
11387 \pgf@x=-\pgf@x
11388 \pgf@y=-\pgf@y
11389 }
11390 \anchorborder{% this is used when the node is used as a path element
11391 \pgf@xa=\pgf@x
11392 \pgf@ya=\pgf@y
11393 \pgfextracty{\pgf@circ@res@up}{\northwest}
11394 \pgfextractx{\pgf@circ@res@left}{\northwest}
11395 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11396 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11397 }
11398 \anchor{text}{%
11399 % centered and a bit to the left (it's a triangle)!
11400 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11401 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11402 }
11403 \backgroundpath{
11404 \pgfsetcolor{\ctikzvalof{color}}
11405
11406 \northwest
11407 \pgf@circ@res@up = \pgf@y
11408 \pgf@circ@res@down = -\pgf@y
11409 \pgf@circ@res@right = -\pgf@x
11410 \pgf@circ@res@left = \pgf@x
11411
11412 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11413
11414 \pgfscope
11415 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11416 \pgftransformxshift{.7\pgf@circ@res@left}
11417 \pgf@circ@res@step=\pgf@circ@res@right
11418 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11419 \pgf@circ@res@step=.7\pgf@circ@res@step
11420
11421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11423 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11425 \pgf@circ@draworfill
11426 \pgfpathellipse
11427 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11428 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11429 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11430 \pgf@circ@draworfill
11431 \endpgfscope
11432
11433 \ifpgfcirc@draw@input@leads
11434 %input leads
11435 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11436 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11437 \fi
11438
11439 \ifpgfcirc@draw@output@leads
11440 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11441 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11442 \fi
11443
11444 \pgfusepath{draw}
11445 }
11446 }
11447
11448 \pgfdeclareshape{american buffer port}{
11449 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11450 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11451 \anchor{center}{\pgfpointorigin}
11452 \savedanchor\northwest{%
11453 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11454 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11455 \pgf@y=.5\pgf@y
11456 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11457 \pgf@x=.5\pgf@x
11458 }
11459 \anchor{in}{
11460 \northwest
11461 \pgf@y=0pt
11462 }
11463 \anchor{in 1}{
11464 \northwest
11465 \pgf@y=0pt
11466 }
11467 \anchor{left}{
11468 \northwest
11469 \pgf@x=0.7\pgf@x
11470 \pgf@y=0pt
11471 }
11472 \anchor{bin}{
11473 \northwest
11474 \pgf@x=0.7\pgf@x
11475 \pgf@y=0pt
11476 }
11477 \anchor{bin 1}{
11478 \northwest
11479 \pgf@y=0pt
11480 \pgf@x=0.7\pgf@x
11481 }
11482 \anchor{out}{
11483 \northwest
11484 \pgf@y=0pt
11485 \pgf@x=-\pgf@x
11486 }
11487 \anchor{right}{
11488 \northwest
11489 \pgf@y=0pt
11490 \pgf@x=-0.7\pgf@x
11491 }
11492 \anchor{bout}{
11493 \northwest
11494 \pgf@y=0pt
11495 \pgf@x=-0.7\pgf@x
11496 }
11497 \anchor{center}{
11498 \pgfpointorigin
11499 }
11500 \anchor{east}{
11501 \northwest
11502 \pgf@y=0pt
11503 \pgf@x=-\pgf@x
11504 }
11505 \anchor{west}{
11506 \northwest
11507 \pgf@y=0pt
11508 }
11509 \anchor{south}{
11510 \northwest
11511 \pgf@x=0pt
11512 \pgf@y=-\pgf@y
11513 }
11514 \anchor{north}{
11515 \northwest
11516 \pgf@x=0pt
11517 }
11518 \anchor{south west}{
11519 \northwest
11520 \pgf@y=-\pgf@y
11521 }
11522 \anchor{north east}{
11523 \northwest
11524 \pgf@x=-\pgf@x
11525 }
11526 \anchor{north west}{
11527 \northwest
11528 }
11529 \anchor{south east}{
11530 \northwest
11531 \pgf@x=-\pgf@x
11532 \pgf@y=-\pgf@y
11533 }
11534 \anchorborder{% this is used when the node is used as a path element
11535 \pgf@xa=\pgf@x
11536 \pgf@ya=\pgf@y
11537 \pgfextracty{\pgf@circ@res@up}{\northwest}
11538 \pgfextractx{\pgf@circ@res@left}{\northwest}
11539 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11540 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11541 }
11542 \anchor{text}{%
11543 % centered and a bit to the left (it's a triangle)!
11544 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11545 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11546 }
11547 \backgroundpath{
11548 \pgfsetcolor{\ctikzvalof{color}}
11549
11550 \northwest
11551 \pgf@circ@res@up = \pgf@y
11552 \pgf@circ@res@down = -\pgf@y
11553 \pgf@circ@res@right = -\pgf@x
11554 \pgf@circ@res@left = \pgf@x
11555
11556 \pgfscope
11557 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11558 \pgftransformxshift{.7\pgf@circ@res@left}
11559 \pgf@circ@res@step=\pgf@circ@res@right
11560 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11561 \pgf@circ@res@step=.7\pgf@circ@res@step
11562
11563 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11564 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11565 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11567 \pgf@circ@draworfill
11568 \endpgfscope
11569
11570 \ifpgfcirc@draw@input@leads
11571 %input leads
11572 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11573 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11574 \fi
11575
11576 \ifpgfcirc@draw@output@leads
11577 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11578 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11579 \fi
11580
11581 \pgfusepath{draw}
11582 }
11583 }
11584 \pgfdeclareshape{invschmitt}{
11585 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11586 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11587 \anchor{center}{\pgfpointorigin}
11588 \savedanchor\northwest{%
11589 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11590 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11591 \pgf@y=.5\pgf@y
11592 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11593 \pgf@x=.5\pgf@x
11594 }
11595 \anchor{in}{
11596 \northwest
11597 \pgf@y=0pt
11598 }
11599 \anchor{in 1}{
11600 \northwest
11601 \pgf@y=0pt
11602 }
11603 \anchor{left}{
11604 \northwest
11605 \pgf@y=0pt
11606 \pgf@x=0.7\pgf@x
11607 }
11608 \anchor{bin}{
11609 \northwest
11610 \pgf@y=0pt
11611 \pgf@x=0.7\pgf@x
11612 }
11613 \anchor{bin 1}{
11614 \northwest
11615 \pgf@y=0pt
11616 \pgf@x=0.7\pgf@x
11617 }
11618 \anchor{out}{
11619 \northwest
11620 \pgf@y=0pt
11621 \pgf@x=-\pgf@x
11622 }
11623 \anchor{right}{
11624 \northwest
11625 \pgf@y=0pt
11626 \pgf@x=-0.7\pgf@x
11627 }
11628 \anchor{bout}{
11629 \northwest
11630 \pgf@y=0pt
11631 \pgf@x=-0.7\pgf@x
11632 }
11633 \anchor{center}{
11634 \pgfpointorigin
11635 }
11636 \anchor{east}{
11637 \northwest
11638 \pgf@y=0pt
11639 \pgf@x=-\pgf@x
11640 }
11641 \anchor{west}{
11642 \northwest
11643 \pgf@y=0pt
11644 }
11645 \anchor{south}{
11646 \northwest
11647 \pgf@x=0pt
11648 \pgf@y=-\pgf@y
11649 }
11650 \anchor{north}{
11651 \northwest
11652 \pgf@x=0pt
11653 }
11654 \anchor{south west}{
11655 \northwest
11656 \pgf@y=-\pgf@y
11657 }
11658 \anchor{north east}{
11659 \northwest
11660 \pgf@x=-\pgf@x
11661 }
11662 \anchor{north west}{
11663 \northwest
11664 }
11665 \anchor{south east}{
11666 \northwest
11667 \pgf@x=-\pgf@x
11668 \pgf@y=-\pgf@y
11669 }
11670 \anchorborder{% this is used when the node is used as a path element
11671 \pgf@xa=\pgf@x
11672 \pgf@ya=\pgf@y
11673 \pgfextracty{\pgf@circ@res@up}{\northwest}
11674 \pgfextractx{\pgf@circ@res@left}{\northwest}
11675 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11676 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11677 }
11678 \anchor{text}{%
11679 % centered and a bit to the left (it's a triangle)!
11680 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11681 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11682 }
11683 \backgroundpath{
11684 \pgfsetcolor{\ctikzvalof{color}}
11685
11686 \northwest
11687 \pgf@circ@res@up = \pgf@y
11688 \pgf@circ@res@down = -\pgf@y
11689 \pgf@circ@res@right = -\pgf@x
11690 \pgf@circ@res@left = \pgf@x
11691
11692 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11693
11694 \pgfscope
11695 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11696 \pgftransformxshift{.7\pgf@circ@res@left}
11697 \pgf@circ@res@step=\pgf@circ@res@right
11698 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11699 \pgf@circ@res@step=.7\pgf@circ@res@step
11700
11701 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11702 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11703 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11704 \pgfpathclose
11705 \pgf@circ@draworfill
11706 \pgfpathellipse
11707 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11708 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11709 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11710 \pgf@circ@draworfill
11711 \endpgfscope
11712
11713 \ifpgfcirc@draw@input@leads
11714 %input leads
11715 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11716 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11717 \fi
11718
11719 \ifpgfcirc@draw@output@leads
11720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11721 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11722 \fi
11723 \pgfusepath{draw}
11724 %draw inner shape
11725
11726 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11727
11728 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11729 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11730 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11731 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11732 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11733 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11734 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11735 \pgfusepath{draw}
11736
11737 }
11738 }
11739
11740 \pgfdeclareshape{schmitt}{
11741 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11742 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11743 \anchor{center}{\pgfpointorigin}
11744 \savedanchor\northwest{%
11745 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11746 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11747 \pgf@y=.5\pgf@y
11748 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11749 \pgf@x=.5\pgf@x
11750 }
11751 \anchor{in}{
11752 \northwest
11753 \pgf@y=0pt
11754 }
11755 \anchor{in 1}{
11756 \northwest
11757 \pgf@y=0pt
11758 }
11759 \anchor{left}{
11760 \northwest
11761 \pgf@y=0pt
11762 \pgf@x=0.7\pgf@x
11763 }
11764 \anchor{bin}{
11765 \northwest
11766 \pgf@y=0pt
11767 \pgf@x=0.7\pgf@x
11768 }
11769 \anchor{bin 1}{
11770 \northwest
11771 \pgf@y=0pt
11772 \pgf@x=0.7\pgf@x
11773 }
11774 \anchor{out}{
11775 \northwest
11776 \pgf@y=0pt
11777 \pgf@x=-\pgf@x
11778 }
11779 \anchor{right}{
11780 \northwest
11781 \pgf@y=0pt
11782 \pgf@x=-.7\pgf@x
11783 }
11784 \anchor{bout}{
11785 \northwest
11786 \pgf@y=0pt
11787 \pgf@x=-.7\pgf@x
11788 }
11789 \anchor{center}{
11790 \pgfpointorigin
11791 }
11792 \anchor{east}{
11793 \northwest
11794 \pgf@y=0pt
11795 \pgf@x=-\pgf@x
11796 }
11797 \anchor{west}{
11798 \northwest
11799 \pgf@y=0pt
11800 }
11801 \anchor{south}{
11802 \northwest
11803 \pgf@x=0pt
11804 \pgf@y=-\pgf@y
11805 }
11806 \anchor{north}{
11807 \northwest
11808 \pgf@x=0pt
11809 }
11810 \anchor{south west}{
11811 \northwest
11812 \pgf@y=-\pgf@y
11813 }
11814 \anchor{north east}{
11815 \northwest
11816 \pgf@x=-\pgf@x
11817 }
11818 \anchor{north west}{
11819 \northwest
11820 }
11821 \anchor{south east}{
11822 \northwest
11823 \pgf@x=-\pgf@x
11824 \pgf@y=-\pgf@y
11825 }
11826 \anchorborder{% this is used when the node is used as a path element
11827 \pgf@xa=\pgf@x
11828 \pgf@ya=\pgf@y
11829 \pgfextracty{\pgf@circ@res@up}{\northwest}
11830 \pgfextractx{\pgf@circ@res@left}{\northwest}
11831 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11832 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11833 }
11834 \anchor{text}{%
11835 % centered and a bit to the left (it's a triangle)!
11836 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11837 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11838 }
11839 \backgroundpath{
11840 \pgfsetcolor{\ctikzvalof{color}}
11841
11842
11843 \northwest
11844 \pgf@circ@res@up = \pgf@y
11845 \pgf@circ@res@down = -\pgf@y
11846 \pgf@circ@res@right = -\pgf@x
11847 \pgf@circ@res@left = \pgf@x
11848
11849 \pgfscope
11850 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11851 \pgftransformxshift{.7\pgf@circ@res@left}
11852 \pgf@circ@res@step=\pgf@circ@res@right
11853 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11854 \pgf@circ@res@step=.7\pgf@circ@res@step
11855
11856 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11857 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11858 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11859 \pgfpathclose
11860 \pgf@circ@draworfill
11861 \endpgfscope
11862
11863 \ifpgfcirc@draw@input@leads
11864 %input leads
11865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11866 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11867 \fi
11868
11869 \ifpgfcirc@draw@output@leads
11870 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11871 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
11872 \fi
11873 \pgfusepath{draw}
11874 %draw inner shape
11875
11876 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11877
11878 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11879 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11880 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11881 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11882 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11883 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11884 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11885 \pgfusepath{draw}
11886
11887 }
11888 }
11889
11890
11891 %%% start european logic ports, from John Kormylo
11892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11893 %%
11894
11895 % #1 - name
11896 % #2 - text inside
11897 % #3 - number of inputs
11898 % #4 = is it a not?
11899 %
11900 % option to add a circle for not-output, see
11901 % https://github.com/circuitikz/circuitikz/issues/385
11902 %
11903 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
11904 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
11905 \ctikzset{tripoles/european not shape/.initial=ocirc}
11906 \ctikzset{tripoles/european not symbol/.is choice}
11907 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
11908 \ctikzset{tripoles/european not symbol/circle/.code={%
11909 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
11910 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
11911 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
11912
11913 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
11914 \pgfdeclareshape{european #1 port}
11915 {
11916 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11917 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11918 \saveddimen{\boutshift}{%
11919 \edef\pgf@temp{not}
11920 \edef\pgf@circ@temp{#4}
11921 \ifx\pgf@temp\pgf@circ@temp % is a not
11922 \ifpgf@circ@european@port@circle
11923 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11924 \edef\pgf@temp{ocirc}
11925 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
11926 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
11927 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11928 \else % it's ieee not circ
11929 \pgf@circ@notradius % defined together with ieeestd ports
11930 \pgf@x=2\pgf@circ@res@temp
11931 \fi
11932 \else
11933 \pgf@x=0pt
11934 \fi
11935 \else
11936 \pgf@x=0pt
11937 \fi
11938 }
11939 \savedmacro\resize{% automatic
11940 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11941 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11942 \pgf@circ@res@up = .5\pgf@circ@res@up
11943 \pgf@circ@res@down = -\pgf@circ@res@up
11944 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
11945 \pgf@circ@res@right = .5\pgf@circ@res@right
11946 \pgf@circ@res@left = -\pgf@circ@res@right
11947 }%
11948 \savedmacro\inputs{% get number of inputs
11949 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11950 \ifnum\pgf@circ@res@count=0
11951 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
11952 \fi
11953 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11954 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11955 \def\inputs{\the\pgf@circ@res@count}%
11956 }%
11957 \savedanchor\step{% 1/2 gap at edges
11958 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11959 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11960 \divide\pgf@circ@res@step by #3
11961 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11962 }%
11963 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
11964 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
11965 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11966 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
11967 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
11968
11969 \anchor{center}{\origin}% for backwards compatibility
11970 % the text anchor overlaps the logic symbol
11971 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
11972 % create input anchors
11973 \ifnum#3=1\relax
11974 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11975 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11976 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11977 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11978 \else
11979 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
11980 \pgfmathloop%
11981 \ifnum\pgfmathcounter>#3%
11982 \else%
11983 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
11984 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
11985 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11986 }%
11987 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
11988 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
11989 }%
11990 %}{}%
11991 \repeatpgfmathloop%
11992 }
11993 \fi
11994 \anchor{out}{\northeast\pgf@y=0pt}
11995 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11996
11997 \anchor{left}{\left}% edges of component minus leads
11998 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11999
12000 \anchor{north east}{\northeast}% see \Compass macro
12001 \anchor{south west}{\southwest}
12002 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12003 \pgfpoint{0cm}{\pgf@circ@res@up}}
12004 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12005 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12006 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12007 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
12008 \pgfpoint{\pgf@circ@res@left}{0cm}}
12009 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12010 \pgfpoint{0cm}{\pgf@circ@res@down}}
12011 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12012 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12013 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12014 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
12015 \pgfpoint{\pgf@circ@res@right}{0cm}}
12016
12017 \anchorborder{% this is used when the node is used as a path element
12018 \pgf@xa=\pgf@x
12019 \pgf@ya=\pgf@y
12020 \pgfextracty{\pgf@circ@res@up}{\northeast}
12021 \pgfextractx{\pgf@circ@res@right}{\northeast}
12022 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12023 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12024 }
12025 \backgroundpath{
12026 \pgfsetcolor{\ctikzvalof{color}}
12027 \pgfstartlinewidth=\pgflinewidth
12028 \pgfscope
12029 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12030 \pgfpathrectanglecorners
12031 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
12032 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
12033 \pgf@circ@draworfill
12034 \endpgfscope
12035 \ifpgfcirc@draw@input@leads
12036 %input leads
12037 \ifnum#3=1\relax
12038 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
12039 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
12040 \else
12041 \pgfextracty{\pgf@circ@res@temp}{\step}%
12042 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12043 %\pgf@circ@res@count = #3\relax% redundant
12044 \loop\ifnum\pgf@circ@res@count>0
12045 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12047 \pgfpathlineto{\pgfpoint
12048 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
12049 {\pgf@circ@res@temp}}
12050 \advance\pgf@circ@res@count by -1
12051 \repeat
12052 \fi
12053 \pgfusepath{draw}
12054 \fi
12055 %
12056 \ifpgfcirc@draw@output@leads
12057 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12058 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
12059 \pgfusepath{draw}
12060 \fi
12061 %
12062 \edef\pgf@temp{not}
12063 \edef\pgf@circ@temp{#4}
12064 \ifx\pgf@temp\pgf@circ@temp % is a not
12065 \ifpgf@circ@european@port@circle
12066 \pgfscope
12067 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12068 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
12069 % reset linewidth for IEEE ports, otherwise they will multiply...
12070 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
12071 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
12072 \endpgfscope
12073 \else
12074 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
12075 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
12076 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
12077 \pgfusepath{draw}
12078 \fi
12079 \fi
12080 %
12081 \pgfpathmoveto{\pgfpointorigin}
12082 \pgftext{#2}
12083 }
12084 }
12085 }
12086 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
12087 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
12088 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
12089 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
12090 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
12091 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
12092 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
12093 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
12094
12095 %% end european logic ports
12096
12097 %%%%%%%%%%%%%%%%%%%%%%%%
12098 %% Transistors
12099 %%%%%%%%%%%%%%%%%%%%%%%%
12100
12101 %
12102 % definitions for transistor circles
12103 %
12104 \ctikzset{transistor circle/.is family}
12105 \ctikzset{transistor circle/relative thickness/.initial=1}
12106 \ctikzset{transistor circle/color/.initial=default}
12107 \ctikzset{transistor circle/dash/.initial=none}
12108 \ctikzset{transistor circle/scale circle radius/.initial=1}
12109 \ctikzset{transistor circle/default base in/.initial=0.9}
12110 \ctikzset{transistor circle/njfet base in/.initial=1.05}
12111 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
12112 \ctikzset{transistor circle/isfet base in/.initial=0.65}
12113
12114 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
12115 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
12116 \tikzset{tr circle/.is if=pgf@circ@trcircle}
12117 %
12118 % add a circle to the transistor:
12119 %
12120 \def\pgfcirc@transistorcircle{
12121 \ifpgf@circ@trcircle
12122 \pgfscope
12123 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12124 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
12125 \edef\@@none{none}\edef\@@default{default}
12126 \edef\@@tmp{\ctikzvalof{transistor circle/color}}
12127 \ifx\@@tmp\@@default\else
12128 \pgfsetcolor{\@@tmp}
12129 \fi
12130 \edef\@@tmp{\ctikzvalof{transistor circle/dash}}
12131 \ifx\@@tmp\@@none\else
12132 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
12133 \fi
12134 % radius of the circle
12135 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
12136 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
12137 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
12138 \pgf@circ@draworfill
12139 \endpgfscope
12140 \fi
12141 }
12142
12143 \long\def\pgfcircdeclaretransistor#1#2#3{
12144 \pgfdeclareshape{#1}
12145 {
12146 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
12147 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12148 \savedmacro{\circlebase}{
12149 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
12150 {% yes, we have it
12151 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
12152 }{% no, use default
12153 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
12154 }}
12155 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
12156 \saveddimen{\extrabodydiodelen}{
12157 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12158 \ifpgf@circuit@fet@bodydiode
12159 % try to put the text to the right of the flyback diode
12160 \pgfmathsetlength{\pgf@x}{(
12161 \ctikzvalof{tripoles/#1/bodydiode distance}*
12162 \ctikzvalof{tripoles/#1/width} +
12163 \ctikzvalof{tripoles/#1/bodydiode scale}*
12164 \ctikzvalof{bipoles/diode/height}/2
12165 )*\pgf@circ@scaled@Rlen}
12166 \else
12167 \pgf@x=0pt\relax
12168 \fi
12169 }
12170 \savedmacro{\scaecircleradius}{
12171 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
12172 }
12173 \saveddimen{\circleradius}{
12174 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12175 % repeat the extrabodydiodelen (grrr)
12176 \ifpgf@circuit@fet@bodydiode
12177 % try to put the text to the right of the flyback diode
12178 \pgfmathsetlength{\pgf@circ@res@other}{(
12179 \ctikzvalof{tripoles/#1/bodydiode distance}*
12180 \ctikzvalof{tripoles/#1/width} +
12181 \ctikzvalof{tripoles/#1/bodydiode scale}*
12182 \ctikzvalof{bipoles/diode/height}/2
12183 )*\pgf@circ@scaled@Rlen}
12184 \else
12185 \pgf@circ@res@other=0pt\relax
12186 \fi
12187 % left
12188 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12189 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
12190 % northeast
12191 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
12192 \pgf@yb=.5\pgf@yb
12193 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
12194 %
12195 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
12196 % find the radius of the circle
12197 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
12198 }
12199 \saveddimen{\circleleft}{
12200 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12201 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12202 \pgf@x=\circlebase\pgf@xa
12203 }
12204 \anchor{circle center}{
12205 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
12206 }
12207 \anchor{center}{
12208 \pgfpointorigin
12209 }
12210 \savedanchor\northeast{% upper right
12211 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12212 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
12213 \pgf@y=.5\pgf@y
12214 \pgf@x=0pt
12215 }
12216 \savedanchor\left{%center left
12217 \pgf@y=0pt
12218 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12219 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
12220 }
12221 \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
12222 \pgf@y=0pt
12223 \pgf@x=0pt
12224 }
12225 \anchor{text}{
12226 \northeast
12227 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12228 \ifpgf@circuit@transisors@fixlabels
12229 \ifpgf@circuit@fet@bodydiode
12230 \advance \pgf@x by \extrabodydiodelen
12231 \fi
12232 \ifpgf@circ@trcircle
12233 \left\pgf@xa=\pgf@x
12234 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
12235 % \advance \pgf@x by \circleradius
12236 \fi
12237 % add a bit of space to avoid central (substrate) terminal if drawn
12238 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
12239 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
12240 \else
12241 \pgf@y=.7\pgf@y
12242 \pgf@x= \pgf@circ@scaled@Rlen
12243 \pgf@x=0.1\pgf@x
12244 \fi
12245 }
12246 \anchor{pathstart}{ % south
12247 \northeast
12248 \pgf@y=-\pgf@y
12249 }
12250 \anchor{pathend}{
12251 \northeast
12252 }
12253 \anchor{north}{
12254 \northeast
12255 \pgf@circ@res@step=\pgf@y
12256 \left
12257 \pgf@y=\pgf@circ@res@step
12258 \pgf@x=.5\pgf@x
12259 }
12260 \anchor{west}{
12261 \left
12262 }
12263 \anchor{east}{
12264 \northeast
12265 \pgf@y=0pt
12266 }
12267 \anchor{south}{
12268 \northeast
12269 \pgf@circ@res@step=\pgf@y
12270 \left
12271 \pgf@y=-\pgf@circ@res@step
12272 \pgf@x=.5\pgf@x
12273 }
12274 \anchor{south west}{
12275 \northeast
12276 \pgf@circ@res@step=\pgf@y
12277 \left
12278 \pgf@y=-\pgf@circ@res@step
12279 }
12280 \anchor{north east}{
12281 \northeast
12282 }
12283 \anchor{north west}{
12284 \northeast
12285 \pgf@circ@res@step=\pgf@y
12286 \left
12287 \pgf@y=\pgf@circ@res@step
12288 }
12289 \anchor{south east}{
12290 \northeast
12291 \pgf@y=-\pgf@y
12292 }
12293 \anchor{B}{
12294 \northeast
12295 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12296 \left
12297 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12298 }
12299 \anchor{base}{
12300 \northeast
12301 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12302 \left
12303 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12304 }
12305 \anchor{bulk}{ %added by Burak Kelleci
12306 \northeast
12307 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12308 \right
12309 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12310 }
12311 \anchor{nobulk}{ %added by Burak Kelleci
12312 \left
12313 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
12314 }
12315 \anchor{G}{
12316 \northeast
12317 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12318 \left
12319 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12320 }
12321 \anchor{gate}{
12322 \northeast
12323 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
12324 \left
12325 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
12326 }
12327 \anchor{nobase}{
12328 \left
12329 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
12330 }
12331 \anchor{circle base}{
12332 \left
12333 \pgf@x=\circlebase\pgf@x
12334 }
12335 \anchor{nogate}{
12336 \left
12337 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
12338 }
12339 \anchor{E}{
12340 \northeast
12341 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12342 }
12343 \anchor{emitter}{
12344 \northeast
12345 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12346 }
12347 \anchor{C}{
12348 \northeast
12349 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12350 }
12351 \anchor{collector}{
12352 \northeast
12353 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12354 }
12355 \anchor{S}{
12356 \northeast
12357 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12358 }
12359 \anchor{source}{
12360 \northeast
12361 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12362 }
12363 \anchor{D}{
12364 \northeast
12365 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12366 }
12367 \anchor{drain}{
12368 \northeast
12369 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12370 }
12371 \anchor{body C in}{
12372 \northeast
12373 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12374 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
12375 }
12376 \anchor{circle C}{
12377 \left
12378 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
12379 \northeast
12380 \pgf@xb=\pgf@x %this is #2 of the circle
12381 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
12382 % the base of the triangle is x_2 - x_1 - r
12383 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
12384 % so let's go with the height
12385 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
12386 % finally, direction
12387 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
12388 }
12389 \anchor{circle E}{
12390 \left
12391 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
12392 \northeast
12393 \pgf@xb=\pgf@x %this is #2 of the circle
12394 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
12395 % the base of the triangle is x_2 - x_1 - r
12396 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
12397 % so let's go with the height
12398 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
12399 % finally, direction
12400 % finally, direction
12401 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
12402 }
12403 \anchor{body E in}{
12404 \northeast
12405 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12406 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
12407 }
12408 \anchor{body C out}{
12409 \northeast
12410 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12411 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
12412 \pgf@y=\pgf@ya
12413 \left
12414 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
12415 \pgf@y=\pgf@ya
12416 }
12417 \anchor{body E out}{
12418 \northeast
12419 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
12420 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
12421 \pgf@y=\pgf@ya
12422 \left
12423 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
12424 \pgf@y=\pgf@ya
12425 }
12426 #2
12427 \backgroundpath{
12428 \pgftransformationadjustments
12429 \pgfsetcolor{\ctikzvalof{color}}
12430 %
12431 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
12432 \pgf@circuit@trans@ntypetrue
12433 \else
12434 \pgf@circuit@trans@ntypefalse
12435 \fi
12436 \northeast
12437 \pgf@circ@res@up = \pgf@y
12438 \pgf@circ@res@down = -\pgf@y
12439 \pgf@circ@res@right = \pgf@x
12440 \left
12441 \pgf@circ@res@left = \pgf@x
12442 \pgf@circ@scaled@Rlen=\scaledRlen
12443 %
12444 #3
12445 % BODY DIODE
12446 \ifpgf@circuit@fet@bodydiode
12447 \drawbodydiode{#1}
12448 \fi
12449 %
12450 }
12451 }
12452 }
12453
12454 \long\def\drawbodydiode#1{
12455 \pgfscope
12456 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
12457 \pgftransformrotate{90}
12458 % diode scale and bodydiode scale interacts. We want the size of the diode
12459 % proportional to the transistor, so we will:
12460 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
12461 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
12462 \pgftransformscale{\@@BDscale}
12463 \ifpgf@circuit@fulldiode
12464 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
12465 \else
12466 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
12467 \fi
12468 \endpgfscope
12469 % Draw stroke line
12470 \ifpgf@circuit@strokediode
12471 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
12472 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
12473 \pgfusepath{stroke}
12474 \fi
12475 %Draw upper connection to body diode
12476 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
12477 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12478 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
12479 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12480 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
12481 \pgfusepath{draw}
12482 \pgfscope
12483 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
12484 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
12485 \pgftransformscale{0.5}
12486 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
12487 \endpgfscope{}
12488 %Draw lower connection to body diode
12489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
12490 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12491 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12492 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
12493 \pgfusepath{draw}
12494 \pgfscope
12495 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
12496 \pgftransformscale{0.5}
12497 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
12498 \endpgfscope
12499 }
12500
12501 \long\def\declarebpt#1{
12502 \pgfcircdeclaretransistor{#1}{
12503 \anchor{inner up}{
12504 \northeast
12505 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
12506 }
12507 \anchor{inner down}{
12508 \northeast
12509 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
12510 }
12511 }{
12512
12513 % add the circle if requested (before everything else, so we can fill it)
12514 \pgfcirc@transistorcircle
12515
12516 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12517 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12518 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12519 \pgfpathlineto{\pgfpoint
12520 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12521 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
12522 \pgfusepath{draw}
12523
12524 % drawing base
12525 \pgfscope
12526 \pgfpathmoveto{\pgfpoint
12527 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12528 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12529 \pgfpathlineto{\pgfpoint
12530 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12531 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12532 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12533 \ifpgf@circuit@bpt@schottky
12534 % upper
12535 \pgfpathmoveto{\pgfpoint
12536 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12537 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12538 \pgfpathlineto{\pgfpoint
12539 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12540 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12541 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12542 \pgfpathlineto{\pgfpoint
12543 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12544 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12545 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12546 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12547 \pgfpathlineto{\pgfpoint
12548 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12549 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12550 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12551 % % lower
12552 \pgfpathmoveto{\pgfpoint
12553 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12554 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12555 \pgfpathlineto{\pgfpoint
12556 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12557 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12558 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12559 \pgfpathlineto{\pgfpoint
12560 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12561 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12562 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12563 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12564 \pgfpathlineto{\pgfpoint
12565 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12566 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12567 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12568 \fi
12569 \pgfusepath{draw}
12570 \endpgfscope
12571
12572 \pgfpathmoveto{\pgfpoint
12573 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12574 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
12575 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12576 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12577 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12578 \pgfusepath{draw}
12579 %draw arrow depending on type of transistor
12580 \pgfscope
12581 \pgfslopedattimetrue
12582 \pgfallowupsidedownattimetrue
12583 \pgfresetnontranslationattimefalse
12584 \edef\@@anchor{center}
12585 \ifpgf@circuit@trans@ntype
12586 \ifpgf@circuit@trans@arrowatend
12587 \edef\@@anchor{btip}
12588 \pgftransformlineattime{1.0}{%
12589 \pgfpoint%
12590 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12591 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12592 }{%
12593 \pgfpoint{\pgf@circ@res@right}%
12594 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12595 }
12596 \else
12597 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12598 \pgfpoint%
12599 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12600 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12601 }{%
12602 \pgfpoint{\pgf@circ@res@right}%
12603 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12604 }
12605 \fi
12606 \else % p-type
12607 \ifpgf@circuit@trans@arrowatend
12608 \edef\@@anchor{tip}
12609 \pgftransformlineattime{1.0}{%
12610 \pgfpoint{\pgf@circ@res@right}%
12611 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12612 }{%
12613 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12614 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12615 }
12616 \else
12617 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12618 \pgfpoint{\pgf@circ@res@right}%
12619 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12620 }{%
12621 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12622 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12623 }
12624 \fi
12625 \fi
12626 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12627 \endpgfscope
12628
12629 \ifpgf@circuit@bpt@drawphoto
12630 \pgfscope
12631 \pgfsetarrowsstart{latexslim}
12632 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12633 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12634 {\pgf@circ@res@up+\pgf@circ@res@down}}
12635 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12636 \pgfpathlineto{\pgfpointadd{\pgfpoint
12637 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12638 {\pgf@circ@res@up+\pgf@circ@res@down}}
12639 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
12640 \pgfusepath{draw}
12641 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12642 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12643 {\pgf@circ@res@up+\pgf@circ@res@down}}
12644 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
12645 \pgfpathlineto{\pgfpointadd{\pgfpoint
12646 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12647 {\pgf@circ@res@up+\pgf@circ@res@down}}
12648 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12649 \pgfusepath{draw}
12650 \endpgfscope
12651 \else
12652 \ifpgf@circuit@bpt@drawbase
12653 \pgfpathmoveto{\pgfpoint
12654 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12655 {\pgf@circ@res@up+\pgf@circ@res@down}}
12656 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12657 \pgfusepath{draw}
12658 \fi
12659 \fi
12660 }
12661 }
12662
12663 \declarebpt{npn}
12664 \declarebpt{pnp}
12665 %
12666 % multi-emitter and multi-collector BJTs by Romano Giannetti
12667 %
12668 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
12669 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12670 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12671 \ifnum\cdir>0 % NPN, above
12672 \pgfpoint{\pgf@circ@res@temp}{%
12673 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12674 \else % PNP, below
12675 \pgfpoint{\pgf@circ@res@temp}{%
12676 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12677 \fi
12678 }
12679 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
12680 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12681 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12682 \ifnum\cdir<0 % PNP, above
12683 \pgfpoint{\pgf@circ@res@temp}{%
12684 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12685 \else % PNP, below
12686 \pgfpoint{\pgf@circ@res@temp}{%
12687 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12688 \fi
12689 }
12690
12691 \long\def\declarebjt#1{
12692 \pgfdeclareshape{bjt#1}{
12693 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
12694 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12695 % \cdir is 1 for npn, -1 for pnp
12696 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
12697 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
12698 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
12699 % step up or down for the additional C/Es
12700 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
12701 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12702 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12703 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
12704 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12705 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
12706 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12707 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12708 \pgf@y=.5\pgf@y
12709 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12710 \pgf@x=.5\pgf@x
12711 }
12712 \savedanchor\northeast{% upper right
12713 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12714 \pgfmathsetlength{\pgf@circ@res@step}{%
12715 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12716 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12717 \ifnum\cdir> 0
12718 \edef\numup{\numC}\edef\numdown{\numE}
12719 \else
12720 \edef\numup{\numE}\edef\numdown{\numC}
12721 \fi
12722 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12723 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
12724 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12725 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12726 \pgf@x=.5\pgf@x
12727 }
12728 \savedanchor\southeast{% lower right
12729 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12730 \pgfmathsetlength{\pgf@circ@res@step}{%
12731 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12732 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12733 \ifnum\cdir> 0
12734 \edef\numup{\numC}\edef\numdown{\numE}
12735 \else
12736 \edef\numup{\numE}\edef\numdown{\numC}
12737 \fi
12738 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12739 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
12740 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12741 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12742 \pgf@x=.5\pgf@x
12743 }
12744 \savedanchor\southwest{% lower left
12745 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12746 \pgfmathsetlength{\pgf@circ@res@step}{%
12747 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12748 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12749 \ifnum\cdir> 0
12750 \edef\numup{\numC}\edef\numdown{\numE}
12751 \else
12752 \edef\numup{\numE}\edef\numdown{\numC}
12753 \fi
12754 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12755 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
12756 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12757 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
12758 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12759 }
12760 \anchor{center}{\pgfpointorigin}
12761 \anchor{north}{\northeast\pgf@x=0cm\relax}
12762 \anchor{east}{\northeast\pgf@y=0cm\relax}
12763 \anchor{south}{\southwest\pgf@x=0cm\relax}
12764 \anchor{west}{\southwest\pgf@y=0cm}
12765 \anchor{north east}{\northeast}
12766 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
12767 \anchor{south west}{\southwest}
12768 \anchor{south east}{\southeast}
12769
12770 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
12771 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
12772 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
12773 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
12774 % center of the base "bar"
12775 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
12776 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12777 }
12778 % geometrical centers
12779 \anchor{vcenter}{\pgf@x=0cm\relax
12780 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12781 }
12782 \anchor{gcenter}{%
12783 \northeast\pgf@xa=0.5\pgf@x
12784 \southwest\advance\pgf@xa by 0.5\pgf@x
12785 \pgf@x=\pgf@xa
12786 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12787 }
12788 % external connections
12789 \anchor{E}{
12790 \ifnum\cdir>0% npn, emitter down
12791 \southeast
12792 \else
12793 \northeast
12794 \fi
12795 }% first emitter
12796 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
12797 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
12798 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
12799
12800 \backgroundpath{
12801 \pgftransformationadjustments
12802 \pgfsetcolor{\ctikzvalof{color}}
12803 %
12804 % set the type and up and down number of connections
12805 %
12806 \ifnum\cdir> 0
12807 \pgf@circuit@trans@ntypetrue
12808 \edef\numup{\numC}
12809 \edef\numdown{\numE}
12810 \else
12811 \pgf@circuit@trans@ntypefalse
12812 \edef\numup{\numE}
12813 \edef\numdown{\numC}
12814 \fi
12815 \basedimension
12816 \pgf@circ@res@up = \pgf@y
12817 \pgf@circ@res@down = -\pgf@y
12818 \pgf@circ@res@right = \pgf@x
12819 \pgf@circ@res@left = -\pgf@x
12820 \pgf@circ@scaled@Rlen=\scaledRlen
12821 \pgf@circ@res@step=\multistep
12822 %
12823 % set arrow positions options
12824 %
12825 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
12826 \ifpgf@circuit@trans@arrowatend
12827 \edef\@@pos{1.0}
12828 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
12829 \edef\@@anchor{btip}
12830 \else
12831 \edef\@@anchor{tip}
12832 \fi
12833 \fi
12834 %
12835 % Drawing upper connections
12836 %
12837 \pgfscope
12838 \pgf@circ@count@a=\numup\relax
12839 \pgfmathloop%
12840 \ifnum\pgf@circ@count@a>0
12841 \advance\pgf@circ@count@a-1\relax
12842 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12843 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
12844 \pgfpathmoveto{\pgfpoint
12845 {\pgf@circ@res@right}%
12846 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12847 \pgfpathlineto{\pgfpoint
12848 {\pgf@circ@res@right}%
12849 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12850 \else
12851 \pgfpathmoveto{\pgfpoint
12852 {\pgf@circ@res@right}%
12853 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12854 \fi
12855 \pgfpathlineto{\pgfpoint
12856 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12857 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
12858 \pgfsetroundcap % better when connecting to sloped lines
12859 \pgfusepath{draw}
12860 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
12861 \pgfscope
12862 \pgfslopedattimetrue
12863 \pgfallowupsidedownattimetrue
12864 \pgfresetnontranslationattimefalse
12865 \pgftransformlineattime{\@@pos}{%
12866 \pgfpoint
12867 {\pgf@circ@res@right}%
12868 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
12869 }{\pgfpoint
12870 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12871 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
12872 }
12873 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12874 \endpgfscope
12875 \fi
12876 \repeatpgfmathloop
12877 \endpgfscope
12878 %
12879 % Drawing base
12880 %
12881 \pgfscope
12882 \pgfpathmoveto{\pgfpoint
12883 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12884 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12885 \pgfpathlineto{\pgfpoint
12886 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12887 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12888 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12889 \ifpgf@circuit@bpt@schottky
12890 % upper
12891 \pgfpathmoveto{\pgfpoint
12892 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12893 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12894 \pgfpathlineto{\pgfpoint
12895 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12896 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12897 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12898 \pgfpathlineto{\pgfpoint
12899 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12900 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12901 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12902 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12903 \pgfpathlineto{\pgfpoint
12904 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12905 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12906 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12907 % lower
12908 \pgfpathmoveto{\pgfpoint
12909 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12910 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12911 \pgfpathlineto{\pgfpoint
12912 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12913 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12914 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12915 \pgfpathlineto{\pgfpoint
12916 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12917 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12918 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12919 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12920 \pgfpathlineto{\pgfpoint
12921 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12922 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12923 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12924 \fi
12925 \pgfsetroundcap % I like it more...
12926 \pgfusepath{draw}
12927 \endpgfscope
12928 %
12929 % draw base external connection
12930 %
12931 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
12932 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
12933 \pgfusepath{draw}
12934 %
12935 % Drawing lower connections
12936 %
12937 \pgfscope
12938 \pgf@circ@count@a=\numdown\relax
12939 \pgfmathloop%
12940 \ifnum\pgf@circ@count@a>0
12941 \advance\pgf@circ@count@a-1\relax
12942 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12943 \pgfpathmoveto{\pgfpoint
12944 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12945 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
12946 \pgfpathlineto{\pgfpoint
12947 {\pgf@circ@res@right}
12948 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
12949 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
12950 \pgfpathlineto{\pgfpoint
12951 {\pgf@circ@res@right}
12952 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
12953 \fi
12954 \pgfsetroundcap % better when connecting to sloped lines
12955 \pgfusepath{draw}
12956 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
12957 \pgfscope
12958 \pgfslopedattimetrue
12959 \pgfallowupsidedownattimetrue
12960 \pgfresetnontranslationattimefalse
12961 \pgftransformlineattime{\@@pos}{%
12962 \pgfpoint
12963 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12964 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
12965 }{\pgfpoint
12966 {\pgf@circ@res@right}%
12967 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
12968 }
12969 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12970 \endpgfscope
12971 \fi
12972 \repeatpgfmathloop
12973 \endpgfscope
12974 }
12975 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
12976 % and is executed just before a node is drawn.
12977 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
12978 % Start with the maximum collector number and go backwards.
12979 \pgf@circ@count@a=\numC\relax
12980 \pgfmathloop%
12981 \ifnum\pgf@circ@count@a>0
12982 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12983 % electrical contact, and the "border one" like `bpin 1` for labels.
12984 % they will coincide if `external pins width` is set to 0.
12985 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
12986 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
12987 }
12988 \advance\pgf@circ@count@a by -1\relax%
12989 \repeatpgfmathloop%
12990 % and emitters
12991 \pgf@circ@count@a=\numE\relax
12992 \pgfmathloop%
12993 \ifnum\pgf@circ@count@a>0
12994 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12995 % electrical contact, and the "border one" like `bpin 1` for labels.
12996 % they will coincide if `external pins width` is set to 0.
12997 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
12998 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
12999 }
13000 \advance\pgf@circ@count@a by -1\relax%
13001 \repeatpgfmathloop%
13002 }%
13003 }
13004 }
13005
13006 \declarebjt{npn}
13007 \declarebjt{pnp}
13008
13009 % end of multi-bjts
13010
13011 \long\def\declareigbt#1{
13012 \pgfcircdeclaretransistor{#1}{
13013 \anchor{inner up}{
13014 \northeast
13015 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
13016 }
13017 \anchor{inner down}{
13018 \northeast
13019 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
13020 }
13021 }
13022 {
13023 % add the circle if requested (before everything else, so we can fill it)
13024 \pgfcirc@transistorcircle
13025 %draw upper connection
13026 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13027 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13028 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13029 \pgfpathlineto{\pgfpoint
13030 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13031 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
13032 \pgfusepath{draw}
13033
13034 %draw thicker gate lines
13035 \pgfscope
13036 \pgfscope
13037 \pgfpathmoveto{\pgfpoint
13038 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13039 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13040 \pgfpathlineto{\pgfpoint
13041 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13042 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13043 % set the normal thickness
13044 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13045 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
13046 \pgfsetlinewidth{\@@extrat\pgflinewidth}
13047 \pgfusepath{draw}
13048 \endpgfscope
13049 \pgfpathmoveto{\pgfpoint
13050 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13051 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13052 \pgfpathlineto{\pgfpoint
13053 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13054 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
13055 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13056 \pgfusepath{draw}
13057 \endpgfscope
13058 %draw lower connection
13059 \pgfpathmoveto{\pgfpoint
13060 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13061 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
13062 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13063 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13064 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13065 \pgfusepath{draw}
13066 %draw arrow depending on type of transistor
13067 \pgfscope
13068 \pgfslopedattimetrue
13069 \pgfallowupsidedownattimetrue
13070 \pgfresetnontranslationattimefalse
13071 \ifpgf@circuit@trans@arrowatend
13072 \ifpgf@circuit@trans@ntype
13073 \edef\@@anchor{btip}\edef\@@pos{1.0}
13074 \else
13075 \edef\@@anchor{tip}\edef\@@pos{1.0}
13076 \fi
13077 \else
13078 \edef\@@anchor{center}\edef\@@pos{0.5}
13079 \fi
13080 \ifpgf@circuit@trans@ntype
13081 \pgftransformlineattime{\@@pos}{%
13082 \pgfpoint%
13083 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13084 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
13085 }{%
13086 \pgfpoint{\pgf@circ@res@right}%
13087 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
13088 }
13089 \else
13090 \pgftransformlineattime{\@@pos}{%
13091 \pgfpoint{\pgf@circ@res@right}%
13092 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
13093 }{%
13094 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13095 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
13096 }
13097 \fi
13098 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13099 \endpgfscope
13100 %draw gate
13101 \ifpgf@circuit@trans@ntype
13102 \pgfpathmoveto{\pgfpoint
13103 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13104 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13105 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
13106 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13107 \else
13108 \pgfpathmoveto{\pgfpoint
13109 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13110 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
13111 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
13112 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
13113 \fi
13114 \pgfusepath{draw}
13115 }
13116 }
13117
13118 \declareigbt{pigbt}
13119 \declareigbt{nigbt}
13120 \declareigbt{Lnigbt}
13121 \declareigbt{Lpigbt}
13122
13123 \pgfcircdeclaretransistor{nmos}{
13124 \anchor{inner up}{
13125 \northeast
13126 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
13127 }
13128 \anchor{inner down}{
13129 \northeast
13130 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
13131 }
13132 }{%
13133 % add the circle if requested (before everything else, so we can fill it)
13134 \pgfcirc@transistorcircle
13135
13136 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13137 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13138 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13139 \pgfpathlineto{\pgfpoint
13140 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13141 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13142
13143 \pgfpathmoveto{\pgfpoint
13144 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13145 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13146 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13147 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13148 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13149 \pgfusepath{draw}
13150
13151 \pgfscope
13152 \pgfpathmoveto{\pgfpoint
13153 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13154 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
13155 \pgfpathlineto{\pgfpoint
13156 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13157 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
13158 \pgfpathmoveto{\pgfpoint
13159 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13160 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
13161 \pgfpathlineto{\pgfpoint
13162 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13163 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
13164 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13165 \pgfusepath{draw}
13166 \endpgfscope
13167 \ifpgf@circuit@mos@arrows
13168 \pgfscope
13169 \ifpgf@circuit@trans@arrowatend
13170 \pgftransformshift{\pgfpoint
13171 {\pgf@circ@res@right}%
13172 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
13173 }
13174 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
13175 \else
13176 \pgfslopedattimetrue
13177 \pgfallowupsidedownattimetrue
13178 \pgfresetnontranslationattimefalse
13179 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
13180 \pgfpoint%
13181 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
13182 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
13183 }{%
13184 \pgfpoint
13185 {\pgf@circ@res@right}%
13186 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
13187 }
13188 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13189 \fi
13190 \endpgfscope
13191 \fi
13192
13193 \ifpgf@circuit@bpt@drawgate
13194 \pgfpathmoveto{\pgfpoint
13195 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
13196 {\pgf@circ@res@up+\pgf@circ@res@down}}
13197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13198 \pgfusepath{draw}
13199 \fi
13200
13201 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13202 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
13203 {\pgf@circ@res@up+\pgf@circ@res@down}}
13204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13205 {\pgf@circ@res@up+\pgf@circ@res@down}}
13206 \pgfusepath{draw}
13207 \fi
13208 }
13209
13210 \pgfcircdeclaretransistor{pmos}{
13211 \anchor{inner up}{
13212 \northeast
13213 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
13214 }
13215 \anchor{inner down}{
13216 \northeast
13217 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
13218 }
13219 }{%
13220 % add the circle if requested (before everything else, so we can fill it)
13221 \pgfcirc@transistorcircle
13222 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13223 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13224 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13225 \pgfpathlineto{\pgfpoint
13226 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13227 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13228 \pgfusepath{draw}
13229
13230 \ifpgf@circuit@mos@arrows
13231 \pgfscope
13232 \ifpgf@circuit@trans@arrowatend
13233 \pgftransformshift{\pgfpoint
13234 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
13235 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13236 }
13237 \pgftransformrotate{180}
13238 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
13239 \else
13240 \pgfslopedattimetrue
13241 \pgfallowupsidedownattimetrue
13242 \pgfresetnontranslationattimefalse
13243 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
13244 \pgfpoint%
13245 {\pgf@circ@res@right}%
13246 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13247 }{%
13248 \pgfpoint
13249 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
13250 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
13251 }
13252 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13253 \fi
13254 \endpgfscope
13255 \fi
13256
13257 \pgfscope
13258 \pgfpathmoveto{\pgfpoint
13259 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13260 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
13261 \pgfpathlineto{\pgfpoint
13262 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13263 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
13264 \pgfpathmoveto{\pgfpoint
13265 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13266 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
13267 \pgfpathlineto{\pgfpoint
13268 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13269 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13270 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13271 \pgfusepath{draw}
13272 \endpgfscope
13273
13274 \pgfpathmoveto{\pgfpoint
13275 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13276 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13277 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13278 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
13279 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13280
13281
13282 \pgfusepath{draw}
13283 \ifpgf@circuit@bpt@drawgate
13284 \pgfpathmoveto{\pgfpoint
13285 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
13286 {\pgf@circ@res@up+\pgf@circ@res@down}}
13287 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13288 \pgfusepath{draw}
13289 \fi
13290
13291 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13292 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
13293 {\pgf@circ@res@up+\pgf@circ@res@down}}
13294 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13295 {\pgf@circ@res@up+\pgf@circ@res@down}}
13296 \pgfusepath{draw}
13297 \fi
13298
13299 \ifpgf@circuit@pmos@nocircle\else
13300 % we are not scaling the circle with the MOS --- I think it's better to have it
13301 % coherent with the poles/nodes of the rest of the circuit.
13302 \pgfpathcircle{\pgfpoint
13303 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
13304 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13305 \ifpgf@circuit@pmos@emptycircle
13306 \pgfsetfillcolor{white}
13307 \fi
13308 \pgfusepath{draw,fill}
13309 \fi
13310 }
13311
13312 %%% depletion MOSFET (simplified symbols)
13313
13314 \long\def\pgfcirc@filldraw@depletion#1{%
13315 \ifx\tikz@fillcolor\pgfutil@empty
13316 % if there is no explicit fill check the specific key
13317 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
13318 \ifx\@@tmp\@@none % if it's none
13319 \pgfusepath{draw}%
13320 \else
13321 \edef\@@default{default}%
13322 \ifx\@@tmp\@@default % fill with the pen color
13323 \pgfusepath{draw, fill}%
13324 \else
13325 \pgfsetfillcolor{\@@tmp}%
13326 \pgfusepath{draw, fill}%
13327 \fi
13328 \fi
13329 \else
13330 \pgfsetfillcolor{\tikz@fillcolor}%
13331 \pgfusepath{draw, fill}%
13332 \fi
13333 }
13334
13335 \pgfcircdeclaretransistor{nmosd}{
13336 \anchor{inner up}{
13337 \northeast
13338 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
13339 }
13340 \anchor{inner down}{
13341 \northeast
13342 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
13343 }
13344 \anchor{nobulk}{ %override
13345 \left
13346 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
13347 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
13348 \advance\pgf@x by -\pgf@circ@res@temp
13349 }
13350 }{%
13351 % draw depletion channel
13352 % add the circle if requested (before everything else, so we can fill it)
13353 \pgfcirc@transistorcircle
13354 \pgfscope
13355 \pgfpathrectanglecorners
13356 {\pgfpoint
13357 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13358 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13359 {\pgfpoint
13360 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
13361 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13362 \pgfcirc@filldraw@depletion{nmosd}
13363 \endpgfscope
13364 % draw drain and source terminals
13365 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13366 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13367 \pgfpathlineto{\pgfpoint
13368 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13369 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13370
13371 \pgfpathmoveto{\pgfpoint
13372 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13373 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13374 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13375 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13377 \pgfusepath{draw}
13378
13379 \pgfscope
13380 \pgfpathmoveto{\pgfpoint
13381 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13382 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
13383 \pgfpathlineto{\pgfpoint
13384 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
13385 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
13386 \pgfpathmoveto{\pgfpoint
13387 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13388 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
13389 \pgfpathlineto{\pgfpoint
13390 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13391 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
13392 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13393 \pgfusepath{draw}
13394 \endpgfscope
13395 \ifpgf@circuit@mos@arrows
13396 \pgfscope
13397 \ifpgf@circuit@trans@arrowatend
13398 \pgftransformshift{\pgfpoint
13399 {\pgf@circ@res@right}%
13400 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
13401 }
13402 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
13403 \else
13404 \pgfslopedattimetrue
13405 \pgfallowupsidedownattimetrue
13406 \pgfresetnontranslationattimefalse
13407 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
13408 \pgfpoint%
13409 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
13410 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
13411 }{%
13412 \pgfpoint
13413 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13414 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
13415 }
13416 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13417 \fi
13418 \endpgfscope
13419 \fi
13420
13421 \ifpgf@circuit@bpt@drawgate
13422 \pgfpathmoveto{\pgfpoint
13423 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
13424 {\pgf@circ@res@up+\pgf@circ@res@down}}
13425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13426 \pgfusepath{draw}
13427 \fi
13428
13429 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13430 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
13431 {\pgf@circ@res@up+\pgf@circ@res@down}}
13432 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13433 {\pgf@circ@res@up+\pgf@circ@res@down}}
13434 \pgfusepath{draw}
13435 \fi
13436 }
13437
13438 \pgfcircdeclaretransistor{pmosd}{
13439 \anchor{inner up}{
13440 \northeast
13441 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
13442 }
13443 \anchor{inner down}{
13444 \northeast
13445 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
13446 }
13447 \anchor{nobulk}{ %override
13448 \left
13449 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
13450 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
13451 \advance\pgf@x by -\pgf@circ@res@temp
13452 }
13453 }{%
13454 % add the circle if requested (before everything else, so we can fill it)
13455 \pgfcirc@transistorcircle
13456 % draw depletion channel
13457 \pgfscope
13458 \pgfpathrectanglecorners
13459 {\pgfpoint
13460 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13461 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13462 {\pgfpoint
13463 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
13464 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13465 \pgfcirc@filldraw@depletion{pmosd}
13466 \endpgfscope
13467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13469 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13470 \pgfpathlineto{\pgfpoint
13471 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13472 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13473 \pgfusepath{draw}
13474
13475 \ifpgf@circuit@mos@arrows
13476 \pgfscope
13477 \ifpgf@circuit@trans@arrowatend
13478 \pgftransformshift{\pgfpoint
13479 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13480 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13481 }
13482 \pgftransformrotate{180}
13483 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
13484 \else
13485 \pgfslopedattimetrue
13486 \pgfallowupsidedownattimetrue
13487 \pgfresetnontranslationattimefalse
13488 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
13489 \pgfpoint%
13490 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
13491 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13492 }{%
13493 \pgfpoint
13494 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
13495 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
13496 }
13497 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
13498 \fi
13499 \endpgfscope
13500 \fi
13501
13502 \pgfscope
13503 \pgfpathmoveto{\pgfpoint
13504 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13505 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
13506 \pgfpathlineto{\pgfpoint
13507 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13508 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
13509 \pgfpathmoveto{\pgfpoint
13510 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13511 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
13512 \pgfpathlineto{\pgfpoint
13513 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13514 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13515 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13516 \pgfusepath{draw}
13517 \endpgfscope
13518
13519 \pgfpathmoveto{\pgfpoint
13520 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
13521 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13522 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13523 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
13524 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13525
13526
13527 \pgfusepath{draw}
13528 \ifpgf@circuit@bpt@drawgate
13529 \pgfpathmoveto{\pgfpoint
13530 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
13531 {\pgf@circ@res@up+\pgf@circ@res@down}}
13532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13533 \pgfusepath{draw}
13534 \fi
13535
13536 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
13537 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
13538 {\pgf@circ@res@up+\pgf@circ@res@down}}
13539 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13540 {\pgf@circ@res@up+\pgf@circ@res@down}}
13541 \pgfusepath{draw}
13542 \fi
13543
13544 \ifpgf@circuit@pmos@nocircle\else
13545 % we are not scaling the circle with the MOS --- I think it's better to have it
13546 % coherent with the poles/nodes of the rest of the circuit.
13547 \pgfpathcircle{\pgfpoint
13548 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
13549 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13550 \ifpgf@circuit@pmos@emptycircle
13551 \pgfsetfillcolor{white}
13552 \fi
13553 \pgfusepath{draw,fill}
13554 \fi
13555 }
13556 %% HEMT FET Transistor
13557 \pgfcircdeclaretransistor{hemt}{
13558 \anchor{inner up}{
13559 \northeast
13560 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
13561 }
13562 \anchor{inner down}{
13563 \northeast
13564 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
13565 }
13566 }{%
13567 % add the circle if requested (before everything else, so we can fill it)
13568 \pgfcirc@transistorcircle
13569 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13570 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13571 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
13572 \pgfpathlineto{\pgfpoint
13573 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13574 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
13575
13576 \pgfpathmoveto{\pgfpoint
13577 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13578 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
13579 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13580 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
13581 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13582 \pgfusepath{draw}
13583
13584 \pgfscope
13585 \pgfpathmoveto{\pgfpoint
13586 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13587 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
13588 \pgfpathlineto{\pgfpoint
13589 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13590 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
13591 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13592 \pgfusepath{draw}
13593 \endpgfscope
13594
13595 \pgfpathmoveto{\pgfpoint
13596 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
13597 {\pgf@circ@res@up+\pgf@circ@res@down}}
13598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13599 \pgfusepath{draw}
13600 }
13601
13602 \long\def\drawfetcore#1{
13603 \pgftransformationadjustments
13604 % add the circle if requested (before everything else, so we can fill it)
13605 \pgfcirc@transistorcircle
13606
13607 %top connection
13608 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13609 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13610 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13611 \pgfpathlineto{\pgfpoint
13612 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13613 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
13614 \pgfusepath{draw}
13615 \pgfscope
13616 \pgfpathmoveto{\pgfpoint
13617 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13618 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13619 \ifpgf@circuit@trans@depletiontype
13620 \pgfpathlineto{\pgfpoint
13621 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13622 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13623 \else
13624
13625 \pgfpathlineto{\pgfpoint
13626 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13627 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
13628 \pgfpathmoveto{\pgfpoint
13629 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13630 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
13631 \pgfpathlineto{\pgfpoint
13632 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13633 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
13634 \pgfpathmoveto{\pgfpoint
13635 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13636 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
13637 \pgfpathlineto{\pgfpoint
13638 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13639 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13640 \fi
13641 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13642 \pgfusepath{draw}
13643 \endpgfscope
13644 %Bulk connection line
13645 \pgfpathmoveto{\pgfpoint
13646 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13647 {\pgf@circ@res@up+\pgf@circ@res@down}}
13648 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13649 {\pgf@circ@res@up+\pgf@circ@res@down}}
13650
13651 %bottom connection
13652 \pgfpathmoveto{\pgfpoint
13653 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13654 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13655 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13656 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
13657 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13658 \pgfusepath{draw}
13659
13660 %draw thick gate line
13661 \pgfscope
13662 \pgfpathmoveto{\pgfpoint
13663 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13664 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13665 \pgfpathlineto{\pgfpoint
13666 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13667 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13668 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13669 \pgfusepath{draw}
13670 \endpgfscope
13671
13672 % arrows
13673 \pgfscope
13674 \pgfslopedattimetrue
13675 \pgfallowupsidedownattimetrue
13676 \pgfresetnontranslationattimefalse
13677 \ifpgf@circuit@trans@arrowatend
13678 \ifpgf@circuit@trans@ntype
13679 \edef\@@anchor{tip}
13680 \edef\@@pos{1.0}
13681 \else
13682 \edef\@@anchor{btip}
13683 \edef\@@pos{0.0}
13684 \fi
13685 \else
13686 \edef\@@anchor{center}\edef\@@pos{0.6}
13687 \fi
13688 \pgftransformlineattime{\@@pos}{%
13689 \pgfpoint
13690 {\pgf@circ@res@right}%
13691 {\pgf@circ@res@up+\pgf@circ@res@down}%
13692 }{%
13693 \pgfpoint%
13694 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13695 {\pgf@circ@res@up+\pgf@circ@res@down}%
13696 }
13697 \ifpgf@circuit@trans@ntype
13698 \else
13699 \pgftransformrotate{180}
13700 \fi
13701 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13702 \endpgfscope
13703
13704 % GATE CONNECTION
13705 \ifpgf@circuit@bpt@drawgate
13706 \ifpgf@circuit@trans@ntype
13707 \pgfpathmoveto{\pgfpoint
13708 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13709 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13710 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13711 \else
13712 \pgfpathmoveto{\pgfpoint
13713 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
13714 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13715 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
13716 \fi
13717 \pgfusepath{draw}
13718 \fi
13719
13720 }
13721
13722 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
13723 {\pgfcircdeclaretransistor{#1}{
13724 \anchor{bulk}{\left\pgf@x=0pt}
13725 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
13726 \anchor{inner up}{
13727 \northeast
13728 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
13729 }
13730 \anchor{inner down}{
13731 \northeast
13732 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
13733 }
13734 #2
13735 }
13736 {#3}
13737 }
13738
13739 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
13740 \pgf@circuit@trans@depletiontypefalse
13741 \drawfetcore{nfet}
13742 }
13743
13744 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
13745 \pgf@circuit@trans@depletiontypefalse
13746 \drawfetcore{pfet}
13747 }
13748
13749 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
13750 \pgf@circuit@trans@depletiontypetrue
13751 \drawfetcore{nfetd}
13752 }
13753
13754 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
13755 \pgf@circuit@trans@depletiontypetrue
13756 \drawfetcore{pfetd}
13757 }
13758 % N-CHANNEL IGFET ENHANCEMENT TYPE
13759 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
13760 \pgf@circuit@trans@depletiontypefalse
13761 \drawfetcore{nigfete}
13762
13763 % SOURCE CONNECTION
13764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
13766 \pgfusepath{draw}
13767
13768 % SOLDER DOT at source-bulk connection
13769 \ifpgf@circuit@fet@solderdot
13770 \pgfscope
13771 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13772 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
13773 \pgfnode{circ}{center}{}{}{}
13774 \endpgfscope{}
13775 \fi
13776 }
13777
13778 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
13779 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
13780 \pgf@circuit@trans@depletiontypefalse
13781 \drawfetcore{nigfetebulk}
13782 % SOLDER DOT at source-bulk connection
13783 \ifpgf@circuit@fet@solderdot
13784 \pgfscope
13785 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13786 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
13787 \pgfnode{circ}{center}{}{}{}
13788 \endpgfscope{}
13789 \fi
13790 }
13791
13792 % N-CHANNEL IGFET DEPLETION TYPE
13793 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
13794 \pgf@circuit@trans@depletiontypetrue
13795 \drawfetcore{nigfetd}
13796
13797 % SOURCE CONNECTION
13798 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13799 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
13800 \pgfusepath{draw}
13801
13802 % SOLDER DOT at source-bulk connection
13803 \ifpgf@circuit@fet@solderdot
13804 \pgfscope
13805 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13806 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
13807 \pgfnode{circ}{center}{}{}{}
13808 \endpgfscope{}
13809 \fi
13810 }
13811
13812 % P-CHANNEL IGFET ENHANCEMENT TYPE
13813 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
13814 \pgf@circuit@trans@depletiontypefalse
13815 \drawfetcore{pigfete}
13816 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13817
13818 % SOURCE CONNECTION
13819 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13820 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13821 \pgfusepath{draw}
13822
13823
13824 % SOLDER DOT at source-bulk connection
13825 \ifpgf@circuit@fet@solderdot
13826 \pgfscope
13827 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13828 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
13829 \pgfnode{circ}{center}{}{}{}
13830 \endpgfscope
13831 \fi
13832 }
13833
13834 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
13835 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
13836 \pgf@circuit@trans@depletiontypefalse
13837 \drawfetcore{pigfetebulk}
13838 }
13839
13840 % P-CHANNEL IGFET DEPLETION TYPE
13841 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
13842 \pgf@circuit@trans@depletiontypetrue
13843 \drawfetcore{pigfetd}
13844
13845 % SOURCE CONNECTION
13846 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13847 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13848 \pgfusepath{draw}
13849
13850
13851 % SOLDER DOT at source-bulk connection
13852 \ifpgf@circuit@fet@solderdot
13853 \pgfscope
13854 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13855 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
13856 \pgfnode{circ}{center}{}{}{}
13857 \endpgfscope{}
13858 \fi
13859 }
13860
13861 \pgfcircdeclaretransistor{njfet}{
13862 \anchor{inner up}{
13863 \northeast
13864 \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
13865 }
13866 \anchor{inner down}{
13867 \northeast
13868 \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
13869 }
13870 }{%
13871 % add the circle if requested (before everything else, so we can fill it)
13872 \pgfcirc@transistorcircle
13873 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13874 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13875 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
13876 \pgfpathlineto{\pgfpoint
13877 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13878 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
13879
13880 \pgfpathmoveto{\pgfpoint
13881 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13882 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13884 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13886 \pgfusepath{draw}
13887
13888 \pgfscope
13889 \pgfpathmoveto{\pgfpoint
13890 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13891 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}}
13892 \pgfpathlineto{\pgfpoint
13893 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13894 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}}
13895 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13896 \pgfusepath{draw}
13897 \endpgfscope
13898
13899 % arrow
13900 \pgfscope
13901 \pgfslopedattimetrue
13902 \pgfallowupsidedownattimetrue
13903 \pgfresetnontranslationattimefalse
13904 \ifpgf@circuit@trans@arrowatend
13905 \edef\@@anchor{tip}\edef\@@pos{1.0}
13906 \else
13907 \edef\@@anchor{center}\edef\@@pos{0.6}
13908 \fi
13909 \pgftransformlineattime{\@@pos}{%
13910 \pgfpoint{\pgf@circ@res@left}%
13911 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
13912 }{%
13913 \pgfpoint
13914 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
13915 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
13916 }
13917 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13918 \endpgfscope
13919
13920 \pgfpathmoveto{\pgfpoint
13921 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13922 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13923 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13924 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13925 \pgfusepath{draw}
13926 }
13927
13928 \pgfcircdeclaretransistor{pjfet}{
13929 \anchor{inner up}{
13930 \northeast
13931 \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
13932 }
13933 \anchor{inner down}{
13934 \northeast
13935 \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
13936 }
13937 }{%
13938 % add the circle if requested (before everything else, so we can fill it)
13939 \pgfcirc@transistorcircle
13940 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13941 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13942 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13943 \pgfpathlineto{\pgfpoint
13944 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13945 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13946
13947 \pgfpathmoveto{\pgfpoint
13948 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13949 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
13950 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13951 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
13952 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13953 \pgfusepath{draw}
13954
13955 \pgfscope
13956 \pgfpathmoveto{\pgfpoint
13957 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13958 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}}
13959 \pgfpathlineto{\pgfpoint
13960 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13961 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}}
13962 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13963 \pgfusepath{draw}
13964 \endpgfscope
13965
13966 \pgfscope
13967 \pgfslopedattimetrue
13968 \pgfallowupsidedownattimetrue
13969 \pgfresetnontranslationattimefalse
13970 \ifpgf@circuit@trans@arrowatend
13971 \edef\@@anchor{btip}\edef\@@pos{1.0}
13972 \else
13973 \edef\@@anchor{center}\edef\@@pos{0.4}
13974 \fi
13975 \pgftransformlineattime{\@@pos}{%
13976 \pgfpoint%
13977 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}%
13978 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
13979 }{%
13980 \pgfpoint{\pgf@circ@res@left}%
13981 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
13982 }
13983 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13984 \endpgfscope
13985
13986 \pgfpathmoveto{\pgfpoint
13987 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13988 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13989 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13990 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13991 \pgfusepath{draw}
13992 }
13993
13994 \pgfdeclaretransistorwrapperaddbulk{isfet}{
13995 }{%
13996 % add the circle if requested (before everything else, so we can fill it)
13997 \pgfcirc@transistorcircle
13998 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13999 % DRAIN CONNECTION
14000 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14001 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
14002 % DRAIN
14003 \pgfpathlineto{\pgfpoint
14004 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14005 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
14006 \pgfusepath{draw}
14007
14008 % GATE, DEPLETION TYPE
14009 \pgfscope %% added
14010 \pgfpathmoveto{\pgfpoint
14011 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14012 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
14013 \pgfpathlineto{\pgfpoint
14014 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14015 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
14016 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
14017 \pgfusepath{draw} %% added
14018 \endpgfscope %% added
14019
14020 % BULK
14021 \pgfpathmoveto{\pgfpoint
14022 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14023 {\pgf@circ@res@up+\pgf@circ@res@down}}
14024 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
14025 {\pgf@circ@res@up+\pgf@circ@res@down}}
14026
14027 % SOURCE
14028 \pgfpathmoveto{\pgfpoint
14029 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
14030 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
14031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14032 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
14033 % SOURCE CONNECTION
14034 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14035 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14036 \pgfusepath{draw}
14037
14038 % SOLDER DOT at source-bulk connection
14039 \ifpgf@circuit@fet@solderdot
14040 \pgfscope
14041 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
14042 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
14043 \pgfnode{circ}{center}{}{}{}
14044 \endpgfscope{}
14045 \fi
14046 % ARROW
14047 \pgfscope
14048 \pgfslopedattimetrue
14049 \pgfallowupsidedownattimetrue
14050 \pgfresetnontranslationattimefalse
14051 \ifpgf@circuit@trans@arrowatend
14052 \edef\@@anchor{tip}\edef\@@pos{1.0}
14053 \else
14054 \edef\@@anchor{center}\edef\@@pos{0.6}
14055 \fi
14056 \pgftransformlineattime{\@@pos}{%
14057 \pgfpoint
14058 {\pgf@circ@res@right}%
14059 {\pgf@circ@res@up+\pgf@circ@res@down}%
14060 }{%
14061 \pgfpoint%
14062 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
14063 {\pgf@circ@res@up+\pgf@circ@res@down}%
14064 }
14065 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14066 \endpgfscope
14067 \pgfusepath{draw}
14068
14069 % Wavy lines
14070 \pgfscope
14071 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
14072 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14073 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14074 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14075 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14076 \pgfusepath{draw}
14077
14078 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
14079 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14080 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14081 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14082 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14083 \pgfusepath{draw}
14084
14085 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
14086 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14087 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14088 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14089 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
14090 \pgfusepath{draw}
14091 \endpgfscope
14092 }
14093
14094 % end of transistors
14095
14096 %%%%%%%%%%%%%
14097 %% Switches
14098 %%%%%%%%%%%%%
14099
14100 \pgfcircdeclarebipole{
14101 \anchor{out 1}{
14102 \northeast
14103 \pgf@y=0cm
14104 }
14105 \anchor{out 2}{
14106 \northeast
14107 \pgf@y=.8\pgf@y
14108 }
14109 }
14110 {\ctikzvalof{tripoles/toggleswitch/height 2}}
14111 {toggleswitch}
14112 {\ctikzvalof{tripoles/toggleswitch/height}}
14113 {\ctikzvalof{tripoles/toggleswitch/width}}
14114 {
14115
14116 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14117 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
14118 \pgfusepath{draw}
14119 \pgfscope
14120 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
14121 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
14122 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
14123 \pgfusepath{draw}
14124 \endpgfscope
14125
14126 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14127 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
14128
14129 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
14130 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
14131 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
14132 \pgfusepath{draw}
14133
14134
14135 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
14136 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
14137 \pgfusepath{draw}
14138
14139 \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}
14140 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
14141 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
14142 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
14143 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
14144 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
14145 \pgfusepath{draw}
14146 \pgfsetdash{}{0cm}
14147 }
14148
14149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14150 %% operational and instrumentation amplifiers
14151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14152
14153 \pgfdeclareshape{op amp}
14154 {
14155 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14156 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14157 \anchor{center}{\pgfpointorigin}
14158 \savedanchor\northwest{%
14159 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14160 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14161 \pgf@y=.5\pgf@y
14162 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14163 \pgf@x=.5\pgf@x
14164 }
14165 \savedanchor\left{%
14166 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14167 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14168 \pgf@x=.5\pgf@x
14169 \pgf@y=0pt
14170 }
14171 \anchor{south}{
14172 \northwest
14173 \pgf@y=-\pgf@y
14174 \pgf@x=0pt
14175 }
14176 \anchor{north}{
14177 \northwest
14178 \pgf@x=0pt
14179 }
14180 \savedanchor\left{%
14181 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14182 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14183 \pgf@x=.5\pgf@x
14184 \pgf@y=0pt
14185 }
14186 \savedanchor\inOneFixed{%
14187 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14188 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14189 \pgf@y=.5\pgf@y
14190 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
14191 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14192 \pgf@x=.5\pgf@x
14193 }
14194 \anchor{in up}{
14195 \inOneFixed
14196 }
14197 \anchor{in down}{
14198 \inOneFixed
14199 \pgf@y=-\pgf@y
14200 }
14201 \savedanchor\inOne{%
14202 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14203 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14204 \pgf@y=.5\pgf@y
14205 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
14206 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14207 \pgf@x=.5\pgf@x
14208 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14209 }
14210 \anchor{-}{
14211 \inOne
14212 }
14213 \anchor{+}{
14214 \inOne
14215 \pgf@y=-\pgf@y
14216 }
14217 \savedanchor\up{%
14218 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14219 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
14220 \pgf@y=.5\pgf@y
14221 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14222 \pgf@x=.5\pgf@x
14223 \pgf@circ@res@up = \pgf@y
14224 \pgf@circ@res@right = -\pgf@x
14225 \pgf@circ@res@left = \pgf@x
14226 \pgfpointlineattime{
14227 \ctikzvalof{tripoles/op amp/up pos}}{
14228 \pgfpoint{
14229 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14230 {\pgf@circ@res@up}}
14231 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
14232 }
14233 \anchor{up}{
14234 \up
14235 }
14236 \anchor{down}{
14237 \up
14238 \pgf@y=-\pgf@y
14239 }
14240 \anchor{out}{
14241 \northwest
14242 \pgf@y=0pt
14243 \pgf@x=-\pgf@x
14244 }
14245 \anchor{west}{
14246 \left
14247 }
14248 \anchor{east}{
14249 \left
14250 \pgf@x=-\pgf@x
14251 }
14252
14253 % support for border anchors
14254 \savedanchor\leftedge{%
14255 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14256 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
14257 \pgf@x=.5\pgf@x
14258 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14259 \pgf@y=0pt
14260 }
14261 \anchor{leftedge}{\leftedge}
14262 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14263 \anchor{bin up}{
14264 \inOneFixed
14265 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14266 }
14267 \anchor{bin down}{
14268 \inOneFixed
14269 \pgf@y=-\pgf@y
14270 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14271 }
14272 \anchor{b-}{
14273 \inOne
14274 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14275 }
14276 \anchor{b+}{
14277 \inOne
14278 \pgf@y=-\pgf@y
14279 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14280 }
14281 \anchor{bout}{
14282 \leftedge
14283 \pgf@y=0pt
14284 \pgf@x=-\pgf@x
14285 }
14286 % end border anchors
14287 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14288 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14289 \anchor{north west}{ \northwest }
14290 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14291
14292 \anchor{text}{
14293 \ifpgf@circ@center@text
14294 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14295 \else
14296 \leftedge
14297 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14298 \fi
14299 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14300 }
14301
14302 \backgroundpath{
14303 \pgfsetcolor{\ctikzvalof{color}}
14304
14305 \northwest
14306 \pgf@circ@res@up = \pgf@y
14307 \pgf@circ@res@down = -\pgf@y
14308 \pgf@circ@res@right = -\pgf@x
14309 \pgf@circ@res@left = \pgf@x
14310 \pgf@circ@scaled@Rlen=\scaledRlen
14311
14312 % Triangle
14313 \pgfscope
14314 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14315 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14316 \pgf@circ@res@step=\pgf@circ@res@right
14317 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14318 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
14319
14320 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14321 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14322 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14323 \pgfpathclose
14324 \pgf@circ@draworfill
14325 \endpgfscope
14326
14327 % Negative input terminal
14328 \pgfpathmoveto{\pgfpoint
14329 {\pgf@circ@res@left}
14330 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
14331 \pgfpathlineto{\pgfpoint
14332 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14333 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
14334 \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}
14335
14336 % Positive input terminal
14337 \pgfpathmoveto{\pgfpoint
14338 {\pgf@circ@res@left}
14339 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
14340 \pgfpathlineto{\pgfpoint
14341 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
14342 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
14343 \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}
14344
14345 % Output terminal
14346 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14347 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
14348 \pgfsetrectcap
14349 \pgfusepath{draw}
14350 }
14351 }
14352
14353 % Op amp shape as in european standard EN 60617
14354 \pgfdeclareshape{en amp}
14355 {
14356 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14357 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14358 \anchor{center}{\pgfpointorigin}
14359 \savedanchor\northwest{%
14360 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14361 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14362 \pgf@y=.5\pgf@y
14363 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14364 \pgf@x=.5\pgf@x
14365 }
14366 \savedanchor\left{%
14367 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14368 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14369 \pgf@x=.5\pgf@x
14370 \pgf@y=0pt
14371 }
14372 \anchor{south}{
14373 \northwest
14374 \pgf@y=-\pgf@y
14375 \pgf@x=0pt
14376 }
14377 \anchor{north}{
14378 \northwest
14379 \pgf@x=0pt
14380 }
14381 \savedanchor\inOneFixed{%
14382 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14383 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14384 \pgf@y=.5\pgf@y
14385 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
14386 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14387 \pgf@x=.5\pgf@x
14388 }
14389 \anchor{in up}{
14390 \inOneFixed
14391 }
14392 \anchor{in down}{
14393 \inOneFixed
14394 \pgf@y=-\pgf@y
14395 }
14396 \savedanchor\inOne{%
14397 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14398 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
14399 \pgf@y=.5\pgf@y
14400 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
14401 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14402 \pgf@x=.5\pgf@x
14403 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14404 }
14405 \anchor{-}{
14406 \inOne
14407 }
14408 \anchor{+}{
14409 \inOne
14410 \pgf@y=-\pgf@y
14411 }
14412 \anchor{up}{
14413 \northwest
14414 \pgf@x=0pt
14415 }
14416 \anchor{down}{
14417 \northwest
14418 \pgf@x=0pt
14419 \pgf@y=-\pgf@y
14420 }
14421 \anchor{out}{
14422 \northwest
14423 \pgf@y=0pt
14424 \pgf@x=-\pgf@x
14425 }
14426 \anchor{west}{
14427 \left
14428 }
14429 \anchor{east}{
14430 \left
14431 \pgf@x=-\pgf@x
14432 }
14433 % support for border anchors
14434 \savedanchor\leftedge{%
14435 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14436 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
14437 \pgf@x=.5\pgf@x
14438 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
14439 \pgf@y=0pt
14440 }
14441 \anchor{leftedge}{\leftedge}
14442 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14443 \anchor{bin up}{
14444 \inOneFixed
14445 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14446 }
14447 \anchor{bin down}{
14448 \inOneFixed
14449 \pgf@y=-\pgf@y
14450 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14451 }
14452 \anchor{b-}{
14453 \inOne
14454 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14455 }
14456 \anchor{b+}{
14457 \inOne
14458 \pgf@y=-\pgf@y
14459 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14460 }
14461 \anchor{bout}{
14462 \leftedge
14463 \pgf@y=0pt
14464 \pgf@x=-\pgf@x
14465 }
14466 % end border anchors
14467 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14468 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14469 \anchor{north west}{ \northwest }
14470 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14471 \anchor{text}{
14472 \ifpgf@circ@center@text
14473 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14474 \else
14475 \leftedge
14476 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14477 \fi
14478 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14479 }
14480
14481 \backgroundpath{
14482 \pgfsetcolor{\ctikzvalof{color}}
14483 \northwest
14484 \pgf@circ@res@up = \pgf@y
14485 \pgf@circ@res@down = -\pgf@y
14486 \pgf@circ@res@right = -\pgf@x
14487 \pgf@circ@res@left = \pgf@x
14488 \pgf@circ@scaled@Rlen=\scaledRlen
14489
14490 \pgfscope
14491 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14492 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
14493 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
14494 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
14495 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
14496 \pgfpathclose
14497 \pgf@circ@draworfill
14498 \endpgfscope
14499
14500 \pgfpathmoveto{\pgfpoint
14501 {\pgf@circ@res@left}
14502 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
14503 \pgfpathlineto{\pgfpoint
14504 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
14505 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
14506 \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}
14507
14508 \pgfpathmoveto{\pgfpoint
14509 {\pgf@circ@res@left}
14510 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
14511 \pgfpathlineto{\pgfpoint
14512 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
14513 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
14514 \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}
14515
14516 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14517 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
14518 \pgfsetrectcap
14519 \pgfusepath{draw}
14520
14521
14522 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
14523 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
14524 }
14525 }
14526
14527 % Fully differential output op amp
14528 % Contributed by Kristofer M. Monisit
14529 \pgfdeclareshape{fd op amp}
14530 {
14531 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14532 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14533 \anchor{center}{\pgfpointorigin}
14534 \savedanchor\northwest{%
14535 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14536 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14537 \pgf@y=.5\pgf@y
14538 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14539 \pgf@x=.5\pgf@x
14540 }
14541 \savedanchor\outline{%
14542 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14543 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14544 \pgf@y=.5\pgf@y
14545 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14546 \pgf@x=.5\pgf@x
14547 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
14548 }
14549 \anchor{south}{
14550 \northwest
14551 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14552 }
14553 \anchor{north}{
14554 \northwest\pgf@x=0pt\relax
14555 }
14556 \savedanchor\left{%
14557 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14558 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14559 \pgf@x=.5\pgf@x
14560 \pgf@y=0pt
14561 }
14562 \savedanchor\inOneFixed{%
14563 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14564 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14565 \pgf@y=.5\pgf@y
14566 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
14567 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14568 \pgf@x=.5\pgf@x
14569 }
14570 \anchor{in up}{
14571 \inOneFixed
14572 }
14573 \anchor{in down}{
14574 \inOneFixed
14575 \pgf@y=-\pgf@y
14576 }
14577 \savedanchor\inOne{%
14578 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14579 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14580 \pgf@y=.5\pgf@y
14581 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
14582 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14583 \pgf@x=.5\pgf@x
14584 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14585 }
14586 \anchor{-}{
14587 \inOne
14588 }
14589 \anchor{+}{
14590 \inOne
14591 \pgf@y=-\pgf@y
14592 }
14593 \savedanchor\up{%
14594 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14595 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
14596 \pgf@y=.5\pgf@y
14597 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14598 \pgf@x=.5\pgf@x
14599 \pgf@circ@res@up = \pgf@y
14600 \pgf@circ@res@right = -\pgf@x
14601 \pgf@circ@res@left = \pgf@x
14602 \pgfpointlineattime{
14603 \ctikzvalof{tripoles/fd op amp/up pos}}{
14604 \pgfpoint{
14605 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14606 {\pgf@circ@res@up}}
14607 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
14608 }
14609 \anchor{up}{
14610 \up
14611 }
14612 \anchor{down}{
14613 \up
14614 \pgf@y=-\pgf@y
14615 }
14616 \anchor{out up}{
14617 \northwest
14618 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14619 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14620 }
14621 \anchor{out down}{
14622 \northwest
14623 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14624 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14625 }
14626 \anchor{out +}{
14627 \outline
14628 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14629 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14630 }
14631 \anchor{out -}{
14632 \outline
14633 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
14634 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14635 }
14636 % support for border anchors
14637 \savedanchor\leftedge{%
14638 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14639 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
14640 \pgf@x=.5\pgf@x
14641 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14642 \pgf@y=0pt
14643 }
14644 \anchor{leftedge}{\leftedge}
14645 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14646 \anchor{bin up}{
14647 \inOneFixed
14648 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14649 }
14650 \anchor{bin down}{
14651 \inOneFixed
14652 \pgf@y=-\pgf@y
14653 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14654 }
14655 \anchor{b-}{
14656 \inOne
14657 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14658 }
14659 \anchor{b+}{
14660 \inOne
14661 \pgf@y=-\pgf@y
14662 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14663 }
14664 \anchor{bout}{
14665 \leftedge
14666 \pgf@y=0pt
14667 \pgf@x=-\pgf@x
14668 }
14669 \anchor{bout +}{
14670 \outline
14671 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14672 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14673 {\pgfpoint{\pgf@xa}{0pt}}
14674 {\pgfpoint{0pt}{\pgf@ya}}
14675 }
14676 \anchor{bout -}{
14677 \outline
14678 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14679 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14680 {\pgfpoint{\pgf@xa}{0pt}}
14681 {\pgfpoint{0pt}{\pgf@ya}}
14682 \pgf@y=-\pgf@y
14683 }
14684 \anchor{bout up}{
14685 \northwest
14686 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14687 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14688 {\pgfpoint{\pgf@xa}{0pt}}
14689 {\pgfpoint{0pt}{\pgf@ya}}
14690 }
14691 \anchor{bout down}{
14692 \northwest
14693 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
14694 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
14695 {\pgfpoint{\pgf@xa}{0pt}}
14696 {\pgfpoint{0pt}{\pgf@ya}}
14697 \pgf@y=-\pgf@y
14698 }
14699 % end border anchors
14700 \anchor{west}{
14701 \left
14702 }
14703 \anchor{east}{
14704 \left
14705 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14706 }
14707 \anchor{out}{% should not be used
14708 \left
14709 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
14710 }
14711 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14712 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
14713 \anchor{north west}{ \northwest }
14714 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
14715 \anchor{text}{
14716 \ifpgf@circ@center@text
14717 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14718 \else
14719 \leftedge
14720 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14721 \fi
14722 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14723 }
14724 \backgroundpath{
14725 \pgfsetcolor{\ctikzvalof{color}}
14726
14727 \northwest
14728 \pgf@circ@res@up = \pgf@y
14729 \pgf@circ@res@down = -\pgf@y
14730 \pgf@circ@res@right = -\pgf@x
14731 \pgf@circ@res@left = \pgf@x
14732 \pgf@circ@scaled@Rlen=\scaledRlen
14733
14734 % Triangle
14735 % Includes output terminals in the traingular shape
14736 % to ensure that diagonal joins are properly displayed
14737 % we first draw the main triangle and the leads with normal thickness,
14738 % and the redraw the main triangle with the component shape
14739 \pgfscope
14740 % shift origin a bit to ease calculations
14741 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14742 \pgf@circ@res@step=\pgf@circ@res@right
14743 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14744 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
14745
14746 % Initial point (right vertex)
14747 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14748
14749 % Negative output terminal
14750 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
14751 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
14752 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
14753
14754 % Top vertex
14755 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14756
14757 % Bottom vertex
14758 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14759
14760 % Positive output terminal
14761 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
14762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
14763 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
14764
14765 % Right vertex
14766 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14767
14768 \pgfpathclose
14769 \pgfusepath{stroke}
14770
14771 % ok, now we'll redraw the triangle with the class specific
14772 % thickness and optionally fill
14773
14774 \pgfscope
14775 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
14776
14777 % Initial point (right vertex)
14778 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14779 % Top vertex
14780 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14781 % Bottom vertex
14782 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14783
14784 \pgfpathclose
14785 \pgf@circ@draworfill
14786 \endpgfscope % thick and fill
14787 \endpgfscope % shift
14788
14789 % Negative input terminal
14790 \pgfpathmoveto{\pgfpoint
14791 {\pgf@circ@res@left}
14792 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
14793 \pgfpathlineto{\pgfpoint
14794 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14795 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
14796 \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}
14797
14798 % Positive input terminal
14799 \pgfpathmoveto{\pgfpoint
14800 {\pgf@circ@res@left}
14801 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
14802 \pgfpathlineto{\pgfpoint
14803 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14804 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
14805 \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}
14806
14807 % Negative output terminal label
14808 \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}
14809
14810 % Positive output terminal label
14811 \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}
14812
14813 \pgfsetrectcap
14814 \pgfusepath{draw}
14815 }
14816 }
14817
14818
14819 % Instrumentation amplifier with differential output
14820 \pgfdeclareshape{fd inst amp}
14821 {
14822 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14823 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14824 % when tikz calls the anchor it wants the relative position in the lengths
14825 % \pgf@x \pgf@y
14826 % \pgfpoint* functions set that variables
14827 % anchors are visible outside and run on use
14828 \anchor{center}{\pgfpointorigin}
14829 % savedanchors are internals and run on node creation (not use)
14830 % bounding-box top left
14831 \savedanchor\northwest{%
14832 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14833 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14834 \pgf@y=.5\pgf@y
14835 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14836 \pgf@x=.5\pgf@x
14837 }
14838 \anchor{nw}{
14839 \northwest
14840 }
14841 \anchor{south}{
14842 \northwest
14843 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14844 }
14845 \anchor{north}{
14846 \northwest\pgf@x=0pt\relax
14847 }
14848 \savedanchor\left{%
14849 \pgf@y=0pt
14850 }
14851 \anchor{leftedge}
14852 {\left
14853 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
14854 }
14855 \savedanchor\inOneFixed{%
14856 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14857 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14858 \pgf@y=.5\pgf@y
14859 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14860 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14861 \pgf@x=.5\pgf@x
14862 }
14863 \anchor{in up}{
14864 \inOneFixed
14865 }
14866 \anchor{in down}{
14867 \inOneFixed
14868 \pgf@y=-\pgf@y
14869 }
14870 \savedanchor\inOne{%
14871 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14872 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14873 \pgf@y=.5\pgf@y
14874 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14875 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14876 \pgf@x=.5\pgf@x
14877 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14878 }
14879 \anchor{-}{
14880 \inOne
14881 }
14882 \anchor{+}{
14883 \inOne
14884 \pgf@y=-\pgf@y
14885 }
14886 \savedanchor\up{%
14887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14888 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14889 \pgf@y=.5\pgf@y
14890 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14891 \pgf@x=.5\pgf@x
14892 \pgf@circ@res@up = \pgf@y
14893 \pgf@circ@res@right = -\pgf@x
14894 \pgf@circ@res@left = \pgf@x
14895 \pgfpointlineattime{
14896 \ctikzvalof{tripoles/fd inst amp/up pos}}{
14897 \pgfpoint{
14898 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14899 {\pgf@circ@res@up}}
14900 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
14901 }
14902 \anchor{up}{
14903 \up
14904 }
14905 \anchor{down}{
14906 \up
14907 \pgf@y=-\pgf@y
14908 }
14909 % reference voltage input anchors.
14910 \savedanchor\refv{%
14911 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14912 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14913 \pgf@y=.5\pgf@y
14914 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14915 \pgf@x=.5\pgf@x
14916 \pgf@circ@res@up = \pgf@y
14917 \pgf@circ@res@right = -\pgf@x
14918 \pgf@circ@res@left = \pgf@x
14919 \pgfpointlineattime{
14920 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
14921 \pgfpoint{
14922 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14923 {\pgf@circ@res@up}}
14924 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
14925 }
14926 % we need both because they are normally drawn under the amp, and if you
14927 % mirror it vertically you need them
14928 \anchor{refv up}{
14929 \refv
14930 }
14931 \anchor{refv down}{
14932 \refv
14933 \pgf@y=-\pgf@y
14934 }
14935 \savedanchor\outport{
14936 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14937 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14938 \pgf@y=.5\pgf@y
14939 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14940 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14941 \pgf@x=-.5\pgf@x
14942 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
14943 }
14944 \anchor{out}{
14945 \outport
14946 \pgf@y=0pt
14947 }
14948 \anchor{out +}{
14949 \outport
14950 }
14951 \anchor{out -}{
14952 \outport
14953 \pgf@y=-\pgf@y
14954 }
14955 \savedanchor\outportfixed{
14956 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14957 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14958 \pgf@y=.5\pgf@y
14959 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14960 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14961 \pgf@x=-.5\pgf@x
14962 }
14963 \anchor{out up}{
14964 \outportfixed
14965 }
14966 \anchor{out down}{
14967 \outportfixed
14968 \pgf@y=-\pgf@y
14969 }
14970 % support for border anchors
14971 \savedanchor\leftedge{%
14972 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14973 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14974 \pgf@x=.5\pgf@x
14975 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
14976 \pgf@y=0pt
14977 }
14978 \anchor{leftedge}{\leftedge}
14979 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14980 \anchor{bin up}{
14981 \inOneFixed
14982 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14983 }
14984 \anchor{bin down}{
14985 \inOneFixed
14986 \pgf@y=-\pgf@y
14987 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14988 }
14989 \anchor{b-}{
14990 \inOne
14991 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14992 }
14993 \anchor{b+}{
14994 \inOne
14995 \pgf@y=-\pgf@y
14996 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14997 }
14998 \anchor{bout}{
14999 \leftedge
15000 \pgf@x=-\pgf@x \pgf@y=0pt
15001 }
15002 \anchor{bout +}{
15003 \outport
15004 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15005 }
15006 \anchor{bout -}{
15007 \outport
15008 \pgf@y=-\pgf@y
15009 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15010 }
15011 \anchor{bout up}{
15012 \outportfixed
15013 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15014 }
15015 \anchor{bout down}{
15016 \outportfixed
15017 \pgf@y=-\pgf@y
15018 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
15019 }
15020 % end border anchors
15021 %
15022 \anchor{west}{
15023 \left
15024 }
15025 \anchor{east}{
15026 \left
15027 \pgf@x=-\pgf@x
15028 }
15029 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15030 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15031 \anchor{north west}{ \northwest }
15032 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15033 \anchor{text}{
15034 \ifpgf@circ@center@text
15035 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15036 \else
15037 \leftedge
15038 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15039 \fi
15040 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15041 }
15042
15043 % let's start drawing the component
15044 \backgroundpath{
15045 \pgfsetcolor{\ctikzvalof{color}}
15046 %
15047 \northwest
15048 \pgf@circ@res@up = \pgf@y
15049 \pgf@circ@res@down = -\pgf@y
15050 \pgf@circ@res@right = -\pgf@x
15051 \pgf@circ@res@left = \pgf@x
15052 \pgf@circ@scaled@Rlen=\scaledRlen
15053 % main component, normally in thicker lines
15054 \pgfscope
15055 \newdimen\pgf@circ@res@right@double
15056 \pgf@circ@res@right@double=2\pgf@circ@res@right
15057
15058 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15059 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15060 \pgf@circ@res@step=\pgf@circ@res@right
15061 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15062 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
15063 %first point (near output)
15064 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
15065 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
15066 \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}}
15067 % and then to the input "front up", "down", to the output short side "down"
15068 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15069 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15070 \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}}
15071 % ...and close
15072 \pgfpathclose
15073 \pgf@circ@draworfill
15074 \endpgfscope
15075
15076 % input terminal up
15077 \pgfpathmoveto{\pgfpoint
15078 {\pgf@circ@res@left}
15079 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
15080 %
15081 \pgfpathlineto{\pgfpoint
15082 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15083 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
15084 %
15085 \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}
15086
15087 % input terminal down
15088 \pgfpathmoveto{\pgfpoint
15089 {\pgf@circ@res@left}
15090 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
15091 %
15092 \pgfpathlineto{\pgfpoint
15093 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
15094 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
15095 \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}
15096
15097 % output leads down and up
15098 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
15099 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
15100 \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}
15101
15102 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
15103 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
15104 \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}
15105 %
15106 \pgfsetrectcap
15107 \pgfusepath{draw}
15108 }
15109 }
15110
15111 % Transconductance amplifier (Transkonduktanzverstärker)
15112 \pgfdeclareshape{gm amp}
15113 {
15114 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15115 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15116 \anchor{center}{\pgfpointorigin}
15117 \savedanchor\northwest{%
15118 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15119 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15120 \pgf@y=.5\pgf@y
15121 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15122 \pgf@x=.5\pgf@x
15123 }
15124 \anchor{south}{
15125 \northwest
15126 \pgf@y=-\pgf@y
15127 }
15128 \anchor{north}{
15129 \northwest
15130 }
15131 \savedanchor\left{%
15132 \pgf@y=0pt
15133 }
15134 \anchor{leftedge}
15135 {\left
15136 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15137 }
15138 \savedanchor\inOneFixed{%
15139 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15140 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15141 \pgf@y=.5\pgf@y
15142 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
15143 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15144 \pgf@x=.5\pgf@x
15145 }
15146 \anchor{in up}{
15147 \inOneFixed
15148 }
15149 \anchor{in down}{
15150 \inOneFixed
15151 \pgf@y=-\pgf@y
15152 }
15153 \savedanchor\inOne{%
15154 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15155 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15156 \pgf@y=.5\pgf@y
15157 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
15158 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15159 \pgf@x=.5\pgf@x
15160 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15161 }
15162 \anchor{-}{
15163 \inOne
15164 }
15165 \anchor{+}{
15166 \inOne
15167 \pgf@y=-\pgf@y
15168 }
15169 \savedanchor\up{%
15170 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15171 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
15172 \pgf@y=.5\pgf@y
15173 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15174 \pgf@x=.5\pgf@x
15175 \pgf@circ@res@up = \pgf@y
15176 \pgf@circ@res@right = -\pgf@x
15177 \pgf@circ@res@left = \pgf@x
15178 \pgfpointlineattime{
15179 \ctikzvalof{tripoles/gm amp/up pos}}{
15180 \pgfpoint{
15181 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15182 {\pgf@circ@res@up}}
15183 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
15184 }
15185 \anchor{up}{
15186 \up
15187 }
15188 \anchor{down}{
15189 \up
15190 \pgf@y=-\pgf@y
15191 }
15192 \anchor{out}{
15193 \northwest
15194 \pgf@y=0pt
15195 \pgf@x=-\pgf@x
15196 }
15197 % support for border anchors
15198 \savedanchor\leftedge{%
15199 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15200 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
15201 \pgf@x=.5\pgf@x
15202 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
15203 \pgf@y=0pt
15204 }
15205 \anchor{leftedge}{\leftedge}
15206 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15207 \anchor{bin up}{
15208 \inOneFixed
15209 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15210 }
15211 \anchor{bin down}{
15212 \inOneFixed
15213 \pgf@y=-\pgf@y
15214 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15215 }
15216 \anchor{b-}{
15217 \inOne
15218 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15219 }
15220 \anchor{b+}{
15221 \inOne
15222 \pgf@y=-\pgf@y
15223 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15224 }
15225 \anchor{bout}{
15226 \leftedge
15227 \pgf@y=0pt
15228 \pgf@x=-\pgf@x
15229 }
15230 % end border anchors
15231 \anchor{west}{
15232 \left
15233 }
15234 \anchor{east}{
15235 \left
15236 \pgf@x=-\pgf@x
15237 }
15238 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15239 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15240 \anchor{north west}{ \northwest }
15241 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15242
15243 \anchor{text}{
15244 \ifpgf@circ@center@text
15245 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15246 \else
15247 \leftedge
15248 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15249 \fi
15250 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15251 }
15252 \backgroundpath{
15253 \pgfsetcolor{\ctikzvalof{color}}
15254
15255 \northwest
15256 \pgf@circ@res@up = \pgf@y
15257 \pgf@circ@res@down = -\pgf@y
15258 \pgf@circ@res@right = -\pgf@x
15259 \pgf@circ@res@left = \pgf@x
15260 \pgf@circ@scaled@Rlen=\scaledRlen
15261
15262 \pgfscope
15263 \newdimen\pgf@circ@res@right@double
15264 \pgf@circ@res@right@double=2\pgf@circ@res@right
15265
15266 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15267 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15268 \pgf@circ@res@step=\pgf@circ@res@right
15269 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15270 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
15271 %Umrandung:
15272 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
15273 \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
15274 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
15275 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
15276 \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
15277 \pgfpathclose
15278 \pgf@circ@draworfill
15279 \endpgfscope
15280
15281 \pgfpathmoveto{\pgfpoint
15282 {\pgf@circ@res@left}
15283 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
15284 \pgfpathlineto{\pgfpoint
15285 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15286 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
15287 \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}
15288
15289
15290 \pgfpathmoveto{\pgfpoint
15291 {\pgf@circ@res@left}
15292 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
15293 \pgfpathlineto{\pgfpoint
15294 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
15295 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
15296 \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}
15297
15298 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15299 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
15300 \pgfsetrectcap
15301 \pgfusepath{draw}
15302
15303 }
15304 }
15305
15306 % Instrumentation amplifier
15307 \pgfdeclareshape{inst amp}
15308 {
15309 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15310 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15311 % when tikz calls the anchor it wants the relative position in the lengths
15312 % \pgf@x \pgf@y
15313 % \pgfpoint* functions set that variables
15314 % anchors are visible outside and run on use
15315 \anchor{center}{\pgfpointorigin}
15316 % savedanchors are internals and run on node creation (not use)
15317 % bounding-box top left
15318 \savedanchor\northwest{%
15319 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15320 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15321 \pgf@y=.5\pgf@y
15322 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15323 \pgf@x=.5\pgf@x
15324 }
15325 \anchor{nw}{
15326 \northwest
15327 }
15328 \anchor{south}{
15329 \northwest
15330 \pgf@y=-\pgf@y
15331 }
15332 \anchor{north}{
15333 \northwest
15334 }
15335 \savedanchor\left{%
15336 \pgf@y=0pt
15337 }
15338 \anchor{leftedge}
15339 {\left
15340 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15341 }
15342 \savedanchor\inOneFixed{%
15343 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15344 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15345 \pgf@y=.5\pgf@y
15346 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
15347 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15348 \pgf@x=.5\pgf@x
15349 }
15350 \anchor{in up}{
15351 \inOneFixed
15352 }
15353 \anchor{in down}{
15354 \inOneFixed
15355 \pgf@y=-\pgf@y
15356 }
15357 \savedanchor\inOne{%
15358 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15359 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15360 \pgf@y=.5\pgf@y
15361 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
15362 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15363 \pgf@x=.5\pgf@x
15364 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15365 }
15366 \anchor{-}{
15367 \inOne
15368 }
15369 \anchor{+}{
15370 \inOne
15371 \pgf@y=-\pgf@y
15372 }
15373 \savedanchor\up{%
15374 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15375 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15376 \pgf@y=.5\pgf@y
15377 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15378 \pgf@x=.5\pgf@x
15379 \pgf@circ@res@up = \pgf@y
15380 \pgf@circ@res@right = -\pgf@x
15381 \pgf@circ@res@left = \pgf@x
15382 \pgfpointlineattime{
15383 \ctikzvalof{tripoles/inst amp/up pos}}{
15384 \pgfpoint{
15385 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15386 {\pgf@circ@res@up}}
15387 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15388 }
15389 \anchor{up}{
15390 \up
15391 }
15392 \anchor{down}{
15393 \up
15394 \pgf@y=-\pgf@y
15395 }
15396 % reference voltage input anchors.
15397 \savedanchor\refv{%
15398 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15399 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
15400 \pgf@y=.5\pgf@y
15401 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15402 \pgf@x=.5\pgf@x
15403 \pgf@circ@res@up = \pgf@y
15404 \pgf@circ@res@right = -\pgf@x
15405 \pgf@circ@res@left = \pgf@x
15406 \pgfpointlineattime{
15407 \ctikzvalof{tripoles/inst amp/refv pos}}{
15408 \pgfpoint{
15409 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15410 {\pgf@circ@res@up}}
15411 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15412 }
15413 % we need both because they are normally drawn under the amp, and if you
15414 % mirror it vertically you need them
15415 \anchor{refv up}{
15416 \refv
15417 }
15418 \anchor{refv down}{
15419 \refv
15420 \pgf@y=-\pgf@y
15421 }
15422 \anchor{out}{
15423 \northwest
15424 \pgf@y=0pt
15425 \pgf@x=-\pgf@x
15426 }
15427 % support for border anchors
15428 \savedanchor\leftedge{%
15429 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15430 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
15431 \pgf@x=.5\pgf@x
15432 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
15433 \pgf@y=0pt
15434 }
15435 \anchor{leftedge}{\leftedge}
15436 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15437 \anchor{bin up}{
15438 \inOneFixed
15439 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15440 }
15441 \anchor{bin down}{
15442 \inOneFixed
15443 \pgf@y=-\pgf@y
15444 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15445 }
15446 \anchor{b-}{
15447 \inOne
15448 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15449 }
15450 \anchor{b+}{
15451 \inOne
15452 \pgf@y=-\pgf@y
15453 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15454 }
15455 \anchor{bout}{
15456 \leftedge
15457 \pgf@y=0pt
15458 \pgf@x=-\pgf@x
15459 }
15460 % end border anchors
15461 \anchor{west}{
15462 \left
15463 }
15464 \anchor{east}{
15465 \left
15466 \pgf@x=-\pgf@x
15467 }
15468 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15469 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15470 \anchor{north west}{ \northwest }
15471 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15472
15473 \anchor{text}{
15474 \ifpgf@circ@center@text
15475 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15476 \else
15477 \leftedge
15478 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15479 \fi
15480 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15481 }
15482
15483 % let's start drawing the component
15484 \backgroundpath{
15485 \pgfsetcolor{\ctikzvalof{color}}
15486 %
15487 \northwest
15488 \pgf@circ@res@up = \pgf@y
15489 \pgf@circ@res@down = -\pgf@y
15490 \pgf@circ@res@right = -\pgf@x
15491 \pgf@circ@res@left = \pgf@x
15492 \pgf@circ@scaled@Rlen=\scaledRlen
15493
15494 % main component, normally in thicker lines
15495 \pgfscope
15496 \newdimen\pgf@circ@res@right@double
15497 \pgf@circ@res@right@double=2\pgf@circ@res@right
15498
15499 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15500 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15501 \pgf@circ@res@step=\pgf@circ@res@right
15502 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15503 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
15504 %first point (near output)
15505 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
15506 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
15507 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
15508 % and then to the input "front up", "down", to the output short side "down"
15509 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15510 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15511 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
15512 % ...and close
15513 \pgfpathclose
15514 \pgf@circ@draworfill
15515 \endpgfscope
15516
15517 % Negative input terminal
15518 \pgfpathmoveto{\pgfpoint
15519 {\pgf@circ@res@left}
15520 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
15521 %
15522 \pgfpathlineto{\pgfpoint
15523 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15524 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
15525 %
15526 \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}
15527
15528 % Positive input terminal
15529 \pgfpathmoveto{\pgfpoint
15530 {\pgf@circ@res@left}
15531 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
15532 %
15533 \pgfpathlineto{\pgfpoint
15534 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
15535 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
15536 \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}
15537
15538 % Output terminal
15539 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15540 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
15541 %
15542 \pgfsetrectcap
15543 \pgfusepath{draw}
15544 }
15545 }
15546
15547 % Instrumentation amplifier with terminals for gain resistance between inputs
15548 \pgfdeclareshape{inst amp ra}
15549 {
15550 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15551 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15552 \anchor{center}{\pgfpointorigin}
15553 % bounding-box top left
15554 \savedanchor\northwest{%
15555 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15556 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15557 \pgf@y=.5\pgf@y
15558 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15559 \pgf@x=.5\pgf@x
15560 }
15561 \anchor{nw}{
15562 \northwest
15563 }
15564 \anchor{south}{
15565 \northwest
15566 \pgf@y=-\pgf@y\pgf@x=0pt\relax
15567 }
15568 \anchor{north}{
15569 \northwest\pgf@x=0pt\relax
15570 }
15571 \savedanchor\left{%
15572 \pgf@y=0pt
15573 }
15574 \anchor{leftedge}
15575 {\left
15576 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15577 }
15578 % inputs (+-)
15579 \savedanchor\inOneFixed{%
15580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15581 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15582 \pgf@y=.5\pgf@y
15583 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
15584 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15585 \pgf@x=.5\pgf@x
15586 }
15587 \anchor{in up}{
15588 \inOneFixed
15589 }
15590 \anchor{in down}{
15591 \inOneFixed
15592 \pgf@y=-\pgf@y
15593 }
15594 \savedanchor\inOne{%
15595 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15596 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15597 \pgf@y=.5\pgf@y
15598 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
15599 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15600 \pgf@x=.5\pgf@x
15601 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15602 }
15603 \anchor{-}{
15604 \inOne
15605 }
15606 \anchor{+}{
15607 \inOne
15608 \pgf@y=-\pgf@y
15609 }
15610 % R ampli anchors. They are by default at 20% more than R-length distance
15611 % you can change that with the `ra pos` key (use 0.5 for one-R).
15612 \savedanchor\raOneFixed{%
15613 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15614 \pgf@y=\pgf@circ@scaled@Rlen
15615 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
15616 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15617 \pgf@x=.5\pgf@x
15618 }
15619 \anchor{ra up}{
15620 \raOneFixed
15621 }
15622 \anchor{ra down}{
15623 \raOneFixed
15624 \pgf@y=-\pgf@y
15625 }
15626 \savedanchor\raOne{%
15627 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15628 \pgf@y=\pgf@circ@scaled@Rlen
15629 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
15630 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15631 \pgf@x=.5\pgf@x
15632 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15633 }
15634 \anchor{ra-}{
15635 \raOne
15636 }
15637 \anchor{ra+}{
15638 \raOne
15639 \pgf@y=-\pgf@y
15640 }
15641 % power supplies
15642 \savedanchor\up{%
15643 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15644 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15645 \pgf@y=.5\pgf@y
15646 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15647 \pgf@x=.5\pgf@x
15648 \pgf@circ@res@up = \pgf@y
15649 \pgf@circ@res@right = -\pgf@x
15650 \pgf@circ@res@left = \pgf@x
15651 \pgfpointlineattime{
15652 \ctikzvalof{tripoles/inst amp ra/up pos}}{
15653 \pgfpoint{
15654 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15655 {\pgf@circ@res@up}}
15656 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
15657 }
15658 \anchor{up}{
15659 \up
15660 }
15661 \anchor{down}{
15662 \up
15663 \pgf@y=-\pgf@y
15664 }
15665 % reference voltage input anchors.
15666 \savedanchor\refv{%
15667 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15668 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
15669 \pgf@y=0.5\pgf@y
15670 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15671 \pgf@x=0.5\pgf@x
15672 \pgf@circ@res@up = \pgf@y
15673 \pgf@circ@res@right = -\pgf@x
15674 \pgf@circ@res@left = \pgf@x
15675 \pgfpointlineattime{
15676 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
15677 \pgfpoint{
15678 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15679 {\pgf@circ@res@up}}
15680 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
15681 }
15682 % we need both because they are normally drawn under the amp, and if you
15683 % mirror it vertically you need them
15684 \anchor{refv up}{
15685 \refv
15686 }
15687 \anchor{refv down}{
15688 \refv
15689 \pgf@y=-\pgf@y
15690 }
15691 \anchor{out}{
15692 \northwest
15693 \pgf@y=0pt
15694 \pgf@x=-\pgf@x
15695 }
15696 % support for border anchors
15697 \savedanchor\leftedge{%
15698 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15699 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
15700 \pgf@x=.5\pgf@x
15701 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
15702 \pgf@y=0pt
15703 }
15704 \anchor{leftedge}{\leftedge}
15705 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15706 \anchor{bin up}{
15707 \inOneFixed
15708 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15709 }
15710 \anchor{bin down}{
15711 \inOneFixed
15712 \pgf@y=-\pgf@y
15713 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15714 }
15715 \anchor{b-}{
15716 \inOne
15717 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15718 }
15719 \anchor{b+}{
15720 \inOne
15721 \pgf@y=-\pgf@y
15722 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15723 }
15724 \anchor{bra up}{
15725 \raOneFixed
15726 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15727 }
15728 \anchor{bra down}{
15729 \raOneFixed
15730 \pgf@y=-\pgf@y
15731 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15732 }
15733 \anchor{bra-}{
15734 \raOne
15735 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15736 }
15737 \anchor{bra+}{
15738 \raOne
15739 \pgf@y=-\pgf@y
15740 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15741 }
15742 \anchor{bout}{
15743 \leftedge
15744 \pgf@y=0pt
15745 \pgf@x=-\pgf@x
15746 }
15747 % end border anchors
15748 \anchor{west}{
15749 \left
15750 }
15751 \anchor{east}{
15752 \left
15753 \pgf@x=-\pgf@x
15754 }
15755 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15756 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15757 \anchor{north west}{ \northwest }
15758 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15759
15760 \anchor{text}{
15761 \ifpgf@circ@center@text
15762 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15763 \else
15764 \leftedge
15765 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15766 \fi
15767 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15768 }
15769
15770 % drawing of the component
15771 \backgroundpath{
15772 \pgfsetcolor{\ctikzvalof{color}}
15773
15774 \northwest
15775 \pgf@circ@res@up = \pgf@y
15776 \pgf@circ@res@down = -\pgf@y
15777 \pgf@circ@res@right = -\pgf@x
15778 \pgf@circ@res@left = \pgf@x
15779 \pgf@circ@scaled@Rlen=\scaledRlen
15780
15781 \newdimen\pgf@circ@res@right@double
15782 \pgf@circ@res@right@double=2\pgf@circ@res@right
15783
15784 % main component, normally in thicker lines
15785 \pgfscope
15786 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15787 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15788 \pgf@circ@res@step=\pgf@circ@res@right
15789 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15790 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
15791 %primer punto: la linea de salida (lado componente)
15792 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
15793 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
15794 \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}}
15795 % and then to the input "front up", "down", to the output short side "down"
15796 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15797 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15798 \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}}
15799 % ...and close
15800 \pgfpathclose
15801 \pgf@circ@draworfill
15802 \endpgfscope
15803
15804 % ra terminal -
15805 \pgfpathmoveto{\pgfpoint
15806 {\pgf@circ@res@left}
15807 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15808 %
15809 \pgfpathlineto{\pgfpoint
15810 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15811 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15812 % ra terminal +
15813 \pgfpathmoveto{\pgfpoint
15814 {\pgf@circ@res@left}
15815 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15816 %
15817 \pgfpathlineto{\pgfpoint
15818 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15819 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15820
15821 % Negative input terminal
15822 \pgfpathmoveto{\pgfpoint
15823 {\pgf@circ@res@left}
15824 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
15825 %
15826 \pgfpathlineto{\pgfpoint
15827 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15828 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
15829 %
15830 \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}
15831
15832 % Positive input terminal
15833 \pgfpathmoveto{\pgfpoint
15834 {\pgf@circ@res@left}
15835 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
15836 %
15837 \pgfpathlineto{\pgfpoint
15838 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15839 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
15840 \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}
15841
15842 % Output terminal
15843 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15844 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
15845 %
15846 \pgfsetrectcap
15847 \pgfusepath{draw}
15848 }
15849 }
15850
15851 % Buffer
15852 % Contributed by Danilo Piazzalunga
15853 \pgfdeclareshape{buffer}
15854 {
15855 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15856 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15857 \anchor{center}{\pgfpointorigin}
15858 \savedanchor\northwest{%
15859 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15860 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
15861 \pgf@y=.5\pgf@y
15862 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
15863 \pgf@x=.5\pgf@x
15864 }
15865 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15866 \anchor{west}{ \northwest \pgf@y=0pt }
15867 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15868 \anchor{north}{ \northwest \pgf@x=0pt }
15869 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15870 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15871 \anchor{north west}{ \northwest }
15872 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15873 \savedanchor\left{%
15874 \pgf@y=0pt
15875 }
15876 \anchor{in}{
15877 \northwest
15878 \pgf@y=0pt
15879 }
15880 \anchor{out}{
15881 \northwest
15882 \pgf@y=0pt
15883 \pgf@x=-\pgf@x
15884 }
15885 \anchor{bin}{
15886 \northwest
15887 \pgf@y=0pt
15888 \pgf@x=0.7\pgf@x
15889 }
15890 \anchor{bout}{
15891 \northwest
15892 \pgf@y=0pt
15893 \pgf@x=-0.7\pgf@x
15894 }
15895
15896 \anchor{text}{
15897 \ifpgf@circ@center@text
15898 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15899 \else
15900 \northwest
15901 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
15902 \fi
15903 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15904 }
15905
15906 \backgroundpath{
15907 \pgfsetcolor{\ctikzvalof{color}}
15908
15909 \northwest
15910 \pgf@circ@res@up = \pgf@y
15911 \pgf@circ@res@down = -\pgf@y
15912 \pgf@circ@res@right = -\pgf@x
15913 \pgf@circ@res@left = \pgf@x
15914 \pgf@circ@scaled@Rlen=\scaledRlen
15915 \pgfscope
15916 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15917 \pgftransformxshift{.7\pgf@circ@res@left}
15918 \pgf@circ@res@step=\pgf@circ@res@right
15919 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15920 \pgf@circ@res@step=.7\pgf@circ@res@step
15921
15922 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15923 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15924 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15925 \pgfpathclose
15926 \pgf@circ@draworfill
15927 \endpgfscope
15928
15929 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15930 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
15931
15932 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15933 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
15934
15935 \pgfusepath{draw}
15936 }
15937 }
15938
15939 % plain amplifier, no symbols
15940 \pgfdeclareshape{plain amp}
15941 {
15942 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15943 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15944 \anchor{center}{\pgfpointorigin}
15945 \savedanchor\northwest{%
15946 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15947 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15948 \pgf@y=.5\pgf@y
15949 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15950 \pgf@x=.5\pgf@x
15951 }
15952 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15953 \anchor{west}{ \northwest \pgf@y=0pt }
15954 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15955 \anchor{north}{ \northwest \pgf@x=0pt }
15956 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15957 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15958 \anchor{north west}{ \northwest }
15959 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15960 \savedanchor\left{%
15961 \pgf@y=0pt
15962 }
15963 \savedanchor\inOne{%
15964 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15965 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15966 \pgf@y=.5\pgf@y
15967 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
15968 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15969 \pgf@x=.5\pgf@x
15970 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15971 }
15972 \savedanchor\inOneFixed{%
15973 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15974 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15975 \pgf@y=.5\pgf@y
15976 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
15977 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15978 \pgf@x=.5\pgf@x
15979 }
15980 \anchor{-}{
15981 \inOne
15982 }
15983 \anchor{+}{
15984 \inOne
15985 \pgf@y=-\pgf@y
15986 }
15987 \anchor{in up}{
15988 \inOneFixed
15989 }
15990 \anchor{in down}{
15991 \inOneFixed
15992 \pgf@y=-\pgf@y
15993 }
15994 % support for border anchors
15995 \savedanchor\leftedge{%
15996 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15997 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15998 \pgf@x=.5\pgf@x
15999 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
16000 \pgf@y=0pt
16001 }
16002 \anchor{leftedge}{\leftedge}
16003 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16004 \anchor{bin up}{
16005 \inOneFixed
16006 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16007 }
16008 \anchor{bin down}{
16009 \inOneFixed
16010 \pgf@y=-\pgf@y
16011 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16012 }
16013 \anchor{b-}{
16014 \inOne
16015 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16016 }
16017 \anchor{b+}{
16018 \inOne
16019 \pgf@y=-\pgf@y
16020 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16021 }
16022 \anchor{bout}{
16023 \leftedge
16024 \pgf@y=0pt
16025 \pgf@x=-\pgf@x
16026 }
16027 % end border anchors
16028 \savedanchor\up{%
16029 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16030 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16031 \pgf@y=.5\pgf@y
16032 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16033 \pgf@x=.5\pgf@x
16034 \pgf@circ@res@up = \pgf@y
16035 \pgf@circ@res@right = -\pgf@x
16036 \pgf@circ@res@left = \pgf@x
16037 \pgfpointlineattime{
16038 \ctikzvalof{tripoles/plain amp/up pos}}{
16039 \pgfpoint{
16040 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16041 {\pgf@circ@res@up}}
16042 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16043 }
16044 \anchor{up}{
16045 \up
16046 }
16047 \anchor{down}{
16048 \up
16049 \pgf@y=-\pgf@y
16050 }
16051 \anchor{out}{
16052 \northwest
16053 \pgf@y=0pt
16054 \pgf@x=-\pgf@x
16055 }
16056
16057 \anchor{text}{
16058 \ifpgf@circ@center@text
16059 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16060 \else
16061 \leftedge
16062 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16063 \fi
16064 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16065 }
16066
16067 \backgroundpath{
16068 \pgfsetcolor{\ctikzvalof{color}}
16069
16070 \northwest
16071 \pgf@circ@res@up = \pgf@y
16072 \pgf@circ@res@down = -\pgf@y
16073 \pgf@circ@res@right = -\pgf@x
16074 \pgf@circ@res@left = \pgf@x
16075
16076 \pgfscope
16077 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16078 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16079 \pgf@circ@res@step=\pgf@circ@res@right
16080 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16081 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
16082
16083 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16084 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16085 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16086 \pgfpathclose
16087 \pgf@circ@draworfill
16088 \endpgfscope
16089 \pgfpathmoveto{\pgfpoint
16090 {\pgf@circ@res@left}
16091 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
16092 \pgfpathlineto{\pgfpoint
16093 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16094 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
16095
16096
16097 \pgfpathmoveto{\pgfpoint
16098 {\pgf@circ@res@left}
16099 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
16100 \pgfpathlineto{\pgfpoint
16101 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16102 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
16103
16104 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16105 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16106
16107 \pgfusepath{draw}
16108 }
16109 }
16110
16111 % plain amplifier, no symbols, one input
16112 \pgfdeclareshape{plain mono amp}
16113 {
16114 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16115 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16116 \anchor{center}{\pgfpointorigin}
16117 \savedanchor\northwest{%
16118 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16119 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16120 \pgf@y=.5\pgf@y
16121 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16122 \pgf@x=.5\pgf@x
16123 }
16124 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
16125 \anchor{west}{ \northwest \pgf@y=0pt }
16126 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16127 \anchor{north}{ \northwest \pgf@x=0pt }
16128 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16129 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16130 \anchor{north west}{ \northwest }
16131 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16132 \savedanchor\left{%
16133 \pgf@y=0pt
16134 }
16135 \savedanchor\inOne{%
16136 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16137 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16138 \pgf@x=.5\pgf@x
16139 \pgf@y=0pt\relax
16140 }
16141 \anchor{in}{
16142 \inOne
16143 }
16144 % support for border anchors
16145 \savedanchor\leftedge{%
16146 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16147 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16148 \pgf@x=.5\pgf@x
16149 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
16150 \pgf@y=0pt
16151 }
16152 \anchor{leftedge}{\leftedge}
16153 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16154 \anchor{bin}{
16155 \inOne
16156 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16157 }
16158 \anchor{bout}{
16159 \leftedge
16160 \pgf@y=0pt
16161 \pgf@x=-\pgf@x
16162 }
16163 % end border anchors
16164 \savedanchor\up{%
16165 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16166 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
16167 \pgf@y=.5\pgf@y
16168 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
16169 \pgf@x=.5\pgf@x
16170 \pgf@circ@res@up = \pgf@y
16171 \pgf@circ@res@right = -\pgf@x
16172 \pgf@circ@res@left = \pgf@x
16173 \pgfpointlineattime{
16174 \ctikzvalof{tripoles/plain amp/up pos}}{
16175 \pgfpoint{
16176 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16177 {\pgf@circ@res@up}}
16178 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16179 }
16180 \anchor{up}{
16181 \up
16182 }
16183 \anchor{down}{
16184 \up
16185 \pgf@y=-\pgf@y
16186 }
16187 \anchor{out}{
16188 \northwest
16189 \pgf@y=0pt
16190 \pgf@x=-\pgf@x
16191 }
16192
16193 \anchor{text}{
16194 \ifpgf@circ@center@text
16195 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16196 \else
16197 \leftedge
16198 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16199 \fi
16200 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16201 }
16202 \backgroundpath{
16203 \pgfsetcolor{\ctikzvalof{color}}
16204
16205 \northwest
16206 \pgf@circ@res@up = \pgf@y
16207 \pgf@circ@res@down = -\pgf@y
16208 \pgf@circ@res@right = -\pgf@x
16209 \pgf@circ@res@left = \pgf@x
16210
16211 \pgfscope
16212 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16213 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16214 \pgf@circ@res@step=\pgf@circ@res@right
16215 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16216 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
16217
16218 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16219 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16220 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16221 \pgfpathclose
16222 \pgf@circ@draworfill
16223 \endpgfscope
16224 \pgfpathmoveto{\pgfpoint
16225 {\pgf@circ@res@left}
16226 {0pt}}
16227 \pgfpathlineto{\pgfpoint
16228 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
16229 {0pt}}
16230
16231 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16232 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
16233
16234 \pgfusepath{draw}
16235 }
16236 }
16237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16238 %% electromechanical device (motor/generator)
16239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16240
16241 \pgfdeclareshape{elmech}
16242 {
16243 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
16244 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16245 \savedanchor\northwest{
16246 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16247 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
16248 \pgf@y=.5\pgf@y
16249 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
16250 \pgf@x=.5\pgf@x
16251 }
16252 \anchor{center}{
16253 \pgfpointorigin
16254 }
16255 \anchor{text}{
16256 \pgfpointorigin
16257 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16258 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
16259 }
16260 \anchor{left}{%
16261 \northwest
16262 \pgf@y=0pt
16263 }
16264 \anchor{right}{%
16265 \northwest
16266 \pgf@y=0pt
16267 \pgf@x=-\pgf@x
16268 }
16269 \anchor{top}{
16270 \northwest
16271 \pgf@x=0pt
16272 }
16273 \anchor{pathstart}{
16274 \northwest
16275 \pgf@x=0pt
16276 }
16277 \anchor{pathend}{
16278 \northwest
16279 \pgf@x=0pt
16280 \pgf@y=-\pgf@y
16281 }
16282 \anchor{bottom}{
16283 \northwest
16284 \pgf@x=0pt
16285 \pgf@y=-\pgf@y
16286 }
16287 \anchor{center}{
16288 \pgf@y=0pt
16289 \pgf@x=0pt
16290 }
16291 \anchor{east}{
16292 \northwest
16293 \pgf@y=0pt
16294 \pgf@x=-\pgf@x
16295 }
16296 \anchor{west}{
16297 \northwest
16298 \pgf@y=0pt
16299 }
16300 \anchor{south}{
16301 \northwest
16302 \pgf@x=0pt
16303 \pgf@y=-\pgf@y
16304 }
16305 \anchor{north}{
16306 \northwest
16307 \pgf@x=0pt
16308 }
16309 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16310 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16311 \anchor{north west}{ \northwest }
16312 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16313 \anchorborder{%
16314 \@tempdima=\pgf@x\@tempdimb=\pgf@y
16315 \northwest\pgf@circ@res@other=-\pgf@x
16316 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
16317 }
16318 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
16319 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
16320 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
16321 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
16322 \anchor{block up right}{
16323 \northwest
16324 % remember that pgf@x is negative
16325 % center of the block is at 0.5*H+W*cos(30)/2
16326 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16327 \pgf@x=-0.5\pgf@x
16328 }
16329 \anchor{block up left}{
16330 \northwest
16331 % remember that pgf@x is negative
16332 % center of the block is at 0.5*H+W*cos(30)/2
16333 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16334 \pgf@x=0.5\pgf@x
16335 }
16336 \anchor{block down right}{
16337 \northwest
16338 % remember that pgf@x is negative
16339 % center of the block is at 0.5*H+W*cos(30)/2
16340 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16341 \pgf@y=-\pgf@y
16342 \pgf@x=-0.5\pgf@x
16343 }
16344 \anchor{block down left}{
16345 \northwest
16346 % remember that pgf@x is negative
16347 % center of the block is at 0.5*H+W*cos(30)/2
16348 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
16349 \pgf@y=-\pgf@y
16350 \pgf@x=0.5\pgf@x
16351 }
16352 \behindbackgroundpath{
16353 \pgfsetcolor{\ctikzvalof{color}}
16354 \pgf@circ@scaled@Rlen=\scaledRlen
16355 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
16356 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
16357 \pgfscope
16358 \pgfstartlinewidth=\pgflinewidth
16359 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16360 \pgfscope % clip the bar: whole size minus the circle
16361 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
16362 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16363 \pgfseteorule
16364 \pgfusepath{clip}
16365 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
16366 \pgfsetfillcolor{\ctikzvalof{color}}
16367 \pgfusepath{fill, draw}
16368 \endpgfscope
16369 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16370 \ifx\tikz@fillcolor\pgfutil@empty
16371 % set the default fill color to white
16372 \pgfsetfillcolor{white}
16373 % ...but override it if the class is defined!
16374 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
16375 \else
16376 \pgfsetfillcolor{\tikz@fillcolor}
16377 \pgfusepath{draw, fill}
16378 \fi
16379 \endpgfscope
16380 }
16381 }
16382
16383 %%%%%%%%%%%%%%%%%%%
16384 %% Magnetron
16385 %%%%%%%%%%%%%%%%%%%
16386
16387 \pgfdeclareshape{magnetron}
16388 {
16389 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
16390 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16391 \savedanchor\northwest{
16392 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16393 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16394 \pgf@y=.5\pgf@y
16395 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16396 \pgf@x=.5\pgf@x
16397 }
16398 \anchor{center}{
16399 \pgfpointorigin
16400 }
16401 \anchor{anode}{
16402 \northwest
16403 \pgf@x=0pt
16404 \pgf@y=-\pgf@y
16405 }
16406 \anchor{cathode1}{
16407 \northwest
16408 \pgf@circ@res@step=\pgf@y
16409 \pgfmathparse{cos(105)}
16410 \pgf@x=\pgfmathresult\pgf@circ@res@step
16411 \pgfmathparse{sin(105)}
16412 \pgf@y=\pgfmathresult\pgf@circ@res@step
16413 %\pgfpointorigin
16414 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
16415 }
16416 \anchor{cathode2}{
16417 \northwest
16418 \pgf@circ@res@step=\pgf@y
16419 \pgfmathparse{cos(75)}
16420 \pgf@x=\pgfmathresult\pgf@circ@res@step
16421 \pgfmathparse{sin(75)}
16422 \pgf@y=\pgfmathresult\pgf@circ@res@step
16423 %\pgfpointorigin
16424 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
16425 }
16426 \anchor{text}{
16427 \pgfpointorigin
16428 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16429 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
16430 }
16431 \anchor{left}{%
16432 \northwest
16433 \pgf@y=0pt
16434 }
16435 \anchor{right}{%
16436 \northwest
16437 \pgf@y=0pt
16438 \pgf@x=-\pgf@x
16439 }
16440 \anchor{top}{
16441 \northwest
16442 \pgf@x=0pt
16443 }
16444 \anchor{pathstart}{
16445 \northwest
16446 \pgf@x=0pt
16447 }
16448 \anchor{pathend}{
16449 \northwest
16450 \pgf@x=0pt
16451 \pgf@y=-\pgf@y
16452 }
16453 \anchor{bottom}{
16454 \northwest
16455 \pgf@x=0pt
16456 \pgf@y=-\pgf@y
16457 }
16458 \anchor{center}{
16459 \pgf@y=0pt
16460 \pgf@x=0pt
16461 }
16462 \anchor{east}{
16463 \northwest
16464 \pgf@y=0pt
16465 \pgf@x=-\pgf@x
16466 }
16467 \anchor{west}{
16468 \northwest
16469 \pgf@y=0pt
16470 }
16471 \anchor{south}{
16472 \northwest
16473 \pgf@x=0pt
16474 \pgf@y=-\pgf@y
16475 }
16476 \anchor{north}{
16477 \northwest
16478 \pgf@x=0pt
16479 }
16480 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16481 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16482 \anchor{north west}{ \northwest }
16483 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16484 \backgroundpath{
16485 \pgfsetcolor{\ctikzvalof{color}}
16486 \pgf@circ@scaled@Rlen=\scaledRlen
16487 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
16488 \northwest
16489 \pgf@circ@res@up = \pgf@y
16490 \pgf@circ@res@down = -\pgf@y
16491 \pgf@circ@res@right = -\pgf@x
16492 \pgf@circ@res@left = \pgf@x
16493 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
16494
16495 \pgfscope
16496 \pgfstartlinewidth=\pgflinewidth
16497 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16498 %create outer circle
16499 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
16500 \pgf@circ@draworfill
16501 %create chambers
16502 \foreach \angle in {45,135,225,315}{
16503 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
16504 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
16505 }
16506 \pgfsetroundcap
16507 \pgfusepath{draw}
16508 \pgfscope
16509 %draw connection from outside
16510 %anode
16511 \pgfsetlinewidth{\pgfstartlinewidth}
16512 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
16513 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
16514 %cathodes
16515 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
16516 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16517 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
16518 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16519 \pgfsetbuttcap
16520 \pgfusepath{draw}
16521 \endpgfscope
16522 %create cathode
16523 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16524 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
16525 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
16526 \pgfusepath{draw}
16527 %create anode
16528 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
16529 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
16530
16531 \pgfsetbuttcap
16532 \pgfusepath{draw}
16533 \endpgfscope
16534 }
16535 }
16536
16537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16538 % Electronic tubes, submitted by J. op den Brouw
16539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16540
16541 % Draw tube outline
16542 \def\pgf@circ@tubes@drawtube{%
16543 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
16544 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16545 \pgfutil@tempdima=\pgf@circ@res@right
16546 \advance\pgfutil@tempdima by -\pgf@circ@res@up
16547 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
16548 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
16549 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
16550 \pgfpatharc{270}{90}{\pgf@circ@res@up}
16551 \else
16552 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
16553 \pgfutil@tempdima=\pgf@circ@res@up
16554 \advance\pgfutil@tempdima by -\pgf@circ@res@right
16555 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16556 \pgfpatharc{180}{0}{\pgf@circ@res@right}
16557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
16558 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
16559 \fi
16560 \pgfpathclose
16561 }
16562
16563 %% The diode (tube), triode, tetrode and pentode only differ in the
16564 %% number of grids. So we construct a generic declare function in
16565 %% which we can put code for the grid anchors and grid drawing code
16566 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
16567 \long\def\pgfcircdeclaretube#1#2#3{%
16568 \pgfdeclareshape{#1}{
16569 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
16570 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16571 \anchor{center}{
16572 \pgfpointorigin
16573 }
16574 \savedanchor\northwest{%
16575 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16576 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16577 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16578 % x and y should be half the Rlen
16579 \pgf@y=\pgf@circ@res@up
16580 \pgf@y=.5\pgf@y
16581 \pgf@x=-\pgf@circ@res@right
16582 \pgf@x=.5\pgf@x
16583 }
16584 \anchor{north} {%
16585 \northwest
16586 \pgf@x=0pt
16587 }
16588 \anchor{east}{%
16589 \northwest
16590 \pgf@x=-\pgf@x
16591 \pgf@y=0pt
16592 }
16593 \anchor{south}{%
16594 \northwest
16595 \pgf@y=-\pgf@y
16596 \pgf@x=0pt
16597 }
16598 \anchor{west}{%
16599 \northwest
16600 \pgf@y=0pt
16601 }
16602 \anchor{north west}{%
16603 \northwest
16604 }
16605 \anchor{north east}{%
16606 \northwest
16607 \pgf@x=-\pgf@x
16608 }
16609 \anchor{south east}{
16610 \northwest
16611 \pgf@x=-\pgf@x
16612 \pgf@y=-\pgf@y
16613 }
16614 \anchor{south west}{
16615 \northwest
16616 \pgf@y=-\pgf@y
16617 }
16618 \anchor{anode} {%
16619 \northwest
16620 \pgf@x=0pt
16621 }
16622 \anchor{cathode}{%
16623 \northwest
16624 \pgf@y=-\pgf@y
16625 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
16626 }
16627 \anchor{cathode 1}{%
16628 \northwest
16629 \pgf@y=-\pgf@y
16630 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
16631 }
16632 \anchor{cathode 2}{%
16633 \northwest
16634 \pgf@y=-\pgf@y
16635 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
16636 }
16637 \anchor{filament 1}{%
16638 \northwest
16639 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16640 \pgf@x=\pgfmathresult\pgf@x
16641 \pgf@y=-\pgf@y
16642 }
16643 \anchor{filament 2}{%
16644 \northwest
16645 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16646 \pgf@x=-\pgfmathresult\pgf@x
16647 \pgf@y=-\pgf@y
16648 }
16649
16650 % Extra anchors
16651 #2
16652
16653 \backgroundpath{
16654 \pgfscope
16655 % Line width for tripoles
16656 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16657 \pgf@circ@scaled@Rlen=\scaledRlen
16658
16659 % Setup to draw tube
16660 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16661 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16662 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
16663 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16664
16665 % Tube outline
16666 \pgf@circ@tubes@drawtube
16667
16668 % Setup to draw grid, filament, anode and cathode
16669 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
16670 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
16671 \pgf@circ@res@up=0.5\pgf@circ@res@up
16672 \pgf@circ@res@right=0.5\pgf@circ@res@right
16673
16674 % Tube fill color (if any)
16675 \pgf@circ@draworfill
16676
16677 % Grid drawing
16678 #3
16679
16680 % Filament (is not drawn by default)
16681 \ifpgf@circuit@tubes@filament
16682 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
16683 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
16684 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
16685 \pgf@xa=\pgfmathresult\pgf@circ@res@right
16686 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
16687 \pgf@ya=\pgfmathresult\pgf@circ@res@up
16688 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
16689 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
16690 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
16691 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
16692 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
16693 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
16694 \pgf@circuit@tubes@filamentfalse
16695 \fi
16696
16697 % Anode (or plate)
16698 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
16699 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16700 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16701 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
16702
16703 % Cathode
16704 \ifpgf@circuit@tubes@nocathode
16705 \pgf@circuit@tubes@nocathodefalse
16706 \else
16707 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
16708 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
16709 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
16710 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
16711 \ifpgf@circuit@tubes@fullcathode
16712 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
16713 \pgf@circuit@tubes@fullcathodefalse
16714 \else
16715 \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}}
16716 \fi
16717 \fi
16718
16719 % Draw the background
16720 \pgfusepath{draw}
16721 \endpgfscope
16722 }
16723 }
16724 }
16725
16726 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
16727
16728 \pgfcircdeclaretube{triode}
16729 {
16730 \anchor{grid} {% should not be used
16731 \northwest
16732 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16733 }
16734 \anchor{control} {%
16735 \northwest
16736 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16737 }
16738 }
16739 {
16740 % Grid protrusion
16741 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16742 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16743 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
16744 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
16745 % Grid dashes: calculations
16746 \pgf@xb=2\pgf@circ@res@right
16747 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16748 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16749 \multiply\pgf@circ@count@a by 2\relax
16750 \advance\pgf@circ@count@a by 1\relax
16751 \advance\pgf@circ@res@step by -\pgf@xa
16752 \divide\pgf@circ@res@step by \pgf@circ@count@a
16753 % Grid dashes: draw
16754 \pgf@circ@res@temp=\pgf@xa
16755 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16756 \loop
16757 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
16759 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16760 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
16761 \advance\pgf@circ@count@a by-1
16762 \ifnum\pgf@circ@count@a>0\relax
16763 \repeat
16764 }
16765
16766 \pgfcircdeclaretube{tetrode}
16767 {
16768 \anchor{grid} {% should not be used
16769 \northwest
16770 \pgfutil@tempdima=\pgf@y
16771 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16772 \pgf@y=0.5\pgf@y
16773 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16774 }
16775 \anchor{control} {%
16776 \northwest
16777 \pgfutil@tempdima=\pgf@y
16778 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16779 \pgf@y=0.5\pgf@y
16780 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16781 }
16782 \anchor{screen} {%
16783 \northwest
16784 \pgfutil@tempdima=\pgf@y
16785 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
16786 \pgf@y=0.5\pgf@y
16787 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16788 }
16789 }
16790 {
16791 % Grid x/y points
16792 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16793 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16794 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
16795 \pgfutil@tempdimb=-\pgfutil@tempdima
16796 \pgfutil@tempdima=0.5\pgfutil@tempdima
16797 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16798 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
16799 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16800 % Grid protrusion
16801 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16802 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16803 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16804 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
16805 % Grid dashes: calculations
16806 \pgf@xb=2\pgf@circ@res@right
16807 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16808 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16809 \multiply\pgf@circ@count@a by 2\relax
16810 \advance\pgf@circ@count@a by 1\relax
16811 \advance\pgf@circ@res@step by -\pgf@xa
16812 \divide\pgf@circ@res@step by \pgf@circ@count@a
16813 % Grid dashes: draw
16814 \pgf@circ@res@temp=\pgf@xa
16815 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16816 \loop
16817 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16820 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16822 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16823 \advance\pgf@circ@count@a by-1
16824 \ifnum\pgf@circ@count@a>0\relax
16825 \repeat
16826 }
16827
16828 \pgfcircdeclaretube{pentode}
16829 {
16830 \anchor{grid} {% should not be used
16831 \northwest
16832 \pgfutil@tempdima=\pgf@y
16833 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16834 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16835 }
16836 \anchor{control} {%
16837 \northwest
16838 \pgfutil@tempdima=\pgf@y
16839 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16840 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16841 }
16842 \anchor{screen} {%
16843 \northwest
16844 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16845 }
16846 \anchor{suppressor} {%
16847 \northwest
16848 \pgfutil@tempdima=\pgf@y
16849 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
16850 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16851 }
16852 }
16853 {
16854 % Grid x/y points
16855 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16856 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16857 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
16858 \pgfutil@tempdimb=-\pgfutil@tempdima
16859 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16860 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16861 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16862 % Grid protrusion
16863 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16864 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16865 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16866 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
16867 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
16868 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
16869 % Grid dashes: calculations
16870 \pgf@xb=2\pgf@circ@res@right
16871 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16872 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16873 \multiply\pgf@circ@count@a by 2\relax
16874 \advance\pgf@circ@count@a by 1\relax
16875 \advance\pgf@circ@res@step by -\pgf@xa
16876 \divide\pgf@circ@res@step by \pgf@circ@count@a
16877 % Grid dashes: draw
16878 \pgf@circ@res@temp=\pgf@xa
16879 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16880 \loop
16881 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16882 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16886 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
16887 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
16888 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16889 \advance\pgf@circ@count@a by-1
16890 \ifnum\pgf@circ@count@a>0\relax
16891 \repeat
16892 }
16893
16894 \pgfcircdeclaretube{pentode suppressor to cathode}
16895 {
16896 \anchor{grid} {% should not be used
16897 \northwest
16898 \pgfutil@tempdima=\pgf@y
16899 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16900 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16901 }
16902 \anchor{control} {%
16903 \northwest
16904 \pgfutil@tempdima=\pgf@y
16905 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16906 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16907 }
16908 \anchor{screen} {%
16909 \northwest
16910 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16911 }
16912 }
16913 {
16914 % Grid x/y points
16915 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16916 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16917 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
16918 \pgfutil@tempdimb=-\pgfutil@tempdima
16919 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16920 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16921 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16922 % Grid protrusion
16923 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16924 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16925 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
16926 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
16927 % Grid dashes: calculations
16928 \pgf@xb=2\pgf@circ@res@right
16929 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16930 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16931 \multiply\pgf@circ@count@a by 2\relax
16932 \advance\pgf@circ@count@a by 1\relax
16933 \advance\pgf@circ@res@step by -\pgf@xa
16934 \divide\pgf@circ@res@step by \pgf@circ@count@a
16935 % Grid dashes: draw
16936 \pgf@circ@res@temp=\pgf@xa
16937 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16938 \loop
16939 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16940 \ifnum\pgf@circ@count@a>1\relax
16941 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16942 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16943 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
16944 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
16945 \fi
16946 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16947 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16948 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16949 \advance\pgf@circ@count@a by-1
16950 \ifnum\pgf@circ@count@a>0\relax
16951 \repeat
16952 % Grid: connection from suppressor to cathode
16953 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
16954 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
16955 \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}}
16956
16957 }
16958
16959 %%%---------- close: tex/pgfcirctripoles
16960 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
16961 %%%---------- open: tex/pgfcircquadpoles.tex
16962 % Copyright 2018-2026 by Romano Giannetti
16963 % Copyright 2015-2026 by Stefan Lindner
16964 % Copyright 2013-2026 by Stefan Erhardt
16965 % Copyright 2007-2026 by Massimo Redaelli
16966 %
16967 % This file may be distributed and/or modified
16968 %
16969 % 1. under the LaTeX Project Public License and/or
16970 % 2. under the GNU Public License.
16971 %
16972 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
16973
16974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16975 %% Quadripoles
16976
16977 \long\def\pgfcircdeclarequadpole#1#2#3{
16978 \pgfdeclareshape{#1}
16979 {
16980 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
16981 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16982 % shapename
16983 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
16984 \anchor{center}{
16985 \northwest
16986 \pgf@x=0pt
16987 \pgf@y=0pt
16988 }
16989 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
16990 \savedanchor\northwest{%
16991 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16992 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
16993 \pgf@y=.5\pgf@y
16994 \pgf@x=.5\pgf@circ@scaled@Rlen
16995 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
16996 }
16997 %% we define the upper right (positive coord) dot (which is B1)
16998 \savedanchor{\innerdot}{%
16999 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17000 \pgf@xa=.5\pgf@circ@scaled@Rlen
17001 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
17002 % by default use the cute inductor size
17003 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
17004 % check if it's american
17005 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
17006 \edef\pgf@temp{american}
17007 \ifx\pgf@circ@temp\pgf@temp
17008 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
17009 \fi
17010 % check if it's european
17011 \edef\pgf@temp{european}
17012 \ifx\pgf@circ@temp\pgf@temp
17013 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
17014 \fi
17015 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
17016 }
17017 \savedanchor{\outerdot}{%
17018 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17019 \pgf@xa=.5\pgf@circ@scaled@Rlen
17020 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
17021 % by default use the cute inductor size
17022 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
17023 % check if it's american
17024 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
17025 \edef\pgf@temp{american}
17026 \ifx\pgf@circ@temp\pgf@temp
17027 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
17028 \fi
17029 % check if it's european
17030 \edef\pgf@temp{european}
17031 \ifx\pgf@circ@temp\pgf@temp
17032 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
17033 \fi
17034 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
17035 }
17036 \anchor{A2}{
17037 \northwest
17038 \pgf@y=-\pgf@y
17039 }
17040 \anchor{B1}{
17041 \northwest
17042 \pgf@x=-\pgf@x
17043 }
17044 \anchor{A1}{
17045 \northwest
17046 }
17047 \anchor{B2}{
17048 \northwest
17049 \pgf@x=-\pgf@x
17050 \pgf@y=-\pgf@y
17051 }
17052 %% dot's anchors
17053 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
17054 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
17055 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17056 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17057 \anchor{inner dot B1}{\innerdot}
17058 \anchor{outer dot B1}{\outerdot}
17059 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
17060 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
17061 % geographical
17062 \anchor{north}{
17063 \northwest
17064 \pgf@x=0pt
17065 }
17066 \anchor{south}{
17067 \northwest
17068 \pgf@x=0pt
17069 \pgf@y=-\pgf@y
17070 }
17071 \anchor{west}{
17072 \northwest
17073 \pgf@y=0pt
17074 }
17075 \anchor{east}{
17076 \northwest
17077 \pgf@y=0pt
17078 \pgf@x=-\pgf@x
17079 }
17080 \anchor{south west}{
17081 \northwest
17082 \pgf@y=-\pgf@y
17083 }
17084 \anchor{north east}{
17085 \northwest
17086 \pgf@x=-\pgf@x
17087 }
17088 \anchor{north west}{
17089 \northwest
17090 }
17091 \anchor{south east}{
17092 \northwest
17093 \pgf@x=-\pgf@x
17094 \pgf@y=-\pgf@y
17095 }
17096 \anchor{base}{
17097 \northwest
17098 \pgf@x=0pt
17099 }
17100 #3
17101 \backgroundpath{
17102 \pgfsetcolor{\ctikzvalof{color}}
17103
17104 \northwest
17105 \pgf@circ@res@up = \pgf@y
17106 \pgf@circ@res@down = -\pgf@y
17107 \pgf@circ@res@right = -\pgf@x
17108 \pgf@circ@res@left = \pgf@x
17109 #2
17110 }
17111 }
17112 }
17113
17114
17115 \def\pgf@circ@drawtransformerbasicanchor{
17116 \ctikzvalof{quadpoles/trans/height}
17117 \anchor{AA2}{
17118 \northwest
17119 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17120 \pgf@x=.7\pgf@x
17121 \pgf@y=-\pgf@y
17122 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17123 }
17124 \anchor{BB1}{
17125 \northwest
17126 \pgf@x=-\pgf@x
17127 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17128 \pgf@x=.7\pgf@x
17129 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17130 }
17131 \anchor{AA1}{
17132 \northwest
17133 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17134 \pgf@x=.7\pgf@x
17135 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17136 }
17137 \anchor{BB2}{
17138 \northwest
17139 \pgf@x=-\pgf@x
17140 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
17141 \pgf@x=.7\pgf@x
17142 \pgf@y=-\pgf@y
17143 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
17144 }
17145 }
17146
17147 %% Null styles that can be used to change individually the L1 and L2
17148 %% inductors of the transformer.
17149
17150 \ctikzset{transformer L1/.style={}}
17151 \ctikzset{transformer L2/.style={}}
17152
17153 \def\pgf@circ@drawtransformerbasicbody{
17154 \pgfscope
17155 \pgfslopedattimetrue
17156 \pgfallowupsidedownattimetrue
17157 \pgftransformlineattime{.5}{%
17158 \pgfpoint%
17159 {\stretto\pgf@circ@res@left}%
17160 {\pgf@circ@res@up}%
17161 }{%
17162 \pgfpoint
17163 {\stretto\pgf@circ@res@left}%
17164 {\pgf@circ@res@down}%
17165 }
17166
17167 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
17168 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
17169 \def\pgf@temp{european}%
17170 \ifx\pgf@temp\pgf@circ@temp%
17171 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17172 \else%
17173 \def\pgf@temp{cute}
17174 \ifx\pgf@temp\pgf@circ@temp%
17175 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17176 \else%
17177 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
17178 \fi%
17179 \fi%
17180
17181
17182 \endpgfscope
17183 \pgfscope
17184 \pgfslopedattimetrue
17185 \pgfallowupsidedownattimetrue
17186 \pgftransformlineattime{.5}{%
17187 \pgfpoint%
17188 {\stretto\pgf@circ@res@right}%
17189 {\pgf@circ@res@down}%
17190 }{%
17191 \pgfpoint
17192 {\stretto\pgf@circ@res@right}%
17193 {\pgf@circ@res@up}%
17194 }
17195
17196 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
17197 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
17198 \def\pgf@temp{european}%
17199 \ifx\pgf@temp\pgf@circ@temp%
17200 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17201 \else%
17202 \def\pgf@temp{cute}
17203 \ifx\pgf@temp\pgf@circ@temp%
17204 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17205 \else%
17206 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
17207 \fi%
17208 \fi%
17209
17210 \endpgfscope
17211
17212 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
17213 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
17214 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
17215
17216 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
17217 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
17218 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
17219
17220 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17221 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
17222 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
17223
17224 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
17225 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
17226 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17227
17228 \pgfusepath{draw}
17229
17230 }
17231
17232
17233 \pgfcircdeclarequadpole{transformer}{
17234 \pgf@circ@drawtransformerbasicbody
17235 }{\pgf@circ@drawtransformerbasicanchor}
17236
17237 \pgfcircdeclarequadpole{transformer core}{
17238
17239 \pgf@circ@drawtransformerbasicbody
17240
17241 % use the chocke line thickness
17242 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
17243
17244 % Find the distance from center for the lines representing the core
17245 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
17246 % of the whole component, now as a fraction of the distance between coils, to be
17247 % compatible with the quadpoles "inner" style.
17248 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
17249
17250 \pgfmoveto{\pgfpoint%
17251 {\pgf@circ@res@other}%
17252 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
17253 }
17254 \pgflineto{
17255 \pgfpoint%
17256 {\pgf@circ@res@other}%
17257 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
17258 }
17259
17260 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
17261 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
17262 \pgfmoveto{\pgfpoint%
17263 {\pgf@circ@res@other}%
17264 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
17265 }
17266 \pgflineto{
17267 \pgfpoint%
17268 {\pgf@circ@res@other}%
17269 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
17270 }
17271
17272 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
17273 \pgfusepath{draw}
17274 }{\pgf@circ@drawtransformerbasicanchor}
17275
17276
17277 \pgfcircdeclarequadpole{gyrator}{
17278
17279 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
17280 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
17281 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
17282 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
17283
17284 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17285 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
17286 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
17287 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17288
17289 \pgfusepath{draw}
17290
17291 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
17292 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
17293 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
17294 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
17295 \pgfpathclose
17296 \pgf@circ@draworfill
17297
17298 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
17299 \pgfpatharc{90}{270}{\pgf@circ@res@other}
17300 \pgfpathclose
17301 \pgf@circ@draworfill
17302 }{}
17303
17304 %%%%%%%%%%%%%%%%%%%%
17305 %% Block elements
17306 %%%%%%%%%%%%%%%%%%%%
17307
17308 \pgfdeclareshape{mixer}
17309 {
17310 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17311 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17312 \savedanchor\northwest{
17313 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17314 \ifpgf@circuit@boxed
17315 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17316 \pgf@y=.5\pgf@y
17317 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17318 \pgf@x=.5\pgf@x
17319 \else
17320 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17321 \pgf@y=.5\pgf@y
17322 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17323 \pgf@x=.5\pgf@x
17324 \fi
17325 }
17326 \anchor{center}{
17327 \pgfpointorigin
17328 }
17329 \anchor{left}{%
17330 \northwest
17331 \pgf@y=0pt
17332 }
17333 \anchor{right}{
17334 \northwest
17335 \pgf@y=0pt
17336 \pgf@x=-\pgf@x
17337 }
17338 \anchor{1}{
17339 \northwest
17340 \pgf@y=0pt
17341 }
17342 \anchor{2}{
17343 \northwest
17344 \pgf@y=-\pgf@y
17345 \pgf@x=0pt
17346 }
17347 \anchor{3}{
17348 \northwest
17349 \pgf@y=0pt
17350 \pgf@x=-\pgf@x
17351 }
17352 \anchor{4}{
17353 \northwest
17354 \pgf@y=\pgf@y
17355 \pgf@x=0pt
17356 }
17357 \anchor{in 1}{
17358 \northwest
17359 \pgf@y=0pt
17360 }
17361 \anchor{in1}{
17362 \northwest
17363 \pgf@y=0pt
17364 }
17365 \anchor{in}{
17366 \northwest
17367 \pgf@y=0pt
17368 }
17369 \anchor{in 2}{
17370 \northwest
17371 \pgf@y=-\pgf@y
17372 \pgf@x=0pt
17373 }
17374 \anchor{in2}{
17375 \northwest
17376 \pgf@y=-\pgf@y
17377 \pgf@x=0pt
17378 }
17379 \anchor{out}{
17380 \northwest
17381 \pgf@y=0pt
17382 \pgf@x=-\pgf@x
17383 }
17384 \anchor{center}{
17385 \pgf@y=0pt
17386 \pgf@x=0pt
17387 }
17388 \anchor{east}{
17389 \northwest
17390 \pgf@y=0pt
17391 \pgf@x=-\pgf@x
17392 }
17393 \anchor{west}{
17394 \northwest
17395 \pgf@y=0pt
17396 }
17397 \anchor{south}{
17398 \northwest
17399 \pgf@x=0pt
17400 \pgf@y=-\pgf@y
17401 }
17402 \anchor{north}{
17403 \northwest
17404 \pgf@x=0pt
17405 }
17406 \anchor{e}{
17407 \northwest
17408 \pgf@y=0pt
17409 \pgf@x=-\pgf@x
17410 }
17411 \anchor{w}{
17412 \northwest
17413 \pgf@y=0pt
17414 }
17415 \anchor{s}{
17416 \northwest
17417 \pgf@x=0pt
17418 \pgf@y=-\pgf@y
17419 }
17420 \anchor{n}{
17421 \northwest
17422 \pgf@x=0pt
17423 }
17424 \anchor{down}{
17425 \northwest
17426 \pgf@x=0pt
17427 \pgf@y=-\pgf@y
17428 }
17429 \anchor{up}{
17430 \northwest
17431 \pgf@x=0pt
17432 }
17433 \anchor{south west}{
17434 \northwest
17435 \pgf@y=-\pgf@y
17436 }
17437 \anchor{north east}{
17438 \northwest
17439 \pgf@x=-\pgf@x
17440 }
17441 \anchor{north west}{
17442 \northwest
17443 }
17444 \anchor{south east}{
17445 \northwest
17446 \pgf@x=-\pgf@x
17447 \pgf@y=-\pgf@y
17448 }
17449 \anchorborder{
17450 \pgf@circ@res@left=\pgf@x
17451 \pgf@circ@res@up=\pgf@y
17452 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17453 }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}}
17454 }
17455 \backgroundpath{
17456 \pgfsetcolor{\ctikzvalof{color}}
17457 \pgf@circ@scaled@Rlen=\scaledRlen
17458
17459 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
17460
17461 \pgfscope
17462 \pgfstartlinewidth=\pgflinewidth
17463
17464 % draw outer box
17465 \ifpgf@circuit@boxed
17466 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17467 \fi
17468
17469 % draw outer circle
17470 \ifpgf@circuit@boxed
17471 \pgf@circ@res@step=.7\pgf@circ@res@step
17472 \pgfsetdash{}{0pt} % draw solid circle if boxed
17473 \else
17474 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17475 \fi
17476 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17477 \pgf@circ@draworfill
17478
17479 % draw inner stuff
17480 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17481 \pgfsetlinewidth{\pgfstartlinewidth}
17482 \pgfpathmoveto{\pgfpointorigin}
17483 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
17484 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
17485 \pgfpathmoveto{\pgfpointorigin}
17486 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
17487 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
17488 \pgfusepath{draw}
17489
17490 \endpgfscope
17491 }
17492 }
17493
17494 \pgfdeclareshape{adder}
17495 {
17496 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17497 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17498 \savedanchor\northwest{
17499 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17500 \ifpgf@circuit@boxed
17501 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17502 \pgf@y=.5\pgf@y
17503 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17504 \pgf@x=.5\pgf@x
17505 \else
17506 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17507 \pgf@y=.5\pgf@y
17508 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17509 \pgf@x=.5\pgf@x
17510 \fi
17511 }
17512 \anchor{center}{
17513 \pgfpointorigin
17514 }
17515 \anchor{left}{%
17516 \northwest
17517 \pgf@y=0pt
17518 }
17519 \anchor{right}{
17520 \northwest
17521 \pgf@y=0pt
17522 \pgf@x=-\pgf@x
17523 }
17524 \anchor{1}{
17525 \northwest
17526 \pgf@y=0pt
17527 }
17528 \anchor{2}{
17529 \northwest
17530 \pgf@y=-\pgf@y
17531 \pgf@x=0pt
17532 }
17533 \anchor{3}{
17534 \northwest
17535 \pgf@y=0pt
17536 \pgf@x=-\pgf@x
17537 }
17538 \anchor{4}{
17539 \northwest
17540 \pgf@y=\pgf@y
17541 \pgf@x=0pt
17542 }
17543 \anchor{in 1}{
17544 \northwest
17545 \pgf@y=0pt
17546 }
17547 \anchor{in1}{
17548 \northwest
17549 \pgf@y=0pt
17550 }
17551 \anchor{in}{
17552 \northwest
17553 \pgf@y=0pt
17554 }
17555 \anchor{in 2}{
17556 \northwest
17557 \pgf@y=-\pgf@y
17558 \pgf@x=0pt
17559 }
17560 \anchor{in2}{
17561 \northwest
17562 \pgf@y=-\pgf@y
17563 \pgf@x=0pt
17564 }
17565 \anchor{out}{
17566 \northwest
17567 \pgf@y=0pt
17568 \pgf@x=-\pgf@x
17569 }
17570 \anchor{center}{
17571 \pgf@y=0pt
17572 \pgf@x=0pt
17573 }
17574 \anchor{east}{
17575 \northwest
17576 \pgf@y=0pt
17577 \pgf@x=-\pgf@x
17578 }
17579 \anchor{west}{
17580 \northwest
17581 \pgf@y=0pt
17582 }
17583 \anchor{south}{
17584 \northwest
17585 \pgf@x=0pt
17586 \pgf@y=-\pgf@y
17587 }
17588 \anchor{north}{
17589 \northwest
17590 \pgf@x=0pt
17591 }
17592 \anchor{e}{
17593 \northwest
17594 \pgf@y=0pt
17595 \pgf@x=-\pgf@x
17596 }
17597 \anchor{w}{
17598 \northwest
17599 \pgf@y=0pt
17600 }
17601 \anchor{s}{
17602 \northwest
17603 \pgf@x=0pt
17604 \pgf@y=-\pgf@y
17605 }
17606 \anchor{n}{
17607 \northwest
17608 \pgf@x=0pt
17609 }
17610 \anchor{down}{
17611 \northwest
17612 \pgf@x=0pt
17613 \pgf@y=-\pgf@y
17614 }
17615 \anchor{up}{
17616 \northwest
17617 \pgf@x=0pt
17618 }
17619 \anchor{south west}{
17620 \northwest
17621 \pgf@y=-\pgf@y
17622 }
17623 \anchor{north east}{
17624 \northwest
17625 \pgf@x=-\pgf@x
17626 }
17627 \anchor{north west}{
17628 \northwest
17629 }
17630 \anchor{south east}{
17631 \northwest
17632 \pgf@x=-\pgf@x
17633 \pgf@y=-\pgf@y
17634 }
17635 \anchorborder{
17636 \pgf@circ@res@left=\pgf@x
17637 \pgf@circ@res@up=\pgf@y
17638 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17639 }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}}
17640 }
17641 \backgroundpath{
17642 \pgfsetcolor{\ctikzvalof{color}}
17643 \pgf@circ@scaled@Rlen=\scaledRlen
17644
17645 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
17646
17647 \pgfscope
17648 \pgfstartlinewidth=\pgflinewidth
17649
17650 % draw outer box
17651 \ifpgf@circuit@boxed
17652 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17653 \fi
17654
17655 % draw outer circle
17656 \ifpgf@circuit@boxed
17657 \pgf@circ@res@step=.7\pgf@circ@res@step{}
17658 \pgfsetdash{}{0pt} % draw solid circle if boxed
17659 \else
17660 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17661 \fi
17662 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17663 \pgf@circ@draworfill
17664
17665 % draw inner stuff
17666 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17667 \pgfsetlinewidth{\pgfstartlinewidth}
17668
17669 \pgfpathmoveto{\pgfpointorigin}
17670 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
17671 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
17672 \pgfpathmoveto{\pgfpointorigin}
17673 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
17674 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
17675 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17676 \pgfusepath{draw}
17677
17678 \endpgfscope
17679 }
17680 }
17681
17682 \pgfdeclareshape{oscillator}
17683 {
17684 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17685 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17686 \savedanchor\northwest{
17687 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17688 \ifpgf@circuit@boxed
17689 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17690 \pgf@y=.5\pgf@y
17691 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17692 \else
17693 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
17694 \pgf@y=.5\pgf@y
17695 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
17696 \fi
17697 }
17698 \anchor{center}{
17699 \pgfpointorigin
17700 }
17701 \anchor{north}{
17702 \northwest
17703 \pgf@x=.5\pgf@x
17704 }
17705 \anchor{south}{
17706 \northwest
17707 \pgf@x=.5\pgf@x
17708 \pgf@y=-\pgf@y
17709 }
17710 \anchor{east}{
17711 \northwest
17712 \pgf@y=0pt
17713 \pgf@x=0pt
17714 }
17715 \anchor{west}{
17716 \northwest
17717 \pgf@y=0pt
17718 }
17719 \anchor{up}{
17720 \northwest
17721 \pgf@x=.5\pgf@x
17722 }
17723 \anchor{down}{
17724 \northwest
17725 \pgf@x=.5\pgf@x
17726 \pgf@y=-\pgf@y
17727 }
17728 \anchor{n}{
17729 \northwest
17730 \pgf@x=.5\pgf@x
17731 }
17732 \anchor{s}{
17733 \northwest
17734 \pgf@x=.5\pgf@x
17735 \pgf@y=-\pgf@y
17736 }
17737 \anchor{e}{
17738 \northwest
17739 \pgf@y=0pt
17740 \pgf@x=0pt
17741 }
17742 \anchor{w}{
17743 \northwest
17744 \pgf@y=0pt
17745 }
17746 \anchor{up}{
17747 \northwest
17748 \pgf@x=.5\pgf@x
17749 }
17750 \anchor{down}{
17751 \northwest
17752 \pgf@x=.5\pgf@x
17753 \pgf@y=-\pgf@y
17754 }
17755 \anchor{right}{
17756 \northwest
17757 \pgf@y=0pt
17758 \pgf@x=0pt
17759 }
17760 \anchor{left}{
17761 \northwest
17762 \pgf@y=0pt
17763 }
17764 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
17765 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
17766 \anchor{north west}{ \northwest }
17767 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17768 \anchor{text}{
17769 \pgf@x=-2\pgf@x
17770 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
17771 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
17772 }
17773 \anchorborder{
17774 \pgf@circ@res@left=\pgf@x
17775 \pgf@circ@res@up=\pgf@y
17776 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17777 }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}}
17778 \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}
17779 }
17780 \backgroundpath{
17781 \pgfsetcolor{\ctikzvalof{color}}
17782 \pgf@circ@scaled@Rlen=\scaledRlen
17783
17784 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
17785
17786 \pgfscope
17787 \pgfstartlinewidth=\pgflinewidth
17788
17789 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
17790
17791 % draw outer box
17792 \ifpgf@circuit@boxed{}
17793 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17794 \fi
17795
17796 % draw outer circle
17797 \ifpgf@circuit@boxed
17798 \pgf@circ@res@step=.7\pgf@circ@res@step{}
17799 \pgfsetdash{}{0pt} % draw solid circle if boxed
17800 \else
17801 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17802 \fi
17803 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17804 \pgf@circ@draworfill
17805
17806 % draw inner sine waves
17807 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17808 \pgfsetlinewidth{\pgfstartlinewidth}
17809 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
17810 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
17811 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
17812 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
17813 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
17814 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
17815
17816 \pgfusepath{draw}
17817
17818 \endpgfscope
17819 }
17820 }
17821
17822 \pgfdeclareshape{circulator}
17823 {
17824 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17825 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17826 \savedanchor\northwest{
17827 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17828 \ifpgf@circuit@boxed
17829 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17830 \pgf@y=.5\pgf@y
17831 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
17832 \pgf@x=.5\pgf@x
17833 \else
17834 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
17835 \pgf@y=.5\pgf@y
17836 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
17837 \pgf@x=.5\pgf@x
17838 \fi
17839 }
17840 \anchor{center}{
17841 \pgfpointorigin
17842 }
17843 \anchor{left}{%
17844 \northwest
17845 \pgf@y=0pt
17846 }
17847 \anchor{right}{
17848 \northwest
17849 \pgf@y=0pt
17850 \pgf@x=-\pgf@x
17851 }
17852 \anchor{1}{
17853 \northwest
17854 \pgf@y=0pt
17855 }
17856 \anchor{2}{
17857 \northwest
17858 \pgf@y=0pt
17859 \pgf@x=-\pgf@x
17860 }
17861 \anchor{3}{
17862 \northwest
17863 \pgf@y=-\pgf@y
17864 \pgf@x=0pt
17865 }
17866 \anchor{east}{
17867 \northwest
17868 \pgf@y=0pt
17869 \pgf@x=-\pgf@x
17870 }
17871 \anchor{west}{
17872 \northwest
17873 \pgf@y=0pt
17874 }
17875 \anchor{south}{
17876 \northwest
17877 \pgf@x=0pt
17878 \pgf@y=-\pgf@y
17879 }
17880 \anchor{north}{
17881 \northwest
17882 \pgf@x=0pt
17883 }
17884 \anchor{e}{
17885 \northwest
17886 \pgf@y=0pt
17887 \pgf@x=-\pgf@x
17888 }
17889 \anchor{w}{
17890 \northwest
17891 \pgf@y=0pt
17892 }
17893 \anchor{s}{
17894 \northwest
17895 \pgf@x=0pt
17896 \pgf@y=-\pgf@y
17897 }
17898 \anchor{n}{
17899 \northwest
17900 \pgf@x=0pt
17901 }
17902 \anchor{down}{
17903 \northwest
17904 \pgf@x=0pt
17905 \pgf@y=-\pgf@y
17906 }
17907 \anchor{up}{
17908 \northwest
17909 \pgf@x=0pt
17910 }
17911 \anchor{south west}{
17912 \northwest
17913 \pgf@y=-\pgf@y
17914 }
17915 \anchor{north east}{
17916 \northwest
17917 \pgf@x=-\pgf@x
17918 }
17919 \anchor{north west}{
17920 \northwest
17921 }
17922 \anchor{south east}{
17923 \northwest
17924 \pgf@x=-\pgf@x
17925 \pgf@y=-\pgf@y
17926 }
17927 \anchorborder{
17928 \pgf@circ@res@left=\pgf@x
17929 \pgf@circ@res@up=\pgf@y
17930 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
17931 }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}}
17932 }
17933 \backgroundpath{
17934 \pgfsetcolor{\ctikzvalof{color}}
17935 \pgf@circ@scaled@Rlen=\scaledRlen
17936
17937 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
17938
17939 \pgfscope
17940 \pgfstartlinewidth=\pgflinewidth
17941
17942 % draw outer box
17943 \ifpgf@circuit@boxed
17944 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
17945 \fi
17946
17947 % draw outer circle
17948 \ifpgf@circuit@boxed{}
17949 \pgf@circ@res@step=.7\pgf@circ@res@step{}
17950 \pgfsetdash{}{0pt} % draw solid circle if boxed
17951 \else
17952 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17953 \fi
17954 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
17955 \pgf@circ@draworfill
17956
17957 % inner arrow
17958 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17959 \pgfsetlinewidth{\pgfstartlinewidth}
17960
17961 \pgfsetarrowsend{latex}
17962 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
17963 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
17964 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
17965 \pgfusepath{draw}
17966
17967 \endpgfscope
17968 }
17969 }
17970
17971 %% gridnode
17972 \pgfdeclareshape{gridnode}
17973 {
17974 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17975 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17976 \savedanchor\northwest{
17977 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17978 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17979 \pgf@y=.5\pgf@y
17980 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17981 \pgf@x=.5\pgf@x
17982 }
17983 \anchor{center}{
17984 \pgfpointorigin
17985 }
17986
17987 \anchor{north}{
17988 \northwest
17989 \pgf@x=0pt
17990 }
17991 \anchor{up}{
17992 \northwest
17993 \pgf@x=0pt
17994 }
17995 \anchor{south}{
17996 \northwest
17997 \pgf@x=0pt
17998 \pgf@y=-\pgf@y
17999 }
18000 \anchor{down}{
18001 \northwest
18002 \pgf@x=0pt
18003 \pgf@y=-\pgf@y
18004 }
18005 \anchor{east}{
18006 \northwest
18007 \pgf@y=0pt
18008 \pgf@x=-\pgf@x
18009 }
18010 \anchor{right}{
18011 \northwest
18012 \pgf@y=0pt
18013 \pgf@x=-\pgf@x
18014 }
18015 \anchor{west}{
18016 \northwest
18017 \pgf@y=0pt
18018 }
18019 \anchor{left}{
18020 \northwest
18021 \pgf@y=0pt
18022 }
18023 \anchor{south west}{
18024 \northwest
18025 \pgf@y=-\pgf@y
18026 }
18027 \anchor{north east}{
18028 \northwest
18029 \pgf@x=-\pgf@x
18030 \relax
18031 }
18032 \anchor{north west}{
18033 \northwest
18034 }
18035 \anchor{south east}{
18036 \northwest
18037 \pgf@x=-\pgf@x
18038 \pgf@y=-\pgf@y
18039 }
18040 \anchor{text}{
18041 \pgf@x=-2\pgf@x
18042 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
18043 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
18044 }
18045 \backgroundpath{
18046 \pgfsetcolor{\ctikzvalof{color}}
18047 \pgf@circ@scaled@Rlen=\scaledRlen
18048
18049 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18050
18051 \northwest
18052 \pgf@circ@res@up = \pgf@y
18053 \pgf@circ@res@down = -\pgf@y
18054 \pgf@circ@res@right = -\pgf@x
18055 \pgf@circ@res@left = \pgf@x
18056
18057 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
18058 \divide \pgf@circ@res@step by 2
18059
18060 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
18061 \pgf@circ@res@other = \pgf@circ@res@left
18062 \advance\pgf@circ@res@other by \pgf@circ@res@step
18063
18064 \ifpgf@circuit@dashed
18065 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
18066 \fi
18067
18068 % draw outer box
18069 \pgf@circ@twoportbox
18070
18071
18072 \ifpgf@circuit@inputarrow
18073 {
18074 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
18075 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
18076 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
18077 }
18078 \fi
18079
18080 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18081 \pgfsetarrows{-} %never draw arrows
18082 \pgfsetlinewidth{0.05mm}
18083
18084 % draw grid
18085 \foreach \line in {-1,-.5,...,1}
18086 {
18087 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
18088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
18089
18090 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
18091 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
18092 }
18093
18094 %prevent from draw the inner cross twice
18095 \foreach \line in {-.5,0,...,.5}
18096 {
18097 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
18098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
18099
18100 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
18101 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
18102 }
18103 \pgfusepath{draw}
18104 }
18105 }
18106
18107
18108 % Wilkinson divider
18109 \pgfdeclareshape{wilkinson}{
18110 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18111 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18112 \savedanchor\northwest{%
18113 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18114 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
18115 \pgf@y=.5\pgf@y
18116 \pgf@x= \pgf@circ@scaled@Rlen
18117 \pgf@x=.5\pgf@x
18118 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
18119 }
18120 \anchor{center}{
18121 \northwest
18122 \pgf@x=0pt
18123 \pgf@y=0pt
18124 }
18125 \anchor{north}{
18126 \northwest
18127 \pgf@x=0pt
18128 }
18129 \anchor{south}{
18130 \northwest
18131 \pgf@x=0pt
18132 \pgf@y=-\pgf@y
18133 }
18134 \anchor{west}{
18135 \northwest
18136 \pgf@y=0pt
18137 }
18138 \anchor{east}{
18139 \northwest
18140 \pgf@y=0pt
18141 \pgf@x=-\pgf@x
18142 }
18143 \anchor{south west}{
18144 \northwest
18145 \pgf@y=-\pgf@y
18146 }
18147 \anchor{north east}{
18148 \northwest
18149 \pgf@x=-\pgf@x
18150 }
18151 \anchor{north west}{
18152 \northwest
18153 }
18154 \anchor{south east}{
18155 \northwest
18156 \pgf@x=-\pgf@x
18157 \pgf@y=-\pgf@y
18158 }
18159 \anchor{in}{
18160 \northwest
18161 \pgf@y=0pt
18162 }
18163 \anchor{out1}{
18164 \northwest
18165 \pgf@x=-\pgf@x
18166 \pgf@y=-0.5\pgf@y
18167 }
18168 \anchor{out2}{
18169 \northwest
18170 \pgf@x=-\pgf@x
18171 \pgf@y=0.5\pgf@y
18172 }
18173 \anchor{text}{
18174 \northwest
18175 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18176 \pgf@x=-.5\wd\pgfnodeparttextbox
18177 }
18178 \backgroundpath{
18179 \pgfsetcolor{\ctikzvalof{color}}
18180 \pgf@circ@scaled@Rlen=\scaledRlen
18181
18182 \northwest
18183 \pgf@circ@res@up = \pgf@y
18184 \pgf@circ@res@down = -\pgf@y
18185 \pgf@circ@res@right = -\pgf@x
18186 \pgf@circ@res@left = \pgf@x
18187
18188 \pgfstartlinewidth=\pgflinewidth
18189
18190 % draw outer box
18191 \pgf@circ@twoportbox
18192
18193 % draw inner stuff
18194 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18195 \pgfsetarrows{-} %never draw arrows
18196 \pgfsetlinewidth{\pgfstartlinewidth}
18197 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
18198 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18199 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18200 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18201 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18202 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18203 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18204
18205 \pgfusepath{draw}
18206
18207 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18208 % draw inner resisitor - european or american style is recognised
18209 {
18210 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
18211 \pgftransformrotate{90}
18212
18213 % calculate size of resistor
18214 \ifpgf@circuit@europeanresistor
18215 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
18216 \pgftransformscale{\pgfmathresult}
18217 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18218 \else
18219 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
18220 \pgftransformscale{\pgfmathresult}
18221 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18222 \fi
18223 }
18224
18225 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18226 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
18227
18228 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
18229 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18230 \pgfusepath{draw}
18231
18232 }
18233 }
18234
18235 %% resistive splitter
18236 \pgfdeclareshape{splitter}{
18237 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18238 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18239 \savedanchor\northwest{%
18240 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18241 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
18242 \pgf@y=.5\pgf@y
18243 \pgf@x= \pgf@circ@scaled@Rlen
18244 \pgf@x=.5\pgf@x
18245 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
18246 }
18247 \anchor{center}{
18248 \northwest
18249 \pgf@x=0pt
18250 \pgf@y=0pt
18251 }
18252 \anchor{north}{
18253 \northwest
18254 \pgf@x=0pt
18255 }
18256 \anchor{south}{
18257 \northwest
18258 \pgf@x=0pt
18259 \pgf@y=-\pgf@y
18260 }
18261 \anchor{west}{
18262 \northwest
18263 \pgf@y=0pt
18264 }
18265 \anchor{east}{
18266 \northwest
18267 \pgf@y=0pt
18268 \pgf@x=-\pgf@x
18269 }
18270 \anchor{south west}{
18271 \northwest
18272 \pgf@y=-\pgf@y
18273 }
18274 \anchor{north east}{
18275 \northwest
18276 \pgf@x=-\pgf@x
18277 }
18278 \anchor{north west}{
18279 \northwest
18280 }
18281 \anchor{south east}{
18282 \northwest
18283 \pgf@x=-\pgf@x
18284 \pgf@y=-\pgf@y
18285 }
18286 \anchor{in}{
18287 \northwest
18288 \pgf@y=0pt
18289 }
18290 \anchor{out1}{
18291 \northwest
18292 \pgf@x=-\pgf@x
18293 \pgf@y=-0.5\pgf@y
18294 }
18295 \anchor{out2}{
18296 \northwest
18297 \pgf@x=-\pgf@x
18298 \pgf@y=0.5\pgf@y
18299 }
18300 \anchor{text}{
18301 \northwest
18302 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18303 \pgf@x=-.5\wd\pgfnodeparttextbox
18304 }
18305 \backgroundpath{
18306 \pgfsetcolor{\ctikzvalof{color}}
18307 \pgf@circ@scaled@Rlen=\scaledRlen
18308
18309 \northwest
18310 \pgf@circ@res@up = \pgf@y
18311 \pgf@circ@res@down = -\pgf@y
18312 \pgf@circ@res@right = -\pgf@x
18313 \pgf@circ@res@left = \pgf@x
18314
18315 \pgfstartlinewidth=\pgflinewidth
18316
18317 % draw outer box
18318 \pgf@circ@twoportbox
18319
18320 % draw inner stuff
18321 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18322 \pgfsetarrows{-} %never draw arrows
18323 \pgfsetlinewidth{\pgfstartlinewidth}
18324 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
18325 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18326 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18327 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18328 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
18329 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18331
18332 \pgfusepath{draw}
18333
18334 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18335 % draw inner resisitors - european or american style is recognised
18336 \foreach \respt/\resang/\linepta/\lineptb in %
18337 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
18338 \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},%
18339 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
18340 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
18341 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
18342 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
18343 {
18344 {
18345 \pgftransformshift{\respt}
18346 \pgftransformrotate{\resang}
18347
18348 % calculate size of resistor
18349 \ifpgf@circuit@europeanresistor
18350 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
18351 \pgftransformscale{\pgfmathresult}
18352 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18353 \else
18354 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
18355 \pgftransformscale{\pgfmathresult}
18356 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
18357 \fi
18358 }
18359
18360 \pgfpathmoveto{\linepta}
18361 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
18362
18363 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
18364 \pgfpathlineto{\lineptb}
18365 \pgfusepath{draw}
18366 }
18367 }
18368 }
18369
18370 %% couplers generics
18371 \long\def\pgfcircdeclarefourport#1#2{
18372
18373 \pgfdeclareshape{#1}{
18374 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18375 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18376 \anchor{center}{
18377 \northwest
18378 \pgf@x=0pt
18379 \pgf@y=0pt
18380 }
18381 \savedanchor\northwest{%
18382 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18383 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
18384 \pgf@y=.5\pgf@y
18385 \pgf@x=.5\pgf@circ@scaled@Rlen
18386 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
18387 }
18388 \anchor{north}{
18389 \northwest
18390 \pgf@x=0pt
18391 }
18392 \anchor{south}{
18393 \northwest
18394 \pgf@x=0pt
18395 \pgf@y=-\pgf@y
18396 }
18397 \anchor{west}{
18398 \northwest
18399 \pgf@y=0pt
18400 }
18401 \anchor{east}{
18402 \northwest
18403 \pgf@y=0pt
18404 \pgf@x=-\pgf@x
18405 }
18406 \anchor{south west}{
18407 \northwest
18408 \pgf@y=-\pgf@y
18409 }
18410 \anchor{north east}{
18411 \northwest
18412 \pgf@x=-\pgf@x
18413 }
18414 \anchor{north west}{
18415 \northwest
18416 }
18417 \anchor{south east}{
18418 \northwest
18419 \pgf@x=-\pgf@x
18420 \pgf@y=-\pgf@y
18421 }
18422 \anchor{port1}{
18423 \northwest
18424 \pgf@y=-0.5\pgf@y
18425 }
18426 \anchor{port2}{
18427 \northwest
18428 \pgf@x=-\pgf@x
18429 \pgf@y=-0.5\pgf@y
18430 }
18431 \anchor{port3}{
18432 \northwest
18433 \pgf@x=-\pgf@x
18434 \pgf@y=0.5\pgf@y
18435 }
18436 \anchor{port4}{
18437 \northwest
18438 \pgf@y=0.5\pgf@y
18439 }
18440 \anchor{left down}{
18441 \northwest
18442 \pgf@y=-0.5\pgf@y
18443 }
18444 \anchor{right down}{
18445 \northwest
18446 \pgf@x=-\pgf@x
18447 \pgf@y=-0.5\pgf@y
18448 }
18449 \anchor{right up}{
18450 \northwest
18451 \pgf@x=-\pgf@x
18452 \pgf@y=0.5\pgf@y
18453 }
18454 \anchor{left up}{
18455 \northwest
18456 \pgf@y=0.5\pgf@y
18457 }
18458 \anchor{1}{
18459 \northwest
18460 \pgf@y=-0.5\pgf@y
18461 }
18462 \anchor{2}{
18463 \northwest
18464 \pgf@x=-\pgf@x
18465 \pgf@y=-0.5\pgf@y
18466 }
18467 \anchor{3}{
18468 \northwest
18469 \pgf@x=-\pgf@x
18470 \pgf@y=0.5\pgf@y
18471 }
18472 \anchor{4}{
18473 \northwest
18474 \pgf@y=0.5\pgf@y
18475 }
18476
18477 \anchor{text}{
18478 \northwest
18479 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18480 \pgf@x=-.5\wd\pgfnodeparttextbox
18481 }
18482 \backgroundpath{
18483 \pgfsetcolor{\ctikzvalof{color}}
18484
18485 \northwest
18486 \pgf@circ@res@up = \pgf@y
18487 \pgf@circ@res@down = -\pgf@y
18488 \pgf@circ@res@right = -\pgf@x
18489 \pgf@circ@res@left = \pgf@x
18490 \pgf@circ@scaled@Rlen=\scaledRlen
18491
18492 \pgfstartlinewidth=\pgflinewidth
18493
18494 % draw outer box
18495 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18496 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18497 \pgf@circ@draworfill
18498
18499 % draw inner stuff
18500 #2
18501
18502 % draw inner text
18503 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
18504 }
18505 }
18506 }
18507
18508 % four-port
18509 \pgfcircdeclarefourport{fourport}{}
18510
18511 % straight coupler
18512 \pgfcircdeclarefourport{coupler}{
18513 \pgfsetlinewidth{\pgfstartlinewidth}
18514 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
18515 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18516 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
18517 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18518 \pgfusepath{draw}
18519
18520 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
18521 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
18522 \pgfsetarrows{latex-latex}
18523 \pgfusepath{draw}
18524 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
18525 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
18526 \pgfsetarrows{latex-latex}
18527 \pgfusepath{draw}
18528 }
18529
18530 % "bended" coupler
18531 \pgfcircdeclarefourport{coupler2}{
18532 \pgfsetlinewidth{\pgfstartlinewidth}
18533 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
18534 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
18535 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
18536 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
18537 \pgfusepath{draw}
18538
18539 \pgfscope
18540 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
18541 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
18542 \pgfsetarrowsend{latex}
18543 \pgfusepath{draw}
18544 \endpgfscope
18545 \pgfscope
18546 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
18547 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
18548 \pgfsetarrowsend{latex}
18549 \pgfusepath{draw}
18550 \endpgfscope
18551 \pgfscope
18552 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
18553 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
18554 \pgfsetarrowsend{latex}
18555 \pgfusepath{draw}
18556 \endpgfscope
18557 \pgfscope
18558 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
18559 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
18560 \pgfsetarrowsend{latex}
18561 \pgfusepath{draw}
18562 \endpgfscope
18563 }
18564
18565 % mach zehnder modulator
18566 \pgfdeclareshape{mzm}{
18567 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
18568 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18569 \savedanchor\northwest{%
18570 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18571 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
18572 \pgf@y=.5\pgf@y
18573 \pgf@x= \pgf@circ@scaled@Rlen
18574 \pgf@x=.5\pgf@x
18575 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
18576 }
18577 \anchor{center}{
18578 \northwest
18579 \pgf@x=0pt
18580 \pgf@y=0pt
18581 }
18582 \anchor{north}{
18583 \northwest
18584 \pgf@x=0pt
18585 }
18586 \anchor{south}{
18587 \northwest
18588 \pgf@x=0pt
18589 \pgf@y=-\pgf@y
18590 }
18591 \anchor{west}{
18592 \northwest
18593 \pgf@y=0pt
18594 }
18595 \anchor{east}{
18596 \northwest
18597 \pgf@y=0pt
18598 \pgf@x=-\pgf@x
18599 }
18600 \anchor{south west}{
18601 \northwest
18602 \pgf@y=-\pgf@y
18603 }
18604 \anchor{north east}{
18605 \northwest
18606 \pgf@x=-\pgf@x
18607 }
18608 \anchor{north west}{
18609 \northwest
18610 }
18611 \anchor{south east}{
18612 \northwest
18613 \pgf@x=-\pgf@x
18614 \pgf@y=-\pgf@y
18615 }
18616 \anchor{in}{
18617 \northwest
18618 \pgf@y=0pt
18619 }
18620 \anchor{mod}{
18621 \northwest
18622 \pgf@x=0pt
18623 }
18624 \anchor{out}{
18625 \northwest
18626 \pgf@x=-\pgf@x
18627 \pgf@y=0pt
18628 }
18629 \anchor{text}{
18630 \northwest
18631 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
18632 \pgf@x=-.5\wd\pgfnodeparttextbox
18633 }
18634 \backgroundpath{
18635 \pgfsetcolor{\ctikzvalof{color}}
18636 \pgf@circ@scaled@Rlen=\scaledRlen
18637
18638 \northwest
18639 \pgf@circ@res@up = \pgf@y
18640 \pgf@circ@res@down = -\pgf@y
18641 \pgf@circ@res@right = -\pgf@x
18642 \pgf@circ@res@left = \pgf@x
18643
18644 \pgfstartlinewidth=\pgflinewidth
18645
18646 % draw outer box
18647 \pgf@circ@twoportbox
18648
18649 % draw inner stuff
18650 % rotate inner symbol
18651 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
18652 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
18653 \pgftransformrotate{270}
18654 \fi\fi
18655 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
18656 \pgftransformrotate{180}
18657 \fi\fi
18658 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
18659 \pgftransformrotate{90}
18660 \fi\fi
18661
18662 % draw inner symbol
18663 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
18664 \pgfsetarrows{-} %never draw arrows
18665 \pgfsetlinewidth{\pgfstartlinewidth}
18666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
18667 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18668 \pgfusepath{draw}
18669
18670 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18671 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
18672 \pgfusepath{draw}
18673
18674 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
18675 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
18676 \pgfusepath{draw}
18677
18678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
18679 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18680 \pgfusepath{draw}
18681
18682 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18683 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
18684 \pgfusepath{draw}
18685
18686 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
18687 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
18688 \pgfusepath{draw}
18689
18690 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
18691 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
18692 \pgfusepath{draw}
18693
18694 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
18695 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
18696 \pgfusepath{draw}
18697
18698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
18699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
18700 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
18701 \pgfusepath{draw}
18702
18703 }
18704 }
18705 %%%---------- close: tex/pgfcircquadpoles
18706 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
18707 %%%---------- open: tex/pgfcircmultipoles.tex
18708 % Copyright 2018-2026 by Romano Giannetti
18709 % Copyright 2015-2026 by Stefan Lindner
18710 % Copyright 2013-2026 by Stefan Erhardt
18711 % Copyright 2007-2026 by Massimo Redaelli
18712 %
18713 % This file may be distributed and/or modified
18714 %
18715 % 1. under the LaTeX Project Public License and/or
18716 % 2. under the GNU Public License.
18717 %
18718 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18719
18720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18721 %% Multipoles by Romano Giannetti
18722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18723
18724 %%%%%%%%%
18725 %% Chips
18726 %%%%%%%%%
18727
18728 % let's use the same shifts everywhere, no magic numbers
18729 \def\pgf@circ@dip@pin@shift{0.5}
18730 \def\pgf@circ@qfp@pin@shift{0.25}
18731
18732 % derived from https://tex.stackexchange.com/a/146753/38080
18733 % original author Mark Wibrow
18734 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
18735 % a lot of thanks to @marmot for the un-rotation hint
18736 % https://tex.stackexchange.com/a/473571/38080
18737
18738 % DIP (dual in line package) chips
18739
18740 \pgfdeclareshape{dipchip}{
18741 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
18742 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18743 \savedmacro\numpins{%
18744 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
18745 \def\numpins{\the\pgf@circ@count@a}
18746 }
18747 \savedanchor\centerpoint{%
18748 \pgf@x=-.5\wd\pgfnodeparttextbox%
18749 \pgf@y=-.5\ht\pgfnodeparttextbox%
18750 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18751 }%
18752 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
18753 \anchor{center}{\origin}
18754 \anchor{text}{\centerpoint}% to adjust text
18755 \saveddimen\height{%
18756 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18757 \pgfmathsetlength\pgf@x{((\numpins)
18758 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18759 }%
18760 \saveddimen{\chipspacing}{
18761 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18762 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
18763 \saveddimen{\width}{
18764 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18765 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
18766 \saveddimen{\extshift}{
18767 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18768 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18769 % standard anchors
18770 \savedanchor\northwest{%
18771 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18772 \pgfmathsetlength\pgf@y{0.5*((\numpins)
18773 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18774 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
18775 }
18776 \anchor{dot}{\northwest
18777 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
18778 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
18779 }
18780 \anchor{nw}{\northwest}
18781 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18782 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18783 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18784 \anchor{north west}{\northwest}
18785 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18786 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18787 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18788 \anchor{n}{\northwest\pgf@x=0pt }
18789 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18790 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18791 \anchor{w}{\northwest\pgf@y=0pt }
18792 \anchor{north}{\northwest\pgf@x=0pt }
18793 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18794 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18795 \anchor{west}{\northwest\pgf@y=0pt }
18796 % start drawing
18797 \backgroundpath{%
18798 \northwest
18799 \pgf@circ@res@up = \pgf@y
18800 \pgf@circ@res@down = -\pgf@y
18801 \pgf@circ@res@right = -\pgf@x
18802 \pgf@circ@res@left = \pgf@x
18803 \pgf@circ@scaled@Rlen=\scaledRlen
18804 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
18805 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
18806 \pgfscope% (for the line width)
18807 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18808 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
18809 \pgf@circ@draworfill
18810 %% upside mark
18811 \ifpgf@circuit@chip@topmark
18812 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
18813 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
18814 \fi
18815 \pgfusepath{stroke}%
18816 \pgfsetcolor{\ctikzvalof{color}}
18817 % Adding the pin number
18818 \ifpgf@circuit@chip@shownumbers
18819 \pgf@circ@count@a=\numpins\relax
18820 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18821 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
18822 \ifpgf@circuit@chip@straightnumbers
18823 \pgfgettransformentries\a\b\temp\temp\temp\temp
18824 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
18825 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
18826 \else
18827 \pgfmathsetmacro{\rot}{0}
18828 \pgfmathsetmacro{\quadrant}{0}
18829 \fi
18830 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
18831 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
18832 \pgfmathloop%
18833 \ifnum\pgf@circ@count@a>0
18834 \ifcase\quadrant % rotation 0
18835 % left
18836 \pgf@circ@count@c=\pgf@circ@count@a
18837 \pgftext[left,
18838 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18839 rotate=\rot]{\mytext}
18840 % right
18841 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18842 \pgftext[right,
18843 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18844 rotate=\rot]{\mytext}
18845 \or % rotation -90
18846 % left
18847 \pgf@circ@count@c=\pgf@circ@count@a
18848 \pgftext[top,
18849 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18850 rotate=\rot]{\mytext}
18851 % right
18852 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18853 \pgftext[bottom,
18854 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18855 rotate=\rot]{\mytext}
18856 \or %rotation 180
18857 % left
18858 \pgf@circ@count@c=\pgf@circ@count@a
18859 \pgftext[right,
18860 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18861 rotate=\rot]{\mytext}
18862 % right
18863 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18864 \pgftext[left,
18865 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18866 rotate=\rot]{\mytext}
18867 \or % rotation +90
18868 % left
18869 \pgf@circ@count@c=\pgf@circ@count@a
18870 \pgftext[bottom,
18871 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18872 rotate=\rot]{\mytext}
18873 % right
18874 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18875 \pgftext[top,
18876 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
18877 rotate=\rot]{\mytext}
18878 \fi
18879 \advance\pgf@circ@count@a-1\relax%
18880 \repeatpgfmathloop
18881 \fi
18882 \endpgfscope
18883 \ifdim\pgf@circ@res@other>0pt
18884 \pgfscope
18885 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18886 \pgf@circ@count@a=\numpins\relax
18887 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18888 \pgfmathloop%
18889 \ifnum\pgf@circ@count@a>0
18890 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
18891 \ifnum\padfrac>0
18892 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
18893 % left side pads
18894 \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}}
18895 \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}}
18896 \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}}
18897 \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}}
18898 % right side pads
18899 \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}}
18900 \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}}
18901 \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}}
18902 \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}}
18903 \else
18904 % left side pins
18905 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18906 \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}}
18907 % right side pins
18908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18909 \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}}
18910 \fi
18911 \advance\pgf@circ@count@a by -1\relax%
18912 \repeatpgfmathloop
18913 \pgfusepath{stroke}
18914 \endpgfscope
18915 \fi
18916 }%
18917 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
18918 % and is executed just before a node is drawn.
18919 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
18920 % Start with the maximum pin number and go backwards.
18921 \pgf@circ@count@a=\numpins\relax
18922 \pgfmathloop%
18923 \ifnum\pgf@circ@count@a>0
18924 % we will create two anchors per pin: the "normal one" like `pin 1` for the
18925 % electrical contact, and the "border one" like `bpin 1` for labels.
18926 % they will coincide if `external pins width` is set to 0.
18927 \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
18928 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
18929 }
18930 \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
18931 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
18932 }
18933 \advance\pgf@circ@count@a by -1\relax%
18934 \repeatpgfmathloop%
18935 }%
18936 }
18937
18938 % QFP (quad flat package) chips
18939
18940 \pgfdeclareshape{qfpchip}{
18941 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
18942 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18943 \savedmacro\numpins{%
18944 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
18945 \def\numpins{\the\pgf@circ@count@a}
18946 }
18947 \savedanchor\centerpoint{%
18948 \pgf@x=-.5\wd\pgfnodeparttextbox%
18949 \pgf@y=-.5\ht\pgfnodeparttextbox%
18950 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18951 }%
18952 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
18953 \anchor{center}{\origin}
18954 \anchor{text}{\centerpoint}% to adjust text
18955 \saveddimen\height{%
18956 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18957 \pgfmathsetlength\pgf@x{((\numpins+2)
18958 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
18959 }%
18960 \saveddimen\width{%
18961 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18962 \pgfmathsetlength\pgf@x{((\numpins+2)
18963 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
18964 }%
18965 \saveddimen{\chipspacing}{
18966 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18967 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
18968 \saveddimen{\extshift}{
18969 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18970 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18971 % standard anchors
18972 \savedanchor\northwest{%
18973 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18974 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
18975 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
18976 \pgf@x=-\pgf@y
18977 }
18978 \anchor{dot}{\northwest
18979 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
18980 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
18981 }
18982 \anchor{nw}{\northwest}
18983 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18984 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18985 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18986 \anchor{north west}{\northwest}
18987 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18988 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18989 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18990 \anchor{n}{\northwest\pgf@x=0pt }
18991 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18992 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18993 \anchor{w}{\northwest\pgf@y=0pt }
18994 \anchor{north}{\northwest\pgf@x=0pt }
18995 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18996 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18997 \anchor{west}{\northwest\pgf@y=0pt }
18998 % start drawing
18999 \backgroundpath{%
19000 \northwest
19001 \pgf@circ@res@up = \pgf@y
19002 \pgf@circ@res@down = -\pgf@y
19003 \pgf@circ@res@right = -\pgf@x
19004 \pgf@circ@res@left = \pgf@x
19005 \pgf@circ@scaled@Rlen=\scaledRlen
19006 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
19007 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
19008 \pgfscope% (for the line width)
19009 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19010 %% upside mark
19011 \ifpgf@circuit@chip@topmark
19012 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
19013 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
19014 \else
19015 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
19016 \fi
19017 %% rest of the shape
19018 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
19019 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
19020 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
19021 \pgfpathclose
19022 \pgf@circ@draworfill
19023 % Adding the pin number
19024 \pgfsetcolor{\ctikzvalof{color}}
19025 \ifpgf@circuit@chip@shownumbers
19026 \pgf@circ@count@a=\numpins%
19027 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
19028 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
19029 \ifpgf@circuit@chip@straightnumbers
19030 \pgfgettransformentries\a\b\temp\temp\temp\temp
19031 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
19032 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
19033 \else
19034 \pgfmathsetmacro{\rot}{0}
19035 \pgfmathsetmacro{\quadrant}{0}
19036 \fi
19037 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
19038 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
19039 \pgfmathloop%
19040 \ifnum\pgf@circ@count@a>0
19041 \ifcase\quadrant % rotation 0
19042 % left
19043 \pgf@circ@count@c=\pgf@circ@count@a
19044 \pgftext[left,
19045 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19046 rotate=\rot]{\mytext}
19047 % bottom
19048 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19049 \pgftext[bottom,
19050 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19051 rotate=\rot]{\mytext}
19052 % right
19053 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19054 \pgftext[right,
19055 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19056 rotate=\rot]{\mytext}
19057 % top
19058 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19059 \pgftext[top,
19060 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19061 rotate=\rot]{\mytext}
19062 \or % rotation -90
19063 % left
19064 \pgf@circ@count@c=\pgf@circ@count@a
19065 \pgftext[top,
19066 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19067 rotate=\rot]{\mytext}
19068 % bottom
19069 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19070 \pgftext[left,
19071 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19072 rotate=\rot]{\mytext}
19073 % right
19074 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19075 \pgftext[bottom,
19076 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19077 rotate=\rot]{\mytext}
19078 % top
19079 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19080 \pgftext[right,
19081 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19082 rotate=\rot]{\mytext}
19083 \or %rotation 180
19084 % left
19085 \pgf@circ@count@c=\pgf@circ@count@a
19086 \pgftext[right,
19087 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19088 rotate=\rot]{\mytext}
19089 % bottom
19090 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19091 \pgftext[top,
19092 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19093 rotate=\rot]{\mytext}
19094 % right
19095 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19096 \pgftext[left,
19097 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19098 rotate=\rot]{\mytext}
19099 % top
19100 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19101 \pgftext[bottom,
19102 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19103 rotate=\rot]{\mytext}
19104 \or % rotation +90
19105 % left
19106 \pgf@circ@count@c=\pgf@circ@count@a
19107 \pgftext[bottom,
19108 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19109 rotate=\rot]{\mytext}
19110 % bottom
19111 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
19112 \pgftext[right,
19113 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
19114 rotate=\rot]{\mytext}
19115 % right
19116 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19117 \pgftext[top,
19118 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
19119 rotate=\rot]{\mytext}
19120 % top
19121 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
19122 \pgftext[left,
19123 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
19124 rotate=\rot]{\mytext}
19125 \fi
19126 \advance\pgf@circ@count@a-1\relax%
19127 \repeatpgfmathloop
19128 \fi
19129 \endpgfscope
19130 \ifdim\pgf@circ@res@other>0pt
19131 \pgfscope
19132 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
19133 \pgf@circ@count@a=\numpins%
19134 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
19135 \pgfmathloop%
19136 \ifnum\pgf@circ@count@a>0
19137 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
19138 \ifnum\padfrac>0
19139 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
19140 % left side pads
19141 \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}}
19142 \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}}
19143 \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}}
19144 \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}}
19145 % bottom side pads
19146 \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}}
19147 \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}}
19148 \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}}
19149 \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}}
19150 % right side pads
19151 \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}}
19152 \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}}
19153 \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}}
19154 \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}}
19155 % top side pads
19156 \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}}
19157 \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}}
19158 \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}}
19159 \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}}
19160 \else
19161 % left side pins
19162 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19163 \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}}
19164 % bottom side pins
19165 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
19166 \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}}
19167 % right side pins
19168 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19169 \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}}
19170 % top side pins
19171 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
19172 \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}}
19173 \fi
19174 \advance\pgf@circ@count@a-1\relax%
19175 \repeatpgfmathloop
19176 \pgfusepath{stroke}
19177 \endpgfscope
19178 \fi
19179 }%
19180 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19181 % and is executed just before a node is drawn.
19182 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
19183 % Start with the maximum pin number and go backwards.
19184 \pgf@circ@count@a=\numpins%
19185 \pgfmathloop%
19186 \ifnum\pgf@circ@count@a>0
19187 \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
19188 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
19189 }
19190 \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
19191 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
19192 }
19193 \advance\pgf@circ@count@a-1\relax%
19194 \repeatpgfmathloop%
19195 }%
19196 }
19197
19198 %% anchors for DIP
19199 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19200 \c@pgf@countc=\numpins\relax
19201 \divide\c@pgf@countc by 2
19202 \ifnum #1 > \the\c@pgf@countc
19203 % right side
19204 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
19205 \else
19206 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
19207 \fi
19208 }
19209
19210 %% anchors for QFP
19211 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19212 \c@pgf@countc=\numpins\relax
19213 \divide\c@pgf@countc by 4
19214 \ifnum #1 > \the\c@pgf@countc
19215 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
19216 \ifnum #1 > \the\c@pgf@countb
19217 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
19218 \ifnum #1 > \the\c@pgf@countb
19219 % 3*npins/4 < pin, top side
19220 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
19221 \else
19222 % 2*npins/4 < pin <= 3*npins/4, right side
19223 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
19224 \fi
19225 \else
19226 % npins/4 < pin <= 2*npins/4, bottom side
19227 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
19228 \fi
19229 \else
19230 % <= npins/4, left side
19231 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
19232 \fi
19233 }
19234
19235 %%%%%%%%%%%%%%%%%
19236 %% Rotary Switch
19237 %%%%%%%%%%%%%%%%%
19238
19239 \pgfdeclareshape{rotaryswitch}
19240 {
19241 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
19242 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19243 \savedanchor\northeast{%
19244 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19245 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19246 % the magic number is 0.25/cos(35)
19247 % try to recalculate it for the actual switch
19248 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19249 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19250 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19251 \edef\r{\ctikzvalof{nodes width}}
19252 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19253 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
19254 }
19255 \savedanchor\northwest{%
19256 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19257 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19258 % the magic number is 0.25/cos(35)
19259 % try to recalculate it for the actual switch
19260 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19261 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19262 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19263 \edef\r{\ctikzvalof{nodes width}}
19264 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19265 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
19266 }
19267 \savedanchor\central{%
19268 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19269 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19270 % the magic number is 0.25/cos(35)
19271 % try to recalculate it for the actual switch
19272 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19273 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
19274 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
19275 \edef\r{\ctikzvalof{nodes width}}
19276 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
19277 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
19278 }
19279 % external square limits
19280 \savedanchor\extnorthwest{%
19281 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19282 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
19283 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
19284 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
19285 \pgf@x=2.5\pgf@x % external square size
19286 \pgf@y=-\pgf@x %square thing when angle=180?
19287 }
19288 \saveddimen{\width}{
19289 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19290 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
19291 % radius of the connector
19292 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
19293 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
19294 % shapename
19295 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19296 % shape type
19297 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
19298 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
19299 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
19300 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
19301 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
19302 % mid of the lever, to stack switches
19303 %\anchor{mid}{\midlever}
19304 \anchor{mid}{\northwest
19305 \pgf@circ@res@temp=-\pgf@x
19306 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
19307 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
19308 }
19309 % center anchors
19310 \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
19311 % horizontal angles
19312 \anchor{in}{ \northwest \pgf@y=0pt}
19313 \anchor{ain}{ \northwest \pgf@y=0pt}
19314
19315 \anchor{center}{ \central \pgf@y=0pt }
19316 \anchor{east}{ \northeast \pgf@y=0pt }
19317 \anchor{west}{ \northwest \pgf@y=0pt }
19318 \anchor{south}{ \central \pgf@y=-\pgf@y }
19319 \anchor{north}{ \central }
19320 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19321 \anchor{north east}{ \northeast }
19322 \anchor{north west}{ \northwest }
19323 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
19324
19325 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
19326 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
19327 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
19328 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19329 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
19330 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19331 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
19332 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
19333 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
19334
19335 \backgroundpath{
19336 \pgfsetcolor{\ctikzvalof{color}}
19337 \pgf@circ@res@right = \width
19338 \pgf@circ@res@left = -\width
19339
19340 \pgfscope %wiper
19341 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
19342 \pgf@circ@res@temp=\radius\relax
19343 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
19344 \pgfsetlinewidth{2\pgf@circ@res@temp}
19345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
19346 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
19347 \pgfsetroundcap\pgfusepath{draw}
19348 \endpgfscope
19349
19350 \ifpgf@circ@rotaryarrow
19351 \pgfscope % arrow
19352 \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
19353 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
19354 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
19355 \pgftransformrotate{\wiper}
19356 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
19357 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
19358 \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
19359 \pgfusepath{draw}
19360 \endpgfscope
19361 \fi
19362
19363 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
19364 \pgf@circ@count@a=\channels\relax
19365 \pgfmathsetmacro{\currenta}{-\angle}
19366 \pgfmathloop%
19367 \ifnum\pgf@circ@count@a>0
19368 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
19369 \pgfscope
19370 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
19371 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
19372 \endpgfscope
19373 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
19374 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
19375 \advance\pgf@circ@count@a by -1\relax%
19376 \repeatpgfmathloop
19377
19378 \pgfscope % input
19379 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19380 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
19381 \endpgfscope
19382 }
19383 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19384 % and is executed just before a node is drawn.
19385 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
19386 % Start with the maximum pin number and go backwards.
19387 \pgf@circ@count@a=\channels\relax
19388 \pgfmathloop%
19389 \ifnum\pgf@circ@count@a>0
19390 % we will create two anchors per pin: the "normal one" like `pin 1` for the
19391 % electrical contact, and the "border one" like `bpin 1` for labels.
19392 % they will coincide if `external pins width` is set to 0.
19393 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
19394 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
19395 }
19396 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
19397 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
19398 }
19399 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
19400 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
19401 }
19402 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
19403 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}%
19404 }
19405 \advance\pgf@circ@count@a by -1\relax%
19406 \repeatpgfmathloop%
19407 }%
19408 }
19409
19410 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
19411 \pgf@circ@res@temp=\width
19412 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
19413 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
19414 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
19415 \advance\pgf@x by -\pgf@circ@res@temp
19416 }
19417
19418 \def\pgf@circ@rotarysqanchor#1{% external square anchors
19419 \pgf@circ@res@temp=\width
19420 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
19421 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
19422 \advance\pgf@x by -\pgf@circ@res@temp
19423 }
19424
19425 %%%%%%%%%%%%%%%%%%%%%%%%%%
19426 % Seven segments displays
19427 %%%%%%%%%%%%%%%%%%%%%%%%%%
19428
19429 \pgfdeclareshape{bare7seg}{
19430 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
19431 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19432 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
19433 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
19434 \ifpgf@circ@sevenseg@dot
19435 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
19436 \else
19437 \pgf@x=0pt
19438 \fi
19439 }
19440 % The object extension is more or less (-width/2,-width) to (width/2,width)
19441 % and adjusted for line thickness (both sides) and eventually the dot
19442 \saveddimen{\width}{
19443 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19444 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
19445 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
19446 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
19447 \savedanchor{\southwest}{% both negative
19448 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19449 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19450 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
19451 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19452 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
19453 }
19454 \savedanchor{\northeast}{% both positive
19455 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19456 \ifpgf@circ@sevenseg@dot
19457 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
19458 \else
19459 \pgf@circ@res@other=0pt
19460 \fi
19461 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19462 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
19463 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
19464 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
19465 }
19466 \savedanchor{\topright}{% anchor without the box sep and the thickness
19467 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19468 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
19469 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
19470 }
19471 \anchor{center}{\pgfpointorigin}
19472 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
19473 \anchor{north east}{\northeast}
19474 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
19475 \anchor{south west}{\southwest}
19476 \anchor{north}{\northeast\pgf@x=0pt}
19477 \anchor{east}{\northeast\pgf@y=0pt}
19478 \anchor{south}{\southwest\pgf@x=0pt}
19479 \anchor{west}{\southwest\pgf@y=0pt}
19480 \anchor{a}{\topright\pgf@x=0pt}
19481 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
19482 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
19483 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
19484 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
19485 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
19486 \anchor{g}{\pgfpointorigin}
19487 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
19488 \behindbackgroundpath{%
19489 \southwest % I do not want the dot here, it will stick out
19490 \pgf@circ@res@up = -\pgf@y
19491 \pgf@circ@res@down = \pgf@y
19492 \pgf@circ@res@right = \pgf@x
19493 \pgf@circ@res@left = -\pgf@x
19494 \pgfscope
19495 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19496 \pgfsetcolor{\ctikzvalof{color}}
19497 \pgfpathrectanglecorners%
19498 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19499 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
19500 \ifpgf@circ@sevenseg@box
19501 \pgf@circ@draworfill
19502 \else
19503 \pgf@circ@maybefill
19504 \fi
19505 \endpgfscope
19506 \edef\bits{\ctikzvalof{seven seg/bits}}
19507 \pgfscope
19508 \pfg@circ@sseg@drawbits{\bits}
19509 \endpgfscope
19510 \pgfscope
19511 \ifpgf@circ@sevenseg@dot
19512 \pgf@circ@sseg@drawdots
19513 \fi
19514 \endpgfscope
19515 }
19516 }
19517
19518 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
19519 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
19520 }
19521 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
19522 \ifnum #1 > 0\relax
19523 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
19524 \else
19525 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
19526 \fi
19527 \pgfpathmoveto{\pgfpoint{#2}{#3}}
19528 \pgfpathlineto{\pgfpoint{#4}{#5}}
19529 \pgfusepath{draw}
19530 }
19531 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
19532 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
19533 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
19534 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
19535 % \pgfsetroundcap
19536 \pgfsetarrowsstart{Triangle Cap[]}
19537 \pgfsetarrowsend{Triangle Cap[]}
19538 % segments
19539 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
19540 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
19541 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
19542 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
19543 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
19544 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
19545 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
19546 }
19547 \def\pgf@circ@sseg@drawdots{% dots
19548 \edef\what{empty}
19549 \ifx\what\pgf@circ@sevenseg@dotstate
19550 % do nothing
19551 \else
19552 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
19553 \edef\what{off}
19554 \ifx\what\pgf@circ@sevenseg@dotstate
19555 % dot off
19556 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
19557 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
19558 \else
19559 % dot on
19560 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
19561 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
19562 \fi
19563 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
19564 \pgfusepath{draw,fill}
19565 \fi
19566 }
19567
19568
19569 %%%%%%
19570 %%%%%% Flip-flops
19571 %%%%%%
19572
19573 % Flip flops are a specialized kind of dipchip.
19574 % they have a class by themselves
19575
19576 %% flip flop definitions --- by default empty
19577 %% pin texts
19578 \ctikzset{multipoles/flipflop/t1/.initial={}}
19579 \ctikzset{multipoles/flipflop/t2/.initial={}}
19580 \ctikzset{multipoles/flipflop/t3/.initial={}}
19581 \ctikzset{multipoles/flipflop/t4/.initial={}}
19582 \ctikzset{multipoles/flipflop/t5/.initial={}}
19583 \ctikzset{multipoles/flipflop/t6/.initial={}}
19584 \ctikzset{multipoles/flipflop/tu/.initial={}}
19585 \ctikzset{multipoles/flipflop/td/.initial={}}
19586 % pin clock wedge flags
19587 \ctikzset{multipoles/flipflop/c1/.initial={0}}
19588 \ctikzset{multipoles/flipflop/c2/.initial={0}}
19589 \ctikzset{multipoles/flipflop/c3/.initial={0}}
19590 \ctikzset{multipoles/flipflop/c4/.initial={0}}
19591 \ctikzset{multipoles/flipflop/c5/.initial={0}}
19592 \ctikzset{multipoles/flipflop/c6/.initial={0}}
19593 \ctikzset{multipoles/flipflop/cu/.initial={0}}
19594 \ctikzset{multipoles/flipflop/cd/.initial={0}}
19595 % pin negation circle flags
19596 \ctikzset{multipoles/flipflop/n1/.initial={0}}
19597 \ctikzset{multipoles/flipflop/n2/.initial={0}}
19598 \ctikzset{multipoles/flipflop/n3/.initial={0}}
19599 \ctikzset{multipoles/flipflop/n4/.initial={0}}
19600 \ctikzset{multipoles/flipflop/n5/.initial={0}}
19601 \ctikzset{multipoles/flipflop/n6/.initial={0}}
19602 \ctikzset{multipoles/flipflop/nu/.initial={0}}
19603 \ctikzset{multipoles/flipflop/nd/.initial={0}}
19604
19605
19606 % Thanks to @marmot
19607 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
19608
19609 % default set of flip flops
19610 \tikzset{
19611 % async
19612 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
19613 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
19614 % sync
19615 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
19616 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
19617 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
19618 % additional features
19619 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
19620 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
19621 }
19622
19623 %
19624 % commodity macro to draw the clock wedges. They leave the size of the
19625 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
19626 %
19627 \def\pgf@circ@do@wedge@left{
19628 \pgf@circ@res@temp=0pt\relax
19629 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
19630 \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}}
19631 \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}}
19632 \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}}
19633 \pgfusepath{stroke}
19634 \pgf@circ@res@temp=\wedge
19635 \fi
19636 }
19637 \def\pgf@circ@do@wedge@right{
19638 \pgf@circ@res@temp=0pt\relax
19639 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
19640 \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}}
19641 \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}}
19642 \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}}
19643 \pgfusepath{stroke}
19644 \pgf@circ@res@temp=-\wedge
19645 \fi
19646 }
19647 \def\pgf@circ@do@wedge@up{
19648 \pgf@circ@res@temp=0pt\relax
19649 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
19650 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
19651 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
19652 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
19653 \pgfusepath{stroke}
19654 \pgf@circ@res@temp=-\wedge
19655 \fi
19656 }
19657 \def\pgf@circ@do@wedge@down{
19658 \pgf@circ@res@temp=0pt\relax
19659 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
19660 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
19661 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
19662 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
19663 \pgfusepath{stroke}
19664 \pgf@circ@res@temp=\wedge
19665 \fi
19666 }
19667 % generic flip-flop shape
19668 \pgfdeclareshape{flipflop}{
19669 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
19670 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19671 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19672 \savedmacro\numpins{\def\numpins{6}}
19673 \savedanchor\centerpoint{%
19674 \pgf@x=-.5\wd\pgfnodeparttextbox%
19675 \pgf@y=-.5\ht\pgfnodeparttextbox%
19676 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
19677 }%
19678 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
19679 \anchor{center}{\origin}
19680 \anchor{text}{\centerpoint}% to adjust text
19681 \saveddimen\height{%
19682 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19683 \pgfmathsetlength\pgf@x{((\numpins)
19684 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19685 }%
19686 \saveddimen{\chipspacing}{
19687 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19688 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
19689 \saveddimen{\width}{
19690 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19691 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
19692 \saveddimen{\extshift}{
19693 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19694 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
19695 % standard anchors
19696 \savedanchor\northwest{%
19697 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19698 \pgfmathsetlength\pgf@y{0.5*((\numpins)
19699 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
19700 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
19701 }
19702 \anchor{dot}{\northwest
19703 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
19704 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
19705 }
19706 \anchor{nw}{\northwest}
19707 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
19708 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19709 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
19710 \anchor{north west}{\northwest}
19711 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
19712 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
19713 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
19714 \anchor{n}{\northwest\pgf@x=0pt }
19715 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19716 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19717 \anchor{w}{\northwest\pgf@y=0pt }
19718 \anchor{north}{\northwest\pgf@x=0pt }
19719 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
19720 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19721 \anchor{west}{\northwest\pgf@y=0pt }
19722 % upper and lower pin
19723 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
19724 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
19725 \anchor{bup}{\northwest\pgf@x=0pt }
19726 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19727 % start drawing
19728 \backgroundpath{%
19729 \northwest
19730 \pgf@circ@res@up = \pgf@y
19731 \pgf@circ@res@down = -\pgf@y
19732 \pgf@circ@res@right = -\pgf@x
19733 \pgf@circ@res@left = \pgf@x
19734 \pgf@circ@scaled@Rlen=\scaledRlen
19735 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
19736 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
19737 \pgfsetcolor{\ctikzvalof{color}}
19738 \pgfscope% (for the line width)
19739 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
19740 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
19741 \pgf@circ@draworfill
19742 \pgfusepath{stroke}%
19743 \endpgfscope
19744 % Adding the pin number
19745 \pgf@circ@count@a=\numpins\relax
19746 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
19747 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
19748 \ifpgf@circuit@chip@straightnumbers
19749 \pgfgettransformentries\a\b\temp\temp\temp\temp
19750 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
19751 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
19752 \else
19753 \pgfmathsetmacro{\rot}{0}
19754 \pgfmathsetmacro{\quadrant}{0}
19755 \fi
19756 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
19757 % text
19758 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
19759 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
19760 \pgf@circ@strut\space}
19761 % \typeout{TEXT\space\mytext}
19762 \pgfmathloop%
19763 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
19764 \pgf@circ@res@temp=0pt\relax
19765 \ifnum\pgf@circ@count@a>0
19766 \ifcase\quadrant % rotation 0
19767 % left
19768 \pgf@circ@count@c=\pgf@circ@count@a
19769 \pgf@circ@do@wedge@left
19770 % \typeout{TEXT Left Q1\space\mytext}
19771 \pgftext[left,
19772 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},
19773 rotate=\rot]{\mytext}
19774 % right
19775 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19776 \pgf@circ@do@wedge@right
19777 \pgftext[right,
19778 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},
19779 rotate=\rot]{\mytext}
19780 \or % rotation -90
19781 % left
19782 \pgf@circ@count@c=\pgf@circ@count@a
19783 \pgf@circ@do@wedge@left
19784 \pgftext[top,
19785 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},
19786 rotate=\rot]{\mytext}
19787 % right
19788 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19789 \pgf@circ@do@wedge@right
19790 \pgftext[bottom,
19791 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},
19792 rotate=\rot]{\mytext}
19793 \or %rotation 180
19794 % left
19795 \pgf@circ@count@c=\pgf@circ@count@a
19796 \pgf@circ@do@wedge@left
19797 \pgftext[right,
19798 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},
19799 rotate=\rot]{\mytext}
19800 % right
19801 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19802 \pgf@circ@do@wedge@right
19803 \pgftext[left,
19804 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},
19805 rotate=\rot]{\mytext}
19806 \or % rotation +90
19807 % left
19808 \pgf@circ@count@c=\pgf@circ@count@a
19809 \pgf@circ@do@wedge@left
19810 \pgftext[bottom,
19811 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},
19812 rotate=\rot]{\mytext}
19813 % right
19814 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19815 \pgf@circ@do@wedge@right
19816 \pgftext[top,
19817 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},
19818 rotate=\rot]{\mytext}
19819 \fi
19820 \advance\pgf@circ@count@a-1\relax%
19821 \repeatpgfmathloop
19822 % Now the up and down text
19823 % up
19824 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
19825 \pgf@circ@do@wedge@up
19826 \ifcase\quadrant % rotation 0
19827 \pgftext[top,
19828 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
19829 rotate=\rot]{\mytext}
19830 \or % rotation -90
19831 \pgftext[right,
19832 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
19833 rotate=\rot]{\mytext}
19834 \or %rotation 180
19835 \pgftext[bottom,
19836 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
19837 rotate=\rot]{\mytext}
19838 \or % rotation +90
19839 \pgftext[left,
19840 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
19841 rotate=\rot]{\mytext}
19842 \fi
19843 % down
19844 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
19845 \pgf@circ@do@wedge@down
19846 \ifcase\quadrant % rotation 0
19847 \pgftext[bottom,
19848 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
19849 rotate=\rot]{\mytext}
19850 \or % rotation -90
19851 \pgftext[left,
19852 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
19853 rotate=\rot]{\mytext}
19854 \or %rotation 180
19855 \pgftext[top,
19856 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
19857 rotate=\rot]{\mytext}
19858 \or % rotation +90
19859 \pgftext[right,
19860 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
19861 rotate=\rot]{\mytext}
19862 \fi
19863 % external pins
19864 \ifdim\pgf@circ@res@other>0pt
19865 \pgfscope
19866 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
19867 \pgf@circ@count@a=\numpins\relax
19868 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
19869 \pgfmathloop%
19870 \ifnum\pgf@circ@count@a>0
19871 % left side pins
19872 \pgf@circ@count@c=\pgf@circ@count@a
19873 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
19874 %% Or'ing tests in core TeX is tough
19875 \edef\@@or{0}
19876 % Just expand the key the minimum needed
19877 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
19878 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
19879 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
19880 \ifnum\@@tmp>0\edef\@@or{1}\fi
19881 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
19882 \ifnum\@@tmp>0\edef\@@or{1}\fi
19883 \ifnum\@@or>0
19884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19885 \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}}
19886 \pgfusepath{stroke}
19887 \fi
19888 % right side pins
19889 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19890 \edef\@@or{0}
19891 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
19892 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
19893 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
19894 \ifnum\@@tmp>0\edef\@@or{1}\fi
19895 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
19896 \ifnum\@@tmp>0\edef\@@or{1}\fi
19897 % \typeout{TEST\space\@@tmp\space\@@x}
19898 \ifnum\@@or>0
19899 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19900 \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}}
19901 \pgfusepath{stroke}
19902 \fi
19903 \advance\pgf@circ@count@a by -1\relax%
19904 \repeatpgfmathloop
19905 % up side
19906 \edef\@@or{0}
19907 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
19908 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
19909 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
19910 \ifnum\@@tmp>0\edef\@@or{1}\fi
19911 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
19912 \ifnum\@@tmp>0\edef\@@or{1}\fi
19913 % \typeout{TEST\space\@@tmp\space\@@x}
19914 \ifnum\@@or>0
19915 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19916 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
19917 \pgfusepath{stroke}
19918 \fi
19919 % down side
19920 \edef\@@or{0}
19921 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
19922 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
19923 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
19924 \ifnum\@@tmp>0\edef\@@or{1}\fi
19925 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
19926 \ifnum\@@tmp>0\edef\@@or{1}\fi
19927 % \typeout{TEST\space\@@tmp\space\@@x}
19928 \ifnum\@@or>0
19929 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19930 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
19931 \pgfusepath{stroke}
19932 \fi
19933 \endpgfscope
19934 \fi % external pin width >0
19935 %
19936 % draw "inverting" circles on outputs, they must be last
19937 %
19938 \pgfscope
19939 \ifpgf@circuit@ieeelogicport
19940 \def\@@notcirc{notcirc}
19941 \else
19942 \ifpgf@circ@european@port@circle@ieee
19943 \def\@@notcirc{notcirc}
19944 \else
19945 \def\@@notcirc{ocirc}
19946 \fi
19947 \fi
19948 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
19949 \pgf@circ@count@a=\numpins\relax
19950 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
19951 \pgfmathloop%
19952 \ifnum\pgf@circ@count@a>0
19953 % left side pins
19954 \pgf@circ@count@c=\pgf@circ@count@a
19955 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
19956 \ifnum\@@tmp>0\pgfscope
19957 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19958 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
19959 \endpgfscope\fi
19960 % right side pins
19961 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
19962 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
19963 \ifnum\@@tmp>0\pgfscope
19964 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
19965 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
19966 \endpgfscope\fi
19967 \advance\pgf@circ@count@a by -1\relax%
19968 \repeatpgfmathloop
19969 % up side
19970 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
19971 \ifnum\@@tmp>0\pgfscope
19972 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
19973 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
19974 \endpgfscope\fi
19975 % down side
19976 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
19977 \ifnum\@@tmp>0\pgfscope
19978 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
19979 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
19980 \endpgfscope\fi
19981 \endpgfscope
19982 }%
19983 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
19984 % and is executed just before a node is drawn.
19985 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
19986 % Start with the maximum pin number and go backwards.
19987 \pgf@circ@count@a=\numpins\relax
19988 \pgfmathloop%
19989 \ifnum\pgf@circ@count@a>0
19990 % we will create two anchors per pin: the "normal one" like `pin 1` for the
19991 % electrical contact, and the "border one" like `bpin 1` for labels.
19992 % they will coincide if `external pins width` is set to 0.
19993 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
19994 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
19995 }
19996 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
19997 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
19998 }
19999 \advance\pgf@circ@count@a by -1\relax%
20000 \repeatpgfmathloop%
20001 }%
20002 }
20003
20004 %
20005 % MUX-DEMUXES
20006 %
20007 % Thanks to @marmot
20008 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
20009 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
20010 \tikzset{one bit adder/.style={muxdemux,
20011 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
20012 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
20013 \tikzset{ALU/.style={muxdemux,
20014 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
20015 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
20016 %generic mux-demux shape
20017 \pgfdeclareshape{muxdemux}{
20018 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
20019 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20020 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
20021 % pins on the four sides
20022 % \savedmacro\NL{%
20023 % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
20024 % \def\NL{\the\pgf@circ@count@a}
20025 % }
20026 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
20027 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
20028 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
20029 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
20030 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
20031 % topleft and topright sizes
20032 \savedanchor{\topleft}{%
20033 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20034 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
20035 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20036 }
20037 \savedanchor{\topright}{%
20038 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20039 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
20040 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20041 }
20042 \savedanchor{\insetnortheast}{%
20043 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20044 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
20045 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
20046 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
20047 }
20048 \saveddimen{\insethright}{
20049 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20050 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
20051 \saveddimen{\extshift}{
20052 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20053 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
20054 \savedanchor{\northwest}{%
20055 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20056 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
20057 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
20058 }
20059 \anchor{nw}{\northwest}
20060 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
20061 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
20062 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
20063 \anchor{north west}{\northwest}
20064 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
20065 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
20066 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
20067 \anchor{n}{\northwest\pgf@x=0pt }
20068 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20069 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20070 \anchor{w}{\northwest\pgf@y=0pt }
20071 \anchor{north}{\northwest\pgf@x=0pt }
20072 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
20073 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20074 \anchor{west}{\northwest\pgf@y=0pt }
20075 \anchor{center}{\pgfpointorigin}
20076 \anchor{top right}{\topright}
20077 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
20078 \anchor{right}{\topright\pgf@y=0pt\relax}
20079 \anchor{top left}{\topleft}
20080 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
20081 \anchor{left}{\topleft\pgf@y=0pt\relax}
20082 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20083 \divide\pgf@y by 2 \pgf@x=0pt\relax}
20084 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20085 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
20086 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
20087 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
20088 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
20089 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
20090 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
20091 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
20092 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
20093 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
20094 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
20095 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
20096 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
20097 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
20098 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
20099 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
20100 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
20101 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
20102 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20103 \divide\pgf@y by 2
20104 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
20105 \divide\pgf@y by 2 \pgf@x=0pt\relax}
20106 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
20107 \divide\pgf@y by 2
20108 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
20109 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
20110 \anchor{text}{%
20111 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20112 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
20113 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
20114 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
20115 \pgf@y=-.5\ht\pgfnodeparttextbox%
20116 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
20117 }%
20118 \backgroundpath{%
20119 \topleft
20120 \pgf@circ@res@up = \pgf@y
20121 \pgf@circ@res@down = -\pgf@y
20122 \pgf@circ@res@left = \pgf@x
20123 \topright
20124 \pgf@circ@res@other = \pgf@y
20125 \pgf@circ@res@right = \pgf@x
20126 \insetnortheast
20127 \pgf@circ@res@step = \pgf@x
20128 \pgf@circ@res@temp = \pgf@y
20129 %
20130 % external block
20131 %
20132 \pgfscope% (for the line width)
20133 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
20134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
20135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
20136 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
20137 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20138 % inset, starting down
20139 \ifdim\pgf@circ@res@temp>0pt % inset
20140 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
20141 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
20142 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
20143 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
20144 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
20145 \fi
20146 \pgfpathclose
20147 \pgf@circ@draworfill
20148 \endpgfscope
20149 % now we have to draw the pins, if needed
20150 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
20151 % Ok, we have to draw the leads (a.k.a. pins)
20152 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
20153 % We mimic the anchors here --- probably there is a better way
20154 % left pins
20155 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
20156 \pgf@circ@count@a=\NL\relax
20157 \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
20158 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20159 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20160 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
20161 % we have to check oddity
20162 \ifodd\NL
20163 \ifnum\NL=1
20164 % only centerpin, step should not be used, but anyway...
20165 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
20166 \else
20167 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
20168 \fi
20169 \else
20170 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
20171 \fi
20172 \else % no inset
20173 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
20174 \fi
20175 \pgfmathloop%
20176 \ifnum\pgf@circ@count@a>0
20177 %%%%%
20178 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
20179 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
20180 % for lower pins we have to shift them down
20181 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
20182 \ifodd\NL
20183 % odd number of pins
20184 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
20185 % centerpin!
20186 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20187 \ifnum\squarepins>0
20188 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
20189 \else
20190 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
20191 \fi
20192 \else
20193 \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}}
20194 \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}}
20195 \fi
20196 \else
20197 % even numer of pins: just go down
20198 \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}}
20199 \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}}
20200 \fi
20201 \else
20202 % nothing need for #1<=NL/2
20203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20205 \fi
20206 \else
20207 % no inset
20208 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20209 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20210 \fi
20211 %%%%%
20212 \advance\pgf@circ@count@a by -1\relax%
20213 \repeatpgfmathloop\fi%
20214 % right pins
20215 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
20216 \pgfmathloop%
20217 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
20218 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
20219 \ifnum\pgf@circ@count@a>0
20220 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20221 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
20222 \advance\pgf@circ@count@a by -1\relax%
20223 \repeatpgfmathloop\fi%
20224 % bottom pins
20225 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
20226 \pgfmathloop%
20227 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20228 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20229 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
20230 \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}
20231 \ifnum\pgf@circ@count@a>0
20232 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20233 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
20234 \ifnum\squarepins>0
20235 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20236 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
20237 \else
20238 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20239 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
20240 \fi
20241 \advance\pgf@circ@count@a by -1\relax%
20242 \repeatpgfmathloop\fi%
20243 % top pins
20244 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
20245 \pgfmathloop%
20246 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
20247 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
20248 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
20249 \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}
20250 \ifnum\pgf@circ@count@a>0
20251 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20252 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
20253 \ifnum\squarepins>0
20254 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20255 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
20256 \else
20257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
20258 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
20259 \fi
20260 \advance\pgf@circ@count@a by -1\relax%
20261 \repeatpgfmathloop\fi%
20262 % end drawing pins; stroke them
20263 \pgfusepath{stroke}
20264 \endpgfscope\fi\fi
20265 }
20266 % let's start adding anchors
20267 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
20268 % left side anchors
20269 \pgf@circ@count@a=\NL\relax
20270 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
20271 \pgfmathloop%
20272 \ifnum\pgf@circ@count@a>0
20273 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
20274 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
20275 % external leads, and the "border one" like `blpin 1` for internal ones.
20276 % they will coincide if `external pins width` is set to 0.
20277 \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
20278 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
20279 }
20280 \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
20281 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
20282 }
20283 \advance\pgf@circ@count@a by -1\relax%
20284 \repeatpgfmathloop%
20285 % right anchors
20286 \pgf@circ@count@a=\NR\relax
20287 \pgfmathloop%
20288 \ifnum\pgf@circ@count@a>0
20289 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
20290 % external leads, and the "border one" like `brpin 1` for internal ones.
20291 % they will coincide if `external pins width` is set to 0.
20292 \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
20293 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
20294 }
20295 \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
20296 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
20297 }
20298 \advance\pgf@circ@count@a by -1\relax%
20299 \repeatpgfmathloop%
20300 % bottom anchors
20301 \pgf@circ@count@a=\NB\relax
20302 \pgfmathloop%
20303 \ifnum\pgf@circ@count@a>0
20304 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
20305 % external leads, and the "border one" like `bbpin 1` for internal ones.
20306 % they will coincide if `external pins width` is set to 0.
20307 \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
20308 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
20309 }
20310 \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
20311 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
20312 }
20313 \advance\pgf@circ@count@a by -1\relax%
20314 \repeatpgfmathloop%
20315 % top anchors
20316 \pgf@circ@count@a=\NT\relax
20317 \pgfmathloop%
20318 \ifnum\pgf@circ@count@a>0
20319 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
20320 % external leads, and the "border one" like `btpin 1` for internal ones.
20321 % they will coincide if `external pins width` is set to 0.
20322 \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
20323 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
20324 }
20325 \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
20326 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
20327 }
20328 \advance\pgf@circ@count@a by -1\relax%
20329 \repeatpgfmathloop%
20330 }%
20331 }
20332
20333 %% left anchors for muxdemux
20334
20335 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20336 \topleft
20337 \pgf@xa=\pgf@x
20338 \pgf@ya=\pgf@y
20339 \insetnortheast
20340 \pgf@xb=\pgf@x
20341 \pgf@yb=\pgf@y
20342 \ifnum#1>\NL
20343 \PackageError{circuitikz}{%
20344 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
20345 which has been defined with \NL\space left pins%
20346 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20347 \fi
20348 \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
20349 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
20350 \ifnum\NL>1
20351 \ifdim\pgf@yb>0pt % check if we have an inset
20352 % we have to check oddity
20353 \ifodd\NL
20354 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
20355 \else
20356 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
20357 \fi
20358 \else % no inset
20359 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
20360 \fi
20361 \ifdim\pgf@yb>0pt % check if we have an inset
20362 \ifnum#1>\pgf@circ@count@a\relax
20363 % for lower pins we have to shift them down
20364 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
20365 \ifodd\NL
20366 % odd number of pins
20367 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
20368 % centerpin!
20369 \ifnum#2=0\relax
20370 \pgfpoint{\pgf@xb}{0pt}
20371 \else
20372 \ifnum\squarepins>0
20373 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
20374 \else
20375 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
20376 \fi
20377 \fi
20378 \else
20379 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
20380 \fi
20381 \else
20382 % even numer of pins: just go down
20383 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
20384 \fi
20385 \else
20386 % nothing need for #1<=NL/2
20387 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20388 \fi
20389 \else
20390 % no inset
20391 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20392 \fi
20393 \else
20394 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
20395 \fi
20396 }
20397
20398 % right anchors
20399 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20400 \topright
20401 \pgf@xa=\pgf@x
20402 \pgf@ya=\pgf@y
20403 \ifnum#1>\NR
20404 \PackageError{circuitikz}{%
20405 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
20406 which has been defined with \NR\space right pins%
20407 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20408 \fi
20409 \ifnum\NR>1
20410 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
20411 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
20412 \else
20413 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
20414 \fi
20415 }
20416
20417 % bottom anchors
20418 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20419 \topleft
20420 \pgf@xa=\pgf@x
20421 \pgf@ya=\pgf@y
20422 \topright
20423 \pgf@xb=\pgf@x
20424 \pgf@yb=\pgf@y
20425 \ifnum#1>\NB
20426 \PackageError{circuitikz}{%
20427 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
20428 which has been defined with \NB\space bottom pins%
20429 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20430 \fi
20431 \ifnum\NB>0
20432 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
20433 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
20434 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
20435 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
20436 \ifnum#2=0\relax
20437 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
20438 \else
20439 \ifnum\squarepins>0\relax
20440 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
20441 \else
20442 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
20443 \fi
20444 \fi
20445 \else
20446 % should not happen, give the same as pin 1 anyway
20447 \ifnum#2=0\relax
20448 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
20449 \else
20450 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
20451 \fi
20452 \fi
20453 }
20454
20455 % top anchors
20456 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
20457 \topleft
20458 \pgf@xa=\pgf@x
20459 \pgf@ya=\pgf@y
20460 \topright
20461 \pgf@xb=\pgf@x
20462 \pgf@yb=\pgf@y
20463 \ifnum#1>\NT
20464 \PackageError{circuitikz}{%
20465 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
20466 which has been defined with \NT\space top pins%
20467 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
20468 \fi
20469 \ifnum\NT>0
20470 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
20471 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
20472 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
20473 \ifnum#2=0\relax
20474 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
20475 \else
20476 \ifnum\squarepins>0
20477 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
20478 \else
20479 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
20480 \fi
20481 \fi
20482 \else
20483 % should not happen, give the same as pin 1 anyway
20484 \ifnum#2=0\relax
20485 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
20486 \else
20487 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
20488 \fi
20489 \fi
20490 }
20491
20492 %% IEEE standard logic ports module
20493 %%
20494 %% Original multi-input code from John Kormylo at tex.stackexchange.com
20495 %% Help by TheTeXnician <[email protected]>
20496 %% Suggested idea and example code by Jason Sachs <[email protected]>
20497 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
20498 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
20499 %% Everything is in the same place here --- more or less; first step to move towards
20500 %% a module interface for circutikz
20501 %%
20502
20503 % base parameters for ieeestd ports.
20504
20505 \ctikzset{ieeestd ports/.is family}
20506 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
20507 % the value of 0.4 is the standard pin distance for a port with height=num pins
20508 % and matches the chip distance
20509 \ctikzset{ieeestd ports/baselen/.initial=0.4}
20510 % these are in term of baselen; width depends on height (fixed proportions)
20511 \ctikzset{ieeestd ports/height/.initial=2}
20512 \ctikzset{ieeestd ports/pin length/.initial=0.7}
20513 % the standard "not" circle should be 1/6.5 of height (diameter);
20514 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
20515 \ctikzset{ieeestd ports/not radius/.initial=0.154}
20516 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
20517 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
20518 % xor/xnor leads go full in in IEEE; let this be optional
20519 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
20520 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
20521 %
20522 % base size of a small external schmitt symbol
20523 %
20524 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
20525 %
20526 % input management
20527 % we are using the same /tikz/number inputs than the legacy ports
20528 %
20529 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
20530 %
20531 % integrate with the other logic ports
20532 %
20533 %
20534 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
20535 \ctikzset{logic ports/ieee/.code= {%
20536 \pgf@circuit@ieeelogicporttrue
20537 \pgf@circuit@europeanlogicportfalse
20538 \tikzset{and port/.style={shape=ieeestd and port}}%
20539 \tikzset{or port/.style={shape=ieeestd or port}}%
20540 \tikzset{xor port/.style={shape=ieeestd xor port}}%
20541 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
20542 \tikzset{not port/.style={shape=ieeestd not port}}%
20543 \tikzset{nand port/.style={shape=ieeestd nand port}}%
20544 \tikzset{nor port/.style={shape=ieeestd nor port}}%
20545 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
20546 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
20547 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
20548 }}
20549 % add code to be compatible with the other ports
20550 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
20551 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
20552 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
20553 %
20554 % the base angle for the or port. See the drawings. This will not change with height
20555 %
20556 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
20557 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
20558 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
20559 {%
20560 \ifnum#1>\inputs
20561 \PackageError{circuitikz}{%
20562 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
20563 which has been defined with \inputs\space pins%
20564 }{Please check the manual about logic ports; if you press return I'll try to continue}
20565 \fi
20566 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20567 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
20568 \pgf@circ@res@step=\pind
20569 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
20570 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
20571 }%
20572
20573 % #1 = \pgfmathcounter #2=type
20574 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
20575 \def\pgf@circ@ieeeport@baseinput#1#2%
20576 {%
20577 \ifnum#1>\inputs
20578 \PackageError{circuitikz}{%
20579 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
20580 which has been defined with \inputs\space pins%
20581 }{Please check the manual about logic ports; if you press return I'll try to continue}
20582 \fi
20583 % Find the vertical position (this is the same for any port)
20584 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20585 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
20586 % rack (extended) pins; they are the same for all the ports
20587 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
20588 % above: 1..K (included)
20589 % below: inputs-K..inputs
20590 % Find the pins on the rack; they are 1...
20591 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
20592 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
20593 % border anchors for rack should be ok
20594 \pgfextractx{\pgf@circ@res@left}{\topleft}
20595 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
20596 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
20597 % we have finished if we are in the rack
20598 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
20599 % we are on the inner ports; we have to do the hard work here
20600 % and and nand
20601 \ifnum #2=1
20602 \relax % It's an and/nand, all border ports are on the rack line
20603 \fi
20604 % or and nor
20605 \ifnum #2=2
20606 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20607 \fi
20608 % xor and xnor
20609 \ifnum #2=3\relax
20610 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20611 \fi
20612 \fi\fi
20613 }%
20614 % inner base ports for xor types port
20615 % #1 = \pgfmathcounter #2=type
20616 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
20617 \def\pgf@circ@ieeeport@innerbaseinput#1%
20618 {%
20619 \ifnum#1>\inputs
20620 \PackageError{circuitikz}{%
20621 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
20622 which has been defined with \inputs\space pins%
20623 }{Please check the manual about logic ports; if you press return I'll try to continue}
20624 \fi
20625 % Find the vertical position (this is the same for any port)
20626 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
20627 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
20628 % rack (extended) pins; they are the same for all the ports
20629 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
20630 % above: 1..K (included)
20631 % below: inputs-K..inputs
20632 % Find the pins on the rack; they are 1...
20633 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
20634 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
20635 % border anchors for rack should be ok
20636 \pgfextractx{\pgf@circ@res@left}{\topleft}
20637 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
20638 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
20639 % we have finished if we are in the rack
20640 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
20641 % we are on the inner ports; we have to do the hard work here
20642 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
20643 \fi\fi
20644 }%
20645
20646 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
20647 \def\pgf@circ@ieeestd@baselen{%
20648 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20649 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
20650 }
20651 \def\pgf@circ@ieeestd@stdH{%
20652 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20653 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
20654 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
20655 }
20656 \def\pgf@circ@ieeestd@pinlen{%
20657 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20658 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
20659 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
20660 }
20661 \def\pgf@circ@ieeestd@xorbar{%
20662 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
20663 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
20664 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
20665 }
20666 %% Not circle
20667 \def\pgf@circ@notradius{
20668 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
20669 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
20670 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
20671 }
20672 %% Find (in ...@other) the height of the rack
20673 \def\pgf@circ@findrackH{%
20674 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
20675 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
20676 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
20677 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
20678 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
20679 \pgf@circ@ieeestd@stdH
20680 \multiply\pgf@circ@res@temp by 2\relax% full height
20681 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
20682 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
20683 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
20684 }
20685 %%
20686 \def\pgf@circ@find@ieeeport@up{% leave it in up
20687 % Normal port limits
20688 \pgf@circ@ieeestd@stdH
20689 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
20690 % rack top size
20691 \pgf@circ@findrackH
20692 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
20693 \pgf@circ@res@up=\pgf@circ@res@other
20694 \else
20695 \fi
20696 }
20697 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
20698 % Normal port limits
20699 \pgf@circ@ieeestd@stdH
20700 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
20701 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
20702 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
20703 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
20704 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20705 % this is the normal left border
20706 % For the or or xor port, the limit can be the pointy thing (in case the
20707 % pinlen is zero or too small)
20708 % add to the body margin the or/nor peak:
20709 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
20710 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
20711 \advance\pgf@circ@res@right by \pgf@circ@res@other
20712 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20713 \fi
20714 % add to the body margin the xor/xnor distance
20715 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
20716 \pgf@circ@ieeestd@xorbar
20717 \advance\pgf@circ@res@right by \pgf@circ@res@temp
20718 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20719 \fi
20720 % and if this exceeds the normal margin, this is it
20721 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20722 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
20723 \pgf@circ@res@left=\pgf@circ@res@right
20724 \fi
20725 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
20726 \pgf@circ@res@left=-\pgf@circ@res@left
20727 }
20728 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
20729 % Normal port limits
20730 \pgf@circ@ieeestd@stdH
20731 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
20732 \pgf@circ@notradius
20733 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
20734 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
20735 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
20736 \pgf@circ@res@right=\pgf@circ@res@other
20737 \fi
20738 }
20739 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
20740 % Normal port limits
20741 \pgf@circ@ieeestd@stdH
20742 % notice 0.8660254 is cos(30)
20743 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
20744 \pgf@circ@notradius
20745 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
20746 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
20747 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
20748 \pgf@circ@res@right=\pgf@circ@res@other
20749 \fi
20750 }
20751
20752
20753 %%% ieeestd multi-input ports
20754 %%% #1: name
20755 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
20756 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
20757 %%% #4: drawing for the port
20758 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
20759 \pgfdeclareshape{ieeestd #1 port}%
20760 {%
20761 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
20762 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20763 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
20764 \saveddimen{\baselen}{%
20765 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
20766 }
20767 \saveddimen{\stdH}{% This is HALF the height of the inner port
20768 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
20769 }
20770 \saveddimen{\notdiameter}{
20771 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
20772 }
20773 \saveddimen{\pind}{% pin distance;
20774 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
20775 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
20776 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
20777 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
20778 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
20779 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
20780 \divide\pgf@x by \pgf@circ@count@b
20781 }
20782 \saveddimen{\pinlen}{%
20783 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
20784 }
20785 \saveddimen{\xorbar}{%
20786 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
20787 }
20788 % anchors for the body (no pins included here)
20789 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
20790 \pgf@circ@ieeestd@stdH
20791 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
20792 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
20793 }
20794 \savedanchor{\topleft}{%
20795 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
20796 \pgf@circ@ieeestd@stdH
20797 \pgf@circ@res@other=0pt\relax
20798 \ifnum #2 = 2\relax% "or" or "nor" gates.
20799 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
20800 \fi
20801 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
20802 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
20803 +\pgf@circ@res@right}
20804 \fi
20805 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
20806 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
20807 }
20808 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
20809 \pgf@circ@ieeestd@stdH
20810 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
20811 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
20812 }
20813 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
20814 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
20815 \pgf@circ@ieeestd@stdH
20816 % #3 is =1 if the port is a negated output one
20817 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
20818 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
20819 }
20820 % geographical anchors --- must be rectangulars!
20821 \savedanchor{\northwest}{%
20822 \pgf@circ@find@ieeeport@up
20823 \pgf@circ@find@ieeeport@left{#2}
20824 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
20825 \pgf@x=\pgf@circ@res@left
20826 \pgf@y=\pgf@circ@res@up
20827 }
20828 \savedanchor{\southwest}{%
20829 \pgf@circ@find@ieeeport@up
20830 \pgf@circ@find@ieeeport@left{#2}
20831 \pgf@x=\pgf@circ@res@left
20832 \pgf@y=-\pgf@circ@res@up
20833 }
20834 \savedanchor{\southeast}{%
20835 \pgf@circ@find@ieeeport@up
20836 \pgf@circ@find@ieeeport@right{#3}
20837 \pgf@x=\pgf@circ@res@right
20838 \pgf@y=-\pgf@circ@res@up
20839 }
20840 \savedanchor{\northeast}{%
20841 \pgf@circ@find@ieeeport@up
20842 \pgf@circ@find@ieeeport@right{#3}
20843 \pgf@x=\pgf@circ@res@right
20844 \pgf@y=\pgf@circ@res@up
20845 }
20846 \savedmacro\inputs{% get number of inputs
20847 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
20848 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
20849 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
20850 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
20851 \def\inputs{\the\pgf@circ@count@a}%
20852 }%
20853 \savedmacro\inners{% get number of "inner" inputs (for racks)
20854 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
20855 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
20856 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
20857 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
20858 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
20859 % \typeout{INNER is \the\pgf@circ@count@b}%
20860 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
20861 \def\inners{\the\pgf@circ@count@b}%
20862 }%
20863 \anchor{center}{\pgfpointorigin}
20864 \anchor{text}{
20865 \ifpgf@circ@center@text
20866 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
20867 \else
20868 \pgf@circ@ieeestd@stdH
20869 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
20870 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
20871 \fi
20872 }
20873 % create input anchors
20874 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
20875 \pgf@circ@count@a=\inputs
20876 \pgfmathloop%
20877 \ifnum\pgfmathcounter>\pgf@circ@count@a%
20878 \else%
20879 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
20880 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
20881 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
20882 }%
20883 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
20884 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
20885 }%
20886 \ifnum #2 = 3\relax % xor/xnor inner border pins
20887 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
20888 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
20889 }%
20890 \fi
20891 %}{}%
20892 \repeatpgfmathloop%
20893 }
20894 % output anchor
20895 \anchor{out}{%
20896 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
20897 \advance\pgf@circ@res@other by\pinlen
20898 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
20899 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
20900 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
20901 \fi
20902 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
20903 }
20904 \anchor{bout}{\bottomright\pgf@y=0pt}
20905
20906 \anchor{body right}{\bodyright\pgf@y=0pt}
20907 \anchor{right}{\bottomright\pgf@y=0pt}
20908 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
20909 \anchor{left}{% central edge of the component
20910 \bodyleft\pgf@y=0pt
20911 \ifnum #2=3\relax
20912 \advance\pgf@x by -\xorbar
20913 \fi
20914 }
20915 \anchor{up}{%
20916 \bodyleft
20917 \ifnum #2 > 1 % pointy shapes
20918 \pgf@circ@ieeestd@stdH
20919 % horizontal coordinate where the right semicircle starts
20920 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
20921 % vertical drop of the circle at the above coordinate
20922 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
20923 \advance \pgf@y by -\pgf@circ@res@step
20924 \fi
20925 \pgf@x=0pt
20926 }
20927 \anchor{down}{%
20928 \bodyleft
20929 \ifnum #2 > 1 % pointy shapes
20930 \pgf@circ@ieeestd@stdH
20931 % horizontal coordinate where the right semicircle starts
20932 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
20933 % vertical drop of the circle at the above coordinate
20934 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
20935 \advance \pgf@y by -\pgf@circ@res@step
20936 \fi
20937 \pgf@y=-\pgf@y\pgf@x=0pt
20938 }
20939
20940 % geographical anchors
20941 \anchor{nw}{\northwest}
20942 \anchor{ne}{\northeast}
20943 \anchor{se}{\southeast}
20944 \anchor{sw}{\southwest}
20945 \anchor{north west}{\northwest}
20946 \anchor{north east}{\northeast}
20947 \anchor{south east}{\southeast}
20948 \anchor{south west}{\southwest}
20949 % over 0,0 even if asymmetric
20950 % will break if the geocoords are not rectangular
20951 \anchor{n}{\northwest\pgf@x=0pt\relax}
20952 \anchor{e}{\northeast\pgf@y=0pt\relax}
20953 \anchor{s}{\southwest\pgf@x=0pt\relax}
20954 \anchor{w}{\northwest\pgf@y=0pt\relax}
20955 \anchor{north}{\northwest\pgf@x=0pt\relax}
20956 \anchor{east}{\northeast\pgf@y=0pt\relax}
20957 \anchor{south}{\southwest\pgf@x=0pt\relax}
20958 \anchor{west}{\northwest\pgf@y=0pt\relax}
20959
20960 \backgroundpath{
20961 \pgfscope
20962 \pgfsetcolor{\ctikzvalof{color}}
20963 #4
20964 \endpgfscope
20965 % output lead:
20966 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
20967 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
20968 \advance\pgf@circ@res@other by \pinlen\relax
20969 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
20970 \ifpgfcirc@draw@output@leads
20971 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20972 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
20973 \pgfusepath{draw}
20974 \fi
20975 \fi
20976 \ifnum #3=1\relax\pgfscope
20977 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
20978 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
20979 \endpgfscope\fi
20980 }
20981 }
20982 }
20983
20984 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
20985 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
20986 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
20987 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
20988 }
20989 %
20990 % ieeestd "and" and "nand"
20991 %
20992 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
20993 \pgf@circ@count@a = \inputs\relax
20994 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
20995 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
20996 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
20997 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
20998 \ifpgfcirc@draw@input@leads
20999 %input leads --- all the same for AND ports
21000 \loop\ifnum\pgf@circ@count@a>0
21001 \advance\pgf@circ@res@temp by -\pind
21002 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
21003 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
21004 \advance\pgf@circ@count@a by -1
21005 \repeat
21006 \fi
21007 \pgfusepath{draw}
21008 %% Body. let's start from the top left
21009 \pgfscope
21010 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21011 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
21012 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
21013 \pgfpatharc{90}{-90}{\stdH}
21014 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
21015 \pgfpathclose
21016 \pgf@circ@draworfill
21017 % rack now; skip if not needed.
21018 % \typeout{WHAT\space \inputs\space \inners}
21019 \ifnum\inputs>\inners
21020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21021 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21022 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
21023 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21024 \pgfusepath{draw}
21025 \fi
21026 \endpgfscope
21027 }
21028 %
21029 % or/nor and xor/xnor are practically the same. Let factor out everything
21030 % the argument #1 is put just before the drawing of the inner pins
21031 % the argument #2 is put after the drawing of the body
21032 %
21033 \long\def\pgf@circ@ieeeport@orxor#1#2{%
21034 \pgf@circ@count@a = \inputs\relax
21035 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
21036 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
21037 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21038 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
21039 % rack (extended) pins; they are the same for all the ports
21040 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
21041 % above: 1..K (included)
21042 % below: inputs-K..inputs
21043 % Find the pins on the rack; they are 1...
21044 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
21045 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
21046 \ifpgfcirc@draw@input@leads
21047 %input leads --- for or ports
21048 \loop\ifnum\pgf@circ@count@a>0
21049 \pgfextractx{\pgf@circ@res@right}{\topleft}
21050 \advance\pgf@circ@res@temp by -\pind
21051 % this is the height; let's find the "right" position
21052 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
21053 % inner pins
21054 % \typeout{INNER\space\pgf@circ@count@a}
21055 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
21056 % hook for xor/xnor
21057 #1
21058 \fi\fi
21059 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
21060 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
21061 \pgfusepath{draw}
21062 \advance\pgf@circ@count@a by -1
21063 \repeat
21064 \fi
21065 %% Body. let's start from the top left
21066 \pgfscope
21067 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21068 % it should start here, but with this trick the close comes out better.
21069 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21070 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
21071 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
21072 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
21073 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
21074 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
21075 %% this should be 2 and 2; but the round part is not a perfect circle that way
21076 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
21077 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21078 \pgfpathclose
21079 \pgf@circ@draworfill
21080 % hook for xor/xnor
21081 #2
21082 % rack now; skip if not needed.
21083 % \typeout{WHAT\space \inputs\space \inners}
21084 \ifnum\inputs>\inners
21085 \pgfextractx{\pgf@circ@res@left}{\topleft}
21086 \pgfextracty{\pgf@circ@res@down}{\topleft}
21087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21089 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
21090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21091 \pgfusepath{draw}
21092 \fi
21093 \endpgfscope
21094 }
21095 %
21096 % ieeestd "or" and "nor"
21097 %
21098 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
21099 \pgf@circ@ieeeport@orxor{}{}
21100 }
21101 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
21102 \pgf@circ@ieeeport@orxor{
21103 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
21104 \ifnum\@@tmp=0\relax
21105 % move pin start to the left to leave the xor gap free (not standard)
21106 \advance\pgf@circ@res@right by -\xorbar
21107 \fi
21108 }{%
21109 % add the xor/xnor bar
21110 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
21111 % see the comment on the main body about the 2.2
21112 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
21113 \pgfusepath{draw}
21114 }
21115 }
21116 %
21117 % Buffer and inverters
21118 %
21119 % #1: name
21120 % #2: polarity
21121 % #3: content
21122 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
21123 \pgfdeclareshape{ieeestd #1 port}%
21124 {%
21125 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21126 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21127 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21128 \saveddimen{\baselen}{%
21129 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
21130 }
21131 \saveddimen{\stdH}{% This is HALF the height of the inner port
21132 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
21133 }
21134 \saveddimen{\notdiameter}{
21135 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
21136 }
21137 \saveddimen{\pinlen}{%
21138 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
21139 }
21140 % anchors for the body (no pins included here)
21141 % Notice that 0.8660254 is cos(30)
21142 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
21143 \pgf@circ@ieeestd@stdH
21144 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21145 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21146 }
21147 \savedanchor{\topleft}{%
21148 \pgf@circ@ieeestd@stdH
21149 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21150 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21151 }
21152 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
21153 \pgf@circ@ieeestd@stdH
21154 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
21155 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21156 }
21157 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
21158 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
21159 \pgf@circ@ieeestd@stdH
21160 % #2 is =1 if the port is a negated output one
21161 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
21162 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21163 }
21164 % geographical anchors --- must be rectangulars!
21165 \savedanchor{\northwest}{%
21166 \pgf@circ@ieeestd@stdH
21167 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21168 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
21169 }
21170 \savedanchor{\southwest}{%
21171 \pgf@circ@ieeestd@stdH
21172 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
21173 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
21174 }
21175 \savedanchor{\southeast}{%
21176 \pgf@circ@ieeestd@stdH
21177 \pgf@circ@res@up=\pgf@circ@res@temp
21178 \pgf@circ@find@ieeeport@not@right{#2}
21179 \pgf@x=\pgf@circ@res@right
21180 \pgf@y=-\pgf@circ@res@up
21181 }
21182 \savedanchor{\northeast}{%
21183 \pgf@circ@ieeestd@stdH
21184 \pgf@circ@res@up=\pgf@circ@res@temp
21185 \pgf@circ@find@ieeeport@not@right{#2}
21186 \pgf@x=\pgf@circ@res@right
21187 \pgf@y=\pgf@circ@res@up
21188 }
21189 \anchor{center}{\pgfpointorigin}
21190 \anchor{text}{
21191 \ifpgf@circ@center@text
21192 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21193 \else
21194 \pgf@circ@ieeestd@stdH
21195 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21196 \fi
21197 }
21198 % input anchors
21199 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21200 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21201 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
21202 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
21203 % output anchors
21204 \anchor{out}{%
21205 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
21206 \advance\pgf@circ@res@other by\pinlen
21207 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
21208 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
21209 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
21210 \fi
21211 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
21212 }
21213 \anchor{bout}{\bottomright\pgf@y=0pt}
21214
21215 \anchor{body right}{\bodyright\pgf@y=0pt}
21216 \anchor{right}{\bottomright\pgf@y=0pt}
21217 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
21218 \anchor{left}{\bodyleft\pgf@y=0pt}
21219 \anchor{up}{%
21220 \bodyleft
21221 \pgf@y=+0.5\pgf@y\pgf@x=0pt
21222 }
21223 \anchor{down}{%
21224 \bodyleft
21225 \pgf@y=-0.5\pgf@y\pgf@x=0pt
21226 }
21227 % this is for when it's used as a bipole
21228 % we use the enclosing rectangle (see below)
21229 \anchorborder{%
21230 %% This (commented out) is the correct border anchor. But if we use the correct
21231 %% border anchor there is no horizontal space for the label ;-) because
21232 %% the triangle is too steep. So we will use a simple square border
21233 %%
21234 %% find the border anchor of a triangle (like a not port or an
21235 %% amplifier) ---
21236 %%
21237 %% -----^ up
21238 %% I --- |
21239 %% I -|--
21240 %%left I | --- right
21241 %% ----I-----|-------I-----
21242 %%
21243 %%
21244 %\pgf@xa=\pgf@x
21245 %% it's simmetrical w/ vertical side, use only positive y
21246 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
21247 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
21248 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
21249 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
21250 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
21251 %% limit angle for the left (vertical) side
21252 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
21253 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
21254 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
21255 %% find the border
21256 %\ifnum\@@leftside>0
21257 % % vertical side
21258 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21259 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21260 %\else
21261 % % triangle upper line
21262 % \pgfpointintersectionoflines
21263 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
21264 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
21265 %\fi
21266 %% readjust y sign
21267 %\pgf@y=\@@switchy\pgf@y
21268 %
21269 % this is the square border to position the path label with a bit of horizontal space
21270 %
21271 \pgf@xa=\pgf@x
21272 \pgf@ya=\pgf@y
21273 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21274 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21275 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21276 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21277 }
21278 % geographical anchors
21279 \anchor{nw}{\northwest}
21280 \anchor{ne}{\northeast}
21281 \anchor{se}{\southeast}
21282 \anchor{sw}{\southwest}
21283 \anchor{north west}{\northwest}
21284 \anchor{north east}{\northeast}
21285 \anchor{south east}{\southeast}
21286 \anchor{south west}{\southwest}
21287 % over 0,0 even if asymmetric
21288 % will break if the geocoords are not rectangular
21289 \anchor{n}{\northwest\pgf@x=0pt\relax}
21290 \anchor{e}{\northeast\pgf@y=0pt\relax}
21291 \anchor{s}{\southwest\pgf@x=0pt\relax}
21292 \anchor{w}{\northwest\pgf@y=0pt\relax}
21293 \anchor{north}{\northwest\pgf@x=0pt\relax}
21294 \anchor{east}{\northeast\pgf@y=0pt\relax}
21295 \anchor{south}{\southwest\pgf@x=0pt\relax}
21296 \anchor{west}{\northwest\pgf@y=0pt\relax}
21297
21298 \backgroundpath{
21299 \pgfscope
21300 \pgfsetcolor{\ctikzvalof{color}}
21301 #3
21302 \endpgfscope
21303 % output lead:
21304 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
21305 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
21306 \advance\pgf@circ@res@other by \pinlen\relax
21307 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
21308 \ifpgfcirc@draw@output@leads
21309 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21310 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
21311 \pgfusepath{draw}
21312 \fi
21313 \fi
21314 \ifnum #2=1\relax\pgfscope
21315 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
21316 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
21317 \endpgfscope\fi
21318 }
21319 }
21320 }
21321
21322 %%% #1 direct name #2 negated name #3 drawing (without output)
21323 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
21324 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
21325 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
21326 }
21327
21328 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
21329 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21330 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21331 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21332 % \draw input pin
21333 \ifpgfcirc@draw@input@leads
21334 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21335 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21336 \pgfusepath{draw}
21337 \fi
21338 \pgfscope
21339 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21340 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21342 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21343 \pgfpathclose
21344 \pgf@circ@draworfill
21345 \endpgfscope
21346 }
21347
21348 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
21349 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21350 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21351 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21352 % \draw input pin
21353 \ifpgfcirc@draw@input@leads
21354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21356 \pgfusepath{draw}
21357 \fi
21358 \pgfscope
21359 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21360 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21361 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21363 \pgfpathclose
21364 \pgf@circ@draworfill
21365 \endpgfscope
21366 % draw schmitt symbol in normal line thickness
21367 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21368 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21369 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21370 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21371 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
21372 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21373 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
21374 \pgfusepath{draw}
21375 }
21376
21377
21378 \pgfdeclareshape{schmitt symbol}{
21379 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21380 \anchor{center}{\pgfpointorigin}
21381 \savedanchor\northwest{%
21382 \pgf@circ@ieeestd@stdH
21383 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
21384 \pgf@x=-1.5\pgf@y
21385 }
21386 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
21387 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21388 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
21389 \anchor{west}{\northwest\pgf@y=0pt}
21390 \anchor{w}{\northwest \pgf@y=0pt}
21391 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
21392 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
21393 \anchor{north}{\northwest\pgf@x=0pt}
21394 \anchor{n}{\northwest\pgf@x=0pt}
21395 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
21396 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
21397 \anchor{north west}{\northwest}
21398 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21399 \backgroundpath{
21400 \pgfscope
21401 \pgfsetcolor{\ctikzvalof{color}}
21402 \pgfextractx{\pgf@circ@res@left}{\northwest}
21403 \pgfextracty{\pgf@circ@res@up}{\northwest}
21404 \pgf@circ@res@left=0.7\pgf@circ@res@left
21405 \pgf@circ@res@up=0.7\pgf@circ@res@up
21406 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21407 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
21408 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
21409 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21410 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
21411 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
21412 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21413 \pgfusepath{draw}
21414 \endpgfscope
21415 }
21416 }
21417
21418 \pgfdeclareshape{notcirc}{
21419 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21420 \anchor{center}{\pgfpointorigin}
21421 \savedanchor\northwest{%
21422 \pgf@circ@notradius
21423 \pgf@y=\pgf@circ@res@temp
21424 \pgf@x=-\pgf@y
21425 }
21426 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
21427 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21428 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
21429 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
21430 \anchor{left}{\northwest\pgf@y=0pt}
21431 \anchor{west}{\northwest\pgf@y=0pt}
21432 \anchor{w}{\northwest \pgf@y=0pt}
21433 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
21434 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
21435 \anchor{north}{\northwest\pgf@x=0pt}
21436 \anchor{n}{\northwest\pgf@x=0pt}
21437 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
21438 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
21439 \anchor{north west}{\northwest}
21440 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21441 \anchorborder{
21442 \pgf@circ@res@left=\pgf@x
21443 \pgf@circ@res@up=\pgf@y
21444 \northwest\pgf@circ@res@temp=\pgf@y
21445 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
21446 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
21447 }
21448 \behindforegroundpath{
21449 \pgfscope
21450 \northwest\pgf@circ@res@temp=\pgf@y
21451 \pgfsetcolor{\ctikzvalof{color}}
21452 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21453 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
21454 \ifx\tikz@fillcolor\pgfutil@empty
21455 % set the default fill color to white
21456 \pgfsetfillcolor{white}
21457 % ...but override it if the class is defined!
21458 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
21459 \else
21460 \pgfsetfillcolor{\tikz@fillcolor}
21461 \fi
21462 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
21463 \pgfusepath{draw,fill}
21464 \endpgfscope
21465 }
21466 }
21467
21468 %%%% Transmission gates
21469 % tgates are only ieee style for now
21470 \tikzset{%
21471 tgate/.style ={shape=ieee tgate},
21472 double tgate/.style ={shape=ieee double tgate},
21473 }
21474 \ctikzset{tgate scale/.initial=0.7}
21475 % Buffer and inverters
21476 %
21477 % #1: name
21478 % #2: 1: one-not, 2:double-not
21479 % #3: content
21480 \long\def\pgfcircdeclareieeetgate#1#2#3{%
21481 \pgfdeclareshape{ieee #1}%
21482 {%
21483 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
21484 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21485 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21486 \saveddimen{\baselen}{%
21487 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
21488 }
21489 \saveddimen{\stdH}{% This is HALF the height of the inner port
21490 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
21491 }
21492 \saveddimen{\notdiameter}{
21493 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
21494 }
21495 \saveddimen{\notradius}{
21496 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
21497 }
21498 \saveddimen{\pinlen}{%
21499 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
21500 }
21501 % anchors for the body (no pins included here)
21502 % Notice that 0.8660254 is cos(30)
21503 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
21504 \pgf@circ@ieeestd@stdH
21505 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21506 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21507 }
21508 \savedanchor{\topleft}{%
21509 \pgf@circ@ieeestd@stdH
21510 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21511 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21512 }
21513 \savedanchor{\bodyright}{%
21514 \pgf@circ@ieeestd@stdH
21515 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21516 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21517 }
21518 \savedanchor{\bottomright}{% Here it is the same as \bodyright
21519 \pgf@circ@ieeestd@stdH
21520 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21521 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21522 }
21523 % geographical anchors --- must be rectangulars!
21524 \savedanchor{\northwest}{%
21525 \pgf@circ@ieeestd@stdH
21526 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21527 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21528 }
21529 \savedanchor{\southwest}{%
21530 \pgf@circ@ieeestd@stdH
21531 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21532 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21533 }
21534 \savedanchor{\southeast}{%
21535 \pgf@circ@ieeestd@stdH
21536 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21537 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21538 }
21539 \savedanchor{\northeast}{%
21540 \pgf@circ@ieeestd@stdH
21541 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21542 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
21543 }
21544 \anchor{center}{\pgfpointorigin}
21545 \anchor{text}{
21546 \ifpgf@circ@center@text
21547 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21548 \else
21549 \pgf@circ@ieeestd@stdH
21550 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
21551 \fi
21552 }
21553 % input anchors
21554 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21555 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
21556 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
21557 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
21558 % gates
21559 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
21560 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
21561 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21562 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
21563 % gate (up) (2.1547 = 1+1/cos(30)
21564 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21565 \pgf@x=0pt\relax
21566 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
21567 \ifdim\pinlen>\pgf@circ@res@temp
21568 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
21569 \else
21570 \pgf@y=\pgf@circ@res@temp
21571 \fi
21572 }
21573 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
21574 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
21575
21576 % output anchors
21577 \anchor{out}{%
21578 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
21579 \advance\pgf@circ@res@other by\pinlen
21580 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
21581 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
21582 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
21583 \fi
21584 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
21585 }
21586 \anchor{bout}{\bottomright\pgf@y=0pt}
21587
21588 \anchor{body right}{\bodyright\pgf@y=0pt}
21589 \anchor{right}{\bottomright\pgf@y=0pt}
21590 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
21591 \anchor{left}{\bodyleft\pgf@y=0pt}
21592 \anchor{up}{%
21593 \bodyleft
21594 \pgf@x=0pt
21595 \ifnum#2=1\relax
21596 \pgf@y=0pt
21597 \else
21598 \pgf@y=.5\pgf@y
21599 \fi
21600 \advance\pgf@y by \notdiameter
21601 }
21602 \anchor{down}{%
21603 \bodyleft
21604 \pgf@x=0pt
21605 \ifnum#2=1\relax
21606 \pgf@y=0pt
21607 \else
21608 \pgf@y=-.5\pgf@y
21609 \fi
21610 }
21611 % this is for when it's used as a bipole
21612 % we use the enclosing rectangle (see below)
21613 \anchorborder{%
21614 %
21615 % this is the square border to position the path label with a bit of horizontal space
21616 %
21617 \pgf@xa=\pgf@x
21618 \pgf@ya=\pgf@y
21619 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21620 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21621 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
21622 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
21623 }
21624 % geographical anchors
21625 \anchor{nw}{\northwest}
21626 \anchor{ne}{\northeast}
21627 \anchor{se}{\southeast}
21628 \anchor{sw}{\southwest}
21629 \anchor{north west}{\northwest}
21630 \anchor{north east}{\northeast}
21631 \anchor{south east}{\southeast}
21632 \anchor{south west}{\southwest}
21633 % over 0,0 even if asymmetric
21634 % will break if the geocoords are not rectangular
21635 \anchor{n}{\northwest\pgf@x=0pt\relax}
21636 \anchor{e}{\northeast\pgf@y=0pt\relax}
21637 \anchor{s}{\southwest\pgf@x=0pt\relax}
21638 \anchor{w}{\northwest\pgf@y=0pt\relax}
21639 \anchor{north}{\northwest\pgf@x=0pt\relax}
21640 \anchor{east}{\northeast\pgf@y=0pt\relax}
21641 \anchor{south}{\southwest\pgf@x=0pt\relax}
21642 \anchor{west}{\northwest\pgf@y=0pt\relax}
21643
21644 \backgroundpath{
21645 \pgfscope
21646 \pgfsetcolor{\ctikzvalof{color}}
21647 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
21648 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
21649 \pgfextractx{\pgf@circ@res@right}{\bodyright}
21650 % \draw input pins
21651 \ifpgfcirc@draw@input@leads
21652 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21653 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
21654 % gate (down)
21655 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
21656 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
21657 % gate (up) (2.1547 = 1+1/cos(30)
21658 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
21659 \ifdim\pinlen>\pgf@circ@res@temp
21660 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
21661 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
21662 \fi
21663 \pgfusepath{draw}
21664 \fi
21665 #3
21666 \endpgfscope
21667 % output lead:
21668 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
21669 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
21670 \advance\pgf@circ@res@other by \pinlen\relax
21671 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
21672 \ifpgfcirc@draw@output@leads
21673 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21674 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
21675 \pgfusepath{draw}
21676 \fi
21677 \fi
21678 }
21679 }
21680 }
21681
21682 \pgfcircdeclareieeetgate{tgate}{1}{%
21683 \pgfscope
21684 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21685 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21686 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
21687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21688 \pgfpathclose
21689 \pgf@circ@draworfill
21690 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21691 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
21692 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
21693 \pgfpathclose
21694 \pgf@circ@draworfill
21695 \endpgfscope
21696 \pgfscope
21697 % 1.1547 is 1/cos(30)
21698 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
21699 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
21700 \endpgfscope
21701 }
21702
21703 \pgfcircdeclareieeetgate{double tgate}{2}{%
21704 \pgfscope
21705 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21706 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21707 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
21708 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21709 \pgfpathclose
21710 \pgf@circ@draworfill
21711 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21712 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
21713 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21714 \pgfpathclose
21715 \pgf@circ@draworfill
21716 % bottom triangles
21717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
21718 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
21719 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21720 \pgfpathclose
21721 \pgf@circ@draworfill
21722 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
21723 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
21724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
21725 \pgfpathclose
21726 \pgf@circ@draworfill
21727 \endpgfscope
21728 \pgfscope
21729 % 1.1547 is 1/cos(30)
21730 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
21731 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
21732 \endpgfscope
21733 }
21734
21735 %%%---------- close: tex/pgfcircmultipoles
21736
21737 %%%%%%%%%%% Springe nach tex/pgfcirclabel
21738 %%%---------- open: tex/pgfcirclabel.tex
21739 % Copyright 2018-2026 by Romano Giannetti
21740 % Copyright 2015-2026 by Stefan Lindner
21741 % Copyright 2013-2026 by Stefan Erhardt
21742 % Copyright 2007-2026 by Massimo Redaelli
21743 %
21744 % This file may be distributed and/or modified
21745 %
21746 % 1. under the LaTeX Project Public License and/or
21747 % 2. under the GNU Public License.
21748 %
21749 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21750
21751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21752 %% Bipole label positioning
21753
21754 %% bipole labels and annotation extra style
21755
21756 \ctikzset{bipole label style/.style={}}
21757 \tikzset{bipole label style/.code={
21758 \ctikzset{bipole label style/.style={#1}}
21759 }}
21760 \tikzset{bipole label append style/.code={
21761 \ctikzset{bipole label style/.append style={#1}}
21762 }}
21763 \ctikzset{bipole annotation style/.style={}}
21764 \tikzset{bipole annotation style/.code={
21765 \ctikzset{bipole annotation style/.style={#1}}
21766 }}
21767 \tikzset{bipole annotation append style/.code={
21768 \ctikzset{bipole annotation style/.append style={#1}}
21769 }}
21770
21771 %% Options
21772 \ctikzset{label/.style = { l=#1 } }
21773 \ctikzset{l/.code = {
21774 \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
21775 \ctikzsetvalof{bipole/label/unit}{}
21776 \ifpgf@circ@siunitx
21777 \pgf@circ@handleSI{#1}
21778 \ifpgf@circ@siunitx@res
21779 \edef\pgf@temp{\pgf@circ@handleSI@val}
21780 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
21781 \edef\pgf@temp{\pgf@circ@handleSI@unit}
21782 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
21783 \else
21784 \fi
21785 \else
21786 \fi
21787 }}
21788
21789 \ctikzset{label above/.code = {
21790 l=#1,
21791 \circuitikzbasekey/bipole/label/position=90 }
21792 }
21793
21794 \ctikzset{l^/.style = {
21795 l=#1,
21796 \circuitikzbasekey/bipole/label/position=90 }
21797 }
21798
21799 \ctikzset{label below/.code = {
21800 l=#1,
21801 \circuitikzbasekey/bipole/label/position=-90 }
21802 }
21803
21804 \ctikzset{l_/.style = {
21805 l=#1,
21806 \circuitikzbasekey/bipole/label/position=-90 }
21807 }
21808
21809 \ctikzset{annotation/.style = { a=#1 } }
21810 \ctikzset{a/.code = {
21811 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
21812 \ctikzsetvalof{bipole/annotation/unit}{}
21813 \ifpgf@circ@siunitx
21814 \pgf@circ@handleSI{#1}
21815 \ifpgf@circ@siunitx@res
21816 \edef\pgf@temp{\pgf@circ@handleSI@val}
21817 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
21818 \edef\pgf@temp{\pgf@circ@handleSI@unit}
21819 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
21820 \else
21821 \fi
21822 \else
21823 \fi
21824 }}
21825
21826 \ctikzset{annotation above/.code = {
21827 a=#1,
21828 \circuitikzbasekey/bipole/annotation/position=90 }
21829 }
21830
21831 \ctikzset{a^/.style = {
21832 a=#1,
21833 \circuitikzbasekey/bipole/annotation/position=90 }
21834 }
21835
21836 \ctikzset{annotation below/.code = {
21837 a=#1,
21838 \circuitikzbasekey/bipole/annotation/position=-90 }
21839 }
21840 \ctikzset{a_/.style = {
21841 a=#1,
21842 \circuitikzbasekey/bipole/annotation/position=-90 }
21843 }
21844
21845 % This is to adjust spacing for the labels so that they are not cramped on components
21846 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
21847
21848 \def\pgf@circ@drawlabels#1{
21849 \pgfextra{
21850 % This function will be called with argument #1 equal
21851 % to "label" or "annotation" form pgfcircpath.tex.
21852 % pgf@circ@direction is the direction of the path,
21853 % its value is set in pgfcircpath.tex
21854 \pgfmathsubtract{\pgf@circ@direction}{90}
21855 \pgfmathround{\pgfmathresult} % avoid precision loss errors
21856 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21857
21858 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
21859 \ifnum \pgf@circ@temp < 0
21860 \pgfmathadd{\pgf@circ@labanc}{180}
21861 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21862 \fi
21863 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
21864 %
21865 % normalize the angle values
21866 %
21867 \pgfmathmod{\pgf@circ@labanc}{360}
21868 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21869 %
21870 \ifpgf@circuit@bipole@inverted
21871 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
21872 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21873 \fi
21874 %
21875 \ifnum \ctikzvalof{mirror value} = -1
21876 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
21877 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21878 \fi
21879 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
21880 }
21881 %Firstly, place a coordinate directly at the edge of the shape
21882 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
21883 %now decide, which labels should be drawn
21884 \pgfextra{
21885 \edef\pgf@temp{\ctikzvalof{label/align}}
21886 \def\pgf@circ@temp{straight}
21887 }
21888 \ifx\pgf@temp\pgf@circ@temp %straight
21889 \pgf@circ@drawreglabels{#1}
21890 \else
21891 \pgfextra{\def\pgf@circ@temp{rotate}}
21892 \ifx\pgf@temp\pgf@circ@temp %rotate
21893 \pgf@circ@drawrotlabels{#1}
21894 \else% smart
21895 \pgf@circ@drawsmartlabels{#1}
21896 \fi
21897 \fi
21898 }
21899
21900
21901 \def\pgf@circ@drawsmartlabels#1{
21902 \pgfextra{
21903 \pgfmathmod{\pgf@circ@direction}{90}
21904 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21905 }
21906 \ifnum \pgfcircmathresult > 20
21907 \ifnum \pgfcircmathresult < 70
21908 \pgf@circ@drawrotlabels{#1}
21909 \else
21910 \pgf@circ@drawreglabels{#1}
21911 \fi
21912 \else
21913 \pgf@circ@drawreglabels{#1}
21914 \fi
21915 }
21916
21917
21918 \def\pgf@circ@drawrotlabels#1{
21919 \pgfextra{
21920 % scale the distances in function of zoom, so that they are not
21921 % dependent on it but on font size. Thanks to @marmot
21922 % https://tex.stackexchange.com/a/476018/38080
21923 % the coeffcient is adjusted so that the distance is more or less
21924 % the same for rotated labels and straight ones (although it will
21925 % depend on the font, so it's not exact).
21926 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
21927 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
21928 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
21929 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale}
21930 \ifnum \ctikzvalof{bipole/#1/position}>0
21931 %we need some more space for placement below, due to mid-anchor
21932 \else % we do not have <= in \ifnum...
21933 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
21934 \fi
21935 %Calculate rotation of the label from direction and strip decimals
21936 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
21937 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
21938 % rotate the label at second or third quadrant:
21939 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
21940 \pgfmathsubtract{\pgf@circ@direction}{180}
21941 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21942 %invert the space relationships due to rotated strings
21943 \ifnum \ctikzvalof{bipole/#1/position}>0
21944 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
21945 \fi
21946 \fi\fi
21947 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
21948 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
21949 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
21950 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
21951 }
21952 % reset cm is not working correctly here
21953 (pgfcirc@labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
21954 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
21955 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
21956 }
21957
21958 \def\pgf@circ@drawreglabels#1{
21959 %Now calculate all shape positions
21960 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
21961 %All points between will be addressed by angled-anchors:
21962 \pgfextra{
21963 % scale ex-distance to make it independent on scale
21964 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
21965 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
21966 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
21967 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
21968 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale}
21969 \pgfmathadd{\pgf@circ@labanc}{90}
21970 \pgfmathround{\pgfmathresult}
21971 \def\pgf@circ@labanctext{\pgf@circ@labanc}
21972 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21973 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
21974 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21975 }
21976 %Values around 90 are at both y-axis
21977 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
21978 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
21979 \ifnum \pgf@circ@labpos > 180
21980 \ifnum \ctikzvalof{bipole/#1/position} > 0
21981 \pgfextra{\def\pgf@circ@labanctext{mid west}}
21982 \else
21983 \pgfextra{\def\pgf@circ@labanctext{mid east}}
21984 \fi
21985 \else
21986 \ifnum \ctikzvalof{bipole/#1/position} > 0
21987 \pgfextra{\def\pgf@circ@labanctext{mid east}}
21988 \else
21989 \pgfextra{\def\pgf@circ@labanctext{mid west}}
21990 \fi
21991 \fi
21992 \fi\fi
21993 %Values between -5 and 5 are at pos /neg x-axis
21994 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
21995 \ifnum \ctikzvalof{bipole/#1/position} < 0
21996 \ifnum \pgf@circ@labanc > 90
21997 % using base coordinate instead of south to naturally align
21998 % symbols with descendants; but this invalidate the effect of
21999 % the inner sep, so recover it by shifting the anchor
22000 % reset cm is not working sometime, use @marmot solution
22001 % see https://tex.stackexchange.com/a/476018/38080
22002 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22003 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22004 \else
22005 \pgfextra{\def\pgf@circ@labanctext{north}}%north
22006 \fi
22007 \else
22008 \ifnum \pgf@circ@labanc < 90
22009 % shift, as above
22010 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22011 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22012 \else
22013 \ifnum \pgf@circ@labanc > 180
22014 % this shouldn't happen, but somehow it does (270 degree anchors)
22015 % shift, as above
22016 (pgfcirc@labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(pgfcirc@labelcoor)
22017 \pgfextra{\def\pgf@circ@labanctext{base}}%base
22018 \else
22019 \pgfextra{\def\pgf@circ@labanctext{north}}%north
22020 \fi
22021 \fi
22022 \fi
22023 \fi\fi
22024 \pgfextra{%
22025 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
22026 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
22027 }
22028 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
22029 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
22030 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
22031 }
22032 }
22033
22034 \def\pgf@circ@finallabels#1{%
22035 \edef\pgf@temp{}%
22036 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
22037 \ifx\pgf@temp\pgf@circ@temp%
22038 \ctikzvalof{bipole/#1/name}%
22039 \else%
22040 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
22041 \fi%
22042 }
22043
22044
22045 %%%% Stacked labels
22046 %
22047 % stacked labels by Romano Giannetti [email protected]
22048 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
22049 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
22050 %
22051 % labels are in a tabular, globally aligned:
22052 % vertically with key l2 valign (default c)
22053 % c: center t: top b: bottom
22054 % horizontally with key l2 align (default l)
22055 % l: left c: centered r: right
22056 % you can switch sides using l2_=... and l2^=...
22057 % syntax is l2_ = line1 and line2 (same for l2^)
22058 %
22059 \ctikzset{%
22060 l2 valign/.store in=\ltwo@valign, l2 valign=c,
22061 l2 halign/.store in=\ltwo@halign, l2 halign=l,
22062 }
22063 \ctikzset{l2base/.code n args={2}{
22064 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
22065 \bgroup
22066 \setlength{\tabcolsep}{2pt}%
22067 \def\ltwo@tabu{\tabular[\ltwo@valign]}%
22068 \expandafter\ltwo@tabu\expandafter{\ltwo@halign}%
22069 #1\\ #2%
22070 \endtabular
22071 \egroup
22072 }%
22073 \ctikzsetvalof{bipole/label/unit}{}
22074 \ifpgf@circ@siunitx
22075 \pgf@circ@handleSI{#2}
22076 \ifpgf@circ@siunitx@res
22077 \edef\pgf@temp{\pgf@circ@handleSI@val}
22078 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
22079 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22080 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
22081 \else
22082 \fi
22083 \else
22084 \fi
22085 }}
22086 \ctikzset{l2/.style args={#1 and #2}{
22087 l2base={#1}{#2},
22088 \circuitikzbasekey/bipole/label/position=90 }
22089 }
22090 \ctikzset{l2 above/.style args={#1 and #2}{
22091 l2base={#1}{#2},
22092 \circuitikzbasekey/bipole/label/position=90 }
22093 }
22094 \ctikzset{l2^/.style args={#1 and #2}{
22095 l2base={#1}{#2},
22096 \circuitikzbasekey/bipole/label/position=90 }
22097 }
22098 \ctikzset{l2 below/.style args={#1 and #2}{
22099 l2base={#1}{#2},
22100 \circuitikzbasekey/bipole/label/position=-90 }
22101 }
22102 \ctikzset{l2_/.style args={#1 and #2}{
22103 l2base={#1}{#2},
22104 \circuitikzbasekey/bipole/label/position=-90 }
22105 }
22106
22107 %%%---------- close: tex/pgfcirclabel
22108 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
22109 %%%---------- open: tex/pgfcircvoltage.tex
22110 % Copyright 2018-2026 by Romano Giannetti
22111 % Copyright 2015-2026 by Stefan Lindner
22112 % Copyright 2013-2026 by Stefan Erhardt
22113 % Copyright 2007-2026 by Massimo Redaelli
22114 %
22115 % This file may be distributed and/or modified
22116 %
22117 % 1. under the LaTeX Project Public License and/or
22118 % 2. under the GNU Public License.
22119 %
22120 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22121
22122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22123 %% Voltage management
22124
22125 %% styles
22126 \ctikzset{bipole voltage style/.style={}}
22127 \tikzset{bipole voltage style/.code={
22128 \ctikzset{bipole voltage style/.style={#1}}
22129 }}
22130 \tikzset{bipole voltage append style/.code={
22131 \ctikzset{bipole voltage style/.append style={#1}}
22132 }}
22133
22134 \ctikzset{v^>/.style = {
22135 v = #1,
22136 \circuitikzbasekey/bipole/voltage/direction = forward,
22137 \circuitikzbasekey/bipole/voltage/position = above
22138 }
22139 }
22140
22141 \ctikzset{v^</.style = {
22142 v = #1,
22143 \circuitikzbasekey/bipole/voltage/direction = backward,
22144 \circuitikzbasekey/bipole/voltage/position = above
22145 }
22146 }
22147
22148 \ctikzset{v_>/.style = {
22149 v = #1,
22150 \circuitikzbasekey/bipole/voltage/direction = forward,
22151 \circuitikzbasekey/bipole/voltage/position = below
22152 }
22153 }
22154
22155 \ctikzset{v_</.style = {
22156 v = #1,
22157 \circuitikzbasekey/bipole/voltage/direction = backward,
22158 \circuitikzbasekey/bipole/voltage/position = below
22159 }
22160 }
22161
22162 \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
22163 \ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
22164 \ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
22165 \ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
22166
22167 % Default position varies whether the component is a voltage source
22168 % or not
22169 \ctikzset{v/.code = {
22170 \pgfcirc@has@vtrue
22171 \ifpgf@circuit@bipole@isvoltage
22172 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
22173 \circuitikzbasekey/bipole/voltage/direction=forward}
22174 \else
22175 \ifpgf@circ@oldvoltagedirection
22176 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22177 \circuitikzbasekey/bipole/voltage/direction=backward}
22178 \else
22179 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22180 \circuitikzbasekey/bipole/voltage/direction=forward}
22181 \fi
22182 \fi
22183 \ifpgf@circ@oldvoltagedirection
22184 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
22185 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22186 \circuitikzbasekey/bipole/voltage/direction=forward}
22187 \fi\fi
22188 \else
22189 \ifpgf@circuit@bipole@iscurrent
22190 \ifpgf@circuit@bipole@current@backward
22191 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22192 \circuitikzbasekey/bipole/voltage/direction=forward}
22193 \else
22194 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
22195 \circuitikzbasekey/bipole/voltage/direction=backward}
22196 \fi\fi\fi
22197 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
22198 \ctikzsetvalof{bipole/voltage/label/unit}{}
22199 \ifpgf@circ@siunitx
22200 \pgf@circ@handleSI{#1}
22201 \ifpgf@circ@siunitx@res
22202 \edef\pgf@temp{\pgf@circ@handleSI@val}
22203 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
22204 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22205 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
22206 \else
22207 \fi
22208 \else
22209 \fi
22210 }
22211 }
22212
22213 % american voltage font selection and symbol definition
22214 % the default font command is {} --- nothing
22215 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
22216 %
22217 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
22218 %
22219 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
22220 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
22221
22222 %%
22223 \def\setscaledRlenforclass{%
22224 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
22225 \ifdefined\ctikzclass
22226 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
22227 \pgfkeysifdefined{\pgf@temp}
22228 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22229 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
22230 \else
22231 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
22232 \fi
22233 }
22234
22235 %% Output routine for generic bipoles
22236 % put this to true to see the voltage label coordinate anchors
22237 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
22238
22239 \def\pgf@circ@drawvoltagegeneric{
22240 \pgfextra{
22241 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
22242 \ifnum \ctikzvalof{mirror value}=-1
22243 \ifpgf@circuit@bipole@inverted
22244 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22245 \else
22246 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22247 \fi
22248 \else
22249 \ifpgf@circuit@bipole@inverted
22250 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22251 \else
22252 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
22253 \fi
22254 \fi
22255 \ifpgf@circuit@bipole@voltage@below
22256 \def\pgf@circ@voltage@angle{90}
22257 \else
22258 \def\pgf@circ@voltage@angle{-90}
22259 \fi
22260 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
22261 \pgfkeysifdefined{\pgf@temp}
22262 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
22263 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
22264 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
22265 \pgfkeysifdefined{\pgf@temp}
22266 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
22267 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
22268 \edef\shiftv{\ctikzvalof{voltage/shift}}
22269 % additional per-bipole voltage shift (internal)
22270 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
22271 \pgfkeysifdefined{\pgf@temp}
22272 {
22273 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
22274 }
22275 {
22276 \edef\addvshift{0}
22277 }
22278 \newdimen{\absvshift}
22279 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
22280 % reset anchor if american and open
22281 \ifpgf@circuit@europeanvoltage
22282 \else
22283 \ifx\@@kind\@@open
22284 \def\pgf@circ@bipole@voltage@label@anchor{center}
22285 \fi
22286 \fi
22287 \ifpgf@circuit@bipole@voltage@raised
22288 \def\pgf@circ@bipole@voltage@label@anchor{center}
22289 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
22290 \fi
22291 }
22292 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
22293 %absolute move, minimum space is length of arrowhead
22294 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
22295 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
22296 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
22297 %absolute move, minimum space is length of arrowhead
22298 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
22299 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
22300 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
22301 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
22302
22303 \ifpgf@circuit@bipole@voltage@below
22304 % see comments for the "above" part (similar)
22305 \ifpgf@circuit@europeanvoltage
22306 \ifpgf@circuit@bipole@voltage@straight
22307 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
22308 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
22309 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
22310 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
22311 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
22312 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22313 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22314 \else
22315 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
22316 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
22317 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
22318 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
22319 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
22320 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
22321 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
22322 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
22323 \fi
22324 \else
22325 % we are in case of american here
22326 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
22327 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
22328 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
22329 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
22330 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
22331 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
22332 \ifpgf@circuit@bipole@voltage@raised
22333 % move the from and to up to the level of Vlab
22334 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
22335 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
22336 \fi
22337 \fi
22338 \else
22339 \ifpgf@circuit@europeanvoltage
22340 \ifpgf@circuit@bipole@voltage@straight
22341 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
22342 % move parallel to the component line at pgfcirc@top distance
22343 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
22344 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
22345 % add the extra distance
22346 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
22347 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
22348 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22349 % direction line to shift the label later
22350 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22351 \else
22352 % european voltages here
22353 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
22354 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
22355 % identify the two control points for the "arc" of the voltage
22356 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
22357 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
22358 % and shift them a bit
22359 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
22360 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
22361 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
22362 % direction line to shift the label later
22363 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
22364 \fi
22365 \else
22366 % we are in case of american here
22367 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
22368 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
22369 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
22370 % move parallel to the component line
22371 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
22372 % and add the extra distance
22373 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
22374 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
22375 \ifpgf@circuit@bipole@voltage@raised
22376 % move the from and to up to the level of Vlab
22377 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
22378 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
22379 \fi
22380 \fi
22381 \fi
22382 \ifx\@@kind\@@open
22383 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
22384 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
22385 \fi
22386 \ifpgf@circ@debugv
22387 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
22388 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
22389 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
22390 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
22391 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
22392 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
22393 \ifpgf@circuit@europeanvoltage
22394 \ifpgf@circuit@bipole@voltage@straight
22395 \else
22396 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
22397 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
22398 \fi
22399 \fi
22400 \fi
22401
22402 %
22403 % Now we draw the voltage things (only if not empty --- in which case we have been
22404 % called just to set the anchors)
22405 %
22406 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
22407 \ifpgf@circuit@europeanvoltage
22408 \ifpgf@circuit@bipole@voltage@straight
22409 \ifpgf@circuit@bipole@voltage@backward
22410 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
22411 \else
22412 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
22413 \fi
22414 \else
22415 \ifpgf@circuit@bipole@voltage@backward
22416 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
22417 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
22418 (\pgfcirc@a@prefix-Vfrom)
22419 \else
22420 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
22421 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
22422 (\pgfcirc@a@prefix-Vto)
22423 \fi
22424 \fi
22425 \else % american
22426 \ifpgf@circuit@bipole@voltage@backward
22427 \ifpgf@circ@oldvoltagedirection
22428 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22429 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22430 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22431 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22432 \else
22433 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22434 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22435 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22436 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22437 \fi
22438 \else
22439 \ifpgf@circ@oldvoltagedirection
22440 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22441 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22442 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22443 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22444 \else
22445 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
22446 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
22447 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
22448 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
22449 \fi
22450 \fi
22451 \fi
22452 \fi % Closing the ...ifempty
22453 }
22454
22455 %% Output routine for voltage sources
22456 \def\pgf@circ@drawvoltagegenerator{
22457 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
22458 % it's not perfect, but I can't find the way to do it correctly...
22459 \pgfextra{
22460 \edef\shiftv{\ctikzvalof{voltage/shift}}
22461 % distance along the 60-120 axis
22462 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
22463 \pgfkeysifdefined{\pgf@temp}
22464 {
22465 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
22466 }
22467 {
22468 \edef\bumpa{\ctikzvalof{voltage/bump a}}
22469 }
22470 % additional per-bipole voltage shift (internal)
22471 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
22472 \pgfkeysifdefined{\pgf@temp}
22473 {
22474 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
22475 }
22476 {
22477 \edef\addvshift{0}
22478 }
22479 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
22480 }
22481 \ifpgf@circuit@bipole@voltage@below
22482 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
22483 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
22484 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
22485 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
22486 \else
22487 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
22488 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
22489 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
22490 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
22491 \fi
22492 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
22493 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
22494 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
22495 \ifpgf@circuit@europeanvoltage
22496 \ifpgf@circuit@bipole@voltage@backward
22497 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
22498 \else
22499 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
22500 \fi
22501 \else% american voltage
22502 \ifpgf@circuit@bipole@voltageoutsideofsymbol
22503 % if it is a battery, must put + and -
22504
22505 \ifpgf@circ@fixbatteries
22506 \ifpgf@circuit@bipole@voltage@backward
22507 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22508 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22509 \else
22510 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22511 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22512 \fi
22513 \else
22514 \ifpgf@circuit@bipole@voltage@backward
22515 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22516 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22517 \else
22518 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
22519 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
22520 \fi
22521 \fi
22522 \fi
22523 \fi
22524 \fi % closes ...ifempty
22525 }
22526
22527 %% Output routine
22528 %% this is the entry point
22529 %%
22530 %% locally used dimensions
22531 \newdimen{\pgfcirc@labelshift}
22532 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
22533 \def\pgf@circ@drawvoltage{% node name
22534 \pgfextra{%
22535 % set the helper if...curved
22536 \ifpgf@circuit@europeanvoltage
22537 \ifpgf@circuit@bipole@voltage@straight
22538 \pgfcirc@v@curvedfalse
22539 \else
22540 \pgfcirc@v@curvedtrue
22541 \fi
22542 \else
22543 \pgfcirc@v@curvedfalse
22544 \fi
22545 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
22546 % Label anchors WARNING: indentation is probably wrong
22547 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
22548 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
22549 \ifpgf@circuit@bipole@voltage@below
22550 \def\pgf@circ@bipole@voltage@label@anchor{north west}
22551 \else
22552 \def\pgf@circ@bipole@voltage@label@anchor{south east}
22553 \fi
22554 \fi\fi
22555 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
22556 \ifpgf@circuit@bipole@voltage@below
22557 \def\pgf@circ@bipole@voltage@label@anchor{west}
22558 \else
22559 \def\pgf@circ@bipole@voltage@label@anchor{east}
22560 \fi
22561 \fi\fi
22562 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
22563 \ifpgf@circuit@bipole@voltage@below
22564 \def\pgf@circ@bipole@voltage@label@anchor{south west}
22565 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
22566 \fi
22567 \fi\fi
22568 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
22569 \ifpgf@circuit@bipole@voltage@below
22570 \def\pgf@circ@bipole@voltage@label@anchor{south}
22571 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
22572 \fi
22573 \fi\fi
22574 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
22575 \ifpgf@circuit@bipole@voltage@below
22576 \def\pgf@circ@bipole@voltage@label@anchor{south east}
22577 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
22578 \fi
22579 \fi\fi
22580 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
22581 \ifpgf@circuit@bipole@voltage@below
22582 \def\pgf@circ@bipole@voltage@label@anchor{east}
22583 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
22584 \fi
22585 \fi\fi
22586 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
22587 \ifpgf@circuit@bipole@voltage@below
22588 \def\pgf@circ@bipole@voltage@label@anchor{north east}
22589 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
22590 \fi
22591 \fi\fi
22592 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
22593 \ifpgf@circuit@bipole@voltage@below
22594 \def\pgf@circ@bipole@voltage@label@anchor{north}
22595 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
22596 \fi
22597 \fi\fi
22598 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
22599 \ifpgf@circuit@bipole@voltage@below
22600 \def\pgf@circ@bipole@voltage@label@anchor{north}
22601 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
22602 \fi
22603 \fi\fi
22604
22605 % export anchor position (if not needed, is always the same macro)
22606 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
22607 % this must be set *before* changing for mirroring and inverting; in that case
22608 % the xscale/yscale parameters take it into account
22609 \ifpgf@circuit@bipole@voltage@below
22610 \def\pgf@circ@bipole@voltage@label@where{-90}
22611 \else
22612 \def\pgf@circ@bipole@voltage@label@where{90}
22613 \fi
22614
22615 % magic to counteract the scale and yscale effects (there should be a better way...)
22616 \ifnum \ctikzvalof{mirror value}=-1
22617 \ifpgf@circuit@bipole@voltage@below
22618 \pgf@circuit@bipole@voltage@belowfalse
22619 \else
22620 \pgf@circuit@bipole@voltage@belowtrue
22621 \fi
22622 \fi
22623
22624 \ifpgf@circuit@bipole@inverted
22625 \ifpgf@circuit@bipole@voltage@below
22626 \pgf@circuit@bipole@voltage@belowfalse
22627 \else
22628 \pgf@circuit@bipole@voltage@belowtrue
22629 \fi
22630 \fi
22631
22632 % take into account scaling
22633 \setscaledRlenforclass
22634
22635 \ifpgf@circuit@europeanvoltage
22636 \ifpgf@circuit@bipole@voltage@straight
22637 % check for straight
22638 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
22639 \pgfkeysifdefined{\pgf@temp}{%
22640 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
22641 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
22642 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
22643 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
22644 \else
22645 % check for european
22646 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
22647 \pgfkeysifdefined{\pgf@temp}{%
22648 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
22649 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
22650 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
22651 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
22652 \fi
22653 \else
22654 % check for american
22655 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
22656 \pgfkeysifdefined{\pgf@temp}{%
22657 \ifpgf@circuit@bipole@voltage@raised
22658 % do not apply the shift if we are using raised american style
22659 \edef\labeldist{1.4}% default value
22660 \else
22661 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
22662 \fi
22663 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
22664 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
22665 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
22666 \fi
22667 % find the height of the bipole or use a default value
22668 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
22669 \pgfkeysifdefined{\pgf@temp}
22670 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
22671 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
22672 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
22673
22674 \ifpgf@circuit@bipole@isvoltage
22675 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
22676 \else
22677 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
22678 \fi
22679 % the value for the european was by default 1.4
22680 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
22681 % set the macro for detecting open
22682 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
22683 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
22684 % \typeout{KIND\space\@@kind}
22685 }%end pgfextra
22686
22687 \ifpgf@circuit@bipole@isvoltage
22688 \pgf@circ@drawvoltagegenerator
22689 % add fake cont1 and cont2 anchors for export
22690 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22691 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22692 \else
22693 \pgf@circ@drawvoltagegeneric
22694 \fi
22695 % % debugging
22696 % \pgfextra{%
22697 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
22698 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
22699 % \pgf@circ@debugvtrue}
22700
22701 % move a bit if requested
22702 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
22703
22704 % check for the case of american AND open
22705 \ifpgf@circuit@europeanvoltage
22706 \else
22707 \ifx\@@kind\@@open
22708 % override pgfcirc@Vlab
22709 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)\fi
22710 \fi
22711
22712 \ifpgf@circ@debugv
22713 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
22714 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
22715 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
22716 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
22717 \fi
22718
22719 % put the node only if it's not empty
22720 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
22721 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
22722 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
22723 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
22724 \fi
22725
22726 \ifpgfcirc@v@curved\else
22727 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
22728 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22729 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
22730 \fi
22731 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
22732 \ifpgf@circuit@bipole@voltage@backward
22733 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
22734 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
22735 \fi
22736
22737 }%end drawvoltages
22738 %%%---------- close: tex/pgfcircvoltage
22739 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
22740 %%%---------- open: tex/pgfcirccurrent.tex
22741 % Copyright 2018-2026 by Romano Giannetti
22742 % Copyright 2015-2026 by Stefan Lindner
22743 % Copyright 2013-2026 by Stefan Erhardt
22744 % Copyright 2007-2026 by Massimo Redaelli
22745 %
22746 % This file may be distributed and/or modified
22747 %
22748 % 1. under the LaTeX Project Public License and/or
22749 % 2. under the GNU Public License.
22750 %
22751 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22752
22753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22754 %% Current handling
22755
22756 %% styles
22757 \ctikzset{bipole current style/.style={}}
22758 \tikzset{bipole current style/.code={
22759 \ctikzset{bipole current style/.style={#1}}
22760 }}
22761 \tikzset{bipole current append style/.code={
22762 \ctikzset{bipole current style/.append style={#1}}
22763 }}
22764
22765 %% Options
22766 \ctikzset{i^>/.style = {
22767 i = #1,
22768 \circuitikzbasekey/bipole/current/direction = forward,
22769 \circuitikzbasekey/bipole/current/x position = after,
22770 \circuitikzbasekey/bipole/current/y position = above
22771 }
22772 }
22773
22774 \ctikzset{i_>/.style = {
22775 i = #1,
22776 \circuitikzbasekey/bipole/current/direction = forward,
22777 \circuitikzbasekey/bipole/current/x position = after,
22778 \circuitikzbasekey/bipole/current/y position = below
22779 }
22780 }
22781
22782 \ctikzset{i>^/.style = {
22783 i = #1,
22784 \circuitikzbasekey/bipole/current/direction = forward,
22785 \circuitikzbasekey/bipole/current/x position = before,
22786 \circuitikzbasekey/bipole/current/y position = above
22787 }
22788 }
22789
22790 \ctikzset{i>_/.style = {
22791 i = #1,
22792 \circuitikzbasekey/bipole/current/direction = forward,
22793 \circuitikzbasekey/bipole/current/x position = before,
22794 \circuitikzbasekey/bipole/current/y position = below
22795 }
22796 }
22797
22798 \ctikzset{i^</.style = {
22799 i = #1,
22800 \circuitikzbasekey/bipole/current/direction = backward,
22801 \circuitikzbasekey/bipole/current/x position = after,
22802 \circuitikzbasekey/bipole/current/y position = above
22803 }
22804 }
22805
22806 \ctikzset{i_</.style = {
22807 i = #1,
22808 \circuitikzbasekey/bipole/current/direction = backward,
22809 \circuitikzbasekey/bipole/current/x position = after,
22810 \circuitikzbasekey/bipole/current/y position = below
22811 }
22812 }
22813
22814 \ctikzset{i<^/.style = {
22815 i = #1,
22816 \circuitikzbasekey/bipole/current/direction = backward,
22817 \circuitikzbasekey/bipole/current/x position = before,
22818 \circuitikzbasekey/bipole/current/y position = above
22819 }
22820 }
22821
22822 \ctikzset{i<_/.style = {
22823 i = #1,
22824 \circuitikzbasekey/bipole/current/direction = backward,
22825 \circuitikzbasekey/bipole/current/x position = before,
22826 \circuitikzbasekey/bipole/current/y position = below
22827 }
22828 }
22829
22830 \ctikzset{i/.code = {
22831 \pgfcirc@has@itrue
22832 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
22833 \circuitikzbasekey/bipole/current/x position = after,
22834 \circuitikzbasekey/bipole/current/y position = above }
22835 \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
22836 \ctikzsetvalof{bipole/current/label/unit}{}
22837 \ifpgf@circ@siunitx
22838 \pgf@circ@handleSI{#1}
22839 \ifpgf@circ@siunitx@res
22840 \edef\pgf@temp{\pgf@circ@handleSI@val}
22841 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
22842 \edef\pgf@temp{\pgf@circ@handleSI@unit}
22843 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
22844 \else
22845 \fi
22846 \else
22847 \fi
22848 %reverse current direction for voltage sources
22849 \ifpgf@circ@oldvoltagedirection\else
22850 \ifpgf@circuit@bipole@isvoltage
22851 \ifpgf@circuit@bipole@voltage@backward
22852 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
22853 \circuitikzbasekey/bipole/current/x position = after,
22854 \circuitikzbasekey/bipole/current/y position = below }
22855 \else
22856 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
22857 \circuitikzbasekey/bipole/current/x position = before,
22858 \circuitikzbasekey/bipole/current/y position = above }
22859 \fi\fi\fi
22860 }
22861 }
22862
22863 \ifpgf@circ@oldvoltagedirection
22864 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
22865 \else
22866 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
22867 \fi
22868 \ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
22869 \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
22870 \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
22871
22872 %% Output routine
22873 \def\pgf@circ@drawcurrent{
22874 \pgfextra{
22875 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
22876 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
22877
22878 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
22879 \ifpgf@circuit@bipole@current@below
22880 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
22881 \fi
22882 \fi\fi
22883 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
22884 \ifpgf@circuit@bipole@current@below
22885 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
22886 \fi
22887 \fi\fi
22888 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
22889 \ifpgf@circuit@bipole@current@below
22890 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
22891 \fi
22892 \fi\fi
22893 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
22894 \ifpgf@circuit@bipole@current@below
22895 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
22896 \fi
22897 \fi\fi
22898 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
22899 \ifpgf@circuit@bipole@current@below
22900 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
22901 \fi
22902 \fi\fi
22903 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
22904 \ifpgf@circuit@bipole@current@below
22905 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
22906 \fi
22907 \fi\fi
22908 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
22909 \ifpgf@circuit@bipole@current@below
22910 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
22911 \fi
22912 \fi\fi
22913 \ifnum\pgfcircmathresult <5
22914 \ifpgf@circuit@bipole@current@below
22915 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
22916 \fi
22917 \fi
22918 \ifnum\pgfcircmathresult >355
22919 \ifpgf@circuit@bipole@current@below
22920 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
22921 \fi
22922 \fi
22923 % export anchor position (if not needed, is always the same macro)
22924 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
22925
22926 \ifpgf@circuit@bipole@current@below
22927 \def\pgf@circ@bipole@current@label@where{-90}
22928 \else
22929 \def\pgf@circ@bipole@current@label@where{+90}
22930 \fi
22931 }
22932
22933 %
22934 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
22935 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
22936 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
22937 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
22938 \else% normal bipole or source
22939 \ifpgf@circuit@bipole@current@before
22940 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
22941 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
22942 \else
22943 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
22944 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
22945 \fi
22946 \fi
22947 \ifpgf@circuit@bipole@current@backward
22948 \pgfextra{
22949 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
22950 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
22951 }
22952 \fi
22953 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
22954 % if the current label is not empty (in which case we have already all the anchors)
22955 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
22956 % put the arrow node
22957 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
22958 % put the label
22959 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
22960 (\ctikzvalof{bipole/name}current)
22961 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
22962 \fi % end ifempty
22963 \ifpgf@circuit@bipole@current@backward
22964 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
22965 \fi
22966 }
22967
22968 %%%---------- close: tex/pgfcirccurrent
22969 %%%%%%%%%%% Springe nach tex/pgfcircflow
22970 %%%---------- open: tex/pgfcircflow.tex
22971 % Copyright 2018-2026 by Romano Giannetti
22972 % Copyright 2015-2026 by Stefan Lindner
22973 % Copyright 2013-2026 by Stefan Erhardt
22974 % Copyright 2007-2026 by Massimo Redaelli
22975 %
22976 % This file may be distributed and/or modified
22977 %
22978 % 1. under the LaTeX Project Public License and/or
22979 % 2. under the GNU Public License.
22980 %
22981 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22982
22983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22984 %% flow handling
22985
22986
22987 %% styles
22988 \ctikzset{bipole flow style/.style={}}
22989 \tikzset{bipole flow style/.code={
22990 \ctikzset{bipole flow style/.style={#1}}
22991 }}
22992 \tikzset{bipole flow append style/.code={
22993 \ctikzset{bipole flow style/.append style={#1}}
22994 }}
22995
22996 %% Options
22997 \ctikzset{f^>/.style = {
22998 f = #1,
22999 \circuitikzbasekey/bipole/flow/direction = forward,
23000 \circuitikzbasekey/bipole/flow/x position = after,
23001 \circuitikzbasekey/bipole/flow/y position = above
23002 }
23003 }
23004
23005 \ctikzset{f_>/.style = {
23006 f = #1,
23007 \circuitikzbasekey/bipole/flow/direction = forward,
23008 \circuitikzbasekey/bipole/flow/x position = after,
23009 \circuitikzbasekey/bipole/flow/y position = below
23010 }
23011 }
23012
23013 \ctikzset{f>^/.style = {
23014 f = #1,
23015 \circuitikzbasekey/bipole/flow/direction = forward,
23016 \circuitikzbasekey/bipole/flow/x position = before,
23017 \circuitikzbasekey/bipole/flow/y position = above
23018 }
23019 }
23020
23021 \ctikzset{f>_/.style = {
23022 f = #1,
23023 \circuitikzbasekey/bipole/flow/direction = forward,
23024 \circuitikzbasekey/bipole/flow/x position = before,
23025 \circuitikzbasekey/bipole/flow/y position = below
23026 }
23027 }
23028
23029 \ctikzset{f^</.style = {
23030 f = #1,
23031 \circuitikzbasekey/bipole/flow/direction = backward,
23032 \circuitikzbasekey/bipole/flow/x position = after,
23033 \circuitikzbasekey/bipole/flow/y position = above
23034 }
23035 }
23036
23037 \ctikzset{f_</.style = {
23038 f = #1,
23039 \circuitikzbasekey/bipole/flow/direction = backward,
23040 \circuitikzbasekey/bipole/flow/x position = after,
23041 \circuitikzbasekey/bipole/flow/y position = below
23042 }
23043 }
23044
23045 \ctikzset{f<^/.style = {
23046 f = #1,
23047 \circuitikzbasekey/bipole/flow/direction = backward,
23048 \circuitikzbasekey/bipole/flow/x position = before,
23049 \circuitikzbasekey/bipole/flow/y position = above
23050 }
23051 }
23052
23053 \ctikzset{f<_/.style = {
23054 f = #1,
23055 \circuitikzbasekey/bipole/flow/direction = backward,
23056 \circuitikzbasekey/bipole/flow/x position = before,
23057 \circuitikzbasekey/bipole/flow/y position = below
23058 }
23059 }
23060
23061 \ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
23062 \ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
23063 \ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
23064 \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
23065
23066 \ctikzset{f/.code = {
23067 \pgfcirc@has@ftrue
23068 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
23069 \circuitikzbasekey/bipole/flow/x position = after,
23070 \circuitikzbasekey/bipole/flow/y position = above }
23071 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
23072 \ctikzsetvalof{bipole/flow/label/unit}{}
23073 \ifpgf@circ@siunitx
23074 \pgf@circ@handleSI{#1}
23075 \ifpgf@circ@siunitx@res
23076 \edef\pgf@temp{\pgf@circ@handleSI@val}
23077 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
23078 \edef\pgf@temp{\pgf@circ@handleSI@unit}
23079 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
23080 \else
23081 \fi
23082 \else
23083 \fi
23084 }
23085 }
23086
23087 %% Output routine
23088
23089 \def\pgf@circ@drawflow{
23090 \pgfextra{
23091 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
23092 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
23093
23094 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
23095 \ifpgf@circuit@bipole@flow@below
23096 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
23097 \fi
23098 \fi\fi
23099 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
23100 \ifpgf@circuit@bipole@flow@below
23101 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
23102 \fi
23103 \fi\fi
23104 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
23105 \ifpgf@circuit@bipole@flow@below
23106 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
23107 \fi
23108 \fi\fi
23109 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
23110 \ifpgf@circuit@bipole@flow@below
23111 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
23112 \fi
23113 \fi\fi
23114 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
23115 \ifpgf@circuit@bipole@flow@below
23116 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
23117 \fi
23118 \fi\fi
23119 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
23120 \ifpgf@circuit@bipole@flow@below
23121 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
23122 \fi
23123 \fi\fi
23124 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
23125 \ifpgf@circuit@bipole@flow@below
23126 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
23127 \fi
23128 \fi\fi
23129 \ifnum\pgfcircmathresult <5
23130 \ifpgf@circuit@bipole@flow@below
23131 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23132 \fi
23133 \fi
23134 \ifnum\pgfcircmathresult >355
23135 \ifpgf@circuit@bipole@flow@below
23136 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
23137 \fi
23138 \fi
23139
23140 \ifpgf@circuit@bipole@flow@below
23141 \def\pgf@circ@bipole@flow@label@where{-90}
23142 \else
23143 \def\pgf@circ@bipole@flow@label@where{+90}
23144 \fi
23145 % export anchor position (if not needed, is always the same macro)
23146 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
23147 }
23148
23149 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
23150 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
23151 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
23152 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
23153 \else% normal bipole or source
23154 \ifpgf@circuit@bipole@flow@before
23155 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
23156 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
23157 \else
23158 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
23159 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
23160 \fi
23161 \fi
23162 \pgfextra{
23163 \newdimen{\absfshift}
23164 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
23165 \absfshift=\flow@offset
23166 \ifpgf@circuit@bipole@flow@backward
23167 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
23168 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
23169 \fi
23170 }
23171 \ifpgf@circuit@bipole@flow@below
23172 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
23173 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
23174 \else
23175 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
23176 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
23177 \fi
23178 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
23179 \pgfextra{
23180 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
23181 }
23182 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
23183 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
23184 %
23185 % coordinate (\pgfcirc@a@prefix-Fpos) at
23186 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
23187 % if the flow label is not empty (in which case we have already all the anchors)
23188 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
23189 % the flow arrow is really a node "flowarrow", not a real arrow
23190 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
23191
23192 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
23193 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
23194 \fi
23195
23196 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
23197 \ifpgf@circuit@bipole@flow@backward
23198 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
23199 \fi
23200
23201 }
23202
23203 %%%---------- close: tex/pgfcircflow
23204
23205 % defaults
23206
23207 \setupmodule
23208 [current=european,
23209 voltage=european,
23210 resistor=american,
23211 inductor=cute,
23212 logic=american,
23213 siunitx=true,
23214 arrowmos=false]
23215
23216 \processaction
23217 [\currentmoduleparameter{voltage}]
23218 [european=>\ctikzset{voltage=european},
23219 american=>\ctikzset{voltage=american}]
23220
23221 \processaction
23222 [\currentmoduleparameter{current}]
23223 [european=>\ctikzset{ current=european},
23224 american=>\ctikzset{ current=american}]
23225
23226 \processaction
23227 [\currentmoduleparameter{label}]
23228 [straight=>\ctikzset{label/align = straight},
23229 align=>\ctikzset{label/align = rotate},
23230 smart=>\ctikzset{label/align = smart}]
23231
23232 \processaction
23233 [\currentmoduleparameter{resistor}]
23234 [european=>\ctikzset{ resistor=european},
23235 american=>\ctikzset{ resistor=american}]
23236
23237 \processaction
23238 [\currentmoduleparameter{inductor}]
23239 [european=>\ctikzset{ inductor=european},
23240 american=>\ctikzset{ inductor=american},
23241 cute=>\ctikzset{ inductor=cute}]
23242
23243 \processaction
23244 [\currentmoduleparameter{diode}]
23245 [full=>\ctikzset{ diode=full},
23246 empty=>\ctikzset{ diode=empty}]
23247
23248 \processaction
23249 [\currentmoduleparameter{logic}]
23250 [european=>\ctikzset{ logic ports=european},
23251 american=>\ctikzset{ logic ports=american}]
23252
23253 \processaction
23254 [\currentmoduleparameter{siunitx}]
23255 [true=>\def\SI#1#2{#1\,#2}
23256 \def\ampere{\rm{A}}
23257 \def\volt{\rm{V}}
23258 \def\ohm{\Omega}
23259 \def\siemens{\rm{S}}
23260 \def\farad{\rm{F}}
23261 \def\henry{\rm{H}}
23262 \def\second{\rm{s}}
23263 \def\coulomb{\rm{C}}
23264 \def\siemens{\rm{S}}
23265 \def\radians{\rm{rad}}
23266 \def\milli{\rm{m}}
23267 \def\micro{\mu}
23268 \def\nano{\rm{n}}
23269 \def\pico{\rm{p}}
23270 \def\kilo{\rm{k}}
23271 \def\mega{\rm{M}}
23272 \def\giga{\rm{G}}
23273 \def\tera{\rm{T}},
23274 false=>]
23275 % \s!default=>\pgf@circ@siunitxtrue,
23276
23277 \processaction
23278 [\currentmoduleparameter{arrowmos}]
23279 [true=>\pgf@circuit@mos@arrowstrue,
23280 false=>\pgf@circuit@mos@arrowsfalse]
23281 % \s!default=>\pgf@circuit@mos@arrowstrue,
23282
23283
23284 \ifpgf@circ@siunitx
23285 % nothing! siunitx and xstrings don't work in context
23286 \fi
23287
23288
23289 % Context specific
23290
23291 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
23292
23293 %%%%%%%%%%% Springe nach tex/pgfcircpath
23294 %%%---------- open: tex/pgfcircpath.tex
23295 % Copyright 2018-2026 by Romano Giannetti
23296 % Copyright 2015-2026 by Stefan Lindner
23297 % Copyright 2013-2026 by Stefan Erhardt
23298 % Copyright 2007-2026 by Massimo Redaelli
23299 %
23300 % This file may be distributed and/or modified
23301 %
23302 % 1. under the LaTeX Project Public License and/or
23303 % 2. under the GNU Public License.
23304 %
23305 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
23306
23307
23308 \def\pgf@circ@direction{0.0}
23309
23310 % swap two coordinates
23311 \def\pgfcirc@swap@coordinates#1#2{%
23312 coordinate (pgfcirc@tmp@swap) at (#1)
23313 coordinate (#1) at (#2)
23314 coordinate (#2) at (pgfcirc@tmp@swap)
23315 }
23316
23317 % Names
23318 \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
23319 \ctikzset{n/.code = {
23320 \pgfkeys{/tikz/circuitikz/bipole/name=#1}
23321 }}
23322
23323 % Reflect the node along
23324 \ctikzset{mirrored/.is choice}
23325 \ctikzset{mirror value/.initial=1}
23326 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
23327 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
23328 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
23329
23330 % Invert node along path
23331 \ctikzset{inverted/.is choice}
23332 \ctikzset{invert value/.initial=1}
23333 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
23334 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
23335 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
23336 \newif\ifpgf@circuit@bipole@inverted
23337 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
23338
23339 \newif\ifpgf@circuit@bipole@voltage@backward
23340 \ctikzset{bipole/voltage/direction/.is choice}
23341 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
23342 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
23343
23344 % Initialize paths
23345 \def\pgfcircresetpath{
23346 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
23347 bipole/inverted=false, bipole/kind=,
23348 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
23349 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
23350 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
23351 bipole/current/y position=above, bipole/current/direction=forward,
23352 mirrored=false
23353 }
23354 }
23355
23356 %
23357 % expandable IF for the extra nodes (thanks to Henri Menke)
23358 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
23359 %
23360 \def\pgfcirc@if@has@i{%
23361 \ifpgfcirc@has@i
23362 \expandafter\pgfutil@firstoftwo
23363 \else
23364 \expandafter\pgfutil@secondoftwo
23365 \fi}
23366 \def\pgfcirc@if@has@v{%
23367 \ifpgfcirc@has@v
23368 \expandafter\pgfutil@firstoftwo
23369 \else
23370 \expandafter\pgfutil@secondoftwo
23371 \fi}
23372 \def\pgfcirc@if@has@f{%
23373 \ifpgfcirc@has@f
23374 \expandafter\pgfutil@firstoftwo
23375 \else
23376 \expandafter\pgfutil@secondoftwo
23377 \fi}
23378
23379
23380
23381 %% Generic bipole path
23382 \def\pgf@circ@bipole@path#1#2{
23383 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
23384 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
23385 % appended to the main (path-style) name
23386 % #1 path-style node name
23387 % #2 the argument passed from the to-path structure; don't touch
23388 %
23389 % Example:
23390 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
23391 %
23392 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
23393 }
23394 %
23395 % this is used for components that are mainly node-style but have a path-style form
23396 %
23397 \def\pgfcirc@node@to@path#1#2#3{%
23398 % add a path-style component based on a node-style one without mangling the name
23399 % of the shape.
23400 % #1: node-type shape name (existing)
23401 % #2: path-type name (to be created)
23402 % #3: additional options to add to the path style
23403 %
23404 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
23405 \compattikzset{#2/.style = {\circuitikzbasekey,
23406 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
23407 #3}}%
23408 \ctikzset{bipoles/#1/height/.initial=1}%
23409 }
23410 %%
23411 %% ultra-generic bipole path
23412 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
23413 %%
23414 \def\pgf@circ@bipole@path@base#1#2#3#4{%
23415 %
23416 % Create a path-style component based on a node-style shape
23417 % #1: postfix to be added to the name path to obtain the main shape name
23418 % #2: text to be passed as text to the node
23419 % #3: name of the bipole component
23420 % #4: this will be filled by the argument of the to-path
23421 %
23422 \pgfextra{
23423 \ctikzset{bipole/kind = #3}
23424 \edef\pgf@temp{\ctikzvalof{bipole/name}}
23425 \def\pgf@circ@temp{}
23426 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
23427 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
23428 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
23429 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
23430 \else
23431 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
23432 \fi
23433 }
23434 % save start and stop values
23435 % notice that we DO NOT MOVE the path position at all!
23436 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
23437 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
23438 \pgfextra{
23439 % find the direction (angle) of the path
23440 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
23441 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
23442 \edef\pgf@circ@direction{\pgfmathresult}
23443 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
23444 }
23445 % position the component in the middle of the path. We DO NOT MOVE the current position!
23446 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
23447 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
23448 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
23449 % set start and end labels
23450 \ifpgf@circuit@bipole@inverted
23451 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
23452 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
23453 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
23454 \else
23455 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
23456 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
23457 \fi
23458 \else
23459 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
23460 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
23461 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
23462 \else
23463 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
23464 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
23465 \fi
23466 \fi
23467 % draw the leads unless it's an open circuit
23468 % stop at the component
23469 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
23470 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
23471 \else
23472 % it is important to start the path with -- to have correct line joins!
23473 -- (\tikztostart) -- (pgfcirc@anchorstartnode)
23474 \fi
23475 % Add all the "ornaments": labels, annotations, voltages, currents and flows
23476 \drawpoles
23477 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
23478 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
23479 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
23480 % it should be logically safe for older version too --- even if TikZ reverted the change
23481 % use explandable ifs too, thanks to Henri Menke
23482 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
23483 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
23484 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
23485 % finish the path from the component to the final target
23486 % you never know --- re-set \pgf@temp to detect open
23487 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
23488 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
23489 (\tikztotarget)
23490 \else
23491 (pgfcirc@anchorendnode) -- (\tikztotarget)
23492 \fi
23493 % reset internal circuit keys
23494 \pgfextra{\pgfcircresetpath}
23495 %draw pending nodes an path
23496 \tikztonodes
23497 }
23498
23499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23500 %% Handling of terminals
23501
23502 \ctikzset{bipole/nodes/.is family}
23503 \ctikzset{bipole/nodes/left/.initial=none}
23504 \ctikzset{bipole/nodes/right/.initial=none}
23505 \tikzset{bipole nodes/.style n args={2}{%
23506 \circuitikzbasekey/bipole/nodes/left=#1,
23507 \circuitikzbasekey/bipole/nodes/right=#2
23508 }
23509 }
23510
23511 %% Easily usable styles
23512
23513 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23514 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23515 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
23516 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23517 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
23518 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23519 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23520 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
23521 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
23522 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
23523 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23524 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
23525 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
23526 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23527 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23528
23529 % rectjoinfill workarounds
23530
23531 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
23532 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
23533 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
23534 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
23535 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23536 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23537 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23538 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23539 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
23540
23541 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
23542
23543 \def\drawpoles{
23544 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
23545 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
23546 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
23547 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
23548 }
23549
23550 %% Path definitions
23551 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
23552 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
23553 \def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
23554 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
23555 \def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}}
23556 \def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}}
23557 \def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}}
23558 \def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}}
23559 \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
23560 \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}}
23561 \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}}
23562 %% polar capacitor is deprectaed, use curved capacitor instead
23563 \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}}
23564 \def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}}
23565 \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
23566 \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
23567 \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
23568 \def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
23569 \def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
23570 \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
23571 \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
23572 \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
23573 \def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}}
23574 \def\pgf@circ@inductor@path#1{%
23575 \pgfextra{
23576 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23577 \def\pgf@temp{european}%
23578 }
23579 \ifx\pgf@temp\pgf@circ@temp%
23580 \pgf@circ@europeaninductor@path{#1}%
23581 \else%
23582 \pgfextra{ \def\pgf@temp{cute} }%
23583 \ifx\pgf@temp\pgf@circ@temp%
23584 \pgf@circ@cuteinductor@path{#1}%
23585 \else%
23586 \pgf@circ@americaninductor@path{#1}%
23587 \fi%
23588 \fi%
23589 }
23590 \def\pgf@circ@vinductor@path#1{
23591 \pgfextra{
23592 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23593 \def\pgf@temp{european}%
23594 }
23595 \ifx\pgf@temp\pgf@circ@temp%
23596 \pgf@circ@veuropeaninductor@path{#1}%
23597 \else%
23598 \pgfextra{ \def\pgf@temp{cute} }%
23599 \ifx\pgf@temp\pgf@circ@temp%
23600 \pgf@circ@vcuteinductor@path{#1}%
23601 \else%
23602 \pgf@circ@vamericaninductor@path{#1}%
23603 \fi%
23604 \fi%
23605 }
23606 \def\pgf@circ@inductivesens@path#1{%
23607 \pgfextra{
23608 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
23609 \def\pgf@temp{european}%
23610 }
23611 \ifx\pgf@temp\pgf@circ@temp%
23612 \pgf@circ@europeaninductivesens@path{#1}%
23613 \else%
23614 \pgfextra{ \def\pgf@temp{cute} }%
23615 \ifx\pgf@temp\pgf@circ@temp%
23616 \pgf@circ@cuteinductivesens@path{#1}%
23617 \else%
23618 \pgf@circ@americaninductivesens@path{#1}%
23619 \fi%
23620 \fi%
23621 }
23622 \def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
23623 \def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}}
23624 \def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}}
23625 \def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}}
23626 \def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}}
23627 \def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}}
23628 \def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}}
23629 \def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}}
23630 \def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}}
23631 \def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}}
23632 \def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}}
23633 \def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}}
23634 \def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}}
23635 \def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}}
23636 \def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}}
23637 \def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}}
23638 \def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}}
23639 \def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}}
23640 \def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}}
23641 \def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}}
23642 \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}}
23643 \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}}
23644 \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}}
23645 \def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}}
23646 \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}}
23647 \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}}
23648 \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}}
23649 \def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}}
23650 \def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}}
23651 \def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}}
23652 \def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}}
23653 \def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}}
23654 \def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}}
23655 \def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}}
23656 \def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}}
23657 \def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}}
23658 \def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}}
23659 \def\pgf@circ@pushbuttonc@path#1{\pgf@circ@bipole@path{pushbuttonc}{#1}}
23660 \def\pgf@circ@ncpushbuttono@path#1{\pgf@circ@bipole@path{ncpushbuttono}{#1}}
23661 \def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}}
23662 \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}}
23663 \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}}
23664 \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}}
23665 \def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}}
23666 \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
23667 \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
23668 \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}}
23669 \def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}}
23670 \def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}}
23671 \def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}}
23672 \def\pgf@circ@empty@path#1{}
23673 \def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}}
23674 \def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}}
23675 \def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}}
23676 \def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}}
23677 \def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}}
23678 \def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}}
23679 \def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}}
23680 \def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}}
23681 \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}}
23682 \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}}
23683 \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}}
23684 \def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}}
23685 \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}}
23686 \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}}
23687 \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}}
23688
23689 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
23690 \def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}}
23691 \def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}}
23692
23693 \def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
23694 \def\pgf@circ@twoportsplit@path#1{\pgf@circ@bipole@path{twoportsplit}{#1}}
23695 \def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
23696 \def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
23697 \def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
23698 \def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
23699 \def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
23700 \def\pgf@circ@allpass@path#1{\pgf@circ@bipole@path{allpass}{#1}}
23701 \def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
23702 \def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}}
23703 \def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}}
23704 \def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}}
23705 \def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}}
23706 \def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}}
23707 \def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}}
23708 \def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}}
23709 \def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}}
23710 \def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}}
23711 \def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}}
23712 \def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}}
23713 \def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}}
23714 %
23715 \def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}}
23716 \def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}}
23717 \def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}}
23718 \def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}}
23719
23720 %%Mechanical
23721 \def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
23722 \def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}}
23723 \def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
23724 \def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
23725 \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
23726
23727 %% Styles
23728
23729 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
23730 \def\compattikzset#1{%
23731 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
23732 \tikzset{\comnpatname#1}}
23733
23734 %\def\ctikzsetbipole#1#2{%
23735 % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
23736 %}
23737
23738 \compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
23739 \compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}}
23740 \compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
23741 \compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
23742 \compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
23743 \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}
23744 \compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}}
23745 \compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}}
23746 \compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}}
23747 \compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}}
23748 \compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}}
23749 \compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}}
23750 \compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}}
23751 \compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
23752 \compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}}
23753 \compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}}
23754 \compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}}
23755 \compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}}
23756 \compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}}
23757 \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}}
23758 \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
23759 \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
23760 % polar capacitor is deprecated, use curved capacitor instead
23761 \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}}
23762 \compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}}
23763 \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
23764 \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
23765 \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23766 \compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23767 \compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
23768 \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
23769 \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
23770 \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
23771 \compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}}
23772 \compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
23773 \compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}}
23774 \compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}}
23775 \compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}}
23776 \compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}}
23777 \compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}}
23778 \compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}}
23779 \compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}}
23780 \compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}}
23781 \compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}}
23782 \compattikzset{transmission line/.style = {tline = #1}}
23783 \compattikzset{TL/.style = {tline = #1}}
23784 \compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}}
23785 \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}}
23786 \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23787 \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23788 \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23789 \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}}
23790 \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}}
23791 \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23792 \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23793 \compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23794 \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 }}
23795 \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 }}
23796 \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 }}
23797 \compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23798 \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}}
23799 \compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
23800
23801 \compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23802 \compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
23803 \compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
23804 \compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
23805
23806
23807 \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}}
23808 \compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}}
23809 \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}}
23810 \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}}
23811 \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}}
23812 \compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}}
23813 \compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}}
23814 \compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}}
23815
23816 \compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}}
23817 \compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}}
23818
23819 \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}}
23820 \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}}
23821 \compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}}
23822 \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}}
23823 \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}}
23824 \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}}
23825
23826 \compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
23827 \compattikzset{twoportsplit/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoportsplit@path}}
23828 \compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
23829 \compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
23830 \compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
23831 \compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
23832 \compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
23833 \compattikzset{allpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@allpass@path}}
23834 \compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}
23835 \compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}}
23836 \compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}}
23837 \compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}}
23838 \compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}}
23839 \compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}}
23840 \compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}}
23841 \compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}}
23842 \compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}}
23843 \compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}}
23844 \compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}}
23845 \compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}}
23846 \compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}}
23847 %
23848 \compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}}
23849 \compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}}
23850 \compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}}
23851 \compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}}
23852
23853 % % % % % %
23854 % % Begin of Diodes
23855 % % % % % %
23856
23857 \def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}}
23858 \def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}}
23859 \def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}}
23860 \def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}}
23861 \def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}}
23862 \def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}}
23863 \def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}}
23864 \def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}}
23865 \def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}}
23866 \def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}}
23867 \def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}}
23868 \def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}}
23869 \def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}}
23870 \def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}}
23871 \def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}}
23872 \def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}}
23873 \def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}}
23874 \def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}}
23875
23876 \compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}}
23877 \compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}}
23878 \compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}}
23879 \compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}}
23880 \compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}}
23881 \compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}}
23882 \compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}}
23883 \compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}}
23884 \compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}}
23885 \compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}}
23886 \compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}}
23887
23888 \compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}}
23889 \compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}}
23890 \compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}}
23891 \compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
23892 \compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}}
23893 \compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}}
23894 \compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}}
23895 \compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}}
23896 \compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}}
23897 \compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}}
23898 \compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}}
23899
23900 \compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}}
23901 \compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}}
23902 \compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}}
23903 \compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
23904 \compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}}
23905 \compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}}
23906 \compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}}
23907 \compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}}
23908 \compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}}
23909 %\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}}
23910
23911 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
23912
23913 \compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
23914 \compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
23915 \compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
23916 \compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
23917 \compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
23918 \compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
23919 \compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
23920 \compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
23921 \compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
23922 \compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
23923 \compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
23924
23925 %% Define Shortcuts
23926 \compattikzset{Do/.style = {\comnpatname empty diode}}
23927 \compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
23928 \compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
23929 \compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
23930 \compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
23931 \compattikzset{pDo/.style = {\comnpatname empty photodiode}}
23932 \compattikzset{leDo/.style = {\comnpatname empty led}}
23933 \compattikzset{VCo/.style = {\comnpatname empty varcap}}
23934 \compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
23935 \compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
23936 \compattikzset{Tro/.style = {\comnpatname empty triac}}
23937
23938 \compattikzset{D*/.style = {\comnpatname full diode}}
23939 \compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
23940 \compattikzset{zD*/.style = {\comnpatname full Zener diode}}
23941 \compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
23942 \compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
23943 \compattikzset{pD*/.style = {\comnpatname full photodiode}}
23944 \compattikzset{leD*/.style = {\comnpatname full led}}
23945 \compattikzset{VC*/.style = {\comnpatname full varcap}}
23946 \compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
23947 \compattikzset{Ty*/.style = {\comnpatname full thyristor}}
23948 \compattikzset{Tr*/.style = {\comnpatname full triac}}
23949
23950 \compattikzset{D/.style = {\comnpatname diode}}
23951 \compattikzset{tD/.style = {\comnpatname tunnel diode}}
23952 \compattikzset{zD/.style = {\comnpatname Zener diode}}
23953 \compattikzset{zzD/.style = {\comnpatname ZZener diode}}
23954 \compattikzset{sD/.style = {\comnpatname Schottky diode}}
23955 \compattikzset{pD/.style = {\comnpatname photodiode}}
23956 \compattikzset{leD/.style = {\comnpatname led}}
23957 \compattikzset{VC/.style = {\comnpatname varcap}}
23958 \compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
23959 \compattikzset{Ty/.style = {\comnpatname thyristor}}
23960 \compattikzset{Tr/.style = {\comnpatname triac}}
23961
23962 \compattikzset{D-/.style = {\comnpatname stroke diode}}
23963 \compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
23964 \compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
23965 \compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
23966 \compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
23967 \compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
23968 \compattikzset{leD-/.style = {\comnpatname stroke led}}
23969 \compattikzset{VC-/.style = {\comnpatname stroke varcap}}
23970 \compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
23971 \compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
23972 \compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
23973
23974 % % % % % %
23975 % % End of Diodes
23976 % % % % % %
23977
23978
23979 \compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}}
23980 \compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
23981 \compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}}
23982 \compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
23983 \compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
23984 \compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
23985 \compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
23986 \compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
23987 \compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
23988 \compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
23989 \compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
23990 \compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
23991 \compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
23992 \compattikzset{nopbc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}}
23993 \compattikzset{normally open push button closed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbuttonc@path, l=#1}}
23994 \compattikzset{ncpbo/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}}
23995 \compattikzset{normally closed push button open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbuttono@path, l=#1}}
23996 \compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}}
23997
23998 \compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}}
23999 \compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}}
24000 \compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}}
24001 \tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}}
24002
24003 % cute switches
24004 %% closed cute switch
24005 \def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}}
24006 \compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}}
24007 \compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
24008
24009 %% open cute switch
24010 \def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}}
24011 \compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}}
24012 \compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
24013
24014 %% closing cute switch
24015 \def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}}
24016 \compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}}
24017 \compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
24018
24019 %% opening cute switch
24020 \def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}}
24021 \compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}}
24022 \compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
24023
24024
24025 % short forms
24026 \compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24027 \compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24028 \compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
24029 \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}}
24030
24031 \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}}
24032 \compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosource@path, v=#1}}
24033 \compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}}
24034 \compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, /tikz/to path=\pgf@circ@ooosource@path, v=#1}}
24035
24036 \compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
24037 \compattikzset{isource/.style = {\comnpatname current source = #1}}
24038 \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
24039 \compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
24040 \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
24041 \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
24042 \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
24043 \compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
24044 \compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
24045 \compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
24046 \compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24047
24048 \compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
24049 \compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
24050 \compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24051 \compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
24052
24053 \compattikzset{R/.style= {\comnpatname resistor = #1}}
24054 \compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
24055 \compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
24056 \compattikzset{thR/.style= {\comnpatname thermistor = #1}}
24057 \compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
24058 \compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
24059 \compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
24060 \compattikzset{C/.style = {\comnpatname capacitor = #1}}
24061 \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
24062 %% pC is deprecated, use cC instead
24063 \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
24064 \compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
24065 \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
24066 \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
24067 \compattikzset{L/.style = {\comnpatname inductor = #1}}
24068 \compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
24069 \compattikzset{V/.style = {\comnpatname voltage source = #1}}
24070 \compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
24071 \compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
24072 \compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
24073 \compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
24074 \compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
24075 \def\pgf@temp#1{
24076 \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
24077 \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
24078 \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
24079 \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
24080 }
24081 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
24082 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
24083
24084 %current sources
24085 \compattikzset{I/.style = {\comnpatname current source = #1}}
24086 \compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
24087 \compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
24088 \compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
24089 \def\pgf@temp#1{
24090 \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
24091 \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
24092 \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
24093 \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
24094 }
24095 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
24096 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
24097 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
24098
24099 % cute sources
24100 \def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}}
24101 \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}}
24102 \compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
24103 \compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
24104
24105 \def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}}
24106 \compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24107 \compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
24108 \compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
24109
24110 \def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}}
24111 \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}}
24112 \compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
24113 \compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
24114
24115 \def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}}
24116 \compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24117 \compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
24118 \compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
24119
24120 % noise sources
24121 \def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}}
24122 \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}}
24123 \compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
24124 \compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
24125
24126 \def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}}
24127 \compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
24128 \compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
24129 \compattikzset{nI/.style= {\comnpatname noise current source= #1}}
24130
24131 % resistive sensor american style
24132 \def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}}
24133 \compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}}
24134 \compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
24135 \compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}}
24136 \compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
24137
24138 \compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}}
24139 \compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
24140
24141 \compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}}
24142 \compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}}
24143 \compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}}
24144 \compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}}
24145 \compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
24146
24147 \compattikzset{Mr/.style = {\comnpatname memristor}}
24148
24149 \compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
24150 \compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
24151 \compattikzset{spst/.style = {\comnpatname switch = #1}}
24152
24153 \compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
24154
24155 \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
24156 \compattikzset{vss/.style = {\comnpatname vee = #1}}
24157
24158 % activate the to-style crossing
24159 \def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}}
24160 \compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}}
24161 \compattikzset{xing/.style= {\comnpatname crossing= #1}}
24162
24163 %% loudspeaker and microphone
24164
24165 \def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}}
24166 \compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}}
24167
24168 \def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}}
24169 \compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}}
24170
24171 % more instrument
24172 \def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}}
24173 \compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}}
24174 \def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}}
24175 \compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}}
24176 \def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}}
24177 \compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}}
24178 % current loop probes
24179 \def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}}
24180 \compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}}
24181 \def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}}
24182 \compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}}
24183 % qucs-style probes
24184 \def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}}
24185 \compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}}
24186 \def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}}
24187 \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}}
24188 \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}}
24189 \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}}
24190 % multiwire(s)
24191 \def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}}
24192 \compattikzset{bmultiwire/.style = {\circuitikzbasekey,
24193 /tikz/to path=\pgf@circ@bmultiwire@path, l=#1}}
24194 \def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}}
24195 \compattikzset{multiwire/.style = {\circuitikzbasekey,
24196 /tikz/to path=\pgf@circ@multiwire@path, l=#1}}
24197 \def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}}
24198 \compattikzset{tmultiwire/.style = {\circuitikzbasekey,
24199 /tikz/to path=\pgf@circ@tmultiwire@path, l=#1}}
24200
24201 % reed switches
24202 \def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}}
24203 \compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}}
24204
24205 % Transistor like bipoles
24206
24207 \def\pgf@circ@trans@path#1#2{
24208 \pgfextra{
24209 \edef\pgf@temp{\ctikzvalof{bipole/name}}
24210 \def\pgf@circ@temp{#2}
24211 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
24212 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
24213 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
24214 \fi
24215 }
24216 \ifpgf@circuit@bipole@inverted
24217 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
24218 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
24219 \else
24220 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
24221 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
24222 \fi
24223 \pgfextra{
24224 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
24225 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
24226 \pgfmathadd{\pgfmathresult}{-90}
24227 \pgfmathround{\pgfmathresult}
24228 \edef\pgf@circ@direction{\pgfmathresult}
24229 }
24230 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
24231 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
24232 (\ctikzvalof{bipole/name}) {}
24233 node {\ctikzvalof{bipole/label/name}}
24234 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
24235 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
24236 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
24237 \else
24238 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
24239 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
24240 \fi
24241 \drawpoles
24242 \pgfextra{
24243 \pgfcircresetpath
24244 }
24245 (\tikztotarget) \tikztonodes % e si continua
24246 }
24247
24248
24249 \def\pgf@circ@definetranspath#1{
24250 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
24251 }
24252
24253 \pgf@circ@definetranspath{elmech}
24254 \pgf@circ@definetranspath{nmos}
24255 \pgf@circ@definetranspath{pmos}
24256 \pgf@circ@definetranspath{nmosd}
24257 \pgf@circ@definetranspath{pmosd}
24258 \pgf@circ@definetranspath{hemt}
24259 \pgf@circ@definetranspath{npn}
24260 \pgf@circ@definetranspath{pnp}
24261 \pgf@circ@definetranspath{nfet}
24262 \pgf@circ@definetranspath{nigfete}
24263 \pgf@circ@definetranspath{nigfetd}
24264 \pgf@circ@definetranspath{nigfetebulk}
24265 \pgf@circ@definetranspath{pfet}
24266 \pgf@circ@definetranspath{pigfete}
24267 \pgf@circ@definetranspath{pigfetd}
24268 \pgf@circ@definetranspath{pigfetebulk}
24269 \pgf@circ@definetranspath{njfet}
24270 \pgf@circ@definetranspath{pjfet}
24271 \pgf@circ@definetranspath{pigbt}
24272 \pgf@circ@definetranspath{nigbt}
24273 \pgf@circ@definetranspath{Lpigbt}
24274 \pgf@circ@definetranspath{Lnigbt}
24275 %
24276 % Path-style logical ports
24277 %
24278 % create path-style element for one input --- one output logical ports
24279 %
24280 \def\pgfcirc@port@node@to@path#1#2{%
24281 %
24282 % add a logic port path style component --- we need to suppress leads
24283 % and use the correct center
24284 %
24285 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
24286 }
24287 \pgfcirc@port@node@to@path{not port}{inline not}
24288 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
24289 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
24290 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
24291
24292 \pgfcirc@port@node@to@path{tgate}{inline tgate}
24293 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
24294
24295 %%%---------- close: tex/pgfcircpath
24296
24297 \catcode`\@=\tikzatcode
24298 \catcode`\|=\tikzbarcode
24299 \catcode`\!=\tikzexclaimcode
24300
24301 % define the environment
24302 \long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}
24303
24304 \protect
24305
24306 \stopmodule
24307
24308 \endinput