Debian Codegraph @

texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.1.2.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.1.2}
14 \def\pgfcircversiondate{2020/05/17}
15 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
16
17 \usemodule[tikz]
18
19 \startmodule[circuitikz-1.1.2]
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 %
48 %% Key managements
49
50 \long\def\pgf@circ@comment#1{}
51
52 \def\circuitikzbasekey{/tikz/circuitikz}
53
54 \pgfkeys{\circuitikzbasekey/.is family}
55
56 \def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
57 \let\ctikzset\circuitikzset
58 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
59 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
60
61 %% Temporary Counters
62
63 \newcount\pgf@circ@count@a
64 \newcount\pgf@circ@count@b
65 \newcount\pgf@circ@count@c
66 %%%%%%%%%%%%
67 %% Dimensions
68
69 % coordinates
70 \newdimen\pgf@circ@res@up
71 \newdimen\pgf@circ@res@down
72 \newdimen\pgf@circ@res@zero
73 \newdimen\pgf@circ@res@left
74 \newdimen\pgf@circ@res@right
75 \newdimen\pgf@circ@res@other
76 \newdimen\pgf@circ@res@step
77 \newdimen\pgf@circ@res@temp
78 % inital thickness
79 \newdimen \pgfstartlinewidth
80
81 % arrow tips, ported over old arrows library (deprecated)
82 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
83 % this was the original definition of latex' tips, renamed to avoid clashes
84 %
85 \pgfarrowsdeclare{latexslim}{latexslim}
86 {
87 \pgfutil@tempdima=0.28pt%
88 \advance\pgfutil@tempdima by.3\pgflinewidth%
89 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
90 \pgfarrowsrightextend{+6\pgfutil@tempdima}
91 }
92 {
93 \pgfutil@tempdima=0.28pt%
94 \advance\pgfutil@tempdima by.3\pgflinewidth%
95 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
96 \pgfpathcurveto
97 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
98 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
99 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
100 \pgfpathcurveto
101 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
102 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
103 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
104 \pgfpathcurveto
105 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
106 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
107 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
108 \pgfpathclose
109 \pgfusepathqfill
110 }
111
112 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
113
114 \def\pgf@circ@setifdefinedfill#1#2{%
115 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
116 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
117 \ifdefined\ctikzclass
118 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
119 {% yes, it's defined
120 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
121 \ifx\@@tmp\@@none % but it's none
122 \pgfusepath{#2}%
123 \else
124 \pgfsetfillcolor{\@@tmp}%
125 \pgfusepath{#1}%
126 \fi
127 }{% the class is defined but the fill key not; use #2
128 \pgfusepath{#2}%
129 }
130 \else
131 \pgfusepath{#2}%
132 \fi
133 }
134
135 %% Macro to fill or draw
136
137 \def\pgf@circ@draworfill{%
138 \ifx\tikz@fillcolor\pgfutil@empty
139 \pgf@circ@setifdefinedfill{draw,fill}{draw}
140 \else
141 \pgfsetfillcolor{\tikz@fillcolor}
142 \pgfusepath{draw, fill}
143 \fi
144 }
145
146 \def\pgf@circ@draworfillandclip{%
147 \ifx\tikz@fillcolor\pgfutil@empty
148 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
149 \pgfusepath{draw, clip}
150 \else
151 \pgfsetfillcolor{\tikz@fillcolor}
152 \pgfusepath{draw, clip, fill}
153 \fi
154 }
155
156 \def\pgf@circ@maybefill{%
157 \ifx\tikz@fillcolor\pgfutil@empty
158 \pgf@circ@setifdefinedfill{fill}{discard}
159 \else
160 \pgfsetfillcolor{\tikz@fillcolor}
161 \pgfusepath{fill}
162 \fi
163 }
164
165 %% Macros for setting linewidth
166 % #1 is the legacy class (bipoles, tripoles) etc
167 % #2 is the reference linewidth
168 \def\pgf@circ@setlinewidth#1#2{%
169 \ifdefined\ctikzclass
170 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
171 {% yes, it's defined
172 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
173 \ifx\@@tmp\@@none % but it's none
174 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
175 \else
176 \pgfsetlinewidth{\@@tmp #2}%
177 \fi
178 }{ % key not defined, do the legacy thing
179 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
180 }% Ok, do nothing
181 \else % no class
182 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
183 \fi
184 }
185 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
186 \ctikzset{none/thickness/.initial=1.0} % do not touch
187
188 %% font changes compatible with plain/LaTeX/ConTeXt
189 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
190
191 \ifpgfutil@format@is@latex
192 \long\def\pgf@circ@font@tiny{\tiny}
193 \long\def\pgf@circ@font@small{\small}
194 \long\def\pgf@circ@font@bold{\textbf}
195 \long\def\pgf@circ@font@boldmath{\boldmath}
196 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
197 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
198 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
199 \else\ifpgfutil@format@is@plain
200 \long\def\pgf@circ@font@tiny{\fiverm}
201 \long\def\pgf@circ@font@small{\sevenrm}
202 \long\def\pgf@circ@font@bold#1{{\bf#1}}
203 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
204 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
205 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
206 \long\def\pgf@circ@font@twelve{\twelverm} %
207 \else\ifpgfutil@format@is@context
208 \long\def\pgf@circ@font@tiny{\tfxx}
209 \long\def\pgf@circ@font@small{\tfx}
210 \long\def\pgf@circ@font@bold{\bold}
211 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
212 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
213 \long\def\pgf@circ@font@tenbm{\normal\bold}%
214 \long\def\pgf@circ@font@twelve{\tfa} %
215 \fi\fi\fi
216
217
218 %
219 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
220 %
221 % this is needed to avoid problems with \ConTeXt
222 \ifcsname normalunexpanded\endcsname
223 \let\pgfcircutil@unexpanded\normalunexpanded
224 \else
225 \let\pgfcircutil@unexpanded\unexpanded
226 \fi
227 % minimally expand a pgfkey to check if it's {}/undefined or filled.
228 \def\unexpandedvalueof#1{%
229 \pgfcircutil@unexpanded\expandafter\expandafter
230 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
231 \def\pgf@circ@valueof@chk#1{%
232 \ifx\relax#1%
233 \expandafter\pgfutil@firstoftwo
234 \else
235 \expandafter\pgfutil@secondoftwo
236 \fi
237 {{}}% #1 is \relax, so consider empty
238 {\expandafter{#1}}% otherwise, leave the key after one more expansion
239 }%
240 %
241 % text position (added with ieeestd logic ports. Maybe to be extended to other components,
242 % like amplifiers)
243 %
244 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
245 \tikzset{component text/.is choice}%
246 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
247 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
248 \ctikzset{component text/.is choice}%
249 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
250 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
251 \ctikzset{left text distance/.initial=0.3em}%
252
253 % voltage options
254
255 \newif\ifpgf@circ@siunitx
256 \newif\ifpgf@circuit@compat
257 \newif\ifpgf@circ@oldvoltagedirection % default false
258 \newif\ifpgf@circ@explicitvdir
259 \newif\ifpgf@circ@fixbatteries
260
261 \ctikzset{voltage dir/.is choice}
262 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
263 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
264 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
265 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
266 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
267
268 % Option ">" for twoports
269 \newif\ifpgf@circuit@inputarrow
270 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
271 \ctikzset{inputarrow/.is choice}
272 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
273 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
274
275 % Option "boxed" for nodes and twoports
276 \newif\ifpgf@circuit@boxed
277 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
278 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
279 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
280 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
281
282 % Option "dashed" for nodes and twoports
283 \newif\ifpgf@circuit@dashed
284 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
285 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}
286
287 % Option "t=*" for nodes
288 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
289
290 \ctikzset{current arrow scale/.initial=16}
291
292 \ctikzset{bipoles/.is family}
293 \ctikzset{bipoles/border margin/.initial=1.1}
294 \ctikzset{bipoles/thickness/.initial=2}
295 \ctikzset{tripoles/thickness/.initial=2}
296 \ctikzset{quadpoles/thickness/.initial=2}
297 \ctikzset{nodes width/.initial=.04}
298
299 % Base len for all circuitikz
300 \newdimen\pgf@circ@Rlen
301 % scaled length for internal use in scalable shapes
302 \newdimen\pgf@circ@scaled@Rlen
303 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
304 \pgf@circ@Rlen = 1.4cm
305 % by default scale is 1.0
306 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
307
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
309 %% main style definitions
310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
311
312
313
314 % load a style file: search ctikzstyle-NAME.tex in path
315 \def\ctikzloadstyle#1{%
316 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
317 \tikzerror{I did not find the circuitikz style #1}}%
318 }
319
320 % load and enact a style
321 \def\ctikzsetstyle#1{%
322 \ctikzloadstyle{#1}%
323 \tikzset{#1 circuit style}%
324 }
325
326 % global style parameters
327 \ctikzset{default/scale/.initial=1.0} % do not touch
328 \ctikzset{default/fill/.initial=none} % do not touch
329 \ctikzset{default/thickness/.initial=none} % do not touch
330 % default is use as the generic default style for bipoles
331
332 % mostly bipoles:
333
334 \ctikzset{resistors/scale/.initial=1.0}
335 \ctikzset{resistors/fill/.initial=none}
336 \ctikzset{resistors/thickness/.initial=none}
337
338 \ctikzset{capacitors/scale/.initial=1.0}
339 \ctikzset{capacitors/fill/.initial=none}
340 \ctikzset{capacitors/thickness/.initial=none}
341
342 \ctikzset{inductors/scale/.initial=1.0}
343 \ctikzset{inductors/fill/.initial=none}
344 \ctikzset{inductors/thickness/.initial=none}
345
346 \ctikzset{diodes/scale/.initial=1.0}
347 \ctikzset{diodes/fill/.initial=none}
348 \ctikzset{diodes/thickness/.initial=none}
349
350 \ctikzset{batteries/scale/.initial=1.0}
351 \ctikzset{batteries/fill/.initial=none}
352 \ctikzset{batteries/thickness/.initial=none}
353
354 \ctikzset{sources/scale/.initial=1.0}
355 \ctikzset{sources/fill/.initial=none}
356 \ctikzset{sources/thickness/.initial=none}
357
358 \ctikzset{csources/scale/.initial=1.0}
359 \ctikzset{csources/fill/.initial=none}
360 \ctikzset{csources/thickness/.initial=none}
361
362 \ctikzset{instruments/scale/.initial=1.0}
363 \ctikzset{instruments/fill/.initial=none}
364 \ctikzset{instruments/thickness/.initial=none}
365
366 \ctikzset{mechanicals/scale/.initial=1.0}
367 \ctikzset{mechanicals/fill/.initial=none}
368 \ctikzset{mechanicals/thickness/.initial=none}
369
370 \ctikzset{misc/scale/.initial=1.0}
371 \ctikzset{misc/fill/.initial=none}
372 \ctikzset{misc/thickness/.initial=none}
373
374 \ctikzset{blocks/scale/.initial=1.0}
375 \ctikzset{blocks/fill/.initial=none}
376 \ctikzset{blocks/thickness/.initial=none}
377
378 % mostly nodes
379
380 \ctikzset{grounds/scale/.initial=1.0}
381 \ctikzset{grounds/fill/.initial=none}
382 \ctikzset{grounds/thickness/.initial=none}
383
384 \ctikzset{power supplies/scale/.initial=1.0}
385 \ctikzset{power supplies/fill/.initial=none}
386 \ctikzset{power supplies/thickness/.initial=none}
387
388 \ctikzset{transistors/scale/.initial=1.0}
389 \ctikzset{transistors/fill/.initial=none}
390 \ctikzset{transistors/thickness/.initial=none}
391
392 \ctikzset{tubes/scale/.initial=1.0}
393 \ctikzset{tubes/fill/.initial=none}
394 \ctikzset{tubes/thickness/.initial=none}
395
396 \ctikzset{RF/scale/.initial=1.0}
397 \ctikzset{RF/fill/.initial=none}
398 \ctikzset{RF/thickness/.initial=none}
399
400 \ctikzset{electromechanicals/scale/.initial=1.0}
401 \ctikzset{electromechanicals/fill/.initial=none}
402 \ctikzset{electromechanicals/thickness/.initial=none}
403
404 % transformers go with inductors
405 \ctikzset{amplifiers/scale/.initial=1.0}
406 \ctikzset{amplifiers/fill/.initial=none}
407 \ctikzset{amplifiers/thickness/.initial=none}
408
409 \ctikzset{switches/scale/.initial=1.0}
410 \ctikzset{switches/fill/.initial=none}
411 \ctikzset{switches/thickness/.initial=none}
412
413 \ctikzset{logic ports/scale/.initial=1.0}
414 \ctikzset{logic ports/fill/.initial=none}
415 \ctikzset{logic ports/thickness/.initial=none}
416
417 \ctikzset{flipflops/scale/.initial=1.0}
418 \ctikzset{flipflops/fill/.initial=none}
419 \ctikzset{flipflops/thickness/.initial=none}
420
421 \ctikzset{muxdemuxes/scale/.initial=1.0}
422 \ctikzset{muxdemuxes/fill/.initial=none}
423 \ctikzset{muxdemuxes/thickness/.initial=none}
424
425 \ctikzset{chips/scale/.initial=1.0}
426 \ctikzset{chips/fill/.initial=none}
427 \ctikzset{chips/thickness/.initial=none}
428
429 \ctikzset{displays/scale/.initial=1.0}
430 \ctikzset{displays/fill/.initial=none}
431 \ctikzset{displays/thickness/.initial=none}
432
433 % grounds and power supplies
434
435 \ctikzset{monopoles/.is family}
436 \ctikzset{monopoles/ground/width/.initial=.25}
437 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
438 \ctikzset{monopoles/ground/thickness/.initial=2}
439 \ctikzset{monopoles/rground/thickness/.initial=2}
440 \ctikzset{monopoles/tground/thickness/.initial=3}
441 \ctikzset{monopoles/vcc/width/.initial=.2}
442 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
443 \ctikzset{monopoles/vee/arrow/.initial=legacy}
444 \ctikzset{monopoles/match/width/.initial=.4}
445 \ctikzset{monopoles/chassis/width/.initial=.25}
446 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
447 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
448 \ctikzset{monopoles/antenna/width/.initial=.25}
449 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
450 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
451 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
452 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
453 \ctikzset{monopoles/txantenna/width/.initial=.25}
454 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
455 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
456 \ctikzset{monopoles/rxantenna/width/.initial=.25}
457 \ctikzset{monopoles/bareantenna/width/.initial=.25}
458 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
459 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
460 \ctikzset{monopoles/waves/width/.initial=0.5}
461
462 % microstrips
463 \ctikzset{bipoles/mstline/height/.initial=0.3}
464 \ctikzset{bipoles/mstline/width/.initial=1.2}
465 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
466 \ctikzset{monopoles/msport/width/.initial=.5}
467 \ctikzset{monopoles/msrstub/height/.initial=1.0}
468 \ctikzset{monopoles/msrstub/width/.initial=0.6}
469
470 % microphone and loudspeaker
471 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
472 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
473 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
474 \ctikzset{bipoles/mic/height/.initial=1.2}
475 \ctikzset{bipoles/mic/depth/.initial=.0}
476 \ctikzset{bipoles/mic/width/.initial=.8}
477
478 % Zig Zag resistors
479 \ctikzset{resistors/zigs/.initial=3}
480 \ctikzset{resistors/width/.code={%
481 \ctikzset{bipoles/resistor/width=#1}%
482 \ctikzset{bipoles/vresistor/width=#1}%
483 \ctikzset{bipoles/potentiometer/width=#1}%
484 \ctikzset{bipoles/resistivesens/width=#1}%
485 \ctikzset{bipoles/photoresistor/width=#1}%
486 \ctikzset{bipoles/thermistor/width=#1}%
487 \ctikzset{bipoles/thermistorntc/width=#1}%
488 \ctikzset{bipoles/thermistorptc/width=#1}%
489 \ctikzset{bipoles/varistor/width=#1}%
490 \ctikzset{bipoles/generic/width=#1}%
491 \ctikzset{bipoles/generic potentiometer/width=#1}%
492 \ctikzset{bipoles/ageneric/width=#1}%
493 \ctikzset{bipoles/tgeneric/width=#1}%
494 }}
495 \ctikzset{wiper pos/.code={%
496 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
497 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
498 }}
499 % zigzag resistor
500 \ctikzset{bipoles/resistor/height/.initial=.3}
501 \ctikzset{bipoles/resistor/width/.initial=.8}
502 \ctikzset{bipoles/potentiometer/height/.initial=.8}
503 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
504 \ctikzset{bipoles/potentiometer/width/.initial=.8}
505 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
506 \ctikzset{bipoles/vresistor/height/.initial=.6}
507 \ctikzset{bipoles/vresistor/width/.initial=.8}
508 \ctikzset{bipoles/resistivesens/height/.initial=.6}
509 \ctikzset{bipoles/resistivesens/width/.initial=.8}
510 % square resistors
511 \ctikzset{bipoles/photoresistor/height/.initial=.6}
512 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
513 \ctikzset{bipoles/photoresistor/width/.initial=.8}
514 \ctikzset{bipoles/thermistor/main/.initial=.7}
515 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
516 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
517 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
518 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
519 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
520 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
521 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
522 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
523 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
524 \ctikzset{bipoles/thermistor/width/.initial=.8}
525 \ctikzset{bipoles/varistor/main/.initial=.7}
526 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
527 \ctikzset{bipoles/varistor/width/.initial=.8}
528 \ctikzset{bipoles/generic/height/.initial=.30}
529 \ctikzset{bipoles/generic/width/.initial=.80}
530 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
531 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
532 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
533 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
534 \ctikzset{bipoles/ageneric/height/.initial=.30}
535 \ctikzset{bipoles/tgeneric/height/.initial=.70}
536 \ctikzset{bipoles/tgeneric/width/.initial=.80}
537 \ctikzset{bipoles/ageneric/width/.initial=.80}
538
539 %% Capacitors
540 \ctikzset{bipoles/capacitor/height/.initial=.6}
541 \ctikzset{bipoles/capacitor/width/.initial=.2}
542 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
543 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
544 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
545 %%% pcapacitor is deprecated
546 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
547 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
548 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
549 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
550 \ctikzset{bipoles/ccapacitor/width/.initial=.12}
551 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
552 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
553 \ctikzset{bipoles/vcapacitor/width/.initial=.5}
554 \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
555 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
556 \ctikzset{bipoles/piezoelectric/width/.initial=.5}
557
558 % Inductors
559 \ctikzset{inductors/coils/.code={%
560 \ctikzset{bipoles/cuteinductor/coils=#1}%
561 \ctikzset{bipoles/cutechoke/coils=#1}%
562 \ctikzset{bipoles/americaninductor/coils=#1}%
563 \ctikzset{bipoles/vcuteinductor/coils=#1}%
564 \ctikzset{bipoles/vamericaninductor/coils=#1}%
565 }}
566 \ctikzset{inductors/width/.code={%
567 \ctikzset{bipoles/cuteinductor/width=#1}%
568 \ctikzset{bipoles/cutechoke/width=#1}%
569 \ctikzset{bipoles/americaninductor/width=#1}%
570 \ctikzset{bipoles/vcuteinductor/width=#1}%
571 \ctikzset{bipoles/vamericaninductor/width=#1}%
572 \ctikzset{bipoles/fullgeneric/width=#1}%
573 \ctikzset{bipoles/tfullgeneric/width=#1}%
574 }}
575 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
576 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
577 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
578 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
579 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
580 %% Cute choke settings
581 \ctikzset{bipoles/cutechoke/height/.initial=.3}
582 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
583 \ctikzset{bipoles/cutechoke/width/.initial=.6}
584 \ctikzset{bipoles/cutechoke/coils/.initial=5}
585 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
586 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
587 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
588 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
589 \newif\ifpgf@circuit@bipole@twolineschoke
590 \pgf@circuit@bipole@twolineschokefalse
591 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
592 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
593 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
594 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
595 %
596 \ctikzset{bipoles/americaninductor/height/.initial=.3}
597 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
598 \ctikzset{bipoles/americaninductor/width/.initial=.8}
599 \ctikzset{bipoles/americaninductor/coils/.initial=4}
600 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
601 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
602 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
603 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
604 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
605 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
606 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
607 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
608 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
609 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
610 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
611 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
612 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
613 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
614 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
615
616 % Sources
617
618 \ctikzset{bipoles/esource/height/.initial=.60}
619 \ctikzset{bipoles/esource/width/.initial=.60}
620 \ctikzset{bipoles/pvsource/height/.initial=.60}
621 \ctikzset{bipoles/pvsource/width/.initial=.60}
622 \ctikzset{bipoles/isource/height/.initial=.60}
623 \ctikzset{bipoles/isource/width/.initial=.60}
624 \ctikzset{bipoles/oosource/height/.initial=.60}
625 \ctikzset{bipoles/oosource/width/.initial=.60}
626 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
627 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
628 \ctikzset{bipoles/dcisource/angle/.initial=80}
629 \ctikzset{bipoles/dcisource/height/.initial=.60}
630 \ctikzset{bipoles/dcisource/width/.initial=.60}
631 \ctikzset{bipoles/dcvsource/height/.initial=.60}
632 \ctikzset{bipoles/dcvsource/width/.initial=.60}
633 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
634 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
635 \ctikzset{bipoles/isourceam/height/.initial=.60}
636 \ctikzset{bipoles/isourceam/width/.initial=.60}
637 \ctikzset{bipoles/vsource/height/.initial=.60}
638 \ctikzset{bipoles/vsource/width/.initial=.60}
639 \ctikzset{bipoles/vsourceam/height/.initial=.60}
640 \ctikzset{bipoles/vsourceam/width/.initial=.60}
641 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
642 \ctikzset{bipoles/isourcesin/height/.initial=.60}
643 \ctikzset{bipoles/isourcesin/width/.initial=.60}
644 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
645 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
646 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
647 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
648 \ctikzset{bipoles/cisource/height/.initial=.7}
649 \ctikzset{bipoles/cisource/width/.initial=.7}
650 \ctikzset{bipoles/cisourceam/height/.initial=.7}
651 \ctikzset{bipoles/cisourceam/width/.initial=.7}
652 \ctikzset{bipoles/ecsource/height/.initial=.7}
653 \ctikzset{bipoles/ecsource/width/.initial=.7}
654 \ctikzset{bipoles/cvsource/height/.initial=.7}
655 \ctikzset{bipoles/cvsource/width/.initial=.7}
656 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
657 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
658 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
659 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
660 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
661 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
662 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
663 \ctikzset{bipoles/battery/height/.initial=.6}
664 \ctikzset{bipoles/battery/width/.initial=.3}
665 \ctikzset{bipoles/battery1/height/.initial=.6}
666 \ctikzset{bipoles/battery1/width/.initial=.3}
667 \ctikzset{bipoles/battery2/height/.initial=.6}
668 \ctikzset{bipoles/battery2/width/.initial=.3}
669
670 % % % ootransformer
671 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
672 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
673 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
674 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
675 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
676
677 % % % oootransformer
678 \ctikzset{bipoles/ooosource/height/.initial=.6}
679 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
680 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
681 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
682
683 % % % primary windings
684 \newif\ifpgf@circ@prim@delta
685 \newif\ifpgf@circ@prim@wye
686 \newif\ifpgf@circ@prim@zig
687 \pgfkeys{tikz/prim/.is choice}
688 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
689 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
690 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
691
692 % % % secondary windings
693 \newif\ifpgf@circ@sec@delta
694 \newif\ifpgf@circ@sec@wye
695 \newif\ifpgf@circ@sec@zig
696 \pgfkeys{tikz/sec/.is choice}
697 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
698 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
699 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
700
701 % % % tertiary windings (ooosource)
702 \newif\ifpgf@circ@tert@delta
703 \newif\ifpgf@circ@tert@wye
704 \newif\ifpgf@circ@tert@zig
705 \pgfkeys{tikz/tert/.is choice}
706 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
707 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
708 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}
709
710 % diodes
711
712 \ctikzset{bipoles/diode/height/.initial=.50}
713 \ctikzset{bipoles/diode/width/.initial=.40}
714 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
715 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
716 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
717 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
718 \ctikzset{bipoles/varcap/height/.initial=.50}
719 \ctikzset{bipoles/varcap/width/.initial=.45}
720
721 % switches
722
723 \ctikzset{bipoles/spst/height/.initial=.35}
724 \ctikzset{bipoles/spst/width/.initial=.35}
725 \ctikzset{bipoles/spst/depth/.initial=.2}
726 \ctikzset{bipoles/nos/height/.initial=.3}
727 \ctikzset{bipoles/nos/width/.initial=.35}
728 \ctikzset{bipoles/nos/depth/.initial=.2}
729 \ctikzset{bipoles/ncs/height/.initial=.35}
730 \ctikzset{bipoles/ncs/width/.initial=.35}
731 \ctikzset{bipoles/ncs/depth/.initial=.2}
732 %%% reed switch
733 \ctikzset{bipoles/reed/height/.initial=.4}
734 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
735 \ctikzset{bipoles/reed/depth/.initial=.4}
736
737 % misc
738
739 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
740 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
741 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
742 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
743 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
744 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
745 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
746 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
747 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
748 \ctikzset{bipoles/fuse/height/.initial=.20}
749 \ctikzset{bipoles/fuse/width/.initial=.50}
750 \ctikzset{bipoles/afuse/height/.initial=.20}
751 \ctikzset{bipoles/afuse/width/.initial=.50}
752 \ctikzset{bipoles/memristor/height/.initial=.30}
753 \ctikzset{bipoles/memristor/wave height/.initial=.5}
754 \ctikzset{bipoles/memristor/width/.initial=.80}
755 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
756 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
757 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
758 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
759 \ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
760 \ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
761 %\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
762 %\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
763 % multiwire
764 \ctikzset{bipoles/multiwire/height/.initial=0.4}
765 \ctikzset{bipoles/multiwire/width/.initial=0.2}
766 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
767
768 \ctikzset{bipoles/ammeter/height/.initial=.60}
769 \ctikzset{bipoles/ammeter/width/.initial=.60}
770 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
771 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
772 \ctikzset{bipoles/voltmeter/height/.initial=.60}
773 \ctikzset{bipoles/voltmeter/width/.initial=.60}
774 \ctikzset{bipoles/smeter/height/.initial=.60}
775 \ctikzset{bipoles/smeter/width/.initial=.60}
776 \ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
777 \ctikzset{bipoles/qmeter/depth/.initial=.40}
778 \ctikzset{bipoles/qmeter/height/.initial=.80}
779 \ctikzset{bipoles/qmeter/width/.initial=.60}
780 % this must be specified for each one
781 \ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
782 \ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
783 \ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
784 \ctikzset{bipoles/iloop/width/.initial=.40}
785 \ctikzset{bipoles/iloop/height/.initial=.60}
786
787 \ctikzset{bipoles/oscope/height/.initial=.60}
788 \ctikzset{bipoles/oscope/width/.initial=.60}
789 \ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
790
791
792 % option to not rotate the new (Romano's) instruments
793 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
794 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
795 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
796 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
797 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
798
799
800 \ctikzset{bipoles/buffer/height/.initial=1}
801 \ctikzset{bipoles/buffer/width/.initial=1}
802 \ctikzset{bipoles/not port/width/.initial=1}
803 \ctikzset{bipoles/not port/height/.initial=.8}
804 \ctikzset{bipoles/not port/circle width/.initial=.15}
805 \ctikzset{bipoles/lamp/height/.initial=.60}
806 \ctikzset{bipoles/lamp/width/.initial=.60}
807 \ctikzset{bipoles/bulb/height/.initial=.8}
808 \ctikzset{bipoles/bulb/width/.initial=.8}
809 \ctikzset{bipoles/tline/height/.initial=.3}
810 \ctikzset{bipoles/tline/width/.initial=.8}
811 \ctikzset{bipoles/squid/height/.initial=.60}
812 \ctikzset{bipoles/squid/width/.initial=.60}
813 \ctikzset{bipoles/barrier/height/.initial=.60}
814 \ctikzset{bipoles/barrier/width/.initial=.60}
815 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
816 \ctikzset{bipoles/thermocouple/height/.initial=.250}
817 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
818 \ctikzset{bipoles/thermocouple/width/.initial=.140}
819 \ctikzset{bipoles/pushbutton/height/.initial=.5}
820 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
821 \ctikzset{bipoles/pushbutton/width/.initial=.50}
822
823 \ctikzset{bipoles/twoport/width/.initial=.7}
824 \ctikzset{bipoles/twoport/height/.initial=.7}
825 \ctikzset{bipoles/twoport/text/.initial=}
826 \ctikzset{bipoles/vco/width/.initial=.7}
827 \ctikzset{bipoles/bandpass/width/.initial=.7}
828 \ctikzset{bipoles/bandstop/width/.initial=.7}
829 \ctikzset{bipoles/highpass/width/.initial=.7}
830 \ctikzset{bipoles/lowpass/width/.initial=.7}
831 \ctikzset{bipoles/adc/width/.initial=.7}
832 \ctikzset{bipoles/dac/width/.initial=.7}
833 \ctikzset{bipoles/dsp/width/.initial=.7}
834 \ctikzset{bipoles/fft/width/.initial=.7}
835 \ctikzset{bipoles/amp/width/.initial=.7}
836 \ctikzset{bipoles/vamp/width/.initial=.7}
837 \ctikzset{bipoles/piattenuator/width/.initial=.7}
838 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
839 \ctikzset{bipoles/tattenuator/width/.initial=.7}
840 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
841 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
842 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
843 \ctikzset{bipoles/detector/width/.initial=.7}
844
845 % crossing wires
846 \ctikzset{bipoles/crossing/size/.initial=.2}
847
848 % Transistors starts here
849
850 \newif\ifpgf@circuit@trans@depletiontype
851 \pgf@circuit@trans@depletiontypefalse
852
853 \newif\ifpgf@circuit@mos@arrows
854 \ctikzset{tripoles/mos style/.is choice}
855 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
856 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
857 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
858 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
859
860 % Fixed label positions
861 \newif\ifpgf@circuit@transisors@fixlabels
862 \pgf@circuit@transisors@fixlabelstrue
863 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
864 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
865 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
866 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
867
868 % Option solderdot for fet
869 \newif\ifpgf@circuit@fet@solderdot
870 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
871 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
872 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
873 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
874
875 % Option bodydiode for fet
876 \newif\ifpgf@circuit@fet@bodydiode
877 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
878 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
879 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
880 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
881
882 % Option draw fet without gate connection
883 \newif\ifpgf@circuit@bpt@drawgate
884 \pgf@circuit@bpt@drawgatetrue
885 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
886 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
887 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
888 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
889
890 % Option draw bpt with schottky base
891 \newif\ifpgf@circuit@bpt@schottky
892 \pgf@circuit@bpt@schottkyfalse
893 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
894 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
895 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
896 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
897 \ctikzset{tripoles/schottky base size/.initial=0.07}
898
899 % Option draw bpt without base connection
900 \newif\ifpgf@circuit@bpt@drawbase
901 \pgf@circuit@bpt@drawbasetrue
902 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
903 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
904 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
905 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
906
907 % Option draw bpt with optical input
908 \newif\ifpgf@circuit@bpt@drawphoto
909 \pgf@circuit@bpt@drawphotofalse
910 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
911 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
912 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
913 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
914
915 % Option draw fet without bulk connection -- Added by Burak Kelleci
916 \newif\ifpgf@circuit@bpt@drawbulk
917 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
918 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
919 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
920 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
921
922 % Option draw pmos with empty circle
923 \newif\ifpgf@circuit@pmos@emptycircle
924 \pgf@circuit@pmos@emptycirclefalse
925 \ctikzset{tripoles/pmos style/.is choice}
926 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
927 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
928 % Option draw pmos with no circle
929 \newif\ifpgf@circuit@pmos@nocircle
930 \pgf@circuit@pmos@nocirclefalse
931 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
932 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
933 % back to normal
934 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
935 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
936 % arrows at the end, the correct way
937 \newif\ifpgf@circuit@trans@arrowatend
938 \pgf@circuit@trans@arrowatendfalse
939 \ctikzset{transistors/arrow pos/.is choice}
940 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
941 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
942
943 \newif\ifpgf@circuit@trans@ntype
944 \pgf@circuit@trans@ntypetrue %default true
945 %\newif\ifpgf@circuit@trans@ptype
946 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
947 \ctikzset{tripoles/nmos/width/.initial=.7}
948 \ctikzset{tripoles/nmos/gate height/.initial=.35}
949 \ctikzset{tripoles/nmos/base height/.initial=.5}
950 \ctikzset{tripoles/nmos/conn height/.initial=0}
951 \ctikzset{tripoles/nmos/height/.initial=1.1}
952 \ctikzset{tripoles/nmos/base width/.initial=.5}
953 \ctikzset{tripoles/nmos/gate width/.initial=.62}
954 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
955 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
956 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
957 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
958 \ctikzset{tripoles/nmos/curr direction/.initial=1}
959
960 \ctikzset{tripoles/pmos/width/.initial=.7}
961 \ctikzset{tripoles/pmos/gate height/.initial=.35}
962 \ctikzset{tripoles/pmos/base height/.initial=.5}
963 \ctikzset{tripoles/pmos/conn height/.initial=0}
964 \ctikzset{tripoles/pmos/height/.initial=1.1}
965 \ctikzset{tripoles/pmos/base width/.initial=.5}
966 \ctikzset{tripoles/pmos/gate width/.initial=.62}
967 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
968 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
969 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
970 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
971 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
972
973 \ctikzset{tripoles/hemt/width/.initial=.7}
974 \ctikzset{tripoles/hemt/gate height/.initial=.35}
975 \ctikzset{tripoles/hemt/base height/.initial=.5}
976 \ctikzset{tripoles/hemt/conn height/.initial=0}
977 \ctikzset{tripoles/hemt/height/.initial=1.1}
978 \ctikzset{tripoles/hemt/base width/.initial=.5}
979 \ctikzset{tripoles/hemt/gate width/.initial=.62}
980 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
981 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
982 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
983 \ctikzset{tripoles/hemt/curr direction/.initial=1}
984
985 \ctikzset{tripoles/nfet/width/.initial=.7}
986 \ctikzset{tripoles/nfet/gate height/.initial=.35}
987 \ctikzset{tripoles/nfet/base height/.initial=.5}
988 \ctikzset{tripoles/nfet/conn height/.initial=0}
989 \ctikzset{tripoles/nfet/height/.initial=1.1}
990 \ctikzset{tripoles/nfet/base width/.initial=.5}
991 \ctikzset{tripoles/nfet/gate width/.initial=.62}
992 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
993 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
994 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
995 \ctikzset{tripoles/nfet/curr direction/.initial=1}
996
997 \ctikzset{tripoles/pfet/width/.initial=.7}
998 \ctikzset{tripoles/pfet/gate height/.initial=.35}
999 \ctikzset{tripoles/pfet/base height/.initial=.5}
1000 \ctikzset{tripoles/pfet/conn height/.initial=0}
1001 \ctikzset{tripoles/pfet/height/.initial=1.1}
1002 \ctikzset{tripoles/pfet/base width/.initial=.5}
1003 \ctikzset{tripoles/pfet/gate width/.initial=.62}
1004 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
1005 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
1006 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
1007 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
1008
1009 \ctikzset{tripoles/nigfete/width/.initial=.7}
1010 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
1011 \ctikzset{tripoles/nigfete/base height/.initial=.5}
1012 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
1013 \ctikzset{tripoles/nigfete/height/.initial=1.1}
1014 \ctikzset{tripoles/nigfete/base width/.initial=.5}
1015 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
1016 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
1017 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
1018 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
1019 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
1020
1021 \ctikzset{tripoles/nigfetd/width/.initial=.7}
1022 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
1023 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
1024 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
1025 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
1026 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
1027 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
1028 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
1029 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
1030 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
1031 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
1032
1033 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
1034 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
1035 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
1036 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
1037 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
1038 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
1039 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
1040 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
1041 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
1042 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
1043 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
1044
1045 \ctikzset{tripoles/pigfete/width/.initial=.7}
1046 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
1047 \ctikzset{tripoles/pigfete/base height/.initial=.5}
1048 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
1049 \ctikzset{tripoles/pigfete/height/.initial=1.1}
1050 \ctikzset{tripoles/pigfete/base width/.initial=.5}
1051 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
1052 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
1053 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
1054 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
1055 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
1056
1057 \ctikzset{tripoles/pigfetd/width/.initial=.7}
1058 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
1059 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
1060 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
1061 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
1062 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
1063 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
1064 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
1065 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
1066 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
1067 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
1068
1069 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
1070 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
1071 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
1072 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
1073 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
1074 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
1075 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
1076 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
1077 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
1078 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
1079 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
1080
1081 \ctikzset{tripoles/npn/width/.initial=.6}
1082 \ctikzset{tripoles/npn/base height/.initial=.45}
1083 \ctikzset{tripoles/npn/base height 2/.initial=.15}
1084 \ctikzset{tripoles/npn/base height/.initial=.4}
1085 \ctikzset{tripoles/npn/conn height/.initial=0}
1086 \ctikzset{tripoles/npn/height/.initial=1.1}
1087 \ctikzset{tripoles/npn/base width/.initial=.5}
1088 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
1089 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
1090 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
1091 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
1092 \ctikzset{tripoles/npn/curr direction/.initial=1}
1093
1094 \ctikzset{tripoles/pnp/width/.initial=.6}
1095 \ctikzset{tripoles/pnp/base height/.initial=.45}
1096 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
1097 \ctikzset{tripoles/pnp/base height/.initial=.4}
1098 \ctikzset{tripoles/pnp/conn height/.initial=0}
1099 \ctikzset{tripoles/pnp/height/.initial=1.1}
1100 \ctikzset{tripoles/pnp/base width/.initial=.5}
1101 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
1102 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
1103 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
1104 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
1105 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
1106
1107 \ctikzset{tripoles/pigbt/width/.initial=.6}
1108 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
1109 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
1110 \ctikzset{tripoles/pigbt/base height/.initial=.4}
1111 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
1112 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
1113 \ctikzset{tripoles/pigbt/conn height/.initial=0}
1114 \ctikzset{tripoles/pigbt/height/.initial=1.1}
1115 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
1116 \ctikzset{tripoles/pigbt/base width/.initial=.5}
1117 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
1118 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
1119 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
1120 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
1121
1122 \ctikzset{tripoles/nigbt/width/.initial=.6}
1123 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
1124 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
1125 \ctikzset{tripoles/nigbt/base height/.initial=.4}
1126 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
1127 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
1128 \ctikzset{tripoles/nigbt/conn height/.initial=0}
1129 \ctikzset{tripoles/nigbt/height/.initial=1.1}
1130 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
1131 \ctikzset{tripoles/nigbt/base width/.initial=.5}
1132 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
1133 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
1134 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
1135 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
1136
1137 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
1138 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
1139 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
1140 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
1141 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
1142 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
1143 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
1144 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
1145 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
1146 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
1147 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
1148 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
1149 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
1150 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
1151
1152 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
1153 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
1154 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
1155 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
1156 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
1157 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
1158 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
1159 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
1160 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
1161 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
1162 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
1163 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
1164 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
1165 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
1166
1167 \ctikzset{tripoles/igbt/outer base height/.code={
1168 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
1169 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
1170 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
1171 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
1172 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
1173 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
1174 }}
1175 \ctikzset{tripoles/igbt/outer base thickness/.code={
1176 \ctikzset{tripoles/nigbt/outer base thickness=#1}
1177 \ctikzset{tripoles/pigbt/outer base thickness=#1}
1178 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
1179 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
1180 }}
1181
1182 \ctikzset{tripoles/njfet/width/.initial=.7}
1183 \ctikzset{tripoles/njfet/gate height/.initial=.5}
1184 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
1185 \ctikzset{tripoles/njfet/gate width/.initial=.5}
1186 \ctikzset{tripoles/njfet/conn height/.initial=.35}
1187 \ctikzset{tripoles/njfet/height/.initial=1.1}
1188 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
1189 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
1190 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
1191 \ctikzset{tripoles/njfet/curr direction/.initial=1}
1192
1193 \ctikzset{tripoles/pjfet/width/.initial=.7}
1194 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
1195 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
1196 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
1197 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
1198 \ctikzset{tripoles/pjfet/height/.initial=1.1}
1199 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
1200 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
1201 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
1202 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
1203
1204 \ctikzset{tripoles/isfet/width/.initial=1}
1205 \ctikzset{tripoles/isfet/gate height/.initial=.35}
1206 \ctikzset{tripoles/isfet/base height/.initial=.5}
1207 \ctikzset{tripoles/isfet/height/.initial=1.1}
1208 \ctikzset{tripoles/isfet/base width/.initial=.3}
1209 \ctikzset{tripoles/isfet/gate width/.initial=.5}
1210 \ctikzset{tripoles/isfet/conn height/.initial=0}
1211 \ctikzset{tripoles/isfet/wave width/.initial=.16}
1212 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
1213 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
1214 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
1215 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
1216 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
1217 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
1218 \ctikzset{tripoles/isfet/curr direction/.initial=1}
1219 %
1220 % multi-emitter and multi-collector BJTs by Romano Giannetti
1221 %
1222 \ctikzset{tripoles/bjt/emitters/.initial=1}
1223 \ctikzset{tripoles/bjt/collectors/.initial=1}
1224 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
1225 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
1226 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
1227 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
1228 \ctikzset{tripoles/bjt/multi height/.initial=.5}
1229 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
1230 %
1231 \ctikzset{tripoles/bjt/width/.initial=.3}
1232 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
1233 \ctikzset{tripoles/bjt/base height/.initial=1.1}
1234 \ctikzset{tripoles/bjt/height/.initial=.4}
1235 \ctikzset{tripoles/bjt/base width/.initial=1}
1236 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
1237 % do NOT touch these two!
1238 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
1239 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
1240
1241 %% transistors stop here
1242
1243 %% Logic ports
1244
1245 \newif\ifpgf@circuit@europeanlogicport
1246 \ctikzset{logic ports/.is choice}
1247 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
1248 \tikzset{and port/.style={shape=european and port}}%
1249 \tikzset{or port/.style={shape=european or port}}%
1250 \tikzset{xor port/.style={shape=european xor port}}%
1251 \tikzset{buffer port/.style={shape=european buffer port}}%
1252 \tikzset{not port/.style={shape=european not port}}%
1253 \tikzset{nand port/.style={shape=european nand port}}%
1254 \tikzset{nor port/.style={shape=european nor port}}%
1255 \tikzset{xnor port/.style={shape=european xnor port}}%
1256 }}
1257 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
1258 \tikzset{and port/.style={shape=american and port}}%
1259 \tikzset{or port/.style={shape=american or port}}%
1260 \tikzset{xor port/.style={shape=american xor port}}%
1261 \tikzset{buffer port/.style={shape=american buffer port}}%
1262 \tikzset{not port/.style={shape=american not port}}%
1263 \tikzset{nand port/.style={shape=american nand port}}%
1264 \tikzset{nor port/.style={shape=american nor port}}%
1265 \tikzset{xnor port/.style={shape=american xnor port}}%
1266 }}
1267
1268 \ctikzset{logic ports origin/.is choice}
1269 \ctikzset{logic ports origin/legacy/.code={
1270 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
1271 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
1272 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
1273 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
1274 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
1275 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
1276 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
1277 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
1278 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
1279 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
1280 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
1281 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
1282 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
1283 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
1284 }%
1285 }
1286 \ctikzset{logic ports origin/center/.code={%
1287 \ctikzset{tripoles/american and port/origin/.initial=0}%
1288 \ctikzset{tripoles/american nand port/origin/.initial=0}%
1289 \ctikzset{tripoles/american nor port/origin/.initial=0}%
1290 \ctikzset{tripoles/american or port/origin/.initial=0}%
1291 \ctikzset{tripoles/american xor port/origin/.initial=0}%
1292 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
1293 \ctikzset{tripoles/european and port/origin/.initial=0}%
1294 \ctikzset{tripoles/european nand port/origin/.initial=0}%
1295 \ctikzset{tripoles/european or port/origin/.initial=0}%
1296 \ctikzset{tripoles/european nor port/origin/.initial=0}%
1297 \ctikzset{tripoles/european xor port/origin/.initial=0}%
1298 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
1299 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
1300 \ctikzset{tripoles/european not port/origin/.initial=0}%
1301 }%
1302 }
1303
1304 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
1305 \ctikzset{american or shape/.is choice}
1306 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
1307 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
1308
1309 \newif\ifpgfcirc@draw@leads\pgfcirc@draw@leadstrue
1310 \ctikzset{logic ports draw input leads/.is choice}
1311 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@leadstrue}}
1312 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@leadsfalse}}
1313 \tikzset{input leads/.code={\pgfcirc@draw@leadstrue}}
1314 \tikzset{no input leads/.code={\pgfcirc@draw@leadsfalse}}
1315
1316 \ctikzset{tripoles/american and port/width/.initial=1.1}
1317 \ctikzset{tripoles/american and port/height/.initial=.8}
1318 \ctikzset{tripoles/american and port/port width/.initial=.7}
1319 \ctikzset{tripoles/american and port/input height/.initial=.5}
1320 \ctikzset{tripoles/american nand port/width/.initial=1.1}
1321 \ctikzset{tripoles/american nand port/height/.initial=.8}
1322 \ctikzset{tripoles/american nand port/port width/.initial=.7}
1323 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
1324 \ctikzset{tripoles/american nand port/input height/.initial=.5}
1325 \ctikzset{tripoles/american or port/width/.initial=1.1}
1326 \ctikzset{tripoles/american or port/height/.initial=.8}
1327 \ctikzset{tripoles/american or port/port width/.initial=.7}
1328 \ctikzset{tripoles/american or port/input height/.initial=.5}
1329 \ctikzset{tripoles/american or port/input skip/.initial=.25}
1330 \ctikzset{tripoles/american or port/aaa/.initial=.6}
1331 \ctikzset{tripoles/american or port/bbb/.initial=.4}
1332 \ctikzset{tripoles/american or port/ccc/.initial=.5}
1333 \ctikzset{tripoles/american or port/ddd/.initial=.0}
1334 \ctikzset{tripoles/american nor port/width/.initial=1.1}
1335 \ctikzset{tripoles/american nor port/height/.initial=.8}
1336 \ctikzset{tripoles/american nor port/port width/.initial=.7}
1337 \ctikzset{tripoles/american nor port/input height/.initial=.5}
1338 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
1339 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
1340 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
1341 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
1342 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
1343 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
1344 \ctikzset{tripoles/american xor port/width/.initial=1.1}
1345 \ctikzset{tripoles/american xor port/height/.initial=.8}
1346 \ctikzset{tripoles/american xor port/port width/.initial=.7}
1347 \ctikzset{tripoles/american xor port/input height/.initial=.5}
1348 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
1349 \ctikzset{tripoles/american xor port/distance/.initial=.1}
1350 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
1351 \ctikzset{tripoles/american xnor port/height/.initial=.8}
1352 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
1353 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
1354 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
1355 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
1356 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
1357 \ctikzset{tripoles/american and port/origin/.initial=0.8}
1358 \ctikzset{tripoles/american and port/inputs/.initial=2}
1359 % variable number of inputs
1360 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
1361 \ctikzset{tripoles/american nand port/inputs/.initial=2}
1362 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
1363 \ctikzset{tripoles/american nor port/inputs/.initial=2}
1364 \ctikzset{tripoles/american nor port/angle/.initial=70}
1365 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
1366 \ctikzset{tripoles/american or port/origin/.initial=0.8}
1367 \ctikzset{tripoles/american or port/inputs/.initial=2}
1368 \ctikzset{tripoles/american or port/angle/.initial=70}
1369 \ctikzset{tripoles/american or port/inner/.initial=0.3}
1370 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
1371 \ctikzset{tripoles/american xor port/inputs/.initial=2}
1372 \ctikzset{tripoles/american xor port/angle/.initial=70}
1373 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
1374 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
1375 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
1376 \ctikzset{tripoles/american xnor port/angle/.initial=70}
1377 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
1378
1379 \ctikzset{tripoles/european and port/width/.initial=1.4}
1380 \ctikzset{tripoles/european and port/height/.initial=.65}
1381 \ctikzset{tripoles/european and port/reserved/.initial=.6}
1382 \ctikzset{tripoles/european and port/input height/.initial=.6}
1383 \ctikzset{tripoles/european or port/width/.initial=1.4}
1384 \ctikzset{tripoles/european or port/height/.initial=.65}
1385 \ctikzset{tripoles/european or port/reserved/.initial=.6}
1386 \ctikzset{tripoles/european or port/input height/.initial=.6}
1387 \ctikzset{tripoles/european xor port/width/.initial=1.4}
1388 \ctikzset{tripoles/european xor port/height/.initial=.65}
1389 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
1390 \ctikzset{tripoles/european xor port/input height/.initial=.6}
1391 \ctikzset{tripoles/european nand port/width/.initial=1.4}
1392 \ctikzset{tripoles/european nand port/not height/.initial=.3}
1393 \ctikzset{tripoles/european nand port/not width/.initial=.8}
1394 \ctikzset{tripoles/european nand port/height/.initial=.65}
1395 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
1396 \ctikzset{tripoles/european nand port/input height/.initial=.6}
1397 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
1398 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
1399 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
1400 \ctikzset{tripoles/european buffer port/height/.initial=.65}
1401 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
1402 \ctikzset{tripoles/european buffer port/input height/.initial=0}
1403 \ctikzset{tripoles/european not port/width/.initial=1.4}
1404 \ctikzset{tripoles/european not port/not height/.initial=.3}
1405 \ctikzset{tripoles/european not port/not width/.initial=.8}
1406 \ctikzset{tripoles/european not port/height/.initial=.65}
1407 \ctikzset{tripoles/european not port/reserved/.initial=.6}
1408 \ctikzset{tripoles/european not port/input height/.initial=0}
1409 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
1410 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
1411 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
1412 \ctikzset{tripoles/european xnor port/height/.initial=.65}
1413 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
1414 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
1415 \ctikzset{tripoles/european nor port/width/.initial=1.4}
1416 \ctikzset{tripoles/european nor port/not height/.initial=.3}
1417 \ctikzset{tripoles/european nor port/not width/.initial=.8}
1418 \ctikzset{tripoles/european nor port/height/.initial=.65}
1419 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
1420 \ctikzset{tripoles/european nor port/input height/.initial=.6}
1421 % variable number of inputs
1422 \ctikzset{tripoles/european and port/origin/.initial=0.8}
1423 \ctikzset{tripoles/european and port/inputs/.initial=2}
1424 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
1425 \ctikzset{tripoles/european nand port/inputs/.initial=2}
1426 \ctikzset{tripoles/european or port/origin/.initial=0.8}
1427 \ctikzset{tripoles/european or port/inputs/.initial=2}
1428 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
1429 \ctikzset{tripoles/european nor port/inputs/.initial=2}
1430 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
1431 \ctikzset{tripoles/european xor port/inputs/.initial=2}
1432 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
1433 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
1434 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
1435 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
1436 \ctikzset{tripoles/european not port/origin/.initial=0.8}
1437 \ctikzset{tripoles/european not port/inputs/.initial=1}%
1438 %%% parameters that are not used anymore after multi-input
1439 %%% gates --- left for compatibility of source code.
1440 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
1441 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
1442 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
1443 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
1444 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
1445 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
1446 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
1447 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
1448 % switches for logic gates
1449 %
1450 \pgfkeys{/tikz/number inputs/.initial=0}
1451 \pgfkeys{/tikz/number inputs/.default=0}
1452
1453 %% flip-flop specific keys (most others are the same as chips)
1454
1455 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
1456 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
1457 \ctikzset{multipoles/flipflop/width/.initial=1.2}
1458 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
1459 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
1460
1461 %% muxdemuxes keys
1462
1463 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
1464 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
1465 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
1466 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
1467 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
1468 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
1469 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
1470 \ctikzset{multipoles/muxdemux/NL/.initial=8}
1471 \ctikzset{multipoles/muxdemux/NR/.initial=1}
1472 \ctikzset{multipoles/muxdemux/NB/.initial=3}
1473 \ctikzset{multipoles/muxdemux/NT/.initial=0}
1474 \ctikzset{multipoles/muxdemux/square pins/.initial=0}
1475 %
1476 % switches for op amps
1477 % changing input polarity
1478 %
1479 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
1480 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1481 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1482 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1483 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1484 %
1485 % changing output polarity (for fully diff objects)
1486 %
1487 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
1488 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1489 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1490 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1491 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1492
1493 % Operational amplifier
1494 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
1495 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
1496 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
1497 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
1498 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
1499 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1500
1501 % Fully differential operational amplifier
1502 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
1503 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
1504 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
1505 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
1506 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
1507 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
1508 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1509
1510 \ctikzset{tripoles/en amp/width/.initial=1.7}
1511 \ctikzset{tripoles/en amp/port width/.initial=.7}
1512 \ctikzset{tripoles/en amp/height/.initial=1.6}
1513 \ctikzset{tripoles/en amp/input height/.initial=.3}
1514 \ctikzset{tripoles/en amp/up pos/.initial=.45}
1515 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1516 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
1517 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
1518 \tikzset{
1519 en amp text/.code = {%
1520 \ctikzsetvalof{tripoles/en amp/text}{#1}%
1521 },
1522 en amp text A/.code = {%
1523 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
1524 },
1525 }
1526
1527 % Transconductance amplifier
1528 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
1529 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
1530 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
1531 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
1532 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
1533 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
1534 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1535
1536 % Instrumentation amplifier
1537 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
1538 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
1539 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
1540 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1541 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
1542 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
1543 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1544 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1545
1546 % Instrumentation amplifier with differential output
1547 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
1548 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
1549 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
1550 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1551 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
1552 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
1553 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
1554 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1555 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1556
1557 % Instrumentation amplifier with gain resistor terminals
1558 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
1559 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
1560 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
1561 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
1562 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
1563 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
1564 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
1565 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
1566 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1567
1568 % Plain amplifier
1569 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
1570 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
1571 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
1572 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
1573 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
1574
1575 % changing fonts and symbols of amplifiers
1576 \ctikzset{amplifiers/symbol font/.code={%
1577 \ctikzset{tripoles/inst amp ra/font=#1}%
1578 \ctikzset{tripoles/fd inst amp/font=#1}%
1579 \ctikzset{tripoles/inst amp/font=#1}%
1580 \ctikzset{tripoles/gm amp/font=#1}%
1581 \ctikzset{tripoles/en amp/font=#1}%
1582 \ctikzset{tripoles/fd op amp/font=#1}%
1583 \ctikzset{tripoles/op amp/font=#1}%
1584 }}
1585 \ctikzset{amplifiers/plus/.initial={$+$}}
1586 \ctikzset{amplifiers/minus/.initial={$-$}}
1587 \tikzset{amp symbol font/.code={%
1588 \ctikzset{amplifiers/symbol font={#1}}%
1589 }
1590 }
1591 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
1592 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
1593 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
1594 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
1595
1596 \ctikzset{tripoles/thyristor/height/.initial=1.10}
1597 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
1598 \ctikzset{tripoles/thyristor/width/.initial=1.0}
1599 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
1600 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
1601 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
1602
1603 \ctikzset{tripoles/triac/height/.initial=1.1}
1604 \ctikzset{tripoles/triac/width/.initial=1}
1605 \ctikzset{tripoles/triac/diode width left/.initial=.3}
1606 \ctikzset{tripoles/triac/diode width right/.initial=.3}
1607
1608 %% Cute switches
1609 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
1610 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
1611 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
1612 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
1613 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
1614
1615 \ctikzset{tripoles/spdt/width/.initial=.85}
1616 \ctikzset{tripoles/spdt/height/.initial=.45}
1617 \ctikzset{tripoles/spdt/margin/.initial=.45}
1618
1619 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
1620 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
1621 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
1622
1623 \ctikzset{tripoles/mixer/width/.initial=0.7}
1624 \ctikzset{tripoles/adder/width/.initial=0.7}
1625 \ctikzset{tripoles/circulator/width/.initial=.7}
1626 \ctikzset{tripoles/oscillator/width/.initial=.7}
1627
1628
1629 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
1630 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
1631
1632 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
1633 \ctikzset{quadpoles/transformer/width/.initial=1.5}
1634 \ctikzset{quadpoles/transformer/width1/.initial=.4}
1635 \ctikzset{quadpoles/transformer/height/.initial=1.5}
1636 \ctikzset{quadpoles/transformer/height1/.initial=.8}
1637 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
1638 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
1639 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
1640 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
1641 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
1642 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
1643 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
1644 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
1645 \ctikzset{quadpoles/fourport/width/.initial=1.3}
1646 \ctikzset{quadpoles/fourport/height/.initial=1.3}
1647 \ctikzset{quadpoles/coupler/width/.initial=1.3}
1648 \ctikzset{quadpoles/coupler/height/.initial=1.3}
1649 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
1650 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
1651
1652 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
1653
1654 \ctikzset{quadpoles style/.is choice}
1655 \ctikzset{quadpoles style/inward/.code={% default value
1656 \ctikzset{quadpoles/transformer/inner=0.4}%
1657 \ctikzset{quadpoles/transformer/width=1.5}%
1658 \ctikzset{quadpoles/transformer core/inner=0.4}%
1659 \ctikzset{quadpoles/transformer core/width=1.5}%
1660 \ctikzset{quadpoles/gyrator/inner=0.4}%
1661 \ctikzset{quadpoles/gyrator/width=1.5}%
1662 }%
1663 }
1664 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
1665 \ctikzset{quadpoles/transformer/inner=1}%
1666 \ctikzset{quadpoles/transformer/width=0.6}%
1667 \ctikzset{quadpoles/transformer core/inner=1}%
1668 \ctikzset{quadpoles/transformer core/width=0.6}%
1669 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
1670 \ctikzset{quadpoles/gyrator/width=0.6}%
1671 }%
1672 }
1673
1674 %
1675 % multipoles
1676 %
1677 \ctikzset{multipoles/thickness/.initial=2}
1678 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
1679 % DIP (dual in line package) chips
1680 \ctikzset{multipoles/dipchip/width/.initial=1.2}
1681 \ctikzset{multipoles/dipchip/num pins/.initial=8}
1682 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
1683 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
1684 % QFP (quad flat package) chips
1685 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
1686 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
1687 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
1688 % chip numbers
1689 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
1690 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
1691 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
1692 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
1693 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
1694 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
1695 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
1696 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
1697 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
1698 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
1699 % external chip pins
1700 \ctikzset{multipoles/external pins thickness/.initial=1}
1701 \ctikzset{multipoles/external pins width/.initial=0.2}
1702 \ctikzset{multipoles/external pad fraction/.initial=0}
1703 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
1704 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
1705 % topmarks
1706 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
1707 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
1708 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
1709 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
1710 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
1711
1712 % rotary switch by Romano
1713 \ctikzset{multipoles/rotary/thickness/.initial=1}
1714 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
1715 \ctikzset{multipoles/rotary/channels/.initial=5}
1716 \ctikzset{multipoles/rotary/angle/.initial=60}
1717 \ctikzset{multipoles/rotary/wiper/.initial=20}
1718 \ctikzset{multipoles/rotary/arrow/.is choice}
1719 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
1720 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
1721 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
1722 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
1723 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
1724 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
1725 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
1726
1727 \tikzset{%
1728 rotary switch/.style args={#1in#2wiper#3}{%
1729 shape=rotaryswitch,
1730 /tikz/circuitikz/multipoles/rotary/channels=#1,
1731 /tikz/circuitikz/multipoles/rotary/angle=#2,
1732 /tikz/circuitikz/multipoles/rotary/wiper=#3,
1733 },
1734 rotary switch -/.style args={#1in#2wiper#3}{
1735 rotary switch=#1 in #2 wiper #3,
1736 /tikz/circuitikz/multipoles/rotary/arrow=none,
1737 },
1738 rotary switch <-/.style args={#1in#2wiper#3}{
1739 rotary switch=#1 in #2 wiper #3,
1740 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
1741 },
1742 rotary switch ->/.style args={#1in#2wiper#3}{
1743 rotary switch=#1 in #2 wiper #3,
1744 /tikz/circuitikz/multipoles/rotary/arrow=cw,
1745 },
1746 rotary switch <->/.style args={#1in#2wiper#3}{
1747 rotary switch=#1 in #2 wiper #3,
1748 /tikz/circuitikz/multipoles/rotary/arrow=both,
1749 },
1750 % Notice that these should be the same as the initial values of the keys
1751 rotary switch/.default={5 in 60 wiper 20},
1752 rotary switch -/.default={5 in 60 wiper 20},
1753 rotary switch <-/.default={5 in 60 wiper 20},
1754 rotary switch ->/.default={5 in 60 wiper 20},
1755 rotary switch <->/.default={5 in 60 wiper 20},
1756 }
1757
1758 % %Mechanical section
1759 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
1760 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
1761 \ctikzset{bipoles/spring/height/.initial=.5}
1762 \ctikzset{bipoles/spring/width/.initial=.5}
1763 \ctikzset{bipoles/inerter/height/.initial=.7}
1764 \ctikzset{bipoles/inerter/width/.initial=.175}
1765 \ctikzset{bipoles/mass/height/.initial=.55}
1766 \ctikzset{bipoles/mass/box height/.initial=.4}
1767 \ctikzset{bipoles/mass/width/.initial=.5}
1768
1769 \ctikzset{bipoles/damper/height/.initial=.35}
1770 \ctikzset{bipoles/damper/length/.initial=.3}
1771 \ctikzset{bipoles/damper/width/.initial=.4}
1772
1773
1774 \ctikzset{bipole/.is family}
1775 \ctikzset{bipole/kind/.initial=}
1776 \ctikzset{bipole/name/.initial=}
1777 \newif\ifpgf@circuit@bipole@isvoltage
1778 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
1779 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
1780 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
1781 \newif\ifpgf@circuit@bipole@strokedsymbol
1782 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
1783 \newif\ifpgf@circuit@bipole@iscurrent
1784 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
1785
1786 \ctikzset{bipole/voltage/.is family}
1787 \newif\ifpgf@circuit@bipole@voltage@backward
1788 \ctikzset{bipole/voltage/direction/.is choice}
1789 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1790 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1791 \newif\ifpgf@circuit@bipole@voltage@below
1792 \ctikzset{bipole/voltage/position/.is choice}
1793 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
1794 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
1795
1796 \ctikzset{bipole/voltage/label/unit/.initial=}
1797 \ctikzset{bipole/voltage/label/name/.initial=}
1798
1799 \ctikzset{bipole/current/.is family}
1800 \newif\ifpgf@circuit@bipole@current@backward
1801 \ctikzset{bipole/current/direction/.is choice}
1802 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
1803 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
1804 \newif\ifpgf@circuit@bipole@current@before
1805 \ctikzset{bipole/current/x position/.is choice}
1806 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
1807 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
1808 \newif\ifpgf@circuit@bipole@current@below
1809 \ctikzset{bipole/current/y position/.is choice}
1810 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
1811 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
1812 \ctikzset{bipole/current/label/unit/.initial=}
1813 \ctikzset{bipole/current/label/name/.initial=}
1814
1815 \ctikzset{bipole/flow/.is family}
1816 \newif\ifpgf@circuit@bipole@flow@backward
1817 \ctikzset{bipole/flow/direction/.is choice}
1818 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
1819 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
1820 \newif\ifpgf@circuit@bipole@flow@before
1821 \ctikzset{bipole/flow/x position/.is choice}
1822 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
1823 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
1824 \newif\ifpgf@circuit@bipole@flow@below
1825 \ctikzset{bipole/flow/y position/.is choice}
1826 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
1827 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
1828 \ctikzset{bipole/flow/label/unit/.initial=}
1829 \ctikzset{bipole/flow/label/name/.initial=}
1830 \ctikzset{flow/distance/.initial = .5}
1831 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
1832
1833 \ctikzset{bipole/label/.is family}
1834 \ctikzset{bipole/label/position/.initial=90}
1835 \ctikzset{bipole/label/unit/.initial=}
1836 \ctikzset{bipole/label/name/.initial=}
1837 \ctikzset{bipole/annotation/.is family}
1838 \ctikzset{bipole/annotation/position/.initial=-90}
1839 \ctikzset{bipole/annotation/unit/.initial=}
1840 \ctikzset{bipole/annotation/name/.initial=}
1841
1842 \newif\ifpgf@circuit@europeanresistor
1843 \ctikzset{resistor/.is choice}
1844 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
1845 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
1846
1847 \ctikzset{inductor/.is choice}
1848 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
1849 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
1850 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
1851
1852 %
1853 % Flipping arrows in LED and photodiodes
1854 %
1855 \newif\ifpgf@led@fliparrows
1856 \newif\ifpgf@pd@fliparrows
1857 \pgf@led@fliparrowsfalse
1858 \pgf@pd@fliparrowsfalse
1859 %
1860 % by default the arrows start (LED) and go (PD) to the anode.
1861 %
1862 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
1863 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
1864 %
1865 % but they can start form the cathode (LED) or go to it (PD)
1866 %
1867 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
1868 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
1869
1870 \newif\ifpgf@circuit@strokediode
1871 \newif\ifpgf@circuit@fulldiode
1872 \pgf@circuit@strokediodefalse
1873 \pgf@circuit@fulldiodefalse
1874
1875 \ctikzset{diode/.is choice}
1876 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
1877 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
1878 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
1879
1880 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
1881 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
1882 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
1883
1884 \ctikzset{thickness/.initial=2}
1885 \ctikzset{color/.initial=black}
1886 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
1887
1888 \newif\ifpgf@circ@siunitx
1889 \newif\ifpgf@circ@siunitx@res
1890
1891 %
1892 % voltage and current options
1893 %
1894
1895 \newif\ifpgf@circuit@europeancurrent
1896 \newif\ifpgf@circuit@europeanvoltage
1897 \newif\ifpgf@circuit@bipole@voltage@straight
1898
1899 \ctikzset{voltage/.is choice}
1900 %
1901 % straight is expected to be a subset of european, so disable it in american style
1902 %
1903 \ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse\pgf@circuit@bipole@voltage@straightfalse}}
1904 \ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straightfalse}}
1905 \ctikzset{voltage/straight/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straighttrue}}
1906 \ctikzset{voltage/curved/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straighttrue}}
1907
1908 \ctikzset{current/.is choice}
1909 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
1910 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
1911
1912 % this is left for backward compatibility...
1913 \ctikzset{straight/.is choice}
1914 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
1915 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
1916 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
1917 % never used, removed (RG 2020-05-17)
1918 % \ctikzset{straightvoltage value/.initial=true}
1919 % \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
1920
1921 %
1922 % voltage is used also to set parameters, apart for the /.is choice
1923 % above. I hope it is ok --- would be a mess otherwise
1924 %
1925
1926 \ctikzset{voltage/distance from node/.initial=.5} %\pgf@circ@Rlen units
1927 \ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
1928 \ctikzset{voltage/bump a/.initial=1.2}
1929 \ctikzset{voltage/bump b/.initial=1.5}
1930 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
1931 \ctikzset{voltage shift/.style={voltage/shift=#1}}
1932 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1933 \ctikzset{voltage/european label distance/.initial=1.4}
1934 \ctikzset{voltage/american label distance/.initial=1.1}
1935 % shaping the +/- sign, see pgfcircvoltage.tex
1936 \ctikzset{voltage/american font/.initial={}}
1937 \ctikzset{voltage/american plus/.initial={$+$}}
1938 \ctikzset{voltage/american minus/.initial={$-$}}
1939
1940 % special cases for voltage positions
1941 \ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
1942 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
1943 \ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
1944 %\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
1945 \ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
1946 \ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
1947 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
1948 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
1949 \ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
1950 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
1951 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
1952 \ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
1953 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
1954 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
1955 \ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
1956 %\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
1957 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
1958 \ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
1959 %\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
1960 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
1961 \ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
1962 %\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
1963 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
1964 \ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
1965 %\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
1966 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
1967 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
1968 %\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
1969 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
1970 %\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
1971 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
1972 %
1973 % american open voltage adjusting
1974 %
1975 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
1976 \ctikzset{american open voltage/.is choice}
1977 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
1978 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
1979
1980 %
1981 % currents
1982 %
1983 \ctikzset{current/distance/.initial = .5}
1984
1985 %
1986 % voltage and current styles
1987 %
1988
1989 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
1990 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
1991 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
1992 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
1993 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
1994 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
1995 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
1996
1997 \newif\ifpgf@circuit@europeangfsurgearrester
1998 \ctikzset{gas filled surge arrester choice/.is choice}
1999 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
2000 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
2001
2002 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
2003 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
2004 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
2005 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
2006 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
2007 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
2008 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
2009
2010 %
2011 % general styles
2012 %
2013
2014 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
2015 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
2016 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
2017
2018
2019 % noise sources
2020 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
2021
2022 \ctikzset{label/align/.is choice}
2023 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
2024 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
2025 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
2026
2027 % seven segment displays by RGtti
2028
2029 \newif\ifpgf@circ@sevenseg@dot
2030 \newif\ifpgf@circ@sevenseg@box
2031 \def\pgf@circ@sevenseg@dotstate{empty}
2032 \ctikzset{seven seg/.is family}
2033 \ctikzset{seven seg/dot/.is choice}
2034 % none means no dot, not space for it. Empty means no dot, but space
2035 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
2036 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
2037 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
2038 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
2039 %
2040 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
2041 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
2042 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
2043 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
2044 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
2045 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
2046 \ctikzset{seven seg/box/.is choice}
2047 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
2048 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
2049
2050 \ctikzset{seven seg/bits/.initial=0000000}
2051
2052 \ctikzset{seven seg/value/.code={%
2053 \edef\@@tmp{#1}%
2054 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
2055 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
2056 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
2057 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
2058 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
2059 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
2060 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
2061 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
2062 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
2063 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
2064 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2065 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2066 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2067 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2068 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2069 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2070 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2071 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2072 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2073 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2074 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2075 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2076 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2077 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2078 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2079 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2080 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2081 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2082 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
2083 }}
2084
2085 \tikzset{%
2086 seven segment val/.style args={#1dot#2box#3}{%
2087 shape=bare7seg,
2088 /tikz/circuitikz/seven seg/value=#1,
2089 /tikz/circuitikz/seven seg/dot=#2,
2090 /tikz/circuitikz/seven seg/box=#3,
2091 },
2092 seven segment bits/.style args={#1dot#2box#3}{%
2093 shape=bare7seg,
2094 /tikz/circuitikz/seven seg/bits=#1,
2095 /tikz/circuitikz/seven seg/dot=#2,
2096 /tikz/circuitikz/seven seg/box=#3,
2097 },
2098 }
2099
2100
2101 %%%%%%%%%% new
2102 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
2103
2104 % Electronic tubes: diodetube, triode, tetrode and pentode
2105 \ctikzset{tubes/width/.initial=1} % relative width
2106 \ctikzset{tubes/height/.initial=1.4} % relative height
2107 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
2108 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
2109 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
2110 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
2111 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
2112 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
2113 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
2114 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
2115 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
2116 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
2117 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
2118 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
2119 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
2120
2121 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
2122 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
2123 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
2124 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
2125 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
2126 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
2127 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
2128 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
2129 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
2130
2131 % powerelectronic blocks
2132 \ctikzset{bipoles/sacdc/width/.initial=.7}
2133 \ctikzset{bipoles/sdcac/width/.initial=.7}
2134 \ctikzset{bipoles/tacdc/width/.initial=.7}
2135 \ctikzset{bipoles/tdcac/width/.initial=.7}
2136 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
2137
2138 %%%---------- close: tex/pgfcirc.defines
2139 %%%%%%%%%%% Springe nach tex/pgfcircutils
2140 %%%---------- open: tex/pgfcircutils.tex
2141 % Copyright 2018-2026 by Romano Giannetti
2142 % Copyright 2015-2026 by Stefan Lindner
2143 % Copyright 2013-2026 by Stefan Erhardt
2144 % Copyright 2007-2026 by Massimo Redaelli
2145 %
2146 % This file may be distributed and/or modified
2147 %
2148 % 1. under the LaTeX Project Public License and/or
2149 % 2. under the GNU Public License.
2150 %
2151 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2152
2153 \def\pgf@circ@handleSI#1{
2154 \noexpandarg
2155 \def\pgf@temp{}
2156 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
2157 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
2158
2159 \ifnum\pgf@circ@handleSI@unit@len=0
2160 \pgf@circ@siunitx@resfalse
2161 \else
2162 \IfEndWith{#1}{>}{
2163 \pgf@circ@siunitx@restrue
2164 \noexpandarg
2165 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
2166 %\typeout{si |#1|}
2167 }{
2168 \pgf@circ@siunitx@resfalse
2169 %\typeout{no si |#1|}
2170 }
2171 \fi
2172 }
2173
2174 \def\pgf@circ@ifkeyempty#1{
2175 \pgfextra{
2176 \ctikzset{#1/.get=\pgf@circ@temp}
2177 \edef\pgf@temp{}
2178 }
2179 \ifx\pgf@circ@temp\pgf@temp
2180 }
2181
2182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2183 %% Math routines
2184
2185 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
2186
2187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2188 %% useful commands
2189
2190 \ifpgfutil@format@is@latex
2191 %% flipping text
2192 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
2193 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
2194 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
2195 % text mode overbar
2196 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2197 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
2198 \else\ifpgfutil@format@is@plain
2199 % text mode overbar
2200 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2201 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2202 \else\ifpgfutil@format@is@context
2203 % text mode overbar
2204 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2205 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2206 \fi\fi\fi
2207
2208 %%%%%%%%%%%%%%%%%%%%%%%%%%%
2209 %% switch to use fpu in reciprocal scale transformations
2210 %%
2211 %% this code has been contributed by Schrödinger's cat
2212 %% https://tex.stackexchange.com/a/529159/38080
2213 %%
2214 \tikzset{use fpu reciprocal/.code={%
2215 \def\pgfmathreciprocal@##1{%
2216 \begingroup
2217 \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
2218 \pgfmathparse{1/##1}%
2219 \pgfmath@smuggleone\pgfmathresult
2220 \endgroup
2221 }}}%
2222
2223 %%%---------- close: tex/pgfcircutils
2224
2225 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2226 %%%---------- open: tex/pgfcircshapes.tex
2227 % Copyright 2018-2026 by Romano Giannetti
2228 % Copyright 2015-2026 by Stefan Lindner
2229 % Copyright 2013-2026 by Stefan Erhardt
2230 % Copyright 2007-2026 by Massimo Redaelli
2231 %
2232 % This file may be distributed and/or modified
2233 %
2234 % 1. under the LaTeX Project Public License and/or
2235 % 2. under the GNU Public License.
2236 %
2237 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2238
2239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2240 %% Other shapes
2241
2242 %% Nothing
2243
2244 \pgfdeclareshape{emptyshape}{
2245 \savedanchor{\northeast}{%
2246 \pgf@x=.5\wd\pgfnodeparttextbox%
2247 \pgf@y=.5\ht\pgfnodeparttextbox%
2248 }
2249 \anchor{north}{\northeast\pgf@x=0cm\relax}
2250 \anchor{east}{\northeast\pgf@y=0cm\relax}
2251 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2252 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2253 \anchor{north east}{\northeast}
2254 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2255 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2256 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2257 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2258 \anchor{center}{
2259 \pgfpointorigin
2260 }
2261 }
2262 %
2263 % Provision for changing opacity. Only expert use, see the manual.
2264 %
2265 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2266 \tikzset{open poles opacity/.code={%
2267 \ctikzset{poles/open fill opacity=#1}%
2268 }}
2269 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2270 \tikzset{full poles opacity/.code={%
2271 \ctikzset{poles/full fill opacity=#1}%
2272 }}
2273
2274 %% Full terminal
2275
2276 \pgfdeclareshape{circ}{
2277 \anchor{center}{
2278 \pgfpointorigin
2279 }
2280 \savedanchor\northwest{%
2281 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2282 \pgf@x=-\pgf@y
2283 }
2284 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2285 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2286 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2287 \anchor{west}{ \northwest \pgf@y=0pt }
2288 \anchor{w}{ \northwest \pgf@y=0pt }
2289 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2290 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2291 \anchor{north}{ \northwest \pgf@x=0pt }
2292 \anchor{n}{ \northwest \pgf@x=0pt }
2293 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2294 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2295 \anchor{north west}{ \northwest }
2296 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2297 \anchorborder{
2298 \pgf@circ@res@left=\pgf@x
2299 \pgf@circ@res@up=\pgf@y
2300 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2301 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2302 }
2303 \behindforegroundpath{
2304
2305 \pgfscope
2306 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2307 \pgfsetcolor{\ctikzvalof{color}}
2308 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2309 \pgfusepath{draw,fill}
2310 \endpgfscope
2311
2312 }
2313 }
2314
2315 %% Empty round terminal
2316
2317 \pgfdeclareshape{ocirc}{
2318 \anchor{center}{
2319 \pgfpointorigin
2320 }
2321 \savedanchor\northwest{%
2322 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2323 \pgf@x=-\pgf@y
2324 }
2325 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2326 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2327 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2328 \anchor{west}{ \northwest \pgf@y=0pt }
2329 \anchor{w}{ \northwest \pgf@y=0pt }
2330 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2331 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2332 \anchor{north}{ \northwest \pgf@x=0pt }
2333 \anchor{n}{ \northwest \pgf@x=0pt }
2334 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2335 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2336 \anchor{north west}{ \northwest }
2337 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2338 \anchorborder{
2339 \pgf@circ@res@left=\pgf@x
2340 \pgf@circ@res@up=\pgf@y
2341 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2342 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2343 }
2344
2345 \behindforegroundpath{
2346
2347 \pgfscope
2348 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2349 \pgfsetcolor{\ctikzvalof{color}}
2350 \ifx\tikz@fillcolor\pgfutil@empty
2351 % set the default fill color to white
2352 \pgfsetfillcolor{white}
2353 % ...but override it if the class is defined!
2354 % note that this element has no class, but will inherit it when used
2355 % into another component
2356 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2357 \else
2358 \pgfsetfillcolor{\tikz@fillcolor}
2359 \fi
2360 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2361 \pgfusepath{draw,fill}
2362 \endpgfscope
2363
2364 }
2365 }
2366
2367 %% Diamond terminal
2368
2369 \pgfdeclareshape{diamondpole}{
2370 \anchor{center}{
2371 \pgfpointorigin
2372 }
2373 \savedanchor\northwest{%
2374 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2375 \pgf@x=-\pgf@y
2376 }
2377 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2378 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2379 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2380 \anchor{west}{ \northwest \pgf@y=0pt }
2381 \anchor{w}{ \northwest \pgf@y=0pt }
2382 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2383 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2384 \anchor{north}{ \northwest \pgf@x=0pt }
2385 \anchor{n}{ \northwest \pgf@x=0pt }
2386 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2387 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2388 \anchor{north west}{ \northwest }
2389 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2390 \anchorborder{
2391 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2392 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2393 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2394 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2395 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2396 \pgfextracty{\pgf@circ@res@up}{\northwest}
2397 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2398 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2399 \pgfpointintersectionoflines
2400 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2401 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2402 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2403 \pgf@x=\@@switchx\pgf@x
2404 \pgf@y=\@@switchy\pgf@y
2405 }
2406 \behindforegroundpath{
2407 \pgfscope
2408 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2409 \pgftransformrotate{45}
2410 \pgfpathrectanglecorners
2411 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2412 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2413 \pgfsetcolor{\ctikzvalof{color}}
2414 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2415 \pgfusepath{draw,fill}
2416 \endpgfscope
2417 }
2418 }
2419
2420 %% Diamond terminal, unfilled
2421
2422 \pgfdeclareshape{odiamondpole}{
2423 \anchor{center}{
2424 \pgfpointorigin
2425 }
2426 \savedanchor\northwest{%
2427 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2428 \pgf@x=-\pgf@y
2429 }
2430 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2431 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2432 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2433 \anchor{west}{ \northwest \pgf@y=0pt }
2434 \anchor{w}{ \northwest \pgf@y=0pt }
2435 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2436 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2437 \anchor{north}{ \northwest \pgf@x=0pt }
2438 \anchor{n}{ \northwest \pgf@x=0pt }
2439 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2440 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2441 \anchor{north west}{ \northwest }
2442 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2443 \anchorborder{
2444 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2445 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2446 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2447 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2448 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2449 \pgfextracty{\pgf@circ@res@up}{\northwest}
2450 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2451 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2452 \pgfpointintersectionoflines
2453 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2454 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2455 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2456 \pgf@x=\@@switchx\pgf@x
2457 \pgf@y=\@@switchy\pgf@y
2458 }
2459 \behindforegroundpath{
2460 \pgfscope
2461 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2462 \pgftransformrotate{45}
2463 \pgfpathrectanglecorners
2464 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2465 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2466 \pgfsetcolor{\ctikzvalof{color}}
2467 \ifx\tikz@fillcolor\pgfutil@empty
2468 % set the default fill color to white
2469 \pgfsetfillcolor{white}
2470 % ...but override it if the class is defined!
2471 % note that this element has no class, but will inherit it when used
2472 % into another component
2473 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2474 \else
2475 \pgfsetfillcolor{\tikz@fillcolor}
2476 \fi
2477 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2478 \pgfusepath{draw,fill}
2479 \endpgfscope
2480 }
2481 }
2482
2483 %% square terminal, filled
2484
2485 \pgfdeclareshape{squarepole}{
2486 \anchor{center}{
2487 \pgfpointorigin
2488 }
2489 \savedanchor\northwest{%
2490 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2491 \pgf@x=-\pgf@y
2492 }
2493 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2494 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2495 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2496 \anchor{west}{ \northwest \pgf@y=0pt }
2497 \anchor{w}{ \northwest \pgf@y=0pt }
2498 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2499 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2500 \anchor{north}{ \northwest \pgf@x=0pt }
2501 \anchor{n}{ \northwest \pgf@x=0pt }
2502 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2503 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2504 \anchor{north west}{ \northwest }
2505 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2506 \anchorborder{
2507 \pgf@xa=\pgf@x
2508 \pgf@ya=\pgf@y
2509 \pgfextracty{\pgf@circ@res@up}{\northwest}
2510 \pgfpointborderrectangle
2511 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2512 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2513 }
2514 \behindforegroundpath{
2515 \pgfscope
2516 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2517 \pgfpathrectanglecorners
2518 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2519 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2520 \pgfsetcolor{\ctikzvalof{color}}
2521 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2522 \pgfusepath{draw,fill}
2523 \endpgfscope
2524 }
2525 }
2526 %% square terminal, unfilled
2527
2528 \pgfdeclareshape{osquarepole}{
2529 \anchor{center}{
2530 \pgfpointorigin
2531 }
2532 \savedanchor\northwest{%
2533 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2534 \pgf@x=-\pgf@y
2535 }
2536 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2537 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2538 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2539 \anchor{west}{ \northwest \pgf@y=0pt }
2540 \anchor{w}{ \northwest \pgf@y=0pt }
2541 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2542 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2543 \anchor{north}{ \northwest \pgf@x=0pt }
2544 \anchor{n}{ \northwest \pgf@x=0pt }
2545 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2546 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2547 \anchor{north west}{ \northwest }
2548 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2549 \anchorborder{
2550 \pgf@xa=\pgf@x
2551 \pgf@ya=\pgf@y
2552 \pgfextracty{\pgf@circ@res@up}{\northwest}
2553 \pgfpointborderrectangle
2554 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2555 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2556 }
2557 \behindforegroundpath{
2558 \pgfscope
2559 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2560 \pgfpathrectanglecorners
2561 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2562 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2563 \pgfsetcolor{\ctikzvalof{color}}
2564 \ifx\tikz@fillcolor\pgfutil@empty
2565 % set the default fill color to white
2566 \pgfsetfillcolor{white}
2567 % ...but override it if the class is defined!
2568 % note that this element has no class, but will inherit it when used
2569 % into another component
2570 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2571 \else
2572 \pgfsetfillcolor{\tikz@fillcolor}
2573 \fi
2574 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2575 \pgfusepath{draw,fill}
2576 \endpgfscope
2577 }
2578 }
2579 % BNC connector
2580
2581 \pgfdeclareshape{bnc}{
2582 \anchor{center}{
2583 \pgfpointorigin
2584 }
2585 % BNC size is 2.5 times the size of the internal "ocirc"
2586 \savedanchor\northwest{%
2587 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2588 \pgf@y=2.5\pgf@y
2589 \pgf@x=-\pgf@y
2590 }
2591 % center is on the opening
2592 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2593 \anchor{zero}{ \pgfpointorigin }
2594 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2595 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2596 % geo-anchors
2597 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2598 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2599 \anchor{west}{ \northwest \pgf@y=0pt }
2600 \anchor{left}{ \northwest \pgf@y=0pt }
2601 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2602 \anchor{north}{ \northwest \pgf@x=0pt }
2603 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2604 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2605 \anchor{north west}{ \northwest }
2606 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2607 % put the node text above and centered
2608 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2609 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2610 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2611 }
2612 }
2613 \anchorborder{
2614 \pgf@circ@res@left=\pgf@x
2615 \pgf@circ@res@up=\pgf@y
2616 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2617 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2618 }
2619 \behindforegroundpath{
2620 \pgfextracty{\pgf@circ@res@other}{\northwest}
2621 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2622 \pgfscope
2623 \pgfstartlinewidth=\pgflinewidth
2624 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2625 \pgfsetcolor{\ctikzvalof{color}}
2626 % external circle
2627 \pgfscope
2628 % clipping path: first a rectangle bigger then the shape
2629 % to avoid problems with the line thickness
2630 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2631 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2632 % next the opening to the right
2633 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2634 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2635 % do the difference and clip before drawing
2636 \pgfseteorule
2637 \pgfusepath{clip}
2638 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2639 \pgfusepath{draw}
2640 \endpgfscope
2641 % internal circle
2642 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2643 \pgf@circ@draworfill
2644 % and the contact line to the right
2645 \pgfsetlinewidth{\pgfstartlinewidth}
2646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2647 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2648 \pgfusepath{draw}
2649 \endpgfscope
2650 }
2651 }
2652
2653 %% Fill for correct rectangular joins
2654
2655 \pgfdeclareshape{rectjoinfill}{
2656 \savedanchor{\northeast}{%
2657 \pgf@x=.5\pgflinewidth%
2658 \pgf@y=.5\pgflinewidth%
2659 }
2660 \anchor{north}{\northeast\pgf@x=0cm\relax}
2661 \anchor{east}{\northeast\pgf@y=0cm\relax}
2662 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2663 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2664 \anchor{north east}{\northeast}
2665 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2666 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2667 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2668 \anchor{center}{
2669 \pgfpointorigin
2670 }
2671 \anchorborder{
2672 \pgf@circ@res@left=\pgf@x
2673 \pgf@circ@res@up=\pgf@y
2674 }
2675 \behindforegroundpath{
2676 \pgfscope
2677 \pgfpathrectanglecorners
2678 {\pgfpoint{0}{.5\pgflinewidth}}
2679 {\pgfpoint{0}{-.5\pgflinewidth}}
2680 \pgfsetcolor{\ctikzvalof{color}}
2681 \pgfusepath{draw,fill}
2682 \endpgfscope
2683 }
2684 }
2685
2686 %% transistor arrow
2687
2688 \def\pgf@circ@find@linescale{
2689 % find the scale inverse of the scale factor: line width do not scale
2690 % with scale=..., transform shape so we have to counteract it.
2691 \iftikz@fullytransformed % this is true if `transform shape` is active
2692 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2693 % Note that this trick is not working inside a `spy` environment...
2694 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2695 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2696 \else
2697 \pgfmathsetmacro{\@@factor}{1.0}
2698 \fi
2699 }
2700
2701 \pgfdeclareshape{trarrow}{%
2702 % this arrow is only filled but grows with the linewidth, more or less
2703 % like currarrow do
2704 \savedanchor{\northeast}{%
2705 \pgf@circ@res@step = \pgf@circ@Rlen
2706 \pgf@circ@find@linescale
2707 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2708 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2709 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2710 }
2711 % The arrow size should be more or less the same of a currarrow, which is
2712 % both filled and stroke, for backward output compatibility (more or less)
2713 %
2714 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2715 % |-\__ currarrow as the tip at (W,0)
2716 % | | and the upper tail at (-0.7*W, 0.8*W)
2717 % | \__ it then "overshoot" do to the linew width L
2718 % | \__ xangle \alpha
2719 % ---0------->
2720 %
2721 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2722 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2723 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2724 %
2725 \savedanchor{\northwest}{%
2726 \pgf@circ@res@step = \pgf@circ@Rlen
2727 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2728 \pgf@circ@find@linescale
2729 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2730 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2731 }
2732 \savedanchor{\tip}{%
2733 \pgf@circ@res@step = \pgf@circ@Rlen
2734 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2735 \pgf@circ@find@linescale
2736 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2737 }
2738 \anchor{north}{\northeast\pgf@x=0cm\relax}
2739 \anchor{east}{\northeast\pgf@y=0cm\relax}
2740 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2741 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2742 \anchor{north east}{\northeast}
2743 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2744 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2745 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2746 \anchor{center}{
2747 \pgfpointorigin
2748 }
2749 \anchor{tip}{
2750 \tip
2751 }
2752 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2753 \tip
2754 \pgf@circ@find@linescale
2755 \pgf@circ@res@temp=\@@factor\pgflinewidth
2756 \advance\pgf@x by -.5\pgf@circ@res@temp
2757 }
2758 \behindforegroundpath{
2759 \pgfscope
2760 \northwest
2761 \pgf@circ@res@up=\pgf@y
2762 \pgf@circ@res@left=\pgf@x
2763 \tip
2764 \pgf@circ@res@step = \pgf@x
2765 %
2766 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2767 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2768 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2769 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2770 \pgfpathclose
2771 \pgfsetcolor{\ctikzvalof{color}}
2772 \pgfusepath{fill} % just fill
2773 \endpgfscope
2774 }
2775 }
2776
2777 %% Current arrow
2778
2779 \pgfdeclareshape{currarrow}{
2780 \savedanchor{\northeast}{%
2781 \pgf@circ@res@step = \pgf@circ@Rlen
2782 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2783 \pgf@x=.5\pgf@circ@res@step
2784 \pgf@y=\pgf@x%
2785 }
2786 \anchor{north}{\northeast\pgf@x=0cm\relax}
2787 \anchor{east}{\northeast\pgf@y=0cm\relax}
2788 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2789 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2790 \anchor{north east}{\northeast}
2791 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2792 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2793 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2794 \anchor{center}{
2795 \pgfpointorigin
2796 }
2797 \anchor{tip}{
2798 \pgfpointorigin
2799 \pgf@circ@res@step = \pgf@circ@Rlen
2800 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2801 \pgf@x =\pgf@circ@res@step
2802 }
2803 \behindforegroundpath{
2804 \pgfscope
2805 \pgf@circ@res@step = \pgf@circ@Rlen
2806 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2807
2808 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2809 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2810 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2811 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2812 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2813 \pgfsetcolor{\ctikzvalof{color}}
2814 \pgfusepath{draw,fill}
2815
2816 \endpgfscope
2817 }
2818 }
2819
2820 %% Flow arrow
2821
2822 \pgfdeclareshape{flowarrow}{
2823 \savedanchor{\northeast}{%
2824 \pgf@circ@res@step = \pgf@circ@Rlen
2825 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2826 \pgf@y=.5\pgf@circ@res@step
2827 \pgf@circ@res@step = \pgf@circ@Rlen
2828 \divide \pgf@circ@res@step by 4
2829 \pgf@x=\pgf@circ@res@step%
2830 }
2831 \anchor{north}{\northeast\pgf@x=0cm\relax}
2832 \anchor{east}{\northeast\pgf@y=0cm\relax}
2833 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2834 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2835 \anchor{north east}{\northeast}
2836 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2837 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2838 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2839 \anchor{text}{% text centered above
2840 \pgfpointorigin
2841 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2842 }
2843 \anchor{center}{
2844 \pgfpointorigin
2845 }
2846 \anchor{tip}{
2847 \pgfpointorigin
2848 \pgf@circ@res@step = \pgf@circ@Rlen
2849 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2850 \pgf@x =\pgf@circ@res@step
2851 }
2852 \behindforegroundpath{
2853 \pgfscope
2854 \pgf@circ@res@step = \pgf@circ@Rlen
2855 \divide \pgf@circ@res@step by 4
2856 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2857 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2858 \pgfsetcolor{\ctikzvalof{color}}
2859 \pgfusepath{draw}
2860 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2861 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2862 \endpgfscope
2863 }
2864 }
2865
2866 %% Input arrow
2867
2868 \pgfdeclareshape{inputarrow}{
2869 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2870 \pgf@circ@res@step = \pgf@circ@Rlen
2871 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2872 \pgf@y=.5\pgf@circ@res@step
2873 \pgf@x=1.7\pgf@circ@res@step
2874 }
2875 \anchor{north}{\northeast\pgf@x=0cm\relax}
2876 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2877 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2878 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2879 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2880 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2881 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2882 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2883 \savedanchor{\tip}{
2884 \pgfpointorigin
2885 }
2886 \anchor{center}{
2887 \tip
2888 }
2889 \anchor{tip}{
2890 \tip
2891 }
2892 \behindforegroundpath{
2893
2894 \pgfscope
2895 \pgf@circ@res@step = \pgf@circ@Rlen
2896 \divide \pgf@circ@res@step by 16
2897
2898 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2899 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2900 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2901 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2902 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2903 \pgfsetcolor{\ctikzvalof{color}}
2904 \pgfusepath{fill}
2905
2906 \endpgfscope
2907 }
2908 }
2909
2910
2911 %% box
2912
2913 \pgfdeclareshape{box}{
2914 \anchor{center}{
2915 \pgfpointorigin
2916 }
2917 \behindforegroundpath{
2918
2919 \pgfscope
2920 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2921 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2922 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2923 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2924 \pgf@circ@draworfill
2925 \endpgfscope
2926 }
2927 }
2928
2929 %% box scaled with blocks
2930
2931 \pgfdeclareshape{blockbox}{
2932 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2933 \anchor{center}{
2934 \pgfpointorigin
2935 }
2936 \behindforegroundpath{
2937 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2938 \pgfscope
2939 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2940 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2941 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2942 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2943 \pgf@circ@draworfill
2944 \endpgfscope
2945 }
2946 }
2947
2948 % full nodes for wire crossing
2949
2950 \pgfdeclareshape{jump crossing}
2951 {
2952 \savedanchor\northwest{%
2953 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2954 \pgf@y=.5\pgf@y
2955 \pgf@x=-\pgf@y
2956 }
2957 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2958 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2959 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2960 \anchor{west}{ \northwest \pgf@y=0pt }
2961 \anchor{w}{ \northwest \pgf@y=0pt }
2962 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2963 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2964 \anchor{north}{ \northwest \pgf@x=0pt }
2965 \anchor{n}{ \northwest \pgf@x=0pt }
2966 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2967 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2968 \anchor{north west}{ \northwest }
2969 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2970 \behindbackgroundpath{
2971 \northwest
2972 \pgf@circ@res@up = \pgf@y
2973 \pgf@circ@res@down = -\pgf@y
2974 \pgf@circ@res@right = -\pgf@x
2975 \pgf@circ@res@left = \pgf@x
2976 % horizontal jumper
2977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2978 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2979 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2980 \pgfsetbeveljoin
2981 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2982 % vertical, broken path
2983 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2984 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2985 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2986 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2987 \pgfusepath{draw}
2988
2989 }
2990 }
2991 \pgfdeclareshape{plain crossing}
2992 {
2993 \savedanchor\northwest{%
2994 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2995 \pgf@y=.5\pgf@y
2996 \pgf@x=-\pgf@y
2997 }
2998 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2999 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3000 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3001 \anchor{west}{ \northwest \pgf@y=0pt }
3002 \anchor{w}{ \northwest \pgf@y=0pt }
3003 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3004 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3005 \anchor{north}{ \northwest \pgf@x=0pt }
3006 \anchor{n}{ \northwest \pgf@x=0pt }
3007 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3008 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3009 \anchor{north west}{ \northwest }
3010 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3011 \behindbackgroundpath{
3012 \northwest
3013 \pgf@circ@res@up = \pgf@y
3014 \pgf@circ@res@down = -\pgf@y
3015 \pgf@circ@res@right = -\pgf@x
3016 \pgf@circ@res@left = \pgf@x
3017 % horizontal jumper
3018 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3019 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3020 % vertical, broken path
3021 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3022 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
3023 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
3024 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3025 \pgfusepath{draw}
3026
3027 }
3028 }
3029
3030 %%%---------- close: tex/pgfcircshapes
3031 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
3032 %%%---------- open: tex/pgfcircmonopoles.tex
3033 % Copyright 2018-2026 by Romano Giannetti
3034 % Copyright 2015-2026 by Stefan Lindner
3035 % Copyright 2013-2026 by Stefan Erhardt
3036 % Copyright 2007-2026 by Massimo Redaelli
3037 %
3038 % This file may be distributed and/or modified
3039 %
3040 % 1. under the LaTeX Project Public License and/or
3041 % 2. under the GNU Public License.
3042 %
3043 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3044
3045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3046 %% Monopoles
3047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3048
3049 %%%%%%%%%%%%%
3050 %% Grounds
3051 %%%%%%%%%%%%%
3052
3053
3054 %% Ground symbol
3055 % #1 -> name
3056 % #2 -> width
3057 % #3 -> depth
3058 % #4 -> code
3059 \long\def\pgf@circ@declareground#1#2#3#4{
3060 \pgfdeclareshape{#1}{
3061 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3062 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3063 \savedanchor{\southeast}{
3064 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3065 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3066 \pgf@x=#2\pgf@x
3067 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3068 \pgf@y=-#3\pgf@y
3069 }
3070 \anchor{north}{\pgfpointorigin}
3071 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3072 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3073 \anchor{south east}{\southeast}
3074 \anchor{south}{\southeast\pgf@x=0pt\relax}
3075 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3076 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3077 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3078 \anchor{left}{\pgfpointorigin}
3079 \anchor{right}{\pgfpointorigin}
3080 \anchor{center}{\pgfpointorigin}
3081 \behindforegroundpath{
3082 \pgf@circ@scaled@Rlen=\scaledRlen
3083 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3084 \pgfscope
3085 \pgfstartlinewidth=\pgflinewidth
3086 #4
3087 \endpgfscope
3088 }
3089 }
3090 }
3091
3092
3093 \pgf@circ@declareground{ground}{0.6}{1.6}{
3094 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3095 \pgfpathmoveto{\pgfpointorigin}
3096 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3097 \pgfusepath{draw}
3098 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3099 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3100 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3101 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3102 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3103 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3104 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3105 \pgfusepath{draw}
3106 }
3107
3108 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3109 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3110 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3111 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3112 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3113 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3114 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3115 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3116 \pgfusepath{draw}
3117 }
3118
3119
3120 \pgf@circ@declareground{rground}{0.6}{1}{
3121 \pgfpathmoveto{\pgfpointorigin}
3122 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3123 \pgfusepath{draw}
3124
3125 \pgfstartlinewidth=\pgflinewidth
3126 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3127
3128 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3129 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3130 \pgfsetroundcap\pgfusepath{draw}
3131 }
3132
3133 \pgf@circ@declareground{tground}{0.6}{0}{
3134 \pgfpathmoveto{\pgfpointorigin}
3135 \pgfusepath{draw}
3136
3137 \pgfstartlinewidth=\pgflinewidth
3138 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3139
3140 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3141 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3142 \pgfusepath{draw}
3143 }
3144
3145 \pgf@circ@declareground{sground}{0.6}{1.8}{
3146 \pgfpathmoveto{\pgfpointorigin}
3147 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3148 \pgfusepath{draw}
3149
3150 \pgfstartlinewidth=\pgflinewidth
3151 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3152
3153 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3154 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3155 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3156 \pgfpathclose
3157 \pgf@circ@draworfill
3158 }
3159
3160 % noiseless ground
3161 \pgf@circ@declareground{nground}{0.9}{1.6}{
3162 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3163 \pgfpathmoveto{\pgfpointorigin}
3164 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3165 \pgfusepath{draw}
3166 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3167 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3168 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3169 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3170 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3171 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3172 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3173 \pgfusepath{draw}
3174 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3175 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3176 \pgfusepath{draw}
3177 }
3178
3179 % protective ground
3180 \pgf@circ@declareground{pground}{0.9}{1.8}{
3181 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3182 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3183 \pgf@circ@draworfill
3184 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3185 \pgfpathmoveto{\pgfpointorigin}
3186 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3187 \pgfusepath{draw}
3188 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3189 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3190 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3191 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3192 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3193 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3194 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3195 \pgfusepath{draw}
3196 }
3197
3198 % chassis ground
3199 \pgf@circ@declareground{cground}{1}{2}{
3200 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3201 \pgfpathmoveto{\pgfpointorigin}
3202 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3203 \pgfusepath{draw}
3204 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3205 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3206 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3207 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3208 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3209 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3210 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3211 \pgfusepath{draw}
3212 }
3213
3214 % Contributed by @fotesan https://github.com/fotesan
3215 % european ground
3216 \pgf@circ@declareground{eground}{1.1}{1.7}{
3217 \pgfpathmoveto{\pgfpointorigin}
3218 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3219 \pgfusepath{draw}
3220
3221 \pgfstartlinewidth=\pgflinewidth
3222 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3223
3224 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3225 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3226 \pgfusepath{draw}
3227
3228 \pgfsetlinewidth{\pgfstartlinewidth}
3229 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3230 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3231 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3232 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3233 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3234 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3235 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3236 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3237 \pgfusepath{draw}
3238 }
3239
3240 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3241 \pgfpathmoveto{\pgfpointorigin}
3242 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3243 \pgfusepath{draw}
3244
3245 \pgfstartlinewidth=\pgflinewidth
3246 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3247
3248 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3249 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3250 \pgfusepath{draw}
3251
3252 \pgfsetlinewidth{\pgfstartlinewidth}
3253 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3254 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3255 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3256 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3257 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3258 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3259 \pgfusepath{draw}
3260 }
3261
3262 %%%%%%%%%%%%%%%%%%
3263 %% Power supplies
3264 %%%%%%%%%%%%%%%%%%
3265
3266 % Vcc
3267 \pgfdeclareshape{vcc}{
3268 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3269 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3270 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3271 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3272 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3273 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3274 }
3275 \savedanchor{\northeast}{%
3276 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3277 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3278 \pgf@x=.5\pgf@circ@res@step
3279 \pgf@y=3\pgf@x%
3280 }
3281 \anchor{north}{\northeast\pgf@x=0cm\relax}
3282 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3283 \anchor{south}{\pgfpointorigin}
3284 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3285 \anchor{north east}{\northeast}
3286 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3287 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3288 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3289 \anchor{center}{\pgfpointorigin}
3290 \anchor{left}{\pgfpointorigin}
3291 \anchor{right}{\pgfpointorigin}
3292 \anchor{text}{
3293 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3294 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3295 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3296 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3297 \pgf@x=0pt
3298 \pgf@y=2\pgf@circ@res@step
3299 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3300 \pgf@x=-.5\wd\pgfnodeparttextbox
3301 }
3302 \behindforegroundpath{
3303 \pgf@circ@scaled@Rlen=\scaledRlen
3304 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3305 \pgfscope
3306 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3307 \ifx\pgf@temp\pgf@circ@temp
3308 \pgfstartlinewidth=\pgflinewidth
3309 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3310
3311 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3312 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3313 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3314 \pgfusepath{draw}
3315
3316 \pgfsetlinewidth{\pgfstartlinewidth}
3317 \else
3318 \pgfsetarrowsend{\pgf@circ@temp}
3319 \fi
3320 \pgfpathmoveto{\pgfpointorigin}
3321 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3322 \pgfusepath{draw}
3323 \endpgfscope
3324 }
3325 }
3326
3327 % Vee
3328 \pgfdeclareshape{vee}{
3329 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3330 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3331 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3332 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3333 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3334 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3335 }
3336 \savedanchor{\northeast}{%
3337 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3338 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3339 \pgf@x=.5\pgf@circ@res@step
3340 \pgf@y=-3\pgf@x%
3341 }
3342 \anchor{south}{\northeast\pgf@x=0cm\relax}
3343 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3344 \anchor{north}{\pgfpointorigin}
3345 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3346 \anchor{south east}{\northeast}
3347 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3348 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3349 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3350 \anchor{center}{\pgfpointorigin}
3351 \anchor{left}{\pgfpointorigin}
3352 \anchor{right}{\pgfpointorigin}
3353 \anchor{text}{
3354 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3355 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3356 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3357 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3358 \pgf@x=0pt
3359 \pgf@y=-2\pgf@circ@res@step
3360 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3361 \pgf@x=-.5\wd\pgfnodeparttextbox
3362 }
3363
3364 \behindforegroundpath{
3365 \pgf@circ@scaled@Rlen=\scaledRlen
3366 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3367 \pgfscope
3368 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3369 \ifx\pgf@temp\pgf@circ@temp
3370
3371 \pgfstartlinewidth=\pgflinewidth
3372 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3373
3374 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3375 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3376 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3377 \pgfusepath{draw}
3378 \pgfsetlinewidth{\pgfstartlinewidth}
3379 \else
3380 \pgfsetarrowsend{\pgf@circ@temp}
3381 \fi
3382 \pgfpathmoveto{\pgfpointorigin}
3383 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3384 \pgfusepath{draw}
3385 \endpgfscope
3386 }
3387 }
3388
3389 %%%%%%%%%%%%%%%%
3390 %% RF elements
3391 %%%%%%%%%%%%%%%%
3392
3393 % Legacy tlinestub
3394 % Contributed by Leonardo Azzinnari
3395 \pgfdeclareshape{tlinestub}{
3396 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3397 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3398 \savedanchor{\northeast}{%
3399 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3400 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3401 \pgf@x=1.2\pgf@circ@res@step
3402 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3403 \pgf@y=.2\pgf@circ@res@step%
3404 }
3405 % the center is on the left side of the shape for facility of usage
3406 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3407 \anchor{east}{\northeast\pgf@y=0cm\relax}
3408 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3409 \anchor{west}{\pgfpointorigin}
3410 \anchor{north east}{\northeast}
3411 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3412 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3413 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3414 \anchor{center}{\pgfpointorigin}
3415 \behindforegroundpath{
3416 \pgfstartlinewidth=\pgflinewidth
3417
3418 \pgf@circ@scaled@Rlen=\scaledRlen
3419 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3420 \pgf@circ@res@step=0.6\pgf@circ@scaled@Rlen
3421
3422 \pgfscope\begin{pgftransparencygroup}
3423 \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}}
3424 \pgf@circ@maybefill
3425 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3426 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3427 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3428 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3429 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3430 \pgf@circ@draworfill
3431 \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}}
3432 \pgfusepath{draw}
3433 \end{pgftransparencygroup} \endpgfscope
3434 \pgfpathmoveto{\pgfpointorigin}
3435 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3436 \pgfusepath{draw}
3437 }
3438 }
3439
3440 %% New antennas without tails
3441
3442 % main body of antennas
3443 \def\pgf@circ@antennabody{%
3444 \pgfstartlinewidth=\pgflinewidth
3445 \pgf@circ@scaled@Rlen=\scaledRlen
3446 \pgfsetcolor{\ctikzvalof{color}}
3447 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3448 \pgfscope
3449 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3450 \pgfpathmoveto{\pgfpointorigin}
3451 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3452 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3453 \pgfsetbeveljoin
3454 \pgfpathclose
3455 \pgf@circ@draworfill
3456 \endpgfscope
3457 \pgfsetlinewidth{\pgfstartlinewidth}
3458 \pgfpathmoveto{\pgfpointorigin}
3459 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3460 \pgfusepath{draw}
3461 }
3462
3463 % Waves for the antennas.
3464 \def\pgf@circ@antennawaves{%
3465 \pgfscope
3466 % define a triangle for clipping the waves
3467 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3468 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3469 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3470 \pgfpathclose
3471 \pgfusepath{clip}
3472 % ...and build the waves as clipped circles
3473 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3474 \pgfmathloop%
3475 \ifnum\pgf@circ@count@a>2
3476 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3477 \advance\pgf@circ@count@a-1\relax%
3478 \repeatpgfmathloop
3479 \pgfusepath{draw}
3480 \endpgfscope
3481 }
3482
3483 % additional shape with the waves
3484 \pgfdeclareshape{waves}{
3485 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3486 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3487 \anchor{center}{\pgfpointorigin}
3488 \savedanchor{\northeast}{
3489 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3490 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3491 \pgf@x=\pgf@circ@res@step
3492 \pgf@y=\pgf@circ@res@step
3493 }
3494 \anchor{text}{
3495 \northeast
3496 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3497 }
3498 \anchor{top}{\northeast\pgf@x=0pt}
3499 \anchor{right}{\northeast\pgf@y=0pt}
3500 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3501 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3502 \anchor{north}{\northeast\pgf@x=0pt}
3503 \anchor{north east}{\northeast}
3504 \anchor{east}{\northeast\pgf@y=0pt}
3505 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3506 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3507 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3508 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3509 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3510 \behindforegroundpath{
3511 \pgf@circ@scaled@Rlen=\scaledRlen
3512 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3513 \pgf@circ@res@step=0.5\pgf@circ@res@step
3514 \pgfsetcolor{\ctikzvalof{color}}
3515 \pgfscope
3516 % define a triangle for clipping the waves
3517 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3518 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3519 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3520 \pgfpathclose
3521 \pgfusepath{clip}
3522 % ...and build the waves as clipped circles
3523 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3524 \pgfmathloop%
3525 \ifnum\c@pgf@counta>1
3526 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3527 \advance\c@pgf@counta-1\relax%
3528 \repeatpgfmathloop
3529 \pgfusepath{draw}
3530 \endpgfscope
3531 }
3532 }
3533
3534 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3535
3536 \pgfdeclareshape{bareantenna}{
3537 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3538 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3539 \anchor{center}{\pgfpointorigin}
3540 \savedanchor{\northeast}{
3541 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3542 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3543 \pgf@x=\pgf@circ@res@step
3544 \pgf@y=2\pgf@circ@res@step
3545 }
3546 \anchor{text}{
3547 \northeast
3548 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3549 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3550 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3551 }
3552 \anchor{top}{\northeast\pgf@x=0pt}
3553 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3554 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3555 \anchor{bottom}{\pgfpointorigin}
3556 \anchor{north}{\northeast\pgf@x=0pt}
3557 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3558 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3559 \anchor{south}{\pgfpointorigin}
3560 \anchor{north east}{\northeast}
3561 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3562 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3563 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3564 \behindforegroundpath{
3565 \pgf@circ@antennabody
3566 }
3567 }
3568
3569 \pgfdeclareshape{bareTXantenna}{
3570 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3571 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3572 \anchor{center}{\pgfpointorigin}
3573 \savedanchor{\northeast}{
3574 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3575 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3576 \pgf@x=\pgf@circ@res@step
3577 \pgf@y=2\pgf@circ@res@step
3578 }
3579 \savedanchor{\savedwaves}{
3580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3581 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3582 \pgf@x=4.2\pgf@circ@res@step
3583 \pgf@y=\pgf@circ@res@step
3584 }
3585 \anchor{text}{
3586 \northeast
3587 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3588 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3589 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3590 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3591 }
3592 \anchor{waves}{\savedwaves}
3593 \anchor{top}{\northeast\pgf@x=0pt}
3594 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3595 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3596 \anchor{bottom}{\pgfpointorigin}
3597 \anchor{north}{\northeast\pgf@x=0pt}
3598 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3599 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3600 \anchor{south}{\pgfpointorigin}
3601 \anchor{north east}{\northeast}
3602 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3603 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3604 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3605 \behindforegroundpath{
3606 \pgf@circ@antennabody
3607 \pgf@circ@antennawaves
3608 }
3609 }
3610
3611 \pgfdeclareshape{bareRXantenna}{
3612 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3613 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3614 \anchor{center}{\pgfpointorigin}
3615 \savedanchor{\northeast}{
3616 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3617 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3618 \pgf@x=\pgf@circ@res@step
3619 \pgf@y=2\pgf@circ@res@step
3620 }
3621 \savedanchor{\savedwaves}{
3622 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3623 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3624 \pgf@x=-4.2\pgf@circ@res@step
3625 \pgf@y=\pgf@circ@res@step
3626 }
3627 \anchor{text}{
3628 \northeast
3629 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3630 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3631 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3632 }
3633 \anchor{waves}{\savedwaves}
3634 \anchor{top}{\northeast\pgf@x=0pt}
3635 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3636 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3637 \anchor{bottom}{\pgfpointorigin}
3638 \anchor{north}{\northeast\pgf@x=0pt}
3639 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3640 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3641 \anchor{south}{\pgfpointorigin}
3642 \anchor{north east}{\northeast}
3643 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3644 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3645 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3646 \behindforegroundpath{
3647 \pgf@circ@antennabody
3648 \pgftransformxshift{-5.2\pgf@circ@res@step}
3649 \pgf@circ@antennawaves
3650 }
3651 }
3652
3653 % Microstrip monopoles
3654
3655 \pgfdeclareshape{mslstub}{
3656 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3657 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3658 \savedanchor{\southeast}{
3659 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3660 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3661 \pgf@x=.5\pgf@x
3662 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3663 \pgf@y=-.5\pgf@y
3664 }
3665 \savedanchor{\northwest}{
3666 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3667 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3668 \pgf@x=-.5\pgf@x
3669 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3670 \pgf@y=.5\pgf@y
3671 }
3672 \anchor{north}{\northwest\pgf@x=0pt\relax}
3673 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3674 \anchor{east}{\southeast\pgf@y=0pt\relax}
3675 \anchor{south east}{\southeast}
3676 \anchor{south}{\southeast\pgf@x=0pt\relax}
3677 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3678 \anchor{west}{\northwest\pgf@y=0pt\relax}
3679 \anchor{north west}{\northwest}
3680 %
3681 \anchor{center}{\northwest\pgf@y=0pt\relax}
3682 \anchor{left}{\northwest\pgf@y=0pt\relax}
3683 \anchor{right}{\southeast\pgf@y=0pt\relax}
3684 % put the node text above and centered
3685 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3686 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3687 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3688 }
3689 }
3690 \behindbackgroundpath{
3691 \pgfextracty{\pgf@circ@res@up}{\northwest}
3692 \pgfextractx{\pgf@circ@res@right}{\southeast}
3693 \pgfextractx{\pgf@circ@res@left}{\northwest}
3694 \pgfextracty{\pgf@circ@res@down}{\southeast}
3695 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3696 \pgfstartlinewidth=\pgflinewidth
3697 \pgfscope
3698 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3699 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3700 \pgf@circ@draworfill
3701 \endpgfscope
3702 }
3703 }
3704
3705 \pgfdeclareshape{msrstub}{
3706 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3707 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3708 \savedanchor{\southeast}{
3709 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3710 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3711 \pgf@x=.5\pgf@x
3712 \pgf@y=0pt\relax
3713 }
3714 \savedanchor{\northwest}{
3715 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3716 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3717 \pgf@x=-.5\pgf@x
3718 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
3719 \pgf@y=.5\pgf@y
3720 }
3721 \anchor{north}{\northwest\pgf@x=0pt\relax}
3722 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3723 \anchor{east}{\southeast\pgf@y=0pt\relax}
3724 \anchor{south east}{\southeast}
3725 \anchor{south}{\southeast\pgf@x=0pt\relax}
3726 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3727 \anchor{west}{\northwest\pgf@y=0pt\relax}
3728 \anchor{north west}{\northwest}
3729 %
3730 \anchor{center}{\pgfpointorigin}
3731 \anchor{left}{\pgfpointorigin}
3732 \anchor{right}{\pgfpointorigin}
3733 % put the node text above and centered
3734 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3735 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3736 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3737 }
3738 }
3739 \behindbackgroundpath{
3740 \pgfextracty{\pgf@circ@res@up}{\northwest}
3741 \pgfextractx{\pgf@circ@res@right}{\southeast}
3742 \pgfextractx{\pgf@circ@res@left}{\northwest}
3743 \pgfextracty{\pgf@circ@res@down}{\southeast}
3744 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3745 \pgfstartlinewidth=\pgflinewidth
3746 \pgfscope
3747 \pgfpathmoveto{\pgfpointorigin}
3748 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3749 \pgfusepath{draw}
3750 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3751 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
3752 \pgfpatharc{135}{45}{\pgf@circ@res@step}
3753 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
3754 \pgfpatharc{45}{135}{\pgf@circ@res@up}
3755 \pgfclosepath
3756 \pgf@circ@draworfill
3757 \endpgfscope
3758 }
3759 }
3760
3761 \pgfdeclareshape{msport}{
3762 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3763 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3764 \savedanchor{\southeast}{
3765 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3766 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3767 \pgf@x=.5\pgf@x
3768 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3769 \pgf@y=-.5\pgf@y
3770 }
3771 \savedanchor{\northwest}{
3772 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3773 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3774 \pgf@x=-.5\pgf@x
3775 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3776 \pgf@y=.5\pgf@y
3777 }
3778 \anchor{north}{\northwest\pgf@x=0pt\relax}
3779 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3780 \anchor{east}{\southeast\pgf@y=0pt\relax}
3781 \anchor{south east}{\southeast}
3782 \anchor{south}{\southeast\pgf@x=0pt\relax}
3783 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3784 \anchor{west}{\northwest\pgf@y=0pt\relax}
3785 \anchor{north west}{\northwest}
3786 %
3787 \anchor{center}{\northwest\pgf@y=0pt\relax}
3788 \anchor{left}{\northwest\pgf@y=0pt\relax}
3789 \anchor{right}{\southeast\pgf@y=0pt\relax}
3790 % put the node text above and centered
3791 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3792 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3793 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3794 }
3795 }
3796 \behindbackgroundpath{
3797 \pgfextracty{\pgf@circ@res@up}{\northwest}
3798 \pgfextractx{\pgf@circ@res@right}{\southeast}
3799 \pgfextractx{\pgf@circ@res@left}{\northwest}
3800 \pgfextracty{\pgf@circ@res@down}{\southeast}
3801 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
3802 \pgfstartlinewidth=\pgflinewidth
3803 \pgfscope
3804 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3805 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3808 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3809 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
3810 \pgfpathclose
3811 \pgf@circ@draworfill
3812 \endpgfscope
3813 }
3814 }
3815
3816 % Legacy antennas (with tails)
3817 \def\pgf@circ@shift@antenna@xy#1#2{%
3818 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
3819 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
3820 \relax}
3821
3822 % Legacy antenna
3823 \pgfdeclareshape{antenna}{
3824 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3825 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3826 \anchor{center}{\pgfpointorigin}
3827 \savedanchor{\northeast}{
3828 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3829 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3830 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3831 \pgf@y=4\pgf@circ@res@step
3832 }
3833 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
3834 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
3835 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
3836 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
3837 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3838 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3839 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
3840 \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}}
3841 \anchor{text}{
3842 \northeast
3843 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
3844 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
3845 }
3846 \behindforegroundpath{
3847 \pgfstartlinewidth=\pgflinewidth
3848 \pgf@circ@scaled@Rlen=\scaledRlen
3849 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3850
3851 \pgftransformxshift{ -4\pgf@circ@res@step }
3852
3853 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3854 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3855
3856 \pgfusepath{draw}
3857
3858 \pgfscope
3859 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3860 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3861 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3862 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3863 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3864 \pgfsetcolor{\ctikzvalof{color}}
3865 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3866 \pgfusepath{draw}
3867 \endpgfscope
3868 \pgfsetlinewidth{\pgfstartlinewidth}
3869
3870 }
3871 }
3872
3873 % Legacy TX antenna
3874 \pgfdeclareshape{txantenna}{
3875 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3876 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3877 \anchor{center}{\pgfpointorigin}
3878 \savedanchor{\northeast}{
3879 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3880 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3881 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3882 \pgf@y=4\pgf@circ@res@step
3883 }
3884 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3885 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3886 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3887 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3888 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3889 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3890 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3891 \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}}
3892 \anchor{text}{
3893 \northeast
3894 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
3895 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
3896 }
3897 \behindforegroundpath{
3898 \pgfstartlinewidth=\pgflinewidth
3899 \pgf@circ@scaled@Rlen=\scaledRlen
3900 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
3901
3902 \pgfpathmoveto{\pgfpointorigin}
3903 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3904 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3905 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3906
3907 \pgfusepath{draw}
3908
3909 \pgfscope
3910 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3911 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3912 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3913 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3914 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3915 \pgfsetcolor{\ctikzvalof{color}}
3916 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3917 \pgfusepath{draw}
3918 \endpgfscope
3919 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
3920 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3921 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3922 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
3923 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3924 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
3925 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3926 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
3927 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
3928 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
3929 \pgfusepath{draw}
3930 \pgfsetlinewidth{\pgfstartlinewidth}
3931
3932 }
3933 }
3934
3935 % Legacy RX antenna
3936 \pgfdeclareshape{rxantenna}{
3937 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3938 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3939 \anchor{center}{\pgfpointorigin}
3940 \savedanchor{\northeast}{
3941 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3942 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3943 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3944 \pgf@y=4\pgf@circ@res@step
3945 }
3946 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3947 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3948 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3949 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3950 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3951 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3952 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3953 \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}}
3954 \anchor{text}{
3955 \northeast
3956 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
3957 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
3958 }
3959 \behindforegroundpath{
3960 \pgfstartlinewidth=\pgflinewidth
3961 \pgf@circ@scaled@Rlen=\scaledRlen
3962 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
3963
3964 \pgfpathmoveto{\pgfpointorigin}
3965 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3966 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3967 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3968
3969 \pgfusepath{draw}
3970
3971 \pgfscope
3972 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3973 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3974 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3975 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3976 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3977 \pgfsetcolor{\ctikzvalof{color}}
3978 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3979 \pgfusepath{draw}
3980 \endpgfscope
3981
3982 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
3983 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3984 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3985 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
3986 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3987 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
3988 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3989 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
3990 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
3991 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
3992 \pgfusepath{draw}
3993 \pgfsetlinewidth{\pgfstartlinewidth}
3994 }
3995 }
3996
3997 % Legacy match
3998 \pgfdeclareshape{match}{
3999 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4000 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4001 \savedanchor{\northeast}{%
4002 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4003 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4004 \pgf@x=2\pgf@circ@res@step
4005 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4006 \pgf@y=.5\pgf@circ@res@step%
4007 }
4008 % the center is on the left side of the shape for facility of usage
4009 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4010 \anchor{east}{\northeast\pgf@y=0cm\relax}
4011 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4012 \anchor{west}{\pgfpointorigin}
4013 \anchor{north east}{\northeast}
4014 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4015 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4016 \anchor{south west}{\pgfpointorigin}
4017 \anchor{center}{
4018 \pgfpointorigin
4019 }
4020 \anchor{text}{
4021 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4022 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4023 \pgf@x=1.5\pgf@x
4024 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4025 \pgf@y=-1.5\ht\pgfnodeparttextbox
4026 }
4027 \behindforegroundpath{
4028 \pgf@circ@scaled@Rlen=\scaledRlen
4029 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4030
4031 \pgfscope
4032 \pgfpathmoveto{\pgfpointorigin}
4033 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4034 \pgfusepath{draw}
4035
4036 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4037 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4038 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4039 \pgfusepath{fill}
4040
4041 \pgfsetlinewidth{\pgfstartlinewidth}
4042 \endpgfscope
4043 }
4044 }
4045
4046 %%%---------- close: tex/pgfcircmonopoles
4047 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4048 %%%---------- open: tex/pgfcircbipoles.tex
4049 % Copyright 2018-2026 by Romano Giannetti
4050 % Copyright 2015-2026 by Stefan Lindner
4051 % Copyright 2013-2026 by Stefan Erhardt
4052 % Copyright 2007-2026 by Massimo Redaelli
4053 %
4054 % This file may be distributed and/or modified
4055 %
4056 % 1. under the LaTeX Project Public License and/or
4057 % 2. under the GNU Public License.
4058 %
4059 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4060
4061 %% Generic macro for defining a bipole shape
4062 % #1 - additional anchors
4063 % #2 - lower y-size of the bipole (from the center).
4064 % #3 - #shape is the name of the shape
4065 % #4 - upper y-size of the bipole (from the center)
4066 % #5 - width of the bipole
4067 % #6 - macros drawing the bipole
4068 %
4069 \long\def\pgfcircdeclarebipole{%
4070 \pgfcircdeclarebipolescaled{default}}
4071
4072 %% Generic macro for defining a bipole shape
4073 % #1 - scale factor
4074 % #2 - additional anchors
4075 % #3 - lower y-size of the bipole (from the center).
4076 % #4 - #shape is the name of the shape
4077 % #5 - upper y-size of the bipole (from the center)
4078 % #6 - width of the bipole
4079 % #7 - macros drawing the bipole
4080 %
4081 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
4082 \pgfdeclareshape{#4shape}{
4083 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
4084 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4085 \savedanchor{\northeast}{
4086 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4087 \pgf@y=#5\pgf@circ@scaled@Rlen
4088 \pgf@y=.5\pgf@y
4089 \pgf@x=#6\pgf@circ@scaled@Rlen
4090 \pgf@x=.5\pgf@x
4091 }
4092 \savedanchor{\northeastborder}{
4093 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4094 \pgf@y=#5\pgf@circ@scaled@Rlen
4095 \pgf@y=.5\pgf@y
4096 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4097 \pgf@x=#6\pgf@circ@scaled@Rlen
4098 \pgf@x=.5\pgf@x
4099 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4100 }
4101 \savedanchor{\southwestborder}{
4102 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4103 \pgf@y=-#3\pgf@circ@scaled@Rlen
4104 \pgf@y=.5\pgf@y
4105 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4106 \pgf@x=-#6\pgf@circ@scaled@Rlen
4107 \pgf@x=.5\pgf@x
4108 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4109 }
4110 \savedanchor{\southwest}{
4111 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4112 \pgf@y=-#3\pgf@circ@scaled@Rlen
4113 \pgf@y=.5\pgf@y
4114 \pgf@x=-#6\pgf@circ@scaled@Rlen
4115 \pgf@x=.5\pgf@x
4116 }
4117 \savedanchor{\centerpoint}{
4118 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4119 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
4120 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
4121 \pgfpointorigin
4122 \pgf@y=\pgf@circ@res@up
4123 \advance\pgf@y by\pgf@circ@res@down
4124 \pgf@y=.5\pgf@y
4125 }
4126 \anchor{center}{\pgfpointorigin}
4127 \anchor{n}{
4128 \northeast
4129 \pgf@x=0cm
4130 }
4131 \anchor{north east}{
4132 \northeast
4133 }
4134 \anchor{north west}{
4135 \northeast
4136 \pgf@x=-\pgf@x
4137 }
4138 \anchor{ne}{
4139 \northeast
4140 }
4141 \anchor{nw}{
4142 \northeast
4143 \pgf@x=-\pgf@x
4144 }
4145 \anchor{e}{
4146 \northeast
4147 \pgf@y=0cm
4148 }
4149 \anchor{s}{
4150 \southwest
4151 \pgf@x=0cm
4152 }
4153 \anchor{south east}{
4154 \southwest
4155 \pgf@x=-\pgf@x
4156 }
4157 \anchor{south west}{
4158 \southwest
4159 }
4160 \anchor{se}{
4161 \southwest
4162 \pgf@x=-\pgf@x
4163 }
4164 \anchor{sw}{
4165 \southwest
4166 }
4167 \anchor{w}{
4168 \southwest
4169 \pgf@y=0cm
4170 }
4171 \anchor{north}{
4172 \northeast
4173 \pgf@x=0cm
4174 }
4175 \anchor{east}{
4176 \northeast
4177 \pgf@y=0cm
4178 }
4179 \anchor{south}{
4180 \southwest
4181 \pgf@x=0cm
4182 }
4183 \anchor{west}{
4184 \southwest
4185 \pgf@y=0cm
4186 }
4187 \anchor{right}{
4188 \northeast
4189 \pgf@y=0cm
4190 }
4191 \anchor{above}{
4192 \northeast
4193 \pgf@x=0cm
4194 }
4195 \anchor{left}{
4196 \southwest
4197 \pgf@y=0cm
4198 }
4199 \anchor{below}{
4200 \southwest
4201 \pgf@x=0cm
4202 }
4203 \anchor{a}{
4204 \northeast
4205 \pgf@y=0cm
4206 }
4207 \anchor{b}{
4208 \southwest
4209 \pgf@y=0cm
4210 }
4211 \savedanchor{\textanchor}{%
4212 \pgf@y=\ht\pgfnodeparttextbox
4213 \pgf@x=-.5\wd\pgfnodeparttextbox
4214 }
4215 \anchor{text}{
4216 \textanchor
4217 }
4218 \anchorborder{%
4219 \ifpgf@circuit@bipole@inverted
4220 \pgf@circ@res@left=-\pgf@x
4221 \pgf@circ@res@right=-\pgf@y
4222 \else
4223 \pgf@circ@res@left=\pgf@x
4224 \pgf@circ@res@right=\pgf@y
4225 \fi
4226 \ifdim\pgf@circ@res@right>0cm
4227 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder}
4228 \else
4229 \southwestborder
4230 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
4231 \fi
4232 }
4233
4234 #2
4235
4236 \backgroundpath{
4237 \pgfsetcolor{\ctikzvalof{color}}
4238
4239 \northeast
4240 \pgf@circ@res@up = \pgf@y
4241 \pgf@circ@res@zero = 0cm
4242 \pgf@circ@res@left = -\pgf@x
4243 \pgf@circ@res@right = \pgf@x
4244 \southwest
4245 \pgf@circ@res@down = \pgf@y
4246 \pgf@circ@scaled@Rlen=\scaledRlen
4247 \pgfstartlinewidth=\pgflinewidth
4248 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
4249 #7
4250
4251 \pgfsetlinewidth{\pgfstartlinewidth}
4252 }
4253 }
4254 }
4255
4256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257 %% Standard bipole shapes declarations
4258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259
4260 %%%%%%%%%%%%%%%%%%%%%%%%
4261 % Resistive components
4262 %%%%%%%%%%%%%%%%%%%%%%%%
4263
4264 %% Short circuit
4265
4266 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4267 %%% natural length is zero.
4268 \pgfcircdeclarebipole
4269 {}
4270 {0}
4271 {short}
4272 {0}
4273 {0}
4274 { }
4275
4276 %% Open circuit
4277 \pgfcircdeclarebipole
4278 {}
4279 {\ctikzvalof{bipoles/open/height}}
4280 {open}
4281 {\ctikzvalof{bipoles/open/height}}
4282 {\ctikzvalof{bipoles/open/width}}
4283 { }
4284
4285 % multiwire(s)
4286 \pgfcircdeclarebipole
4287 {}
4288 {\ctikzvalof{bipoles/multiwire/height}}
4289 {multiwire}
4290 {\ctikzvalof{bipoles/multiwire/height}}
4291 {\ctikzvalof{bipoles/multiwire/width}}
4292 {
4293 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4294 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4295 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4296 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4297 \pgfusepath{draw}
4298 }
4299
4300 \pgfcircdeclarebipole
4301 {}
4302 {\ctikzvalof{bipoles/multiwire/height}}
4303 {bmultiwire}
4304 {\ctikzvalof{bipoles/multiwire/height}}
4305 {\ctikzvalof{bipoles/multiwire/width}}
4306 {
4307 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4308 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4309 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4310 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4311 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4312 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4313 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4314 \pgfusepath{draw}
4315 }
4316
4317 \pgfcircdeclarebipole
4318 {}
4319 {\ctikzvalof{bipoles/multiwire/height}}
4320 {tmultiwire}
4321 {\ctikzvalof{bipoles/multiwire/height}}
4322 {\ctikzvalof{bipoles/multiwire/width}}
4323 {
4324 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4325 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4326 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4327 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4328 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4329 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4330 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4331 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4332 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4333 \pgfusepath{draw}
4334 }
4335
4336 %
4337 %
4338 %% Generic bipole - used as resistor by some (bleah)
4339 \pgfcircdeclarebipolescaled{resistors}
4340 {}
4341 {\ctikzvalof{bipoles/generic/height}}
4342 {generic}
4343 {\ctikzvalof{bipoles/generic/height}}
4344 {\ctikzvalof{bipoles/generic/width}}
4345 {
4346 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4347 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4348 \pgf@circ@draworfill
4349 }
4350
4351 %
4352 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4353 % inherit "generic" properties
4354 %
4355 \pgfcircdeclarebipolescaled{resistors}
4356 {}
4357 {\ctikzvalof{bipoles/generic/height}}
4358 {xgeneric}
4359 {\ctikzvalof{bipoles/generic/height}}
4360 {\ctikzvalof{bipoles/generic/width}}
4361 {
4362 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4363 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4364 \pgf@circ@draworfill
4365 % cross it
4366 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4367 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4368 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4369 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4370 \pgfusepath{draw}
4371 }
4372 %% Generic empty tunable
4373 \pgfcircdeclarebipolescaled{resistors}
4374 {}
4375 {\ctikzvalof{bipoles/tgeneric/height}}
4376 {tgeneric}
4377 {\ctikzvalof{bipoles/tgeneric/height}}
4378 {\ctikzvalof{bipoles/tgeneric/width}}
4379 {
4380 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4381 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4382 \pgf@circ@draworfill
4383 \pgfscope
4384 \pgfsetarrowsend{latexslim}
4385 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4386 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4387 \pgfusepath{draw}
4388 \endpgfscope
4389 }
4390
4391 %% Generic asymmetric bipole
4392 \pgfcircdeclarebipolescaled{resistors}
4393 {}
4394 {\ctikzvalof{bipoles/ageneric/height}}
4395 {ageneric}
4396 {\ctikzvalof{bipoles/ageneric/height}}
4397 {\ctikzvalof{bipoles/ageneric/width}}
4398 {
4399 \pgfscope
4400 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4401 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4402 \pgf@circ@draworfill
4403 \endpgfscope
4404
4405 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4406 \pgfusepath{stroke,fill}
4407 }
4408
4409 %% Memristor
4410 \pgfcircdeclarebipolescaled{resistors}
4411 {}
4412 {\ctikzvalof{bipoles/memristor/height}}
4413 {memristor}
4414 {\ctikzvalof{bipoles/memristor/height}}
4415 {\ctikzvalof{bipoles/memristor/width}}
4416 {
4417 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4418 \divide \pgf@circ@res@step by 14
4419
4420 \pgfscope
4421 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4422 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4423 \pgf@circ@draworfill
4424 \endpgfscope
4425 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4426 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4427 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4428 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4429 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4430 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4431 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4432 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4433 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4434 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4435
4436 \pgfusepath{draw}
4437
4438 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4439 \pgfusepath{stroke,fill}
4440 }
4441
4442 %% Photoresistor
4443 \pgfcircdeclarebipolescaled{resistors}
4444 {}
4445 {\ctikzvalof{bipoles/photoresistor/height 2}}
4446 {photoresistor}
4447 {\ctikzvalof{bipoles/photoresistor/height}}
4448 {\ctikzvalof{bipoles/photoresistor/width}}
4449 {
4450 \pgfscope
4451 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4452 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4453 \pgf@circ@draworfill
4454 \endpgfscope
4455
4456 \pgfscope
4457 \pgfsetarrowsend{latexslim}
4458 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4459 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4460 \pgfusepath{draw}
4461 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4462 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4463 \pgfusepath{draw}
4464 \endpgfscope
4465 }
4466
4467 %% Thermistor
4468 \pgfcircdeclarebipolescaled{resistors}
4469 {{% anchor for labelling the type of dependency
4470 \anchor{label}{%
4471 \southwest
4472 \pgf@x=0.4\pgf@x
4473 \pgf@y=1.2\pgf@y
4474 }%
4475 }}
4476 {\ctikzvalof{bipoles/thermistor/height}}
4477 {thermistor}
4478 {\ctikzvalof{bipoles/thermistor/height}}
4479 {\ctikzvalof{bipoles/thermistor/width}}
4480 {
4481 \pgfscope
4482 \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}}
4483 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4484 \pgf@circ@draworfill
4485 \endpgfscope
4486
4487 %\pgfscope
4488 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4489 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4490 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4491 \pgfusepath{draw}
4492 %\endpgfscope
4493 }
4494
4495 %% Thermistor PTC
4496 \pgfcircdeclarebipolescaled{resistors}
4497 {}
4498 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4499 {thermistorptc}
4500 {\ctikzvalof{bipoles/thermistorptc/height}}
4501 {\ctikzvalof{bipoles/thermistorptc/width}}
4502 {
4503 \pgfscope
4504 \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}}
4505 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4506 \pgf@circ@draworfill
4507 \endpgfscope
4508 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4509 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4510 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4511 \pgfusepath{draw}
4512
4513 \pgfsetlinewidth{\pgfstartlinewidth}
4514 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4515 \pgfsetarrowsend{latexslim}
4516 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4517 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4518 \pgfusepath{draw}
4519 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4520 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4521 \pgfusepath{draw}
4522 }
4523
4524 %% Thermistor NTC
4525 \pgfcircdeclarebipolescaled{resistors}
4526 {}
4527 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4528 {thermistorntc}
4529 {\ctikzvalof{bipoles/thermistorntc/height}}
4530 {\ctikzvalof{bipoles/thermistorntc/width}}
4531 {
4532 \pgfscope
4533 \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}}
4534 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4535 \pgf@circ@draworfill
4536 \endpgfscope
4537
4538 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4539 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4540 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4541 \pgfusepath{draw}
4542
4543 \pgfsetlinewidth{\pgfstartlinewidth}
4544 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4545 \pgfsetarrowsend{latexslim}
4546 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4547 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4548 \pgfusepath{draw}
4549 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4550 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4551 \pgfusepath{draw}
4552 }
4553
4554 %% Generic tunable
4555 \pgfcircdeclarebipolescaled{resistors}
4556 {
4557 \savedanchor{\wiper}{
4558 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4559 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4560 \pgf@y=.5\pgf@ya
4561 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4562 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4563 }
4564 \anchor{wiper}{\wiper}
4565 \anchor{W}{\wiper}
4566 }
4567 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4568 {genericpotentiometer}
4569 {\ctikzvalof{bipoles/generic potentiometer/height}}
4570 {\ctikzvalof{bipoles/generic potentiometer/width}}
4571 {
4572
4573 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4574 \divide \pgf@circ@res@step by 14
4575
4576 \pgfscope
4577 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4578 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4579 \pgf@circ@draworfill
4580 \endpgfscope
4581 \pgfscope
4582 %\pgfsetlinewidth{\pgfstartlinewidth}
4583 \pgfsetarrowsend{latexslim}
4584 \pgfextractx{\pgf@circ@res@other}{\wiper}
4585 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4586 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4587 \pgfusepath{draw}
4588 \endpgfscope
4589 }
4590
4591 %% Zig zag resistores
4592 \def\pgf@circ@zigzag#1{%
4593 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4594
4595 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4596 \pgf@circ@res@other = \pgf@circ@res@left
4597 \pgf@circ@count@a=\zigs\relax
4598 % first half zig
4599 \advance\pgf@circ@res@other by \pgf@circ@res@step
4600 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4601 \pgfmathloop%
4602 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4603 \ifnum\pgf@circ@count@a>0
4604 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4605 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4606 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4607 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4608 \repeatpgfmathloop%
4609 % last zig and a half
4610 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4611 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4612 \advance\pgf@circ@res@other by \pgf@circ@res@step
4613 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4614 \pgfsetbeveljoin
4615 \pgfusepath{draw}
4616 }
4617
4618 %% Resistor
4619 \pgfcircdeclarebipolescaled{resistors}
4620 {
4621 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4622 }
4623 {\ctikzvalof{bipoles/resistor/height}}
4624 {resistor}
4625 {\ctikzvalof{bipoles/resistor/height}}
4626 {\ctikzvalof{bipoles/resistor/width}}
4627 {
4628 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4629 \pgftransformationadjustments
4630 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4631 \pgf@circ@zigzag{1}
4632 }
4633
4634
4635 %% Variable resistor
4636 \pgfcircdeclarebipolescaled{resistors}
4637 {
4638 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4639 }
4640 {\ctikzvalof{bipoles/vresistor/height}}
4641 {vresistor}
4642 {\ctikzvalof{bipoles/vresistor/height}}
4643 {\ctikzvalof{bipoles/vresistor/width}}
4644 {
4645 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4646 \pgftransformationadjustments
4647 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4648 \pgf@circ@zigzag{.5}
4649
4650 \pgfscope
4651 \pgfsetarrowsend{latexslim}
4652 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4653 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4654 \pgfusepath{draw}
4655 \endpgfscope
4656 }
4657
4658 %% Potentiometer
4659 \pgfcircdeclarebipolescaled{resistors}
4660 {
4661 \savedanchor{\wiper}{
4662 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4663 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
4664 \pgf@y=.5\pgf@ya
4665 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
4666 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
4667 }
4668 \anchor{wiper}{\wiper}
4669 \anchor{W}{\wiper}
4670 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4671 }
4672 {\ctikzvalof{bipoles/potentiometer/height 2}}
4673 {potentiometer}
4674 {\ctikzvalof{bipoles/potentiometer/height}}
4675 {\ctikzvalof{bipoles/potentiometer/width}}
4676 {
4677 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4678 \pgftransformationadjustments
4679 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4680 \pgf@circ@zigzag{1}
4681
4682 \pgfscope
4683 %\pgfsetlinewidth{\pgfstartlinewidth}
4684 \pgfsetarrowsend{latexslim}
4685 \pgfextractx{\pgf@circ@res@other}{\wiper}
4686 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4688 \pgfusepath{draw}
4689 \endpgfscope
4690 }
4691
4692 %% Resistive sensor
4693 \pgfcircdeclarebipolescaled{resistors}
4694 {% anchor for labelling the type of dependency
4695 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
4696 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4697 }
4698 {\ctikzvalof{bipoles/resistivesens/height}}
4699 {resistivesens}
4700 {\ctikzvalof{bipoles/resistivesens/height}}
4701 {\ctikzvalof{bipoles/resistivesens/width}}
4702 {%
4703 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4704 \pgftransformationadjustments
4705 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4706 \pgf@circ@zigzag{.5}
4707
4708 \pgfscope
4709 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4710 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4711 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
4712 \pgfusepath{draw}
4713 \endpgfscope
4714 }
4715
4716 %%%%%%%%%%%%%%
4717 %% Capacitors
4718 %%%%%%%%%%%%%
4719
4720 %% Plain Capacitor
4721 \pgfcircdeclarebipolescaled{capacitors}
4722 {}
4723 {\ctikzvalof{bipoles/capacitor/height}}
4724 {capacitor}
4725 {\ctikzvalof{bipoles/capacitor/height}}
4726 {\ctikzvalof{bipoles/capacitor/width}}
4727 {
4728 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4729 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4730 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4731
4732 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4733 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4734 \pgfusepath{draw}
4735
4736 }
4737
4738 %% Capacitive sensor
4739 \pgfcircdeclarebipolescaled{capacitors}
4740 {
4741 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
4742 }
4743 {\ctikzvalof{bipoles/capacitor/height}}
4744 {capacitivesens}
4745 {\ctikzvalof{bipoles/capacitor/height}}
4746 {\ctikzvalof{bipoles/capacitor/width}}
4747 {
4748 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4749 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4750 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4751
4752 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4753 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4754 \pgfusepath{draw}
4755 \pgfscope
4756 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
4757 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4758 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4759 \pgfusepath{draw}
4760 \endpgfscope
4761 }
4762
4763 %% Polar Capacitor (DEPRECATED)
4764 \pgfcircdeclarebipolescaled{capacitors}
4765 {}
4766 {\ctikzvalof{bipoles/pcapacitor/height}}
4767 {polarcapacitor}
4768 {\ctikzvalof{bipoles/pcapacitor/height}}
4769 {\ctikzvalof{bipoles/pcapacitor/width}}
4770 {
4771 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4772
4773 \pgfscope
4774 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
4775 \pgftransformrotate{-90}
4776 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4777 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4778 \pgfusepath{draw}
4779 \endpgfscope
4780
4781 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4782 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4783 \pgfusepath{draw}
4784 }
4785
4786
4787 %% Curved capacitor
4788 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
4789 % for a rationale
4790 %
4791 \pgfcircdeclarebipolescaled{capacitors}
4792 {}
4793 {\ctikzvalof{bipoles/ccapacitor/height}}
4794 {ccapacitor}
4795 {\ctikzvalof{bipoles/ccapacitor/height}}
4796 {\ctikzvalof{bipoles/ccapacitor/width}}
4797 {
4798 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4799
4800 \pgfscope
4801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}}
4802 \pgftransformrotate{-90}
4803 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4804 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4805 \pgfusepath{draw}
4806 \endpgfscope
4807
4808 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4809 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4810 \pgfusepath{draw}
4811 }
4812
4813
4814
4815
4816 %% Electrolytic Capacitor
4817 \pgfcircdeclarebipolescaled{capacitors}
4818 {}
4819 {\ctikzvalof{bipoles/ecapacitor/height}}
4820 {ecapacitor}
4821 {\ctikzvalof{bipoles/ecapacitor/height}}
4822 {\ctikzvalof{bipoles/ecapacitor/width}}
4823 {
4824 \pgfsetrectcap
4825 % % % Draw plus pole
4826 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4827 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4828 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
4829 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4830 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4831 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4832 \pgf@circ@draworfill
4833 % % Draw minus pole
4834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4835 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4836 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4837 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4838 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4839 \pgfsetfillcolor{\ctikzvalof{color}}
4840 \pgfusepath{draw,fill}
4841 \pgfsetfillcolor{\ctikzvalof{color}}
4842 % % plus pole annotation
4843 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
4844 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
4845 }
4846
4847 %% Variable Capacitor
4848 \pgfcircdeclarebipolescaled{capacitors}
4849 {}
4850 {\ctikzvalof{bipoles/vcapacitor/height}}
4851 {vcapacitor}
4852 {\ctikzvalof{bipoles/vcapacitor/height}}
4853 {\ctikzvalof{bipoles/vcapacitor/width}}
4854 {
4855 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right
4856
4857 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4858 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
4859 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
4860
4861 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
4862 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
4863 \pgfusepath{draw}
4864
4865 \pgfscope
4866 \pgfsetarrowsend{latexslim}
4867 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4868 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4869 \pgfusepath{draw}
4870 \endpgfscope
4871
4872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4873 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
4874 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4876 \pgfsetlinewidth{\pgfstartlinewidth}
4877 \pgfusepath{draw}
4878 }
4879
4880
4881 %% Piezoelectric Element
4882
4883 \pgfcircdeclarebipolescaled{capacitors}
4884 {}
4885 {\ctikzvalof{bipoles/piezoelectric/height}}
4886 {piezoelectric}
4887 {\ctikzvalof{bipoles/piezoelectric/height}}
4888 {\ctikzvalof{bipoles/piezoelectric/width}}
4889 {
4890 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
4891 % \divide \pgf@circ@res@step by 5
4892
4893 %% Outer markings
4894 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4895 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4896 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4897
4898 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4899 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4900 \pgfusepath{draw}
4901
4902 %% Inner Box
4903 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
4904 \pgfscope
4905 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4906 \pgfpathrectanglecorners
4907 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
4908 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
4909 \pgf@circ@draworfill
4910 \endpgfscope
4911 }
4912
4913 %%%%%%%%%%%%%%%
4914 %% Inductors
4915 %%%%%%%%%%%%%%%
4916
4917 %% cute inductor
4918 \pgfcircdeclarebipolescaled{inductors}
4919 {
4920 \savedanchor{\midtap}{%
4921 \pgf@x=0pt\relax
4922 \pgfmathsetlength{\pgf@y}{%
4923 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4924 \ctikzvalof{bipoles/cuteinductor/height} :% even
4925 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4926 *\pgf@circ@scaled@Rlen/2
4927 }
4928 }
4929 \anchor{midtap}{\midtap}
4930 }
4931 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4932 {cuteinductor}
4933 {\ctikzvalof{bipoles/cuteinductor/height}}
4934 {\ctikzvalof{bipoles/cuteinductor/width}}
4935 {
4936 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4937 \pgftransformationadjustments
4938
4939 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4940 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4941
4942
4943 \pgfmathsetlength{\pgf@circ@res@step}
4944 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4945
4946 \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
4947 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4948 {
4949 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4950 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4951 }
4952 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4953 \pgfsetbuttcap
4954 \pgfsetbeveljoin
4955 \pgfusepath{stroke}
4956 }
4957
4958 %% cute inductive sensor
4959 \pgfcircdeclarebipolescaled{inductors}
4960 {% anchor for labelling the type of dependency
4961 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
4962 \savedanchor{\midtap}{%
4963 \pgf@x=0pt\relax
4964 \pgfmathsetlength{\pgf@y}{%
4965 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4966 \ctikzvalof{bipoles/cuteinductor/height} :% even
4967 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4968 *\pgf@circ@scaled@Rlen/2
4969 }
4970 }
4971 \anchor{midtap}{\midtap}
4972 }
4973 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4974 {scuteinductor}
4975 {\ctikzvalof{bipoles/cuteinductor/height}}
4976 {\ctikzvalof{bipoles/cuteinductor/width}}
4977 {
4978 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4979 \pgftransformationadjustments
4980
4981 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4982 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4983
4984
4985 \pgfmathsetlength{\pgf@circ@res@step}
4986 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4987
4988 \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
4989 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4990 {
4991 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4992 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4993 }
4994 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4995 \pgfsetbuttcap
4996 \pgfsetbeveljoin
4997 \pgfusepath{stroke}
4998 \pgfscope
4999 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5000 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5001 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5002 \pgfusepath{draw}
5003 \endpgfscope
5004 }
5005
5006 %% cute choke
5007 \pgfcircdeclarebipolescaled{inductors}
5008 {
5009 \savedanchor{\midtap}{%
5010 \pgf@x=0pt\relax
5011 \pgfmathsetlength{\pgf@y}{%
5012 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5013 \ctikzvalof{bipoles/cuteinductor/height} :% even
5014 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5015 *\pgf@circ@scaled@Rlen/2
5016 }
5017 }
5018 \anchor{midtap}{\midtap}
5019 }
5020 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5021 {cutechoke}
5022 {\ctikzvalof{bipoles/cutechoke/height}}
5023 {\ctikzvalof{bipoles/cutechoke/width}}
5024 {
5025 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5026 \pgftransformationadjustments
5027
5028 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5029 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5030
5031
5032 \pgfmathsetlength{\pgf@circ@res@step}
5033 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5034
5035 \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
5036 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5037 {
5038 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5039 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5040 }
5041 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5042 \pgfsetbuttcap
5043 \pgfsetbeveljoin
5044 \pgfusepath{stroke}
5045
5046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5047 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5048 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5049 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5050 \pgfusepath{stroke}
5051
5052 \ifpgf@circuit@bipole@twolineschoke
5053 \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}}
5054 \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}}
5055 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5056 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5057 \pgfusepath{stroke}
5058 \fi
5059 }
5060
5061 %% variable cute inductor
5062 \pgfcircdeclarebipolescaled{inductors}
5063 {
5064 \savedanchor{\midtap}{%
5065 \pgf@x=0pt\relax
5066 \pgfmathsetlength{\pgf@y}{%
5067 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5068 \ctikzvalof{bipoles/cuteinductor/height} :% even
5069 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5070 *\pgf@circ@scaled@Rlen/2
5071 }
5072 }
5073 \anchor{midtap}{\midtap}
5074 }
5075 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5076 {vcuteinductor}
5077 {\ctikzvalof{bipoles/vcuteinductor/height}}
5078 {\ctikzvalof{bipoles/vcuteinductor/width}}
5079 {
5080 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5081 \pgftransformationadjustments
5082
5083 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5084 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5085
5086
5087 \pgfmathsetlength{\pgf@circ@res@step}
5088 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5089
5090 \pgfscope
5091 \pgfsetarrowsend{latexslim}
5092 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5093 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5094 \pgfusepath{draw}
5095 \endpgfscope
5096
5097 \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
5098 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5099 {
5100 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5101 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5102 }
5103 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5104 \pgfsetbuttcap
5105 \pgfsetbeveljoin
5106 \pgfusepath{stroke}
5107 }
5108
5109 %% american inductor
5110 \pgfcircdeclarebipolescaled{inductors}
5111 {
5112 \savedanchor{\midtap}{%
5113 \pgf@x=0pt\relax
5114 \pgfmathsetlength{\pgf@y}{%
5115 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5116 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5117 0) %odd
5118 *\pgf@circ@scaled@Rlen/2
5119 }
5120 }
5121 \anchor{midtap}{\midtap}
5122 }
5123 {\ctikzvalof{bipoles/americaninductor/height 2}}
5124 {americaninductor}
5125 {\ctikzvalof{bipoles/americaninductor/height}}
5126 {\ctikzvalof{bipoles/americaninductor/width}}
5127 {
5128 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5129 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5130 \pgftransformationadjustments
5131 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5132 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5133 \divide \pgf@circ@res@step by 2
5134 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5135
5136 \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
5137 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5138 {
5139 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5140 }
5141 \pgfsetbuttcap
5142 \pgfsetbeveljoin
5143 \pgfusepath{stroke}
5144 }
5145
5146
5147 %% american inductive sensor
5148 \pgfcircdeclarebipolescaled{inductors}
5149 {% anchor for labelling the type of dependency
5150 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5151 \savedanchor{\midtap}{%
5152 \pgf@x=0pt\relax
5153 \pgfmathsetlength{\pgf@y}{%
5154 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5155 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5156 0) %odd
5157 *\pgf@circ@scaled@Rlen/2
5158 }
5159 }
5160 \anchor{midtap}{\midtap}
5161 }
5162 {\ctikzvalof{bipoles/americaninductor/height 2}}
5163 {samericaninductor}
5164 {\ctikzvalof{bipoles/americaninductor/height}}
5165 {\ctikzvalof{bipoles/americaninductor/width}}
5166 {
5167 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5168 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5169 \pgftransformationadjustments
5170 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5171 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5172 \divide \pgf@circ@res@step by 2
5173 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5174
5175 \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
5176 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5177 {
5178 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5179 }
5180 \pgfsetbuttcap
5181 \pgfsetbeveljoin
5182 \pgfusepath{stroke}
5183 \pgfscope
5184 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5185 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5186 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5187 \pgfusepath{draw}
5188 \endpgfscope
5189 }
5190
5191 %% variable american inductor
5192 \pgfcircdeclarebipolescaled{inductors}
5193 {
5194 \savedanchor{\midtap}{%
5195 \pgf@x=0pt\relax
5196 \pgfmathsetlength{\pgf@y}{%
5197 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5198 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5199 0) %odd
5200 *\pgf@circ@scaled@Rlen/2
5201 }
5202 }
5203 \anchor{midtap}{\midtap}
5204 }
5205 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5206 {vamericaninductor}
5207 {\ctikzvalof{bipoles/vamericaninductor/height}}
5208 {\ctikzvalof{bipoles/vamericaninductor/width}}
5209 {
5210 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5211 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5212 \pgftransformationadjustments
5213 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5214 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5215 \divide \pgf@circ@res@step by 2
5216 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5217
5218 \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
5219 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5220 {
5221 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5222 }
5223 \pgfsetbuttcap
5224 \pgfsetbeveljoin
5225 \pgfusepath{stroke}
5226
5227 \pgfscope
5228 \pgfsetarrowsend{latexslim}
5229 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5230 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5231 \pgfusepath{draw}
5232 \endpgfscope
5233 }
5234
5235 %% Generic bipole, filled - used as inductor by some
5236 \pgfcircdeclarebipolescaled{inductors}
5237 {
5238 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5239 }
5240 {\ctikzvalof{bipoles/fullgeneric/height}}
5241 {fullgeneric}
5242 {\ctikzvalof{bipoles/fullgeneric/height}}
5243 {\ctikzvalof{bipoles/fullgeneric/width}}
5244 {
5245 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5246 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5247
5248 \pgfusepath{draw,fill}
5249 }
5250
5251 %% Generic sensor, filled - used as inductive sensor by some
5252 \pgfcircdeclarebipolescaled{inductors}
5253 {% anchor for labelling the type of dependency
5254 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5255 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5256 }
5257 {\ctikzvalof{bipoles/fullgeneric/height}}
5258 {sfullgeneric}
5259 {\ctikzvalof{bipoles/fullgeneric/height}}
5260 {\ctikzvalof{bipoles/fullgeneric/width}}
5261 {
5262
5263 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5264 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5265 \pgfusepath{draw,fill}
5266 %\pgfscope
5267 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5268 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5269 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5270 \pgfusepath{draw}
5271 %\endpgfscope
5272 }
5273
5274 %% Generic full tunable
5275 \pgfcircdeclarebipolescaled{inductors}
5276 {
5277 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5278 }
5279 {\ctikzvalof{bipoles/tfullgeneric/height}}
5280 {tfullgeneric}
5281 {\ctikzvalof{bipoles/tfullgeneric/height}}
5282 {\ctikzvalof{bipoles/tfullgeneric/width}}
5283 {
5284 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5285 \divide \pgf@circ@res@step by 14
5286
5287 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5288 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5289 \pgfusepath{draw,fill}
5290
5291 \pgfscope
5292 \pgfsetarrowsend{latexslim}
5293 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5294 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5295 \pgfusepath{draw}
5296 \endpgfscope
5297 }
5298
5299 %%%%%%%%%%%
5300 %% Battery
5301 %%%%%%%%%%%
5302
5303 %% Battery
5304 \pgfcircdeclarebipolescaled{batteries}
5305 {}
5306 {\ctikzvalof{bipoles/battery/height}}
5307 {battery}
5308 {\ctikzvalof{bipoles/battery/height}}
5309 {\ctikzvalof{bipoles/battery/width}}
5310 {
5311 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5312 \divide \pgf@circ@res@step by 6
5313
5314 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5315
5316 \ifpgf@circ@fixbatteries
5317 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5318 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5319
5320 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5321 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5322
5323 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5324 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5325
5326 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5327 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5328 \else
5329 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5331
5332 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5333 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5334
5335 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5336 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5337
5338 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5339 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5340 \fi
5341 \pgfusepath{draw}
5342 }
5343
5344
5345 %% Battery 1 % poles with equl thickness
5346
5347 \pgfcircdeclarebipolescaled{batteries}
5348 {}
5349 {\ctikzvalof{bipoles/battery1/height}}
5350 {battery1}
5351 {\ctikzvalof{bipoles/battery1/height}}
5352 {\ctikzvalof{bipoles/battery1/width}}
5353 {
5354 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5356 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5357 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5358 \pgfusepath{draw}
5359
5360 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5361 \ifpgf@circ@fixbatteries
5362 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5363 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5364
5365 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5366 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5367 \else
5368 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5369 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5370
5371 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5372 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5373 \fi
5374 \pgfusepath{draw}
5375 }
5376
5377 %% Battery 2 % negative pole thicker
5378
5379 \pgfcircdeclarebipolescaled{batteries}
5380 {}
5381 {\ctikzvalof{bipoles/battery2/height}}
5382 {battery2}
5383 {\ctikzvalof{bipoles/battery2/height}}
5384 {\ctikzvalof{bipoles/battery2/width}}
5385 {
5386 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5387 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5388 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5389 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5390 \pgfusepath{draw}
5391
5392 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5393 \ifpgf@circ@fixbatteries
5394 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5395 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5396 \pgfusepath{draw}
5397 \pgfsetlinewidth{3\pgflinewidth}
5398 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5399 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5400 \else
5401 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5402 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5403 \pgfusepath{draw}
5404 \pgfsetlinewidth{3\pgflinewidth}
5405 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5406 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5407 \fi
5408 \pgfusepath{draw}
5409 }
5410
5411 %%%%%%%%%%%
5412 %% Round and diamond sources
5413 %%%%%%%%%%%
5414
5415 %% Independent voltage source
5416 \pgfcircdeclarebipolescaled{sources}
5417 {}
5418 {\ctikzvalof{bipoles/vsource/height}}
5419 {vsource}
5420 {\ctikzvalof{bipoles/vsource/height}}
5421 {\ctikzvalof{bipoles/vsource/width}}
5422 {
5423
5424 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5425
5426 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5427 \pgf@circ@draworfill
5428 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5429 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5430 \pgfusepath{draw}
5431 }
5432
5433 %% To change the internal symbols of the voltage source american style
5434 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
5435 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
5436 %% Independent voltage source - American style
5437 \pgfcircdeclarebipolescaled{sources}
5438 {}
5439 {\ctikzvalof{bipoles/vsourceam/height}}
5440 {vsourceAM}
5441 {\ctikzvalof{bipoles/vsourceam/height}}
5442 {\ctikzvalof{bipoles/vsourceam/width}}
5443 {
5444
5445 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5446 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5447 \pgf@circ@draworfill
5448 \pgfsetcolor{\ctikzvalof{color}}
5449 \ifpgf@circ@oldvoltagedirection
5450 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5451 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5452 \else
5453 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5454 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5455 \fi
5456 }
5457
5458 %% Independent sinusoidal voltage source
5459 \pgfcircdeclarebipolescaled{sources}
5460 {}
5461 {\ctikzvalof{bipoles/vsourcesin/height}}
5462 {vsourcesin}
5463 {\ctikzvalof{bipoles/vsourcesin/height}}
5464 {\ctikzvalof{bipoles/vsourcesin/width}}
5465 {
5466
5467 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5468 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5469 \pgf@circ@draworfill
5470
5471 \pgf@circ@res@up = .5\pgf@circ@res@up
5472 \pgfscope
5473 \pgftransformrotate{90}
5474 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5475 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5476 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5477 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5478 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5479 \pgfusepath{draw}
5480 \endpgfscope
5481 }
5482
5483 % Square Voltage source - contributed by Alistair Kwan
5484 \pgfcircdeclarebipolescaled{sources}
5485 {}
5486 {\ctikzvalof{bipoles/vsourcesquare/height}}
5487 {vsourcesquare}
5488 {\ctikzvalof{bipoles/vsourcesquare/height}}
5489 {\ctikzvalof{bipoles/vsourcesquare/width}}
5490 {
5491 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5492 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5493 \pgf@circ@draworfill
5494 \pgf@circ@res@up = .5\pgf@circ@res@up
5495 \pgfscope
5496 \pgftransformrotate{90}
5497 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5498 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
5499 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
5500 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5501 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5502 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5503 \pgfusepath{draw}
5504 \endpgfscope
5505 }
5506
5507 % Triangle Voltage source - contributed by Ralf Farkas
5508 \pgfcircdeclarebipolescaled{sources}
5509 {}
5510 {\ctikzvalof{bipoles/vsourcetri/height}}
5511 {vsourcetri}
5512 {\ctikzvalof{bipoles/vsourcetri/height}}
5513 {\ctikzvalof{bipoles/vsourcetri/width}}
5514 {
5515
5516 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5517 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5518 \pgf@circ@draworfill
5519
5520 \pgf@circ@res@up = .5\pgf@circ@res@up
5521 \pgfscope
5522 \pgftransformrotate{90}
5523 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5524 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
5525 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
5526 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5527 \pgfusepath{draw}
5528 \endpgfscope
5529 }
5530
5531
5532 %% PV Source
5533 \pgfcircdeclarebipolescaled{sources}
5534 {}
5535 {\ctikzvalof{bipoles/pvsource/height}}
5536 {pvsource}
5537 {\ctikzvalof{bipoles/pvsource/height}}
5538 {\ctikzvalof{bipoles/pvsource/width}}
5539 {
5540 \pgfpointorigin
5541 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5542 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5544 \pgf@circ@draworfill
5545
5546 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
5547 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5548 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
5549 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5550 \pgfusepath{draw}
5551
5552 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5553 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
5554 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
5555
5556 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
5557 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
5558 \pgfusepath{draw}
5559
5560 %Arrow Part
5561 \pgfscope
5562 \pgfsetarrowsend{latex}
5563 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5564 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5565 \pgfusepath{draw}
5566 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5567 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5568 \pgfusepath{draw}
5569 \endpgfscope
5570
5571 }
5572
5573 %% Empty Source
5574 \pgfcircdeclarebipolescaled{sources}
5575 {}
5576 {\ctikzvalof{bipoles/esource/height}}
5577 {esource}
5578 {\ctikzvalof{bipoles/esource/height}}
5579 {\ctikzvalof{bipoles/esource/width}}
5580 {
5581 \pgfpointorigin
5582 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5583 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5584 \pgf@circ@draworfill
5585 }
5586
5587 %% DC Current Source with open shape
5588 \pgfcircdeclarebipolescaled{sources}
5589 {}
5590 {\ctikzvalof{bipoles/dcisource/height}}
5591 {dcisource}
5592 {\ctikzvalof{bipoles/dcisource/height}}
5593 {\ctikzvalof{bipoles/dcisource/width}}
5594 {
5595 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5596 \pgfpathmoveto{\pgfpointorigin}
5597 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5598 \pgf@circ@maybefill
5599 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
5600 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
5601 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
5602 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
5603 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
5604 \pgfusepath{draw}
5605
5606 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5607 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5608 \pgfusepath{draw}
5609 \pgfscope
5610 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5611 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5612 \endpgfscope
5613 }
5614
5615 %% DC-Voltage source
5616 \pgfcircdeclarebipolescaled{sources}
5617 {}
5618 {\ctikzvalof{bipoles/dcvsource/height}}
5619 {dcvsource}
5620 {\ctikzvalof{bipoles/dcvsource/height}}
5621 {\ctikzvalof{bipoles/dcvsource/width}}
5622 {
5623 \pgfpointorigin
5624 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5625 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5626 \pgf@circ@draworfill
5627 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
5628 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
5629 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
5630 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
5631 \pgfusepath{draw}
5632 }
5633
5634 %% Independent current source
5635 \pgfcircdeclarebipolescaled{sources}
5636 {}
5637 {\ctikzvalof{bipoles/isource/height}}
5638 {isource}
5639 {\ctikzvalof{bipoles/isource/height}}
5640 {\ctikzvalof{bipoles/isource/width}}
5641 {
5642 \pgfpointorigin
5643 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5644 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5645 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5646 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5647 \pgf@circ@draworfill
5648 }
5649
5650 %% Independent double oo source
5651 \pgfcircdeclarebipolescaled{sources}
5652 {}
5653 {\ctikzvalof{bipoles/oosource/height}}
5654 {oosource}
5655 {\ctikzvalof{bipoles/oosource/height}}
5656 {\ctikzvalof{bipoles/oosource/width}}
5657 {
5658 \pgfpointorigin
5659 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5660 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5661 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5662 \pgf@circ@maybefill
5663 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
5664 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
5665 \pgf@circ@draworfill
5666 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5667 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5668 \pgfusepath{draw}
5669 }
5670
5671 % % % winding symbols
5672 % triangle
5673 \def\pgf@circ@delta#1{
5674 \pgfscope
5675 \pgftransformscale{-.01\pgf@circ@res@left*#1}
5676 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5677 \pgftransformrotate{-\pgfcircmathresult}
5678
5679 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5682 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
5683 \pgfpathclose
5684 \pgfusepath{stroke}
5685 \endpgfscope
5686 }
5687
5688 % star
5689 \def\pgf@circ@wye#1{
5690 \pgfscope
5691 \pgftransformscale{-.015\pgf@circ@res@left*#1}
5692 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5693 \pgftransformrotate{-\pgfcircmathresult}
5694
5695 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5696 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
5697 \pgfpathlineto{\pgfpointorigin}
5698 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
5699 \pgfpathmoveto{\pgfpointorigin}
5700 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
5701 \pgfusepath{stroke}
5702 \endpgfscope
5703 }
5704
5705 % zigzag
5706 \def\pgf@circ@zig#1{
5707 \pgfscope
5708 \pgftransformscale{-.015\pgf@circ@res@left*#1}
5709 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5710 \pgftransformrotate{-\pgfcircmathresult}
5711
5712 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5713 \pgfpathmoveto{\pgfpointorigin}
5714 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
5715 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
5716
5717 \pgfpathmoveto{\pgfpointorigin}
5718 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
5719 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
5720
5721 \pgfpathmoveto{\pgfpointorigin}
5722 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
5723 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
5724 \pgfusepath{stroke}
5725 \endpgfscope
5726 }
5727
5728 % % % % round three-phase transformer
5729 \pgfcircdeclarebipolescaled{sources}
5730 {}
5731 {\ctikzvalof{bipoles/oosourcetrans/height}}
5732 {oosourcetrans}
5733 {\ctikzvalof{bipoles/oosourcetrans/height}}
5734 {\ctikzvalof{bipoles/oosourcetrans/width}}
5735 {
5736
5737 \pgfpointorigin
5738 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5739 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
5740 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
5741 \pgf@circ@maybefill
5742 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
5743 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
5744 \pgf@circ@draworfill
5745 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
5746 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
5747 \pgfusepath{draw}
5748
5749
5750 % % % % draw inner symbols
5751
5752 %%primary winding
5753 \ifpgf@circ@prim@delta
5754 \pgfscope
5755 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
5756 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5757 \endpgfscope
5758
5759 \else\ifpgf@circ@prim@wye
5760 \pgfscope
5761 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
5762 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5763 \endpgfscope
5764
5765 \else\ifpgf@circ@prim@zig
5766 \pgfscope
5767 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
5768 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5769 \endpgfscope
5770 \fi\fi\fi
5771
5772 %%secondary winding
5773 \ifpgf@circ@sec@delta
5774 \pgfscope
5775 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
5776 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5777 \endpgfscope
5778
5779 \else\ifpgf@circ@sec@wye
5780 \pgfscope
5781 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
5782 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5783 \endpgfscope
5784
5785 \else\ifpgf@circ@sec@zig
5786 \pgfscope
5787 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
5788 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
5789 \endpgfscope
5790 \fi\fi\fi
5791 }
5792
5793
5794 % % % % ooosource for three phase transformer
5795 \pgfcircdeclarebipolescaled{sources}
5796 {
5797 \anchor{right}{
5798 \northeast
5799 \pgf@y=0pt
5800 \pgfmathparse{
5801 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
5802 %%the sqrt must be > 0, the circles have to intersect
5803 sqrt(
5804 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
5805 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
5806 )
5807 }
5808 \pgf@x=\pgfmathresult\pgf@x
5809 }
5810 \anchor{east}{
5811 \northeast
5812 \pgf@y=0pt
5813 }
5814 \savedanchor{\centerprim}{
5815 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5816 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
5817 \pgf@y=0pt
5818 \pgf@x=.5\pgf@circ@scaled@Rlen
5819 }
5820 \anchor{centerprim}{
5821 \centerprim
5822 }
5823 \savedanchor{\centersec}{
5824 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5825 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
5826 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
5827 \pgf@y=-\pgf@y
5828 \pgf@x=-\pgf@x
5829 }
5830 \anchor{centersec}{
5831 \centersec
5832 }
5833 \savedanchor{\centertert}{
5834 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5835 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
5836 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
5837 \pgf@y=\pgf@y
5838 \pgf@x=-\pgf@x
5839 }
5840 \anchor{centertert}{
5841 \centertert
5842 }
5843
5844 % add some anchors in case the are needed :)
5845 \anchor{prim1}{
5846 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5847 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5848 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}}
5849 }
5850 \anchor{prim2}{
5851 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5852 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5853 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}}
5854 }
5855 \anchor{sec1}{
5856 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5857 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5858 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
5859 }
5860 \anchor{sec2}{
5861 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5862 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5863 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}}
5864 }
5865 \anchor{sec3}{
5866 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5867 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5868 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}}
5869 }
5870 \anchor{tert1}{
5871 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5872 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5873 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
5874 }
5875 \anchor{tert2}{
5876 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5877 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5878 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}}
5879 }
5880 \anchor{tert3}{
5881 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
5882 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
5883 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}}
5884 }
5885 }
5886 {\ctikzvalof{bipoles/ooosource/height}}
5887 {ooosource}
5888 {\ctikzvalof{bipoles/ooosource/height}}
5889 {\ctikzvalof{bipoles/ooosource/height}}
5890 {
5891 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
5892
5893 % % filling
5894 % left
5895 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5896 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
5897 \pgf@circ@maybefill
5898
5899 % up
5900 \pgfscope
5901 \pgfpointorigin
5902 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
5903 \pgf@circ@maybefill
5904 \endpgfscope
5905 % down
5906 \pgfscope
5907 \pgfpointorigin
5908 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
5909 \pgf@circ@draworfill
5910 \endpgfscope
5911
5912 % drawing
5913 % left
5914 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
5915 \pgfusepath{draw}
5916
5917 % up
5918 \pgfscope
5919 \pgfpointorigin
5920 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
5921 \pgfusepath{draw}
5922 \endpgfscope
5923
5924 % % % draw inner symbols
5925
5926 % % primary winding
5927 \ifpgf@circ@prim@delta
5928 \pgfscope
5929 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
5930 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5931 \endpgfscope
5932
5933 \else\ifpgf@circ@prim@wye
5934 \pgfscope
5935 \pgftransformxshift{.6\pgf@circ@res@left}
5936 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5937 \endpgfscope
5938
5939 \else\ifpgf@circ@prim@zig
5940 \pgfscope
5941 \pgftransformxshift{.6\pgf@circ@res@left}
5942 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5943 \endpgfscope
5944 \fi\fi\fi
5945
5946 % % secondary winding
5947 \ifpgf@circ@sec@delta
5948 \pgfscope
5949 \pgfpointorigin
5950 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5951 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5952 \endpgfscope
5953
5954 \else\ifpgf@circ@sec@wye
5955 \pgfscope
5956 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5957 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5958 \endpgfscope
5959
5960 \else\ifpgf@circ@sec@zig
5961 \pgfscope
5962 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5963 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5964 \endpgfscope
5965 \fi\fi\fi
5966
5967 % % tertiary winding
5968 \ifpgf@circ@tert@delta
5969 \pgfscope
5970 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5971 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5972 \endpgfscope
5973
5974 \else\ifpgf@circ@tert@wye
5975 \pgfscope
5976 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5977 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5978 \endpgfscope
5979
5980 \else\ifpgf@circ@tert@zig
5981 \pgfscope
5982 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
5983 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
5984 \endpgfscope
5985 \fi\fi\fi
5986 }
5987
5988 %% Independent current source - American
5989 \pgfcircdeclarebipolescaled{sources}
5990 {}
5991 {\ctikzvalof{bipoles/isourceam/height}}
5992 {isourceAM}
5993 {\ctikzvalof{bipoles/isourceam/height}}
5994 {\ctikzvalof{bipoles/isourceam/width}}
5995 {
5996 \pgfpointorigin
5997 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5998 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5999 \pgf@circ@draworfill
6000
6001 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6002 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6003 \pgfusepath{draw}
6004 \pgfscope
6005 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6006 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6007 \endpgfscope
6008 }
6009
6010 %% Independent sinusoidal current source
6011 \pgfcircdeclarebipolescaled{sources}
6012 {}
6013 {\ctikzvalof{bipoles/isource/height}}
6014 {isourcesin}
6015 {\ctikzvalof{bipoles/isource/height}}
6016 {\ctikzvalof{bipoles/isource/width}}
6017 {
6018 \pgfpointorigin
6019 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6020 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6021 \pgf@circ@draworfill
6022
6023 \pgf@circ@res@up = .5\pgf@circ@res@up
6024 \pgfscope
6025 \pgftransformrotate{90}
6026 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6027 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6028 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6029 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6030 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6031 \pgfusepath{draw}
6032 \endpgfscope
6033 }
6034
6035 %% Empty controlled source
6036 \pgfcircdeclarebipolescaled{csources}
6037 {}
6038 {\ctikzvalof{bipoles/ecsource/height}}
6039 {ecsource}
6040 {\ctikzvalof{bipoles/ecsource/height}}
6041 {\ctikzvalof{bipoles/ecsource/width}}
6042 {
6043
6044 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6045
6046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6047 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6048 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6049 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6050 \pgfpathclose
6051 \pgf@circ@draworfill
6052 }
6053
6054 %% Controlled voltage source
6055 \pgfcircdeclarebipolescaled{csources}
6056 {}
6057 {\ctikzvalof{bipoles/cvsource/height}}
6058 {cvsource}
6059 {\ctikzvalof{bipoles/cvsource/height}}
6060 {\ctikzvalof{bipoles/cvsource/width}}
6061 {
6062
6063 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6064
6065 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6066 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6067 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6068 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6069 \pgfpathclose
6070 \pgf@circ@draworfill
6071
6072 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6073 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6074 \pgfusepath{draw}
6075 }
6076
6077 %% To change the internal symbols of the controlled voltage source american style
6078 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6079 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6080 %% Controlled voltage source - American
6081 \pgfcircdeclarebipolescaled{csources}
6082 {}
6083 {\ctikzvalof{bipoles/cvsourceam/height}}
6084 {cvsourceAM}
6085 {\ctikzvalof{bipoles/cvsourceam/height}}
6086 {\ctikzvalof{bipoles/cvsourceam/width}}
6087 {
6088 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6089 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6091 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6093 \pgfpathclose
6094 \pgf@circ@draworfill
6095
6096 \pgfsetcolor{\ctikzvalof{color}}
6097 \ifpgf@circ@oldvoltagedirection
6098 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6099 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6100 \else
6101 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6102 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6103 \fi
6104 }
6105
6106 %% Controlled sinusoidal voltage source
6107 \pgfcircdeclarebipolescaled{csources}
6108 {}
6109 {\ctikzvalof{bipoles/cvsourcesin/height}}
6110 {cvsourcesin}
6111 {\ctikzvalof{bipoles/cvsourcesin/height}}
6112 {\ctikzvalof{bipoles/cvsourcesin/width}}
6113 {
6114
6115 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6116
6117 \pgfscope
6118 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6119 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6120 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6121 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6122 \pgfpathclose
6123 \pgf@circ@draworfill
6124 \endpgfscope
6125
6126 \pgf@circ@res@up = .5\pgf@circ@res@up
6127 \pgfscope
6128 \pgftransformrotate{90}
6129 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6130 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6131 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6132 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6133 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6134 \pgfusepath{draw}
6135 \endpgfscope
6136 }
6137
6138 %% Controlled sinusoidal current source
6139 \pgfcircdeclarebipolescaled{csources}
6140 {}
6141 {\ctikzvalof{bipoles/cvsourcesin/height}}
6142 {cisourcesin}
6143 {\ctikzvalof{bipoles/cvsourcesin/height}}
6144 {\ctikzvalof{bipoles/cvsourcesin/width}}
6145 {
6146
6147 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6148
6149 \pgfscope
6150 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6151 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6152 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6154 \pgfpathclose
6155 \pgf@circ@draworfill
6156 \endpgfscope
6157
6158 \pgf@circ@res@up = .5\pgf@circ@res@up
6159 \pgfscope
6160 \pgftransformrotate{90}
6161 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6162 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6163 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6164 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6165 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6166 \pgfusepath{draw}
6167 \endpgfscope
6168 }
6169
6170 %% Controlled current source
6171 \pgfcircdeclarebipolescaled{csources}
6172 {}
6173 {\ctikzvalof{bipoles/cisource/height}}
6174 {cisource}
6175 {\ctikzvalof{bipoles/cisource/height}}
6176 {\ctikzvalof{bipoles/cisource/width}}
6177 {
6178
6179 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6180
6181 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6182 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6183 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6184 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6185 \pgfpathclose
6186 \pgf@circ@draworfill
6187
6188 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6189 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6190 \pgfusepath{draw}
6191 }
6192
6193 %% Controlled current source - American
6194 \pgfcircdeclarebipolescaled{csources}
6195 {}
6196 {\ctikzvalof{bipoles/cisourceam/height}}
6197 {cisourceAM}
6198 {\ctikzvalof{bipoles/cisourceam/height}}
6199 {\ctikzvalof{bipoles/cisourceam/width}}
6200 {
6201 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6202
6203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6205 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6206 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6207 \pgfpathclose
6208 \pgf@circ@draworfill
6209 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6210 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6211 \pgfusepath{draw}
6212 \pgfscope
6213 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6214 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6215 \endpgfscope
6216 }
6217
6218 %% Cute Independent voltage source
6219 \pgfcircdeclarebipolescaled{sources}
6220 {}
6221 {\ctikzvalof{bipoles/vsource/height}}
6222 {vsourceC}
6223 {\ctikzvalof{bipoles/vsource/height}}
6224 {\ctikzvalof{bipoles/vsource/width}}
6225 {
6226 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6227 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6228 \pgf@circ@draworfill
6229 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6230 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6231 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6232 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6233 \pgfsetroundcap\pgfusepath{draw}
6234 }
6235
6236 %% Cute Independent current source
6237 \pgfcircdeclarebipolescaled{sources}
6238 {}
6239 {\ctikzvalof{bipoles/isource/height}}
6240 {isourceC}
6241 {\ctikzvalof{bipoles/isource/height}}
6242 {\ctikzvalof{bipoles/isource/width}}
6243 {
6244 \pgfpointorigin
6245 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6246 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6247 \pgf@circ@draworfill
6248 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6249 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6250 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6251 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6252 \pgfsetroundcap\pgfusepath{draw}
6253 }
6254
6255 %% Cute Controlled voltage source
6256 \pgfcircdeclarebipolescaled{csources}
6257 {}
6258 {\ctikzvalof{bipoles/cvsource/height}}
6259 {cvsourceC}
6260 {\ctikzvalof{bipoles/cvsource/height}}
6261 {\ctikzvalof{bipoles/cvsource/width}}
6262 {
6263 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6264 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6265 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6266 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6267 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6268 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6269 \pgf@circ@draworfill
6270 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6271 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6272 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6273 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6274 \pgfsetroundcap\pgfusepath{draw}
6275 }
6276
6277 %% Cute Controlled current source
6278 \pgfcircdeclarebipolescaled{csources}
6279 {}
6280 {\ctikzvalof{bipoles/cisource/height}}
6281 {cisourceC}
6282 {\ctikzvalof{bipoles/cisource/height}}
6283 {\ctikzvalof{bipoles/cisource/width}}
6284 {
6285 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6286 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6287 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6288 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6289 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6290 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6291 \pgf@circ@draworfill
6292 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6293 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6294 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6296 \pgfsetroundcap\pgfusepath{draw}
6297 }
6298
6299 %% Noise voltage source
6300 \pgfcircdeclarebipolescaled{sources}
6301 {}
6302 {\ctikzvalof{bipoles/vsource/height}}
6303 {vsourceN}
6304 {\ctikzvalof{bipoles/vsource/height}}
6305 {\ctikzvalof{bipoles/vsource/width}}
6306 {
6307 \pgfscope
6308 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6309 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6310 %
6311 \pgf@circ@scaled@Rlen=\scaledRlen
6312 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6313 \edef\pgf@noise@temp{dashed}
6314 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6315 \ifx\pgf@noise@temp\pgf@noise@fill
6316 % fillable in this case
6317 \pgf@circ@draworfillandclip
6318 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6319 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6320 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6321 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6322 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6323 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6324 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6325 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6326 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6327 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6328 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6329 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6331 %
6332 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6333 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6334 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6335 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6336 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6338 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6340 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6341 \pgfusepath{draw}
6342 \else
6343 \pgfsetfillcolor{\pgf@noise@fill}
6344 \pgfusepath{draw,fill}
6345 \fi
6346 \endpgfscope
6347 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6348 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6349 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6350 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6351 \pgfsetroundcap\pgfusepath{draw}
6352 }
6353 %% Noise current source
6354
6355 \pgfcircdeclarebipolescaled{sources}
6356 {}
6357 {\ctikzvalof{bipoles/isource/height}}
6358 {isourceN}
6359 {\ctikzvalof{bipoles/isource/height}}
6360 {\ctikzvalof{bipoles/isource/width}}
6361 {
6362 \pgfpointorigin
6363 \pgfscope
6364 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6365 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6366 %
6367 \pgf@circ@scaled@Rlen=\scaledRlen
6368 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6369 \edef\pgf@noise@temp{dashed}
6370 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6371 \ifx\pgf@noise@temp\pgf@noise@fill
6372 % fillable in this case
6373 \pgf@circ@draworfillandclip
6374 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6375 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6376 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6377 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6378 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6379 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6380 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6381 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6382 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6383 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6384 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6387 %
6388 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6389 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6390 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6391 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6392 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6394 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6395 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6396 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6397 \pgfusepath{draw}
6398 \else
6399 \pgfsetfillcolor{\pgf@noise@fill}
6400 \pgfusepath{draw,fill}
6401 \fi
6402 \endpgfscope
6403 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6404 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6405 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6406 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6407 \pgfsetroundcap\pgfusepath{draw}
6408 }
6409
6410 %%%%%%%%%%%%%%
6411 %% Diodes
6412 %%%%%%%%%%%%%%
6413
6414 %% Black generic diode
6415 \pgfcircdeclarebipolescaled{diodes}
6416 {}
6417 {\ctikzvalof{bipoles/diode/height}}
6418 {fulldiode}
6419 {\ctikzvalof{bipoles/diode/height}}
6420 {\ctikzvalof{bipoles/diode/width}}
6421 {
6422
6423 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6424
6425 \pgfscope
6426 \pgftransformxshift{\pgf@circ@res@left}
6427 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6428 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6429 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6430 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6431 \pgfusepath{draw,fill}
6432 \endpgfscope
6433 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6434 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6435 \pgfusepath{draw}
6436 }
6437
6438 %% Black Zener diode
6439 \pgfcircdeclarebipolescaled{diodes}
6440 {}
6441 {\ctikzvalof{bipoles/diode/height}}
6442 {fullzdiode}
6443 {\ctikzvalof{bipoles/diode/height}}
6444 {\ctikzvalof{bipoles/diode/width}}
6445 {
6446
6447 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6448
6449 \pgfscope
6450 \pgftransformxshift{\pgf@circ@res@left}
6451 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6452 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6453 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6454 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6455 \pgfusepath{draw,fill}
6456 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6457 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6458 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6459 \pgfusepath{draw}
6460 \endpgfscope
6461 }
6462
6463 %% Black alternative zigzag Zener diode
6464 \pgfcircdeclarebipolescaled{diodes}
6465 {}
6466 {\ctikzvalof{bipoles/diode/height}}
6467 {fullzzdiode}
6468 {\ctikzvalof{bipoles/diode/height}}
6469 {\ctikzvalof{bipoles/diode/width}}
6470 {
6471
6472 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6473
6474 \pgfscope
6475 \pgftransformxshift{\pgf@circ@res@left}
6476 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6477 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6478 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6479 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6480 \pgfusepath{draw,fill}
6481 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
6482 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6484 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
6485 \pgfusepath{draw}
6486 \endpgfscope
6487 }
6488
6489 %% Black Schottky diode
6490 \pgfcircdeclarebipolescaled{diodes}
6491 {}
6492 {\ctikzvalof{bipoles/diode/height}}
6493 {fullsdiode}
6494 {\ctikzvalof{bipoles/diode/height}}
6495 {\ctikzvalof{bipoles/diode/width}}
6496 {
6497
6498 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6499 \pgfscope
6500 \pgftransformxshift{\pgf@circ@res@left}
6501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6502 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6503 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6505 \pgfusepath{draw,fill}
6506
6507 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
6508 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6510 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6511 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6512 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6513 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
6514 \pgfusepath{draw}
6515 \endpgfscope
6516
6517 }
6518
6519 %% Black tunnel diode
6520 \pgfcircdeclarebipolescaled{diodes}
6521 {}
6522 {\ctikzvalof{bipoles/diode/height}}
6523 {fulltdiode}
6524 {\ctikzvalof{bipoles/diode/height}}
6525 {\ctikzvalof{bipoles/diode/width}}
6526 {
6527
6528 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6529 \pgfscope
6530 \pgftransformxshift{\pgf@circ@res@left}
6531 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6532 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6533 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6534 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6535 \pgfusepath{draw,fill}
6536
6537 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6538 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6539 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6540 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6541 \pgfusepath{draw}
6542 \endpgfscope
6543 }
6544
6545 %
6546 % draw LED arrows
6547 %
6548 \def\pgf@circ@draw@ledarrows{%
6549 \pgfsetlinewidth{\pgfstartlinewidth}
6550 \pgfsetarrowsend{latexslim}
6551 \ifpgf@led@fliparrows
6552 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6553 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6554 \pgfusepath{draw}
6555 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6556 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6557 \pgfusepath{draw}
6558 \else
6559 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6560 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6561 \pgfusepath{draw}
6562 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6563 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6564 \pgfusepath{draw}
6565 \fi
6566 }
6567 %
6568 % ---and photodiode arrows
6569 %
6570 \def\pgf@circ@draw@pdarrows{%
6571 \pgfsetlinewidth{\pgfstartlinewidth}
6572 \pgfsetarrowsstart{latexslim}
6573 \ifpgf@pd@fliparrows
6574 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6575 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6576 \pgfusepath{draw}
6577 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6578 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6579 \pgfusepath{draw}
6580 \else
6581 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6582 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6583 \pgfusepath{draw}
6584 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6585 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6586 \pgfusepath{draw}
6587 \fi
6588 }
6589 %% Black light emitting diode
6590 \pgfcircdeclarebipolescaled{diodes}
6591 {}
6592 {\ctikzvalof{bipoles/diode/height}}
6593 {fulllediode}
6594 {\ctikzvalof{bipoles/diode/height}}
6595 {\ctikzvalof{bipoles/diode/width}}
6596 {
6597
6598 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6599 \pgfscope
6600 \pgftransformxshift{\pgf@circ@res@left}
6601 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6602 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6603 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6604 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6605 \pgfusepath{draw,fill}
6606 \endpgfscope
6607 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6608 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6609 \pgfusepath{draw}
6610
6611 \pgf@circ@draw@ledarrows
6612 }
6613
6614 %% Black photodiode
6615 \pgfcircdeclarebipolescaled{diodes}
6616 {}
6617 {\ctikzvalof{bipoles/diode/height}}
6618 {fullpdiode}
6619 {\ctikzvalof{bipoles/diode/height}}
6620 {\ctikzvalof{bipoles/diode/width}}
6621 {
6622
6623 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6624 \pgfscope
6625 \pgftransformxshift{\pgf@circ@res@left}
6626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6627 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6628 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6629 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6630 \pgfusepath{draw,fill}
6631 \endpgfscope
6632 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6633 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6634 \pgfusepath{draw}
6635
6636 \pgf@circ@draw@pdarrows
6637 }
6638
6639 %% Black varcap
6640 \pgfcircdeclarebipolescaled{diodes}
6641 {}
6642 {\ctikzvalof{bipoles/varcap/height}}
6643 {fullvarcap}
6644 {\ctikzvalof{bipoles/varcap/height}}
6645 {\ctikzvalof{bipoles/varcap/width}}
6646 {
6647 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
6648 \pgfsetlinewidth{\pgf@circ@res@temp}
6649 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6651 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6652 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6653 \pgfusepath{draw,fill}
6654 %
6655 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
6656 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
6657 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6658 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6659 \pgfusepath{draw}
6660 }
6661
6662 %% Code for the diode triangle
6663 \def\pgf@circ@basicdiodeshape{
6664 % \pgfscope
6665 \pgftransformxshift{\pgf@circ@res@left}
6666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6667 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6668 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6669 \pgfpathclose
6670 \pgf@circ@draworfill
6671 \pgfscope
6672 % to allow filling, we need to draw explicitly the stroke here.
6673 \pgfsetlinewidth{\pgfstartlinewidth}
6674 \ifpgf@circuit@bipole@strokedsymbol
6675 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6676 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
6677 \pgfusepath{draw}
6678 \fi
6679 \endpgfscope
6680 % \endpgfscope
6681 }
6682
6683 %% Empty generic diode
6684 \pgfcircdeclarebipolescaled{diodes}
6685 {}
6686 {\ctikzvalof{bipoles/diode/height}}
6687 {emptydiode}
6688 {\ctikzvalof{bipoles/diode/height}}
6689 {\ctikzvalof{bipoles/diode/width}}
6690 {
6691 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6692 \pgfscope
6693 \pgf@circ@basicdiodeshape
6694 \endpgfscope
6695 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6697 \pgfusepath{draw}
6698 }
6699
6700 %% Empty Zener diode
6701 \pgfcircdeclarebipolescaled{diodes}
6702 {}
6703 {\ctikzvalof{bipoles/diode/height}}
6704 {emptyzdiode}
6705 {\ctikzvalof{bipoles/diode/height}}
6706 {\ctikzvalof{bipoles/diode/width}}
6707 {
6708
6709 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6710
6711 \pgfscope
6712 \pgf@circ@basicdiodeshape
6713 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6714 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6715 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6716 \pgfusepath{draw}
6717 \endpgfscope
6718 }
6719
6720 %% Empty alternative zigzag Zener diode
6721 \pgfcircdeclarebipolescaled{diodes}
6722 {}
6723 {\ctikzvalof{bipoles/diode/height}}
6724 {emptyzzdiode}
6725 {\ctikzvalof{bipoles/diode/height}}
6726 {\ctikzvalof{bipoles/diode/width}}
6727 {
6728
6729 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6730
6731 \pgfscope
6732 \pgf@circ@basicdiodeshape
6733 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
6734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6735 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6736 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
6737 \pgfusepath{draw}
6738 \endpgfscope
6739 }
6740 %% Empty Schottky diode
6741 \pgfcircdeclarebipolescaled{diodes}
6742 {}
6743 {\ctikzvalof{bipoles/diode/height}}
6744 {emptysdiode}
6745 {\ctikzvalof{bipoles/diode/height}}
6746 {\ctikzvalof{bipoles/diode/width}}
6747 {
6748
6749 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6750 \pgfscope
6751 \pgf@circ@basicdiodeshape
6752 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
6753 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6754 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6755 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6756 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6757 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6758 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
6759 \pgfusepath{draw}
6760 \endpgfscope
6761
6762 }
6763
6764 %% Empty tunnel diode
6765 \pgfcircdeclarebipolescaled{diodes}
6766 {}
6767 {\ctikzvalof{bipoles/diode/height}}
6768 {emptytdiode}
6769 {\ctikzvalof{bipoles/diode/height}}
6770 {\ctikzvalof{bipoles/diode/width}}
6771 {
6772
6773 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6774 \pgfscope
6775 \pgf@circ@basicdiodeshape
6776 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6777 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6779 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6780 \pgfusepath{draw}
6781 \endpgfscope
6782 }
6783
6784 %% Empty light emitting diode
6785 \pgfcircdeclarebipolescaled{diodes}
6786 {}
6787 {\ctikzvalof{bipoles/diode/height}}
6788 {emptylediode}
6789 {\ctikzvalof{bipoles/diode/height}}
6790 {\ctikzvalof{bipoles/diode/width}}
6791 {
6792
6793 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6794 \pgfscope
6795 \pgf@circ@basicdiodeshape
6796 \endpgfscope
6797 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6798 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6799 \pgfusepath{draw}
6800
6801 \pgf@circ@draw@ledarrows
6802 }
6803
6804 %% Empty photodiode
6805 \pgfcircdeclarebipolescaled{diodes}
6806 {}
6807 {\ctikzvalof{bipoles/diode/height}}
6808 {emptypdiode}
6809 {\ctikzvalof{bipoles/diode/height}}
6810 {\ctikzvalof{bipoles/diode/width}}
6811 {
6812
6813 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6814 \pgfscope
6815 \pgf@circ@basicdiodeshape
6816 \endpgfscope
6817 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6818 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6819 \pgfusepath{draw}
6820
6821 \pgf@circ@draw@pdarrows
6822 }
6823
6824 %% Empty varcap
6825 \pgfcircdeclarebipolescaled{diodes}
6826 {}
6827 {\ctikzvalof{bipoles/varcap/height}}
6828 {emptyvarcap}
6829 {\ctikzvalof{bipoles/varcap/height}}
6830 {\ctikzvalof{bipoles/varcap/width}}
6831 {
6832 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
6833 \pgfsetlinewidth{\pgf@circ@res@temp}
6834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6836 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6837 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6838 \pgfpathclose
6839 \pgf@circ@draworfill
6840 \pgfscope
6841 % to allow filling, we need to draw explicitily the stroke here.
6842 \pgfsetlinewidth{\pgfstartlinewidth}
6843 \ifpgf@circuit@bipole@strokedsymbol
6844 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6846 \pgfusepath{draw}
6847 \fi
6848 \endpgfscope
6849 %
6850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
6851 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
6852 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6853 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6854 \pgfusepath{draw}
6855 }
6856
6857 %% Empty bidirectionaldiode
6858 \pgfcircdeclarebipolescaled{diodes}
6859 {}
6860 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6861 {emptybidirectionaldiode}
6862 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6863 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
6864 {
6865
6866 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6867
6868 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
6869 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
6870
6871 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6872 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6873 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6874 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6875
6876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6877 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6878 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6879 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6880
6881 \pgf@circ@draworfill
6882
6883 \pgfsetlinewidth{\pgfstartlinewidth}
6884
6885 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6886 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6887
6888 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6889 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6890
6891 \pgfusepath{draw}
6892 }
6893
6894 %% Full bidirectionaldiode
6895 \pgfcircdeclarebipolescaled{diodes}
6896 {}
6897 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6898 {fullbidirectionaldiode}
6899 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
6900 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
6901 {
6902
6903 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6904
6905 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
6906 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
6907
6908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6909 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6910 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6912
6913 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6914 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
6915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6916 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
6917
6918 \pgfusepath{draw, fill}
6919
6920 \pgfsetlinewidth{\pgfstartlinewidth}
6921
6922 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6923 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6924
6925 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6927
6928 \pgfusepath{draw}
6929 }
6930
6931 %% Black thyristor
6932 \pgfcircdeclarebipolescaled{diodes}
6933 {
6934 \anchor{gate}{\northeast}
6935 \anchor{anode}{\southwest\pgf@y=0cm}
6936 \anchor{G}{\northeast}
6937 \anchor{cathode}{\northeast\pgf@y=0cm }
6938 }
6939 {\ctikzvalof{tripoles/thyristor/height 2}}
6940 {fullthyristor}
6941 {\ctikzvalof{tripoles/thyristor/height}}
6942 {\ctikzvalof{tripoles/thyristor/width}}
6943 {
6944
6945 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6946
6947 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
6948 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
6949
6950 \pgfscope
6951 \pgftransformxshift{\pgf@circ@res@other}
6952 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6953
6954 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
6955 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6956 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6957 \pgfusepath{draw,fill}
6958
6959 \pgfsetlinewidth{\pgfstartlinewidth}
6960
6961 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
6962 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
6963 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
6964 \pgfusepath{draw}
6965 \endpgfscope
6966
6967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6968 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
6969
6970 \pgfusepath{draw}
6971
6972 \pgfsetlinewidth{\pgfstartlinewidth}
6973
6974 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
6975 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
6976
6977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
6978 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
6979
6980 \pgfusepath{draw}
6981
6982 }
6983
6984 %% Empty thyristor
6985
6986 \pgfcircdeclarebipolescaled{diodes}
6987 {
6988 \anchor{gate}{\northeast}
6989 \anchor{anode}{\southwest\pgf@y=0cm}
6990 \anchor{G}{\northeast}
6991 \anchor{cathode}{\northeast\pgf@y=0cm }
6992 }
6993 {\ctikzvalof{tripoles/thyristor/height 2}}
6994 {emptythyristor}
6995 {\ctikzvalof{tripoles/thyristor/height}}
6996 {\ctikzvalof{tripoles/thyristor/width}}
6997 {
6998
6999 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7000
7001 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7002 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7003
7004 \pgfscope
7005 \pgftransformxshift{\pgf@circ@res@other}
7006 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7007
7008 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7009 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7010 \pgfpathclose
7011 \pgf@circ@draworfill
7012 \pgfscope
7013 % to allow filling, we need to draw explicitily the stroke here.
7014 \pgfsetlinewidth{\pgfstartlinewidth}
7015 \ifpgf@circuit@bipole@strokedsymbol
7016 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7017 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7018 \pgfusepath{draw}
7019 \fi
7020 \endpgfscope
7021
7022 \pgfsetlinewidth{\pgfstartlinewidth}
7023
7024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7025 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7026 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7027 \pgfusepath{draw}
7028 \endpgfscope
7029
7030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7032
7033 \pgfusepath{draw}
7034
7035 \pgfsetlinewidth{\pgfstartlinewidth}
7036
7037 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7038 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7039
7040 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7041 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7042
7043 \pgfusepath{draw}
7044 }
7045
7046 %% Empty triac
7047 \pgfcircdeclarebipolescaled{diodes}
7048 {
7049 \anchor{gate}{\northeast}
7050 \anchor{anode}{\southwest\pgf@y=0cm}
7051 \anchor{G}{\northeast}
7052 \anchor{cathode}{\northeast\pgf@y=0cm }
7053 }
7054 {\ctikzvalof{tripoles/triac/height}}
7055 {emptytriac}
7056 {\ctikzvalof{tripoles/triac/height}}
7057 {\ctikzvalof{tripoles/triac/width}}
7058 {
7059
7060 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7061
7062 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7063 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7064
7065 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7066 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7067 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7068 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7069
7070 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7071 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7072 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7073 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7074
7075 \pgf@circ@draworfill
7076
7077 \pgfsetlinewidth{\pgfstartlinewidth}
7078
7079 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7080 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7082
7083 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7084 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7085
7086 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7088
7089 \pgfusepath{draw}
7090 }
7091
7092 %% Full triac
7093 \pgfcircdeclarebipolescaled{diodes}
7094 {
7095 \anchor{gate}{\northeast}
7096 \anchor{anode}{\southwest\pgf@y=0cm}
7097 \anchor{G}{\northeast}
7098 \anchor{cathode}{\northeast\pgf@y=0cm }
7099 }
7100 {\ctikzvalof{tripoles/triac/height}}
7101 {fulltriac}
7102 {\ctikzvalof{tripoles/triac/height}}
7103 {\ctikzvalof{tripoles/triac/width}}
7104 {
7105 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7106
7107 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7108 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7109
7110 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7111 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7112 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7113 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7114
7115 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7116 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7118 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7119
7120 \pgfusepath{draw,fill}
7121
7122 \pgfsetlinewidth{\pgfstartlinewidth}
7123
7124 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7126 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7127
7128 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7130
7131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7132 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7133
7134 \pgfusepath{draw}
7135 }
7136
7137 %%%%%%%%%%%%%
7138 %% switches
7139 %%%%%%%%%%%%%
7140
7141 %% (Closing) SPST
7142 \pgfcircdeclarebipolescaled{switches}
7143 {}
7144 {\ctikzvalof{bipoles/spst/depth}}
7145 {cspst}
7146 {\ctikzvalof{bipoles/spst/height}}
7147 {\ctikzvalof{bipoles/spst/width}}
7148 {
7149 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7150 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7151 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7152 \pgfusepath{draw}
7153
7154 \pgfscope
7155 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7156 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
7157 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
7158 \pgfsetarrowsend{latexslim}
7159 \pgfsetbeveljoin
7160 \pgfusepath{draw}
7161 \endpgfscope
7162 }
7163
7164 %% Opening SPST
7165 \pgfcircdeclarebipolescaled{switches}
7166 {}
7167 {\ctikzvalof{bipoles/spst/depth}}
7168 {ospst}
7169 {\ctikzvalof{bipoles/spst/height}}
7170 {\ctikzvalof{bipoles/spst/width}}
7171 {
7172
7173 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7174 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7175 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7176 \pgfusepath{draw}
7177
7178 \pgfscope
7179 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7180 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7181 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
7182 \pgfsetarrowsend{latexslim}
7183 \pgfsetbeveljoin
7184 \pgfusepath{draw}
7185 \endpgfscope
7186 }
7187
7188 %% Normal open Switch
7189 \pgfcircdeclarebipolescaled{switches}
7190 {}
7191 {\ctikzvalof{bipoles/nos/depth}}
7192 {nos}
7193 {\ctikzvalof{bipoles/nos/height}}
7194 {\ctikzvalof{bipoles/nos/width}}
7195 {
7196
7197 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7199 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7200 \pgfsetbuttcap
7201 \pgfusepath{draw}
7202 }
7203
7204 %% Normal closed Switch
7205 \pgfcircdeclarebipolescaled{switches}
7206 {}
7207 {\ctikzvalof{bipoles/ncs/depth}}
7208 {ncs}
7209 {\ctikzvalof{bipoles/ncs/height}}
7210 {\ctikzvalof{bipoles/ncs/width}}
7211 {
7212 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7213 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7214 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7215 \pgfusepath{draw}
7216 \pgfsetlinewidth{\pgfstartlinewidth}
7217 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7218 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
7219 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
7220 \pgfusepath{draw}
7221 }
7222
7223 %% Push Button
7224 \pgfcircdeclarebipolescaled{switches}
7225 {}
7226 {\ctikzvalof{bipoles/pushbutton/height 2}}
7227 {pushbutton}
7228 {\ctikzvalof{bipoles/pushbutton/height}}
7229 {\ctikzvalof{bipoles/pushbutton/width}}
7230 {
7231 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7232 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
7233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
7234 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
7235 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7236 \pgfusepath{draw}
7237
7238 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7239 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7240 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7241 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7242 }
7243
7244 %% Normally closed Push Button
7245 \pgfcircdeclarebipolescaled{switches}
7246 {}
7247 {\ctikzvalof{bipoles/pushbutton/height 2}}
7248 {ncpushbutton}
7249 {\ctikzvalof{bipoles/pushbutton/height}}
7250 {\ctikzvalof{bipoles/pushbutton/width}}
7251 {
7252 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7253 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7254 % Warning, if the nodes will have a class, we have to touch this.
7255 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7256 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
7257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
7258 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
7259 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7260 \pgfusepath{draw}
7261 %
7262 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7263 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7264 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7265 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7266 }
7267 %%% reed switches
7268 \pgfcircdeclarebipolescaled{switches}
7269 {}
7270 {\ctikzvalof{bipoles/reed/depth}}
7271 {reed}
7272 {\ctikzvalof{bipoles/reed/height}}
7273 {\ctikzvalof{bipoles/reed/width}}
7274 {
7275 % this is designed to be the same as a "nos".
7276 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
7277 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
7278 \pgfscope
7279 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7280 % eclosure
7281 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
7282 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
7283 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
7284 \pgfpatharc{270}{90}{\pgf@circ@res@up}
7285 \pgfpathclose
7286 \pgf@circ@draworfill
7287 % switch
7288 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7289 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
7290 % connection lines
7291 \pgfsetbuttcap
7292 \pgfusepath{draw}
7293 \endpgfscope
7294 % connection lines
7295 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7296 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7297 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7298 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
7299 \pgfusepath{draw}
7300 }
7301
7302 % cute switch "to" shapes help function
7303 % #1 -> name
7304 % #2 -> barposition
7305 % #3 -> arrowcode
7306 \long\def\pgfcircdeclarecutesw#1#2#3{
7307 \pgfcircdeclarebipolescaled{switches}
7308 {
7309 \savedanchor\midlever{
7310 % these values are calculated when we create the definition of the shape.
7311 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
7312 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
7313 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
7314 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7315 \pgf@circ@res@down = -.5\pgf@y
7316 \pgf@circ@res@up = .5\pgf@y
7317 \pgfextracty{\pgf@circ@res@other}{#2}
7318 \pgf@x=0pt
7319 \pgf@y=.5\pgf@circ@res@other
7320 }
7321 % radius of the connector
7322 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7323 % If cnnecting nodes are scaled, we have to modify this
7324 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
7325 % shapename
7326 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
7327 % shape type
7328 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
7329 % mid of the lever, to stack switches
7330 \anchor{mid}{\midlever}
7331 \anchor{cout}{\northeast \pgf@y=0cm}
7332 \anchor{cin}{\southwest\pgf@y=0cm}
7333 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
7334 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
7335 }
7336 {\ctikzvalof{bipoles/cuteswitch/height 2}}
7337 {#1}
7338 {\ctikzvalof{bipoles/cuteswitch/height}}
7339 {\ctikzvalof{bipoles/cuteswitch/width}}{
7340 \pgfscope
7341 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7342 % If cnnecting nodes are scaled, we have to modify this
7343 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7344 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7345 \pgfsetlinewidth{2\pgf@circ@res@temp}
7346 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7347 \pgfpathlineto{#2}
7348 \pgfsetroundcap\pgfusepath{draw}
7349 \endpgfscope
7350 \pgfscope % arrow
7351 #3
7352 \endpgfscope
7353 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7354 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
7355 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7356 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
7357 }
7358 }
7359
7360 %% closed cute switch
7361 \pgfcircdeclarecutesw{cuteclosedswitch}
7362 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7363 {}
7364
7365 %% open cute switch
7366 \pgfcircdeclarecutesw{cuteopenswitch}
7367 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7368 {}
7369
7370 %% closing cute switch
7371 \pgfcircdeclarecutesw{cuteclosingswitch}
7372 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7373 {
7374 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7375 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7376 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
7377 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
7378 \pgfsetarrowsend{latexslim}
7379 \pgfusepath{draw}
7380 }
7381
7382 %% opening cute switch
7383 \pgfcircdeclarecutesw{cuteopeningswitch}
7384 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7385 {
7386 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7387 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7388 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7389 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
7390 \pgfsetarrowsend{latexslim}
7391 \pgfusepath{draw}
7392 }
7393
7394 %%%%%%%%%%%%%%%%%
7395 %% Instruments
7396 %%%%%%%%%%%%%%%%%
7397
7398 % % METERINGSHAPE
7399 \long\def\drawmeteringcircle{
7400 \def\pgf@circ@temp{right}
7401 \ifx\tikz@res@label@pos\pgf@circ@temp
7402 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7403 \else
7404 \def\pgf@circ@temp{below}
7405 \ifx\tikz@res@label@pos\pgf@circ@temp
7406 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7407 \else
7408 \pgf@circ@res@step=1.2\pgf@circ@res@up
7409 \fi
7410 \fi
7411 %draw connections to circle
7412 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7413 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
7414 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
7415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7416 \pgfusepath{draw}
7417 %draw circle
7418 \pgfscope
7419 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7420 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
7421 \pgf@circ@draworfill
7422 \endpgfscope
7423 %draw arrow
7424 \pgfscope
7425 \pgfsetarrowsend{latex}
7426 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7427 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
7428 \pgfusepath{draw}
7429 \endpgfscope
7430 }
7431
7432 %AMPEREMETER
7433 \pgfcircdeclarebipolescaled{instruments}
7434 {}
7435 {\ctikzvalof{bipoles/ammeter/height}}
7436 {ammeter}
7437 {\ctikzvalof{bipoles/ammeter/height}}
7438 {\ctikzvalof{bipoles/ammeter/width}}
7439 {
7440 \drawmeteringcircle
7441 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
7442 }
7443 %OHMMETER
7444 \pgfcircdeclarebipolescaled{instruments}
7445 {}
7446 {\ctikzvalof{bipoles/ohmmeter/height}}
7447 {ohmmeter}
7448 {\ctikzvalof{bipoles/ohmmeter/height}}
7449 {\ctikzvalof{bipoles/ohmmeter/width}}
7450 {
7451 \drawmeteringcircle
7452 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
7453 }
7454 %VOLTMETER
7455 \pgfcircdeclarebipolescaled{instruments}
7456 {}
7457 {\ctikzvalof{bipoles/voltmeter/height}}
7458 {voltmeter}
7459 {\ctikzvalof{bipoles/voltmeter/height}}
7460 {\ctikzvalof{bipoles/voltmeter/width}}
7461 {
7462 \drawmeteringcircle
7463 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
7464
7465 }
7466
7467 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
7468 \pgfcircdeclarebipolescaled{instruments}
7469 {
7470 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7471 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7472 % put the node text above and centered
7473 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7474 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7475 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7476 }
7477 }
7478 }
7479 {\ctikzvalof{bipoles/oscope/height}}
7480 {oscope}
7481 {\ctikzvalof{bipoles/oscope/height}}
7482 {\ctikzvalof{bipoles/oscope/width}}
7483 {
7484 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7485 \pgfextracty{\pgf@circ@res@up}{\northeast}
7486 \pgfextractx{\pgf@circ@res@right}{\northeast}
7487 \pgfextractx{\pgf@circ@res@left}{\southwest}
7488 \pgfextracty{\pgf@circ@res@down}{\southwest}
7489 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7490 \pgfscope
7491 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7492 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7493 % this would create a round (analog?) scope...
7494 % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7495 \pgf@circ@draworfill
7496 \endpgfscope
7497 % get the rotation
7498 \ifpgf@circuit@straightinstruments
7499 \pgfgettransformentries\a\b\temp\temp\temp\temp
7500 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7501 \else
7502 \edef\rot{0}
7503 \fi
7504 % and unrotate the scope
7505 \pgfscope
7506 \pgftransformrotate{\rot}
7507 % grid
7508 \pgfscope
7509 \pgfsetlinewidth{0.5\pgfstartlinewidth}
7510 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7511 \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]%
7512 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
7513 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
7514 \pgfsetstrokeopacity{0.5}
7515 \pgfusepath{draw}
7516 \endpgfscope
7517 % function displayed, thanks to
7518 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7519 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7520 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
7521 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7522 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
7523 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
7524 \pgfusepath{draw}
7525 \endpgfscope
7526 }
7527
7528 % generic round meter with always horizontal text, no arrow
7529 \pgfcircdeclarebipolescaled{instruments}
7530 {}
7531 {\ctikzvalof{bipoles/esource/height}}
7532 {rmeter}
7533 {\ctikzvalof{bipoles/esource/height}}
7534 {\ctikzvalof{bipoles/esource/width}}
7535 {
7536 \pgfpointorigin
7537 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7538 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7539 \pgf@circ@draworfill
7540 % draw the text label
7541 % get the rotation
7542 \ifpgf@circuit@straightinstruments
7543 \pgfgettransformentries\a\b\temp\temp\temp\temp
7544 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7545 \else
7546 \edef\rot{0}
7547 \fi
7548 % and unrotate the scope
7549 \pgfscope
7550 \pgfsetcolor{\ctikzvalof{color}}
7551 \pgftransformrotate{\rot}
7552 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
7553 \endpgfscope
7554 }
7555
7556 % generic round meter with always horizontal text, with arrow
7557 \pgfcircdeclarebipolescaled{instruments}
7558 {}
7559 {\ctikzvalof{bipoles/esource/height}}
7560 {rmeterwa}
7561 {\ctikzvalof{bipoles/esource/height}}
7562 {\ctikzvalof{bipoles/esource/width}}
7563 {
7564 \pgfpointorigin
7565 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7566 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7567 \pgf@circ@draworfill
7568 % draw the text label
7569 % get the rotation
7570 \ifpgf@circuit@straightinstruments
7571 \pgfgettransformentries\a\b\temp\temp\temp\temp
7572 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7573 \else
7574 \edef\rot{0}
7575 \fi
7576 % and unrotate the scope
7577 \pgfscope
7578 \pgftransformrotate{\rot}
7579 \pgfsetcolor{\ctikzvalof{color}}
7580 \pgfsetlinewidth{\pgfstartlinewidth}
7581 % arrow: create a center hole to have better visual
7582 \pgfscope
7583 % clipping path: first a rectangle bigger then the shape
7584 % to avoid problems with the line thickness
7585 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7586 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7587 % next open a circle into it
7588 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
7589 % do the difference and clip before drawing
7590 \pgfseteorule
7591 \pgfusepath{clip}
7592 \pgfsetarrowsend{latexslim}
7593 % the arrow is better if it has a bit of breath and it's not 45º
7594 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
7595 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
7596 \pgfusepath{draw}
7597 \endpgfscope
7598 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
7599 \endpgfscope
7600 }
7601
7602 % generic square meter with always horizontal text
7603 \pgfcircdeclarebipolescaled{instruments}
7604 {
7605 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7606 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7607 % put the node text above and centered
7608 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7609 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7610 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7611 }
7612 }
7613 }
7614 {\ctikzvalof{bipoles/smeter/height}}
7615 {smeter}
7616 {\ctikzvalof{bipoles/smeter/height}}
7617 {\ctikzvalof{bipoles/smeter/width}}
7618 {
7619 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7620 \pgfextracty{\pgf@circ@res@up}{\northeast}
7621 \pgfextractx{\pgf@circ@res@right}{\northeast}
7622 \pgfextractx{\pgf@circ@res@left}{\southwest}
7623 \pgfextracty{\pgf@circ@res@down}{\southwest}
7624 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7625 \pgfscope
7626 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7627 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7628 \pgf@circ@draworfill
7629 \endpgfscope
7630 % get the rotation
7631 \ifpgf@circuit@straightinstruments
7632 \pgfgettransformentries\a\b\temp\temp\temp\temp
7633 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7634 \else
7635 \edef\rot{0}
7636 \fi
7637 % and unrotate the scope
7638 \pgfscope
7639 \pgftransformrotate{\rot}
7640 % the metering window
7641 \pgfscope
7642 \def\@starta{105}\def\@stopa{75}
7643 \pgfsetlinewidth{\pgfstartlinewidth}
7644 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
7645 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
7646 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
7647 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
7648 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
7649 \pgfclosepath
7650 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
7651 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
7652 \pgfusepath{draw}
7653 \endpgfscope
7654 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
7655 \endpgfscope
7656 }
7657
7658 % probes qucs style:
7659 % #1 : name
7660 % #2 : extra code
7661 \long\def\pgfcirc@qucsprobe#1#2{
7662 \pgfcircdeclarebipolescaled{instruments}
7663 {
7664 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
7665 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
7666 % put the node text above and centered
7667 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7668 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7669 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7670 }
7671 }
7672 }
7673 {\ctikzvalof{bipoles/qmeter/depth}}
7674 {#1}
7675 {\ctikzvalof{bipoles/qmeter/height}}
7676 {\ctikzvalof{bipoles/qmeter/width}}
7677 {
7678 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7679 \pgfextracty{\pgf@circ@res@up}{\northeast}
7680 \pgfextractx{\pgf@circ@res@right}{\northeast}
7681 \pgfextractx{\pgf@circ@res@left}{\southwest}
7682 \pgfextracty{\pgf@circ@res@down}{\southwest}
7683 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7684 \pgfscope
7685 \pgfscope
7686 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7687 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7688 \pgf@circ@draworfill
7689 \endpgfscope
7690 \def\@starta{103}\def\@stopa{77}
7691 \pgfsetlinewidth{\pgfstartlinewidth}
7692 \pgfscope
7693 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
7694 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
7695 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
7696 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
7697 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
7698 \pgfclosepath
7699 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
7700 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
7701 \pgfusepath{draw}
7702 \pgf@circ@draworfill
7703 \endpgfscope
7704 #2
7705 \endpgfscope
7706 }
7707 }
7708
7709 \pgfcirc@qucsprobe{qiprobe}{
7710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7711 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7712 \pgfusepath{draw}
7713 \pgfnode{currarrow}{center}{}{}{}
7714 }
7715
7716 \pgfcirc@qucsprobe{qvprobe}{
7717 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
7718 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7719 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
7720 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
7721 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
7722 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7723 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
7724 \pgfusepath{draw}
7725 \pgfscope
7726 % "+" and "-", drawn so that they scale correctly
7727 \pgfsetlinewidth{2\pgfstartlinewidth}
7728 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
7729 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
7730 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7731 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7732 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7733 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
7734 \pgfusepath{draw}
7735 \endpgfscope
7736 }
7737
7738 \pgfcirc@qucsprobe{qpprobe}{
7739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7741 \pgfusepath{draw}
7742 \pgfnode{currarrow}{center}{}{}{}
7743 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
7744 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
7745 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
7746 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
7747 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
7748 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
7749 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
7750 \pgfusepath{draw}
7751 \pgfscope
7752 % "+" and "-", drawn so that they scale correctly
7753 \pgfsetlinewidth{2\pgfstartlinewidth}
7754 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
7755 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
7756 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7757 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7758 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7759 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
7760 \pgfusepath{draw}
7761 \endpgfscope
7762 }
7763
7764 % current loop for oscope and similar: stylized
7765 \pgfcircdeclarebipolescaled{instruments}
7766 {
7767 \anchor{i}{\northeast\pgf@x=0pt\relax}
7768 \anchor{text}{
7769 \pgfextracty{\pgf@circ@res@up}{\northeast}
7770 \pgfextractx{\pgf@circ@res@left}{\northeast}
7771 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
7772 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7773 }
7774 }
7775 }
7776 {\ctikzvalof{bipoles/iloop/height}}
7777 {iloop}
7778 {\ctikzvalof{bipoles/iloop/height}}
7779 {\ctikzvalof{bipoles/iloop/width}}
7780 {
7781 \pgfextracty{\pgf@circ@res@up}{\northeast}
7782 \pgfextractx{\pgf@circ@res@right}{\northeast}
7783 \pgf@circ@res@down=-\pgf@circ@res@up
7784 \pgf@circ@res@left=-\pgf@circ@res@right
7785 \pgfscope
7786 \pgfstartlinewidth=\pgflinewidth
7787 \pgfsetcolor{\ctikzvalof{color}}
7788 % external ellipse
7789 \pgfscope
7790 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
7791 % clipping path: first a rectangle bigger then the shape
7792 % to avoid problems with the line thickness
7793 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7794 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7795 % next the opening to the left
7796 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
7797 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
7798 % do the difference and clip before drawing
7799 \pgfseteorule
7800 \pgfusepath{clip}
7801 \pgfpathellipse{\pgfpointorigin}{
7802 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
7803 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
7804 \pgfusepath{draw}
7805 \endpgfscope
7806 % internal wire
7807 \pgfsetlinewidth{\pgfstartlinewidth}
7808 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7809 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
7810 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
7811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7812 % and the contact line up
7813 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7814 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7815 \pgfusepath{draw}
7816 \endpgfscope
7817 }
7818
7819 % current loop for oscope and similar: real (double connection)
7820 \pgfcircdeclarebipolescaled{instruments}
7821 {
7822 \anchor{i+}{
7823 \pgfextracty{\pgf@circ@res@up}{\northeast}
7824 \pgfextractx{\pgf@circ@res@right}{\northeast}
7825 \pgf@circ@res@step=0.4\pgf@circ@res@right
7826 \pgf@circ@res@other=0.8\pgf@circ@res@up
7827 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
7828 \pgf@y=\pgf@circ@res@up
7829 }
7830 \anchor{i-}{
7831 \pgfextracty{\pgf@circ@res@up}{\northeast}
7832 \pgfextractx{\pgf@circ@res@right}{\northeast}
7833 \pgf@circ@res@step=0.4\pgf@circ@res@right
7834 \pgf@circ@res@other=0.8\pgf@circ@res@up
7835 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
7836 \pgf@y=\pgf@circ@res@up
7837 }
7838 \anchor{text}{
7839 \pgfextracty{\pgf@circ@res@up}{\northeast}
7840 \pgfextractx{\pgf@circ@res@left}{\northeast}
7841 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
7842 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7843 }
7844 }
7845 }
7846 {\ctikzvalof{bipoles/iloop/height}}
7847 {iloop2}
7848 {\ctikzvalof{bipoles/iloop/height}}
7849 {\ctikzvalof{bipoles/iloop/width}}
7850 {
7851 \pgfextracty{\pgf@circ@res@up}{\northeast}
7852 \pgfextractx{\pgf@circ@res@right}{\northeast}
7853 \pgf@circ@res@down=-\pgf@circ@res@up
7854 \pgf@circ@res@left=-\pgf@circ@res@right
7855 % must be the same than internal i+ and i- anchors definition
7856 \pgf@circ@res@step=0.4\pgf@circ@res@right
7857 \pgf@circ@res@other=0.8\pgf@circ@res@up
7858 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
7859 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
7860 \pgfscope
7861 \pgfstartlinewidth=\pgflinewidth
7862 \pgfsetcolor{\ctikzvalof{color}}
7863 % external ellipse
7864 \pgfscope
7865 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
7866 % clipping path: first a rectangle bigger then the shape
7867 % to avoid problems with the line thickness
7868 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7869 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7870 % next the opening to the left
7871 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
7872 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
7873 % do the difference and clip before drawing
7874 \pgfseteorule
7875 \pgfusepath{clip}
7876 \pgfpathmoveto{\@plus}
7877 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
7878 \pgfusepath{draw}
7879 \endpgfscope
7880 % internal wire
7881 \pgfsetlinewidth{\pgfstartlinewidth}
7882 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7883 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
7884 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
7885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7886 % and the contact line up
7887 % I use ...left and ---right as temporal lengths here to avoid defining more
7888 \pgfextractx{\pgf@circ@res@left}{\@plus}
7889 \pgfextractx{\pgf@circ@res@right}{\@minus}
7890 \pgfpathmoveto{\@plus}
7891 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7892 \pgfpathmoveto{\@minus}
7893 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7894 \pgfusepath{draw}
7895 \endpgfscope
7896 }
7897
7898
7899 %% Varistor
7900 \pgfcircdeclarebipolescaled{resistors}
7901 {}
7902 {\ctikzvalof{bipoles/varistor/height}}
7903 {varistor}
7904 {\ctikzvalof{bipoles/varistor/height}}
7905 {\ctikzvalof{bipoles/varistor/width}}
7906 {
7907 \pgfscope
7908 \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}}
7909 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7910 \pgf@circ@draworfill
7911 \endpgfscope
7912
7913 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
7914 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
7915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7916 \pgfusepath{draw}
7917
7918 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
7919 }
7920
7921 %%%%%%%%%%%%%%
7922 %% RF bipoles
7923 %%%%%%%%%%%%%%
7924
7925 % transmission line
7926 \pgfcircdeclarebipolescaled{RF}
7927 {}
7928 {\ctikzvalof{bipoles/tline/height}}
7929 {tline}
7930 {\ctikzvalof{bipoles/tline/height}}
7931 {\ctikzvalof{bipoles/tline/width}}
7932 {
7933 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
7934 \begin{pgftransparencygroup}
7935 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7936 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
7937 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
7938 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
7939 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
7940 \pgf@circ@draworfill
7941 \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
7942 {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
7943 \pgf@circ@draworfill
7944 \end{pgftransparencygroup}
7945 \pgfsetlinewidth{\pgfstartlinewidth}
7946 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
7947 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7948 \pgfusepath{stroke}
7949 }
7950
7951 % microstrip transmission line
7952 \pgfcircdeclarebipolescaled{RF}
7953 {}
7954 {\ctikzvalof{bipoles/mstline/height}}
7955 {mstline}
7956 {\ctikzvalof{bipoles/mstline/height}}
7957 {\ctikzvalof{bipoles/mstline/width}}
7958 {
7959 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7960 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7961 \pgf@circ@draworfill
7962 }
7963
7964 %%%%%%%%%%%%%%%%%%%
7965 %% Block diagrams
7966 %%%%%%%%%%%%%%%%%%%
7967
7968 %% Draw the two-port fillable box
7969 \def\pgf@circ@twoportbox{
7970 \pgfscope
7971 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7972 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7973 \pgf@circ@draworfill
7974 \endpgfscope
7975 }
7976
7977 %% Generic two port box
7978 \pgfcircdeclarebipolescaled{blocks}
7979 {}
7980 {\ctikzvalof{bipoles/twoport/height}}
7981 {twoport}
7982 {\ctikzvalof{bipoles/twoport/height}}
7983 {\ctikzvalof{bipoles/twoport/width}}
7984 {
7985 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
7986 \divide \pgf@circ@res@step by 2
7987
7988 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7989 \pgf@circ@res@other = \pgf@circ@res@left
7990 \advance\pgf@circ@res@other by \pgf@circ@res@step
7991 \ifpgf@circuit@dashed
7992 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
7993 \fi
7994 % draw outer box
7995 \pgf@circ@twoportbox
7996 \ifpgf@circuit@inputarrow
7997 {
7998 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7999 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8000 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8001 }
8002 \fi
8003
8004 % rotate inner symbol
8005 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8006 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8007 \pgftransformrotate{270}
8008 \fi\fi
8009 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8010 \pgftransformrotate{180}
8011 \fi\fi
8012 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8013 \pgftransformrotate{90}
8014 \fi\fi
8015
8016 % draw inner symbol
8017 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8018
8019 }
8020
8021 %% voltage controled oscillator
8022 \pgfcircdeclarebipolescaled{blocks}
8023 {}
8024 {\ctikzvalof{bipoles/vco/width}}
8025 {vco}
8026 {\ctikzvalof{bipoles/twoport/width}}
8027 {\ctikzvalof{bipoles/vco/width}}
8028 {
8029 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
8030 \divide \pgf@circ@res@step by 2
8031
8032 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8033 \pgf@circ@res@other = \pgf@circ@res@left
8034 \advance\pgf@circ@res@other by \pgf@circ@res@step
8035
8036 \ifpgf@circuit@dashed
8037 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8038 \fi
8039 % draw circle
8040 \pgfscope
8041 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8042 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
8043 \pgf@circ@draworfill
8044 \endpgfscope
8045 \ifpgf@circuit@inputarrow
8046 {
8047 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8048 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8049 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8050 }
8051 \fi
8052
8053 % rotate inner symbol
8054 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8055 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8056 \pgftransformrotate{270}
8057 \fi\fi
8058 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8059 \pgftransformrotate{180}
8060 \fi\fi
8061 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8062 \pgftransformrotate{90}
8063 \fi\fi
8064
8065 % draw inner sine waves
8066 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8067 \pgfsetlinewidth{\pgfstartlinewidth}
8068 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
8069 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8070 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8071 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8072 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8073 \pgfusepath{draw}
8074 }
8075
8076 %% bandpass filter
8077 \pgfcircdeclarebipolescaled{blocks}
8078 {}
8079 {\ctikzvalof{bipoles/bandpass/width}}
8080 {bandpass}
8081 {\ctikzvalof{bipoles/bandpass/width}}
8082 {\ctikzvalof{bipoles/bandpass/width}}
8083 {
8084
8085 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
8086 \divide \pgf@circ@res@step by 2
8087
8088 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8089 \pgf@circ@res@other = \pgf@circ@res@left
8090 \advance\pgf@circ@res@other by \pgf@circ@res@step
8091
8092 \ifpgf@circuit@dashed
8093 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8094 \fi
8095
8096 % draw outer box
8097 \pgf@circ@twoportbox
8098
8099 \ifpgf@circuit@inputarrow
8100 {
8101 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8102 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8103 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8104 }
8105 \fi
8106
8107 % rotate inner symbol
8108 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8109 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8110 \pgftransformrotate{270}
8111 \fi\fi
8112 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8113 \pgftransformrotate{180}
8114 \fi\fi
8115 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8116 \pgftransformrotate{90}
8117 \fi\fi
8118
8119 % draw inner symbol
8120 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8121 \pgfsetarrows{-} %never draw arrows
8122 \pgfsetlinewidth{\pgfstartlinewidth}
8123 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8124 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8125 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8126 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8127 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8128 \pgfusepath{draw}
8129 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8130 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8131 \pgfusepath{draw}
8132
8133 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8134 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8135 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8136 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8137 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8138 \pgfusepath{draw}
8139
8140 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8141 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8142 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8143 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8144 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8145 \pgfusepath{draw}
8146 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8147 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8148 \pgfusepath{draw}
8149 }
8150
8151 %% bandstop filter
8152 \pgfcircdeclarebipolescaled{blocks}
8153 {}
8154 {\ctikzvalof{bipoles/bandstop/width}}
8155 {bandstop}
8156 {\ctikzvalof{bipoles/bandstop/width}}
8157 {\ctikzvalof{bipoles/bandstop/width}}
8158 {
8159 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
8160 \divide \pgf@circ@res@step by 2
8161
8162 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8163 \pgf@circ@res@other = \pgf@circ@res@left
8164 \advance\pgf@circ@res@other by \pgf@circ@res@step
8165
8166 \ifpgf@circuit@dashed
8167 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8168 \fi
8169
8170 % draw outer box
8171 \pgf@circ@twoportbox
8172
8173 \ifpgf@circuit@inputarrow
8174 {
8175 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8176 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8177 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8178 }
8179 \fi
8180
8181 % rotate inner symbol
8182 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8183 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8184 \pgftransformrotate{270}
8185 \fi\fi
8186 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
8187 \pgftransformrotate{180}
8188 \fi\fi
8189 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8190 \pgftransformrotate{90}
8191 \fi\fi
8192
8193 % draw inner symbol
8194 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
8195 \pgfsetarrows{-}%never draw arrows
8196 \pgfsetlinewidth{\pgfstartlinewidth}
8197 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8198 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8199 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8200 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8201 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8202 \pgfusepath{draw}
8203
8204 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8205 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8206 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8207 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8208 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8209 \pgfusepath{draw}
8210 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8211 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8212 \pgfusepath{draw}
8213
8214 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8215 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8216 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8217 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8218 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8219 \pgfusepath{draw}
8220 }
8221
8222 %% highpass filter
8223 \pgfcircdeclarebipolescaled{blocks}
8224 {}
8225 {\ctikzvalof{bipoles/highpass/width}}
8226 {highpass}
8227 {\ctikzvalof{bipoles/highpass/width}}
8228 {\ctikzvalof{bipoles/highpass/width}}
8229 {
8230 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
8231 \divide \pgf@circ@res@step by 2
8232
8233 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8234 \pgf@circ@res@other = \pgf@circ@res@left
8235 \advance\pgf@circ@res@other by \pgf@circ@res@step
8236
8237 \ifpgf@circuit@dashed
8238 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8239 \fi
8240
8241 % draw outer box
8242 \pgf@circ@twoportbox
8243
8244 \ifpgf@circuit@inputarrow
8245 {
8246 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8247 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8248 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8249 }
8250 \fi
8251
8252 % rotate inner symbol
8253 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8254 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8255 \pgftransformrotate{270}
8256 \fi\fi
8257 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8258 \pgftransformrotate{180}
8259 \fi\fi
8260 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8261 \pgftransformrotate{90}
8262 \fi\fi
8263
8264 % draw inner symbol
8265 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8266 \pgfsetarrows{-} %never draw arrows
8267 \pgfsetlinewidth{\pgfstartlinewidth}
8268 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8269 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8270 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8271 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8272 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8273 \pgfusepath{draw}
8274
8275 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8276 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8277 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8278 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8279 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8280 \pgfusepath{draw}
8281 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8282 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8283 \pgfusepath{draw}
8284
8285 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8286 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8287 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8288 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8289 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8290 \pgfusepath{draw}
8291 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8292 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8293 \pgfusepath{draw}
8294 }
8295
8296 %% lowpass filter
8297 \pgfcircdeclarebipolescaled{blocks}
8298 {}
8299 {\ctikzvalof{bipoles/lowpass/width}}
8300 {lowpass}
8301 {\ctikzvalof{bipoles/lowpass/width}}
8302 {\ctikzvalof{bipoles/lowpass/width}}
8303 {
8304 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
8305 \divide \pgf@circ@res@step by 2
8306
8307 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8308 \pgf@circ@res@other = \pgf@circ@res@left
8309 \advance\pgf@circ@res@other by \pgf@circ@res@step
8310
8311 \ifpgf@circuit@dashed
8312 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8313 \fi
8314
8315 % draw outer box
8316 \pgf@circ@twoportbox
8317
8318 \ifpgf@circuit@inputarrow
8319 {
8320 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8321 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8322 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8323 }
8324 \fi
8325
8326 % rotate inner symbol
8327 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8328 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8329 \pgftransformrotate{270}
8330 \fi\fi
8331 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8332 \pgftransformrotate{180}
8333 \fi\fi
8334 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8335 \pgftransformrotate{90}
8336 \fi\fi
8337
8338 % draw inner symbol
8339 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8340 \pgfsetarrows{-} %never draw arrows
8341 \pgfsetlinewidth{\pgfstartlinewidth}
8342 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8343 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8344 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8345 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8346 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8347 \pgfusepath{draw}
8348 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8349 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8350 \pgfusepath{draw}
8351
8352 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8353 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8354 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8355 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8356 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8357 \pgfusepath{draw}
8358 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8359 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8360 \pgfusepath{draw}
8361
8362 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8363 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8364 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8365 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8366 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8367 \pgfusepath{draw}
8368 }
8369
8370 %% ADC
8371 \pgfcircdeclarebipolescaled{blocks}
8372 {}
8373 {\ctikzvalof{bipoles/adc/width}}
8374 {adc}
8375 {\ctikzvalof{bipoles/adc/width}}
8376 {\ctikzvalof{bipoles/adc/width}}
8377 {
8378 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
8379 \divide \pgf@circ@res@step by 2
8380
8381 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8382 \pgf@circ@res@other = \pgf@circ@res@left
8383 \advance\pgf@circ@res@other by \pgf@circ@res@step
8384
8385 \ifpgf@circuit@dashed
8386 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8387 \fi
8388
8389 % draw outer box
8390 \pgf@circ@twoportbox
8391
8392 \ifpgf@circuit@inputarrow
8393 {
8394 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8395 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8396 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8397 }
8398 \fi
8399
8400 % rotate inner symbol
8401 \def\texti{A}
8402 \def\textii{D}
8403 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8404 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8405 \def\texti{D}
8406 \def\textii{A}
8407 \pgftransformrotate{270}
8408 \fi\fi
8409 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8410 \def\texti{D}
8411 \def\textii{A}
8412 \pgftransformrotate{180}
8413 \fi\fi
8414 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8415 \pgftransformrotate{90}
8416 \def\texti{A}
8417 \def\textii{D}
8418 \fi\fi
8419
8420 % draw inner symbol
8421 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8422 \pgfsetarrows{-} %never draw arrows
8423 \pgfsetlinewidth{\pgfstartlinewidth}
8424 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8426 \pgfusepath{draw}
8427
8428 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
8429 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
8430 }
8431
8432 %% DAC
8433 \pgfcircdeclarebipolescaled{blocks}
8434 {}
8435 {\ctikzvalof{bipoles/dac/width}}
8436 {dac}
8437 {\ctikzvalof{bipoles/dac/width}}
8438 {\ctikzvalof{bipoles/dac/width}}
8439 {
8440 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
8441 \divide \pgf@circ@res@step by 2
8442
8443 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8444 \pgf@circ@res@other = \pgf@circ@res@left
8445 \advance\pgf@circ@res@other by \pgf@circ@res@step
8446
8447 \ifpgf@circuit@dashed
8448 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8449 \fi
8450
8451 % draw outer box
8452 \pgf@circ@twoportbox
8453
8454 \ifpgf@circuit@inputarrow
8455 {
8456 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8457 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8458 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8459 }
8460 \fi
8461
8462 % rotate inner symbol
8463 \def\texti{D}
8464 \def\textii{A}
8465 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8466 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8467 \def\texti{A}
8468 \def\textii{D}
8469 \pgftransformrotate{270}
8470 \fi\fi
8471 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8472 \def\texti{A}
8473 \def\textii{D}
8474 \pgftransformrotate{180}
8475 \fi\fi
8476 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8477 \pgftransformrotate{90}
8478 \def\texti{D}
8479 \def\textii{A}
8480 \fi\fi
8481
8482 % draw inner symbol
8483 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8484 \pgfsetarrows{-} %never draw arrows
8485 \pgfsetlinewidth{\pgfstartlinewidth}
8486 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8488 \pgfusepath{draw}
8489
8490 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
8491 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
8492 }
8493
8494 %% DSP
8495 \pgfcircdeclarebipolescaled{blocks}
8496 {}
8497 {\ctikzvalof{bipoles/dsp/width}}
8498 {dsp}
8499 {\ctikzvalof{bipoles/dsp/width}}
8500 {\ctikzvalof{bipoles/dsp/width}}
8501 {
8502 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
8503 \divide \pgf@circ@res@step by 2
8504
8505 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8506 \pgf@circ@res@other = \pgf@circ@res@left
8507 \advance\pgf@circ@res@other by \pgf@circ@res@step
8508
8509 \ifpgf@circuit@dashed
8510 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8511 \fi
8512
8513 % draw outer box
8514 \pgf@circ@twoportbox
8515
8516 \ifpgf@circuit@inputarrow
8517 {
8518 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8519 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8520 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8521 }
8522 \fi
8523
8524 % rotate inner symbol
8525 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8526 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8527 \pgftransformrotate{270}
8528 \fi\fi
8529 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8530 \pgftransformrotate{180}
8531 \fi\fi
8532 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8533 \pgftransformrotate{90}
8534 \fi\fi
8535
8536 % draw inner symbol
8537 \pgftext[center,x=0,y=0]{\textsf{DSP}}
8538 }
8539
8540 %% FFT
8541 \pgfcircdeclarebipolescaled{blocks}
8542 {}
8543 {\ctikzvalof{bipoles/fft/width}}
8544 {fft}
8545 {\ctikzvalof{bipoles/fft/width}}
8546 {\ctikzvalof{bipoles/fft/width}}
8547 {
8548 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
8549 \divide \pgf@circ@res@step by 2
8550
8551 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8552 \pgf@circ@res@other = \pgf@circ@res@left
8553 \advance\pgf@circ@res@other by \pgf@circ@res@step
8554
8555 \ifpgf@circuit@dashed
8556 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8557 \fi
8558
8559 % draw outer box
8560 \pgf@circ@twoportbox
8561
8562 \ifpgf@circuit@inputarrow
8563 {
8564 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8565 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8566 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8567 }
8568 \fi
8569
8570 % rotate inner symbol
8571 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8572 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8573 \pgftransformrotate{270}
8574 \fi\fi
8575 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8576 \pgftransformrotate{180}
8577 \fi\fi
8578 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8579 \pgftransformrotate{90}
8580 \fi\fi
8581
8582 % draw inner symbol
8583 \pgftext[center,x=0,y=0]{\textsf{FFT}}
8584 }
8585
8586 %% Amplifier
8587 \pgfcircdeclarebipolescaled{blocks}
8588 {}
8589 {
8590 \ifpgf@circuit@boxed
8591 \ctikzvalof{bipoles/twoport/width}
8592 \else
8593 \ctikzvalof{bipoles/amp/width}
8594 \fi
8595 }
8596 {amp}
8597 {
8598 \ifpgf@circuit@boxed
8599 \ctikzvalof{bipoles/twoport/width}
8600 \else
8601 \ctikzvalof{bipoles/amp/width}
8602 \fi
8603 }
8604 {
8605 \ifpgf@circuit@boxed
8606 \ctikzvalof{bipoles/twoport/width}
8607 \else
8608 \ctikzvalof{bipoles/amp/width}
8609 \fi
8610 }
8611 {
8612 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8613
8614 \ifpgf@circuit@dashed
8615 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8616 \fi
8617
8618 % draw outer box
8619 \ifpgf@circuit@boxed
8620 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8621 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
8622 \pgf@circ@draworfill
8623 \fi
8624
8625 % draw input arrow
8626 \ifpgf@circuit@inputarrow
8627 {
8628 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8629 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8630 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8631 }
8632 \fi
8633
8634 \ifpgf@circuit@boxed
8635 \pgfsetlinewidth{\pgfstartlinewidth}
8636 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
8637 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
8638 \else
8639 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8640 \fi
8641
8642 \pgfsetarrows{-} %never draw arrows
8643
8644 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
8645 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
8646 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
8647
8648 \pgfpathclose
8649 \pgf@circ@draworfill
8650
8651 % draw inner text
8652 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
8653 }
8654
8655
8656 %% variable amplifier
8657 \pgfcircdeclarebipolescaled{blocks}
8658 {}
8659 {
8660 \ifpgf@circuit@boxed
8661 \ctikzvalof{bipoles/twoport/width}
8662 \else
8663 \ctikzvalof{bipoles/amp/width}
8664 \fi
8665 }
8666 {vamp}
8667 {
8668 \ifpgf@circuit@boxed
8669 \ctikzvalof{bipoles/twoport/width}
8670 \else
8671 \ctikzvalof{bipoles/amp/width}
8672 \fi
8673 }
8674 {
8675 \ifpgf@circuit@boxed
8676 \ctikzvalof{bipoles/twoport/width}
8677 \else
8678 \ctikzvalof{bipoles/amp/width}
8679 \fi
8680 }
8681 {
8682 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8683
8684 \ifpgf@circuit@dashed
8685 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8686 \fi
8687
8688 % draw outer box
8689 \ifpgf@circuit@boxed
8690 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
8691 \fi
8692
8693 % draw input arrow
8694 \ifpgf@circuit@inputarrow
8695 {
8696 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8697 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8698 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8699 }
8700 \fi
8701
8702 \ifpgf@circuit@boxed
8703 \pgfsetlinewidth{\pgfstartlinewidth}
8704 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
8705 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
8706 \else
8707 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8708 \fi
8709
8710
8711 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8712 \pgfsetarrows{-} %never draw arrows
8713
8714 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
8715 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
8716 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
8717
8718 \pgfpathclose
8719 \pgf@circ@draworfill
8720
8721 % draw inner text
8722 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
8723
8724 % draw arrow
8725 \pgfsetlinewidth{\pgfstartlinewidth}
8726 \pgfsetarrowsend{latex}
8727 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8728 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
8729 \pgfusepath{draw}
8730 }
8731
8732 %% pi attenuator
8733 \pgfcircdeclarebipolescaled{blocks}
8734 {}
8735 {\ctikzvalof{bipoles/piattenuator/width}}
8736 {piattenuator}
8737 {\ctikzvalof{bipoles/piattenuator/width}}
8738 {\ctikzvalof{bipoles/piattenuator/width}}
8739 {
8740 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
8741 \divide \pgf@circ@res@step by 2
8742
8743 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8744 \pgf@circ@res@other = \pgf@circ@res@left
8745 \advance\pgf@circ@res@other by \pgf@circ@res@step
8746
8747 \ifpgf@circuit@dashed
8748 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8749 \fi
8750
8751 % draw outer box
8752 \pgf@circ@twoportbox
8753
8754 \ifpgf@circuit@inputarrow
8755 {
8756 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8757 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8758 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8759 }
8760 \fi
8761
8762 % rotate inner symbol
8763 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8764 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8765 \pgftransformrotate{270}
8766 \fi\fi
8767 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8768 \pgftransformrotate{90}
8769 \fi\fi
8770
8771 % draw inner symbol
8772 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8773 \pgfsetarrows{-} %never draw arrows
8774 \pgfsetlinewidth{\pgfstartlinewidth}
8775 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
8776 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8777 \pgfusepath{draw}
8778 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
8779 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8780 \pgfusepath{draw}
8781 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8782 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8783 \pgfusepath{draw}
8784 }
8785
8786 %% variable pi attenuator
8787 \pgfcircdeclarebipolescaled{blocks}
8788 {}
8789 {\ctikzvalof{bipoles/vpiattenuator/width}}
8790 {vpiattenuator}
8791 {\ctikzvalof{bipoles/vpiattenuator/width}}
8792 {\ctikzvalof{bipoles/vpiattenuator/width}}
8793 {
8794 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
8795 \divide \pgf@circ@res@step by 2
8796
8797 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8798 \pgf@circ@res@other = \pgf@circ@res@left
8799 \advance\pgf@circ@res@other by \pgf@circ@res@step
8800
8801 \ifpgf@circuit@dashed
8802 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8803 \fi
8804
8805 % draw outer box
8806 \pgf@circ@twoportbox
8807
8808 \ifpgf@circuit@inputarrow
8809 {
8810 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8811 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8812 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8813 }
8814 \fi
8815
8816 % rotate inner symbol
8817 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8818 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8819 \pgftransformrotate{270}
8820 \fi\fi
8821 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8822 \pgftransformrotate{90}
8823 \fi\fi
8824
8825 % draw inner symbol
8826 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8827 \pgfsetarrows{-} %never draw arrows
8828 \pgfsetlinewidth{\pgfstartlinewidth}
8829 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
8830 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8831 \pgfusepath{draw}
8832 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
8833 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8834 \pgfusepath{draw}
8835 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8836 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8837 \pgfusepath{draw}
8838
8839 \pgfsetarrowsend{latex}
8840 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8841 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8842 \pgfusepath{draw}
8843 }
8844
8845 %% T attenuator
8846 \pgfcircdeclarebipolescaled{blocks}
8847 {}
8848 {\ctikzvalof{bipoles/tattenuator/width}}
8849 {tattenuator}
8850 {\ctikzvalof{bipoles/tattenuator/width}}
8851 {\ctikzvalof{bipoles/tattenuator/width}}
8852 {
8853 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
8854 \divide \pgf@circ@res@step by 2
8855
8856 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8857 \pgf@circ@res@other = \pgf@circ@res@left
8858 \advance\pgf@circ@res@other by \pgf@circ@res@step
8859
8860 \ifpgf@circuit@dashed
8861 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8862 \fi
8863
8864 % draw outer box
8865 \pgf@circ@twoportbox
8866
8867 \ifpgf@circuit@inputarrow
8868 {
8869 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8870 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8871 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8872 }
8873 \fi
8874
8875 % rotate inner symbol
8876 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8877 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8878 \pgftransformrotate{270}
8879 \fi\fi
8880 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8881 \pgftransformrotate{90}
8882 \fi\fi
8883
8884 % draw inner symbol
8885 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8886 \pgfsetarrows{-} %never draw arrows
8887 \pgfsetlinewidth{\pgfstartlinewidth}
8888 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
8889 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
8890 \pgfusepath{draw}
8891 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8892 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8893 \pgfusepath{draw}
8894 }
8895
8896 %% variable T attenuator
8897 \pgfcircdeclarebipolescaled{blocks}
8898 {}
8899 {\ctikzvalof{bipoles/vtattenuator/width}}
8900 {vtattenuator}
8901 {\ctikzvalof{bipoles/vtattenuator/width}}
8902 {\ctikzvalof{bipoles/vtattenuator/width}}
8903 {
8904 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
8905 \divide \pgf@circ@res@step by 2
8906
8907 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8908 \pgf@circ@res@other = \pgf@circ@res@left
8909 \advance\pgf@circ@res@other by \pgf@circ@res@step
8910
8911 \ifpgf@circuit@dashed
8912 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8913 \fi
8914
8915 % draw outer box
8916 \pgf@circ@twoportbox
8917
8918 \ifpgf@circuit@inputarrow
8919 {
8920 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8921 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8922 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8923 }
8924 \fi
8925
8926 % rotate inner symbol
8927 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8928 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8929 \pgftransformrotate{270}
8930 \fi\fi
8931 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8932 \pgftransformrotate{90}
8933 \fi\fi
8934
8935 % draw inner symbol
8936 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8937 \pgfsetarrows{-} %never draw arrows
8938 \pgfsetlinewidth{\pgfstartlinewidth}
8939 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
8940 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
8941 \pgfusepath{draw}
8942 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
8943 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
8944 \pgfusepath{draw}
8945
8946 \pgfsetarrowsend{latex}
8947 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8948 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8949 \pgfusepath{draw}
8950 }
8951
8952 %% phase shifter
8953 \pgfcircdeclarebipolescaled{blocks}
8954 {}
8955 {\ctikzvalof{bipoles/phaseshifter/width}}
8956 {phaseshifter}
8957 {\ctikzvalof{bipoles/phaseshifter/width}}
8958 {\ctikzvalof{bipoles/phaseshifter/width}}
8959 {
8960 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/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\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8984 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8985 \pgftransformrotate{270}
8986 \fi\fi
8987 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8988 \pgftransformrotate{180}
8989 \fi\fi
8990 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8991 \pgftransformrotate{90}
8992 \fi\fi
8993
8994 % inner symbol
8995 \pgftext[center,x=0,y=0]{\Large$\varphi$}
8996 }
8997
8998 %% variable phase shifter
8999 \pgfcircdeclarebipolescaled{blocks}
9000 {}
9001 {\ctikzvalof{bipoles/phaseshifter/width}}
9002 {vphaseshifter}
9003 {\ctikzvalof{bipoles/vphaseshifter/width}}
9004 {\ctikzvalof{bipoles/vphaseshifter/width}}
9005 {
9006 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
9007 \divide \pgf@circ@res@step by 2
9008
9009 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9010 \pgf@circ@res@other = \pgf@circ@res@left
9011 \advance\pgf@circ@res@other by \pgf@circ@res@step
9012
9013 \ifpgf@circuit@dashed
9014 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9015 \fi
9016
9017 % draw outer box
9018 \pgf@circ@twoportbox
9019
9020 \ifpgf@circuit@inputarrow
9021 {
9022 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9023 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9024 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9025 }
9026 \fi
9027
9028 % rotate inner symbol
9029 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9030 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9031 \pgftransformrotate{270}
9032 \fi\fi
9033 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9034 \pgftransformrotate{180}
9035 \fi\fi
9036 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9037 \pgftransformrotate{90}
9038 \fi\fi
9039
9040 % inner symbol
9041 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9042
9043 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9044 \pgfsetlinewidth{\pgfstartlinewidth}
9045 \pgfsetarrowsend{latex}
9046 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
9047 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
9048 \pgfusepath{draw}
9049 }
9050
9051 %% detector
9052 \pgfcircdeclarebipolescaled{blocks}
9053 {}
9054 {\ctikzvalof{bipoles/detector/width}}
9055 {detector}
9056 {\ctikzvalof{bipoles/detector/width}}
9057 {\ctikzvalof{bipoles/detector/width}}
9058 {
9059 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
9060 \divide \pgf@circ@res@step by 2
9061
9062 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9063 \pgf@circ@res@other = \pgf@circ@res@left
9064 \advance\pgf@circ@res@other by \pgf@circ@res@step
9065
9066 \ifpgf@circuit@dashed
9067 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9068 \fi
9069
9070 % draw outer box
9071 \pgf@circ@twoportbox
9072
9073 \ifpgf@circuit@inputarrow
9074 {
9075 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9076 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9077 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9078 }
9079 \fi
9080
9081 % draw inner stuff
9082 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9083 \pgfsetarrows{-} %never draw arrows
9084 \pgfsetlinewidth{0.8\pgfstartlinewidth}
9085 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
9086 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
9087 \pgfusepath{draw}
9088
9089 \ifpgf@circuit@fulldiode
9090 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
9091 \pgftransformscale{\pgfmathresult}
9092 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
9093 \else
9094 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
9095 \pgftransformscale{\pgfmathresult}
9096 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
9097 \fi
9098
9099 }
9100
9101 %% single phase ac/dc converter
9102 \pgfcircdeclarebipolescaled{blocks}
9103 {
9104 \anchor{dc1}{
9105 \northeast
9106 \pgf@y=.4\pgf@y
9107 }
9108 \anchor{dc2}{
9109 \northeast
9110 \pgf@y=-.4\pgf@y
9111 }
9112 }
9113 {\ctikzvalof{bipoles/sacdc/width}}
9114 {sacdc}
9115 {\ctikzvalof{bipoles/sacdc/width}}
9116 {\ctikzvalof{bipoles/sacdc/width}}
9117 {
9118 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
9119 \divide \pgf@circ@res@step by 2
9120
9121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9122 \pgf@circ@res@other = \pgf@circ@res@left
9123 \advance\pgf@circ@res@other by \pgf@circ@res@step
9124
9125 \ifpgf@circuit@dashed
9126 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9127 \fi
9128
9129 % draw outer box
9130 \pgf@circ@twoportbox
9131
9132 \ifpgf@circuit@inputarrow
9133 {
9134 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9135 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9136 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9137 }
9138 \fi
9139
9140 % rotate inner symbol
9141 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9142 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9143 \pgftransformrotate{270}
9144 \fi\fi
9145 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9146 \pgftransformrotate{180}
9147 \fi\fi
9148 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9149 \pgftransformrotate{90}
9150 \fi\fi
9151
9152 % draw inner symbol
9153 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9154 \pgfsetarrows{-} %never draw arrows
9155 \pgfsetlinewidth{\pgfstartlinewidth}
9156 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9158 \pgfusepath{draw}
9159
9160 % draw sin wave
9161 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9162 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9163 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9164 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9165 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9166 \pgfusepath{draw}
9167
9168 % draw equal sign
9169 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9170 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9171 \pgfusepath{draw}
9172 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9173 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9174 \pgfusepath{draw}
9175 }
9176
9177
9178
9179 %% single phase dc/ac converter
9180 \pgfcircdeclarebipolescaled{blocks}
9181 {
9182 \anchor{dc1}{
9183 \northeast
9184 \pgf@y=.4\pgf@y
9185 \pgf@x=-\pgf@x
9186 }
9187 \anchor{dc2}{
9188 \northeast
9189 \pgf@y=-.4\pgf@y
9190 \pgf@x=-\pgf@x
9191 }
9192 }
9193 {\ctikzvalof{bipoles/sdcac/width}}
9194 {sdcac}
9195 {\ctikzvalof{bipoles/sdcac/width}}
9196 {\ctikzvalof{bipoles/sdcac/width}}
9197 {
9198 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
9199 \divide \pgf@circ@res@step by 2
9200
9201 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9202 \pgf@circ@res@other = \pgf@circ@res@left
9203 \advance\pgf@circ@res@other by \pgf@circ@res@step
9204
9205 \ifpgf@circuit@dashed
9206 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9207 \fi
9208
9209 % draw outer box
9210 \pgf@circ@twoportbox
9211
9212 \ifpgf@circuit@inputarrow
9213 {
9214 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9215 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9216 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9217 }
9218 \fi
9219
9220 % rotate inner symbol
9221 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9222 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9223 \pgftransformrotate{270}
9224 \fi\fi
9225 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9226 \pgftransformrotate{180}
9227 \fi\fi
9228 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9229 \pgftransformrotate{90}
9230 \fi\fi
9231
9232 % draw inner symbol
9233 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9234 \pgfsetarrows{-} %never draw arrows
9235 \pgfsetlinewidth{\pgfstartlinewidth}
9236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9238 \pgfusepath{draw}
9239
9240 % draw sin wave
9241 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
9242 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9243 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9244 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9245 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9246 \pgfusepath{draw}
9247
9248 % draw equal sign
9249 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
9250 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
9251 \pgfusepath{draw}
9252 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
9253 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
9254 \pgfusepath{draw}
9255 }
9256
9257
9258 %% threephase ac/dc converter
9259 \pgfcircdeclarebipolescaled{blocks}
9260 {
9261 \anchor{dc1}{
9262 \northeast
9263 \pgf@y=.4\pgf@y
9264 }
9265 \anchor{dc2}{
9266 \northeast
9267 \pgf@y=-.4\pgf@y
9268 }
9269 \anchor{ac1}{
9270 \northeast
9271 \pgf@y=.6\pgf@y
9272 \pgf@x=-\pgf@x
9273 }
9274 \anchor{ac2}{
9275 \northeast
9276 \pgf@y=0\pgf@y
9277 \pgf@x=-\pgf@x
9278 }
9279 \anchor{ac3}{
9280 \northeast
9281 \pgf@y=-.6\pgf@y
9282 \pgf@x=-\pgf@x
9283 }
9284 }
9285 {\ctikzvalof{bipoles/tacdc/width}}
9286 {tacdc}
9287 {\ctikzvalof{bipoles/tacdc/width}}
9288 {\ctikzvalof{bipoles/tacdc/width}}
9289 {
9290 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
9291 \divide \pgf@circ@res@step by 2
9292
9293 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9294 \pgf@circ@res@other = \pgf@circ@res@left
9295 \advance\pgf@circ@res@other by \pgf@circ@res@step
9296
9297 \ifpgf@circuit@dashed
9298 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9299 \fi
9300
9301 % draw outer box
9302 \pgf@circ@twoportbox
9303
9304 \ifpgf@circuit@inputarrow
9305 {
9306 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9307 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9308 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9309 }
9310 \fi
9311
9312 % rotate inner symbol
9313 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9314 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9315 \pgftransformrotate{270}
9316 \fi\fi
9317 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9318 \pgftransformrotate{180}
9319 \fi\fi
9320 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9321 \pgftransformrotate{90}
9322 \fi\fi
9323
9324 % draw inner symbol
9325 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9326 \pgfsetarrows{-} %never draw arrows
9327 \pgfsetlinewidth{\pgfstartlinewidth}
9328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9329 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9330 \pgfusepath{draw}
9331
9332 % draw sin waves
9333 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
9334 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9335 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9336 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9337 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9338 \pgfusepath{draw}
9339 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9340 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9341 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9342 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9343 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9344 \pgfusepath{draw}
9345 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
9346 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9347 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9348 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9349 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9350 \pgfusepath{draw}
9351
9352
9353
9354
9355 % draw equal sign
9356 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9357 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9358 \pgfusepath{draw}
9359 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9360 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9361 \pgfusepath{draw}
9362 }
9363
9364
9365 %% threephase dc/ac converter
9366 \pgfcircdeclarebipolescaled{blocks}
9367 {
9368 \anchor{dc1}{
9369 \northeast
9370 \pgf@y=.4\pgf@y
9371 \pgf@x=-\pgf@x
9372 }
9373 \anchor{dc2}{
9374 \northeast
9375 \pgf@y=-.4\pgf@y
9376 \pgf@x=-\pgf@x
9377 }
9378 \anchor{ac1}{
9379 \northeast
9380 \pgf@y=.6\pgf@y
9381 }
9382 \anchor{ac2}{
9383 \northeast
9384 \pgf@y=0\pgf@y
9385 }
9386 \anchor{ac3}{
9387 \northeast
9388 \pgf@y=-.6\pgf@y
9389 }
9390 }
9391 {\ctikzvalof{bipoles/tdcac/width}}
9392 {tdcac}
9393 {\ctikzvalof{bipoles/tdcac/width}}
9394 {\ctikzvalof{bipoles/tdcac/width}}
9395 {
9396 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
9397 \divide \pgf@circ@res@step by 2
9398
9399 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9400 \pgf@circ@res@other = \pgf@circ@res@left
9401 \advance\pgf@circ@res@other by \pgf@circ@res@step
9402
9403 \ifpgf@circuit@dashed
9404 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9405 \fi
9406
9407 % draw outer box
9408 \pgf@circ@twoportbox
9409
9410 \ifpgf@circuit@inputarrow
9411 {
9412 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9413 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9414 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9415 }
9416 \fi
9417
9418 % rotate inner symbol
9419 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9420 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9421 \pgftransformrotate{270}
9422 \fi\fi
9423 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9424 \pgftransformrotate{180}
9425 \fi\fi
9426 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9427 \pgftransformrotate{90}
9428 \fi\fi
9429
9430 % draw inner symbol
9431 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9432 \pgfsetarrows{-} %never draw arrows
9433 \pgfsetlinewidth{\pgfstartlinewidth}
9434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9436 \pgfusepath{draw}
9437
9438 % draw sin waves
9439 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
9440 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9441 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9442 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9443 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9444 \pgfusepath{draw}
9445 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
9446 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9447 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9448 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9449 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9450 \pgfusepath{draw}
9451 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}}
9452 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9453 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9454 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9455 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9456 \pgfusepath{draw}
9457
9458
9459
9460
9461 % draw equal sign
9462 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
9463 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
9464 \pgfusepath{draw}
9465 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
9466 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
9467 \pgfusepath{draw}
9468 }
9469
9470
9471 %%%%%%%%%%%%%%%%%%%%%%%
9472 %% MECHANICAL SYMBOLS
9473 %%%%%%%%%%%%%%%%%%%%%%%
9474
9475 %% mechanical capacitance - stiffness/spring
9476
9477 \pgfcircdeclarebipolescaled{mechanicals}
9478 {}
9479 {\ctikzvalof{bipoles/spring/height}}
9480 {spring}
9481 {\ctikzvalof{bipoles/spring/height}}
9482 {\ctikzvalof{bipoles/spring/width}}{
9483 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9484 \pgftransformationadjustments
9485
9486 \pgfmathsetlength{\pgf@circ@res@step}
9487 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
9488
9489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
9490 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
9491 \pgf@circ@res@other = \pgf@circ@res@left
9492 \advance\pgf@circ@res@other by \pgf@circ@res@step
9493 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9494 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9496 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9497 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9498 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9500 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9501 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9502 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9503 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9504 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9505 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9506 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9507 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9508 \advance\pgf@circ@res@other by \pgf@circ@res@step
9509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9510 \pgfsetbuttcap
9511 \pgfsetbeveljoin
9512 \pgfusepath{stroke}
9513 }
9514
9515 %% mechanical capacitance - inerter
9516 \pgfcircdeclarebipolescaled{mechanicals}
9517 {}
9518 {\ctikzvalof{bipoles/inerter/height}}
9519 {inerter}
9520 {\ctikzvalof{bipoles/inerter/height}}
9521 {\ctikzvalof{bipoles/inerter/width}}
9522 {
9523 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9524 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9525 \pgf@circ@draworfill
9526 }
9527
9528
9529 %% mechanical inductance - mass
9530 \pgfcircdeclarebipolescaled{mechanicals}
9531 {}
9532 {\ctikzvalof{bipoles/mass/box height}}
9533 {mass}
9534 {\ctikzvalof{bipoles/mass/height}}
9535 {\ctikzvalof{bipoles/mass/width}}
9536 {
9537 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9538 \pgftransformationadjustments
9539 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9540 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
9541 \pgf@circ@draworfill
9542
9543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9544 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9546 \pgfsetrectcap
9547 \pgfsetmiterjoin
9548 \pgfusepath{stroke}
9549 }
9550
9551 %% mechanical resistor - damper
9552 \pgfcircdeclarebipolescaled{mechanicals}
9553 {}
9554 {\ctikzvalof{bipoles/damper/height}}
9555 {damper}
9556 {\ctikzvalof{bipoles/damper/height}}
9557 {\ctikzvalof{bipoles/damper/width}}
9558 {
9559 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9560 \pgf@circ@maybefill
9561
9562 % line into the damper
9563 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9564 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9565 {\pgf@circ@res@zero}}
9566 \pgfusepath{stroke}
9567
9568 % damper box
9569 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9570 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9571 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9572 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9573 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9574
9575 \pgfsetrectcap
9576 \pgfsetmiterjoin
9577 \pgfusepath{stroke}
9578
9579 % damper vertical element
9580 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9581 {.8\pgf@circ@res@down}}
9582 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9583 {.8\pgf@circ@res@up}}
9584 \pgfsetbuttcap
9585 \pgfusepath{stroke}
9586
9587 }
9588 %% mechanical viscoelastic element, suggested by @alex
9589 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
9590 \pgfcircdeclarebipolescaled{mechanicals}
9591 {} % extra anchors
9592 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
9593 {viscoe} % name
9594 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
9595 {\ctikzvalof{bipoles/damper/width}} % width
9596 { % draw the bipole
9597 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9598 \pgf@circ@maybefill
9599
9600 % spring into the damper
9601 \pgfscope
9602 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9603 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9604 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
9605 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9606 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
9607 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9608 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
9609 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
9610 \pgfusepath{stroke}
9611 \endpgfscope
9612 % damper box
9613 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9614 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9615 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9616 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9617 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9618
9619 \pgfsetrectcap
9620 \pgfsetmiterjoin
9621 \pgfusepath{stroke}
9622
9623 % damper vertical element
9624 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9625 {.8\pgf@circ@res@down}}
9626 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9627 {.8\pgf@circ@res@up}}
9628 \pgfsetbuttcap
9629 \pgfusepath{stroke}
9630
9631 }
9632
9633 %%%%%%%%%%%%%%%%
9634 %% Crossing
9635 %%%%%%%%%%%%%%%%
9636
9637 %% crossing bipole (but see also nodes)
9638 \pgfcircdeclarebipole
9639 {}
9640 {\ctikzvalof{bipoles/crossing/size}}
9641 {crossing}
9642 {\ctikzvalof{bipoles/crossing/size}}
9643 {\ctikzvalof{bipoles/crossing/size}}{
9644 \pgfscope
9645 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9646 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
9647 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
9648 \pgfsetbeveljoin
9649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9650 \pgfusepath{draw}
9651 \endpgfscope
9652 }
9653
9654 %%%%%%%%%%%%%%%%%%%%%%%%%
9655 %% Miscellaneous bipoles
9656 %%%%%%%%%%%%%%%%%%%%%%%%%
9657
9658 %% loudspeaker and microphone
9659
9660 \pgfcircdeclarebipolescaled{misc}
9661 {}
9662 {\ctikzvalof{bipoles/loudspeaker/depth}}
9663 {loudspeaker}
9664 {\ctikzvalof{bipoles/loudspeaker/height}}
9665 {\ctikzvalof{bipoles/loudspeaker/width}}{
9666
9667 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9668 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9669 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9670 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
9671 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
9672 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9673 \pgfpathclose
9674 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9675 \pgf@circ@draworfill
9676 }
9677
9678 \pgfcircdeclarebipolescaled{misc}
9679 {}
9680 {\ctikzvalof{bipoles/mic/depth}}
9681 {mic}
9682 {\ctikzvalof{bipoles/mic/height}}
9683 {\ctikzvalof{bipoles/mic/width}}{
9684
9685 \pgfscope
9686 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9687 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
9688 \pgf@circ@draworfill
9689 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
9690 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9691 \pgfusepath{draw}
9692 \endpgfscope
9693 \pgfscope
9694 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9695 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
9696 % 0.25358 is 0.6-0.4*cos(30)
9697 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9698 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9699 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
9700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9701 \pgfusepath{draw}
9702
9703 \pgfusepath{draw}
9704 \endpgfscope
9705 }
9706
9707 %% european gas filled surge arrester
9708 \pgfcircdeclarebipolescaled{misc}
9709 {}
9710 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9711 {european gas filled surge arrester}
9712 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9713 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
9714 {
9715
9716 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9717 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9718
9719 \pgf@circ@draworfill
9720
9721 \pgfscope
9722 \pgfsetarrowsend{latexslim}
9723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9724 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
9725 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9726 \pgfusepath{draw}
9727
9728 \endpgfscope
9729 }
9730
9731 %% american gas filled surge arrester
9732 \pgfcircdeclarebipolescaled{misc}
9733 {}
9734 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
9735 {american gas filled surge arrester}
9736 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
9737 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
9738
9739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9740 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
9741 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9742 \pgfusepath{draw}
9743
9744 \pgfscope
9745 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9746 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
9747 \pgf@circ@draworfill
9748 \endpgfscope
9749
9750 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
9751 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9752 \pgfusepath{draw}
9753
9754 \pgfscope
9755 \pgfsetarrowsend{latex}
9756
9757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9758 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
9759 \pgfusepath{draw}
9760
9761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9762 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
9763 \pgfusepath{draw}
9764 \endpgfscope{}
9765
9766 \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}
9767 \pgfusepath{fill}
9768 }
9769
9770 %% thermocouple
9771 \pgfcircdeclarebipolescaled{misc}
9772 {}
9773 {\ctikzvalof{bipoles/thermocouple/height 2}}
9774 {thermocouple}
9775 {\ctikzvalof{bipoles/thermocouple/height}}
9776 {\ctikzvalof{bipoles/thermocouple/width}}
9777 {
9778 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
9780 \pgfusepath{draw}
9781 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
9782 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9783 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
9784 \pgfusepath{draw}
9785 \pgfsetlinewidth{\pgfstartlinewidth}
9786 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
9787 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
9788 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9789 \pgfusepath{draw}
9790 }
9791
9792 %% fuse
9793 \pgfcircdeclarebipolescaled{misc}
9794 {}
9795 {\ctikzvalof{bipoles/fuse/height}}
9796 {fuse}
9797 {\ctikzvalof{bipoles/fuse/height}}
9798 {\ctikzvalof{bipoles/fuse/width}}
9799 {
9800 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9802 \pgfusepath{draw}
9803
9804 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9805 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9806
9807 \pgf@circ@draworfill
9808 }
9809
9810 %% asymmetric fuse
9811 \pgfcircdeclarebipolescaled{misc}
9812 {}
9813 {\ctikzvalof{bipoles/afuse/height}}
9814 {afuse}
9815 {\ctikzvalof{bipoles/afuse/height}}
9816 {\ctikzvalof{bipoles/afuse/width}}
9817 {
9818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9820 \pgfusepath{draw}
9821
9822 \pgfscope
9823 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9824 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9825 \pgf@circ@draworfill
9826 \endpgfscope
9827
9828 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9829 \pgfusepath{stroke,fill}
9830 }
9831
9832 %% SQUID added by Cor Molenaar 5 March 2010
9833 \pgfcircdeclarebipolescaled{misc}
9834 {}
9835 {\ctikzvalof{bipoles/squid/height}}
9836 {squid}
9837 {\ctikzvalof{bipoles/squid/height}}
9838 {\ctikzvalof{bipoles/squid/width}}
9839 {
9840 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9841
9842 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9843 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
9844 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
9845 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
9846 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
9847 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
9848 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
9849 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
9850 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
9851
9852 \pgfusepath{draw}
9853 }
9854
9855 % Generic barrier added by Cor Molenaar 5 March 2010
9856 \pgfcircdeclarebipolescaled{misc}
9857 {}
9858 {\ctikzvalof{bipoles/barrier/height}}
9859 {barrier}
9860 {\ctikzvalof{bipoles/barrier/height}}
9861 {\ctikzvalof{bipoles/barrier/width}}
9862 {
9863 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9864
9865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
9866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
9867 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
9868 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
9869 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
9870 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
9871
9872 \pgfusepath{draw}
9873 }
9874
9875 %
9876 % open version of the barrier symbol
9877 % suggested by Radványi Patrik Tamás <[email protected]>
9878 %
9879 \pgfcircdeclarebipolescaled{misc}
9880 {}
9881 {\ctikzvalof{bipoles/barrier/height}}
9882 {openbarrier}
9883 {\ctikzvalof{bipoles/barrier/height}}
9884 {\ctikzvalof{bipoles/barrier/width}}
9885 {
9886 % this is set with normal wire linewidth
9887 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9888 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
9889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9890 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
9891 \pgfusepath{draw}
9892
9893 % do the cross part
9894 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9895
9896 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
9897 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
9898 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
9899 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
9900
9901 \pgfusepath{draw}
9902 }
9903 %% Lamp
9904 \pgfcircdeclarebipolescaled{misc}
9905 {}
9906 {\ctikzvalof{bipoles/lamp/height}}
9907 {lamp}
9908 {\ctikzvalof{bipoles/lamp/height}}
9909 {\ctikzvalof{bipoles/lamp/width}}
9910 {
9911 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9912
9913 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9914 \pgf@circ@draworfill
9915 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
9916 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
9917 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
9918 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
9919 \pgfusepath{draw}
9920 }
9921
9922 %% bulb
9923 \pgfcircdeclarebipolescaled{misc}
9924 {}
9925 {\ctikzvalof{bipoles/bulb/height}}
9926 {bulb}
9927 {\ctikzvalof{bipoles/bulb/height}}
9928 {\ctikzvalof{bipoles/bulb/width}}
9929 {%
9930 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9931 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
9932 \pgf@circ@draworfill
9933 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9934 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
9935 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
9936 \pgfsetbeveljoin
9937 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9938 \pgfusepath{draw}
9939 }
9940
9941
9942 % end of pgfcircbipoles.tex
9943 %%%---------- close: tex/pgfcircbipoles
9944 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
9945 %%%---------- open: tex/pgfcirctripoles.tex
9946 % Copyright 2018-2026 by Romano Giannetti
9947 % Copyright 2015-2026 by Stefan Lindner
9948 % Copyright 2013-2026 by Stefan Erhardt
9949 % Copyright 2007-2026 by Massimo Redaelli
9950 %
9951 % This file may be distributed and/or modified
9952 %
9953 % 1. under the LaTeX Project Public License and/or
9954 % 2. under the GNU Public License.
9955 %
9956 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
9957
9958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9959 %% Tripoles
9960
9961 %%%%%%%%%%%%%
9962 %% switches
9963 %%%%%%%%%%%%%
9964
9965 % Legacy spdt
9966 \pgfdeclareshape{spdt}{
9967 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
9968 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9969 \savedanchor\northwest{%
9970 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9971 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
9972 \pgf@y=.5\pgf@y
9973 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
9974 \pgf@x=.5\pgf@x
9975 }
9976 \anchor{left}{%
9977 \northwest
9978 \pgf@y=0pt
9979 }
9980 \anchor{in}{
9981 \northwest
9982 \pgf@y=0pt
9983 }
9984 \anchor{out 1}{
9985 \northwest
9986 \pgf@x=-\pgf@x
9987 }
9988 \anchor{out 2}{
9989 \northwest
9990 \pgf@x=-\pgf@x
9991 \pgf@y=-\pgf@y
9992 }
9993 \anchor{center}{
9994 \pgf@y=0pt
9995 \pgf@x=0pt
9996 }
9997 \anchor{east}{
9998 \northwest
9999 \pgf@y=0pt
10000 \pgf@x=-\pgf@x
10001 }
10002 \anchor{west}{
10003 \northwest
10004 \pgf@y=0pt
10005 }
10006 \anchor{south}{
10007 \northwest
10008 \pgf@x=0pt
10009 \pgf@y=-\pgf@y
10010 }
10011 \anchor{north}{
10012 \northwest
10013 \pgf@x=0pt
10014 }
10015 \anchor{south west}{
10016 \northwest
10017 \pgf@y=-\pgf@y
10018 }
10019 \anchor{north east}{
10020 \northwest
10021 \pgf@x=-\pgf@x
10022 }
10023 \anchor{north west}{
10024 \northwest
10025 }
10026 \anchor{south east}{
10027 \northwest
10028 \pgf@x=-\pgf@x
10029 \pgf@y=-\pgf@y
10030 }
10031 \backgroundpath{
10032 \pgfsetcolor{\ctikzvalof{color}}
10033
10034 \northwest
10035 \pgf@circ@res@up = \pgf@y
10036 \pgf@circ@res@down = -\pgf@y
10037 \pgf@circ@res@right = -\pgf@x
10038 \pgf@circ@res@left = \pgf@x
10039 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
10040
10041
10042 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10043 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10044 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10045 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10046
10047 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10048 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10049
10050 \pgfusepath{draw}
10051
10052 \pgfscope
10053 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10054 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
10055 \endpgfscope
10056 \pgfscope
10057 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10058 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
10059 \endpgfscope
10060 \pgfscope
10061 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
10062 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
10063 \endpgfscope
10064
10065 \pgfscope
10066 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
10067 \pgfpathlineto{
10068 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
10069 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
10070 }
10071 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10072 \pgfusepath{draw}
10073 \endpgfscope
10074 }
10075 }
10076
10077
10078 % cute switch "node" shapes, matching with cute "to" shapes
10079 % #1 -> name
10080 % #2 -> barposition
10081 % #3 -> arrowcode
10082 \long\def\pgfcircdeclarecutespdt#1#2#3{
10083 \pgfdeclareshape{#1}
10084 {
10085 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10086 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10087 \savedanchor\northwest{%
10088 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10089 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10090 \pgf@y=.5\pgf@y
10091 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10092 \pgf@x=.25\pgf@x
10093 }
10094 \savedanchor\midlever{
10095 % these values are calculated when we create the definition of the shape.
10096 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10097 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10098 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
10099 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10100 \pgf@circ@res@down = -.5\pgf@y
10101 \pgf@circ@res@up = .5\pgf@y
10102 \pgfextracty{\pgf@circ@res@other}{#2}
10103 \pgf@x=0pt
10104 \pgf@y=.5\pgf@circ@res@other
10105 }
10106 % radius of the connector
10107 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10108 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10109 % shapename
10110 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10111 % shape type
10112 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
10113 % mid of the lever, to stack switches
10114 \anchor{mid}{\midlever}
10115 % center anchors
10116 \anchor{cin}{ \northwest \pgf@y=0pt}
10117 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
10118 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10119 % horizontal angles
10120 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
10121 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
10122 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
10123
10124 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
10125 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
10126 \anchor{west}{ \northwest \pgf@y=0pt }
10127 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
10128 \anchor{north}{ \northwest \pgf@x=0pt }
10129 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
10130 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
10131 \anchor{north west}{ \northwest }
10132 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10133
10134 \backgroundpath{
10135 \pgfsetcolor{\ctikzvalof{color}}
10136 \northwest
10137 \pgf@circ@res@up = \pgf@y
10138 \pgf@circ@res@down = -\pgf@y
10139 \pgf@circ@res@right = -\pgf@x
10140 \pgf@circ@res@left = \pgf@x
10141
10142 \pgfscope
10143 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10144 \pgf@circ@res@temp=\radius\relax
10145 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10146 \pgfsetlinewidth{2\pgf@circ@res@temp}
10147 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10148 \pgfpathlineto{#2}
10149 \pgfsetroundcap\pgfusepath{draw}
10150 \endpgfscope
10151 \pgfscope % arrow
10152 #3
10153 \endpgfscope
10154 % terminals
10155 \pgfscope
10156 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10157 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
10158 \endpgfscope
10159 \pgfscope
10160 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10161 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
10162 \endpgfscope
10163 \pgfscope
10164 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10165 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
10166 \endpgfscope
10167
10168 }
10169 }
10170 }
10171
10172 \pgfcircdeclarecutespdt{cute spdt up}
10173 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10174 {}
10175
10176 \pgfcircdeclarecutespdt{cute spdt mid}
10177 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10178 {}
10179
10180 \pgfcircdeclarecutespdt{cute spdt down}
10181 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10182 {}
10183
10184 \pgfcircdeclarecutespdt{cute spdt up arrow}
10185 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10186 {
10187 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10188 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10189 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
10190 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
10191 \pgfsetarrowsend{latexslim}
10192 \pgfusepath{draw}
10193 }
10194
10195 \pgfcircdeclarecutespdt{cute spdt mid arrow}
10196 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10197 {
10198 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10199 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10200 \pgfsetarrowsstart{latexslim}
10201 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
10202 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
10203 \pgfsetarrowsend{latexslim}
10204 \pgfusepath{draw}
10205 }
10206
10207 \pgfcircdeclarecutespdt{cute spdt down arrow}
10208 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10209 {
10210 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10211 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10212 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
10213 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
10214 \pgfsetarrowsend{latexslim}
10215 \pgfusepath{draw}
10216 }
10217
10218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10220 %%
10221 %% Logic ports
10222 %%
10223 %% Code from John Kormylo at tex.stackexchange.com
10224 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
10225 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
10226 %%
10227
10228 \newcount\pgf@circ@res@count% reserve global register
10229
10230 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
10231 {%
10232 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10233 \step
10234 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10235 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10236 }%
10237
10238 % #1 = \pgfmathcounter #2=type #3 specificic port
10239 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
10240 \def\pgf@circ@logicport@baseinput#1#2#3%
10241 {%
10242 % and and nand
10243 \ifnum #2=1\relax
10244 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10245 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10246 \step
10247 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10248 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10249 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
10250 \fi
10251 % or and nor
10252 \ifnum #2=2\relax
10253 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10254 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10255 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10256 \step
10257 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10258 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10259 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
10260 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10261 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10262 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10263 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10264 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10265 \pgf@circ@res@temp=\pgf@y
10266 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10267 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10268 \pgf@x=\pgf@circ@res@other
10269 \fi
10270 % xor and xnor
10271 \ifnum #2=3\relax
10272 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10273 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10274 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10275 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
10276 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10277 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10278 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10279 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10280 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10281 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
10282 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10283 % this compensates for the effect of the line width on the gap between the arcs
10284 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10285 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10286
10287 \step
10288 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10289 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10290 \pgf@circ@res@temp=\pgf@y
10291 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10292 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10293 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10294 \pgf@x=\pgf@circ@res@other
10295 \fi
10296 % european
10297 \ifnum #2=4\relax
10298 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10299 \pgfextractx{\pgf@circ@res@other}{\left}%
10300 \step
10301 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10302 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10303 \pgf@x=\pgf@circ@res@other
10304 \fi
10305 }%
10306
10307 %%% american
10308 \long\def\pgfcircdeclarelogicport#1#2#3{%
10309 \pgfdeclareshape{american #1 port}%
10310 {%
10311 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10312 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10313 \savedmacro\resize{% automatic
10314 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10315 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10316 \pgf@circ@res@up = .5\pgf@circ@res@up
10317 \pgf@circ@res@down = -\pgf@circ@res@up
10318 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
10319 \pgf@circ@res@right = .5\pgf@circ@res@right
10320 \pgf@circ@res@left = -\pgf@circ@res@right
10321 }%
10322 \savedmacro\inputs{% get number of inputs
10323 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10324 \ifnum\pgf@circ@res@count=0
10325 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
10326 \fi
10327 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10328 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10329 \def\inputs{\the\pgf@circ@res@count}%
10330 }%
10331 \savedanchor\step{% 1/2 gap at edges
10332 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10333 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10334 \divide\pgf@circ@res@step by \pgf@circ@res@count
10335 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10336 }%
10337 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10338 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10339 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
10340 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
10341 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
10342
10343 \anchor{center}{\origin}% for backwards compatibility
10344 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
10345
10346 % create input anchors
10347 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
10348 \pgfmathloop%
10349 \ifnum\pgfmathcounter>\pgf@circ@res@count%
10350 \else%
10351 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
10352 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
10353 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10354 }%
10355 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
10356 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
10357 }%
10358 %}{}%
10359 \repeatpgfmathloop%
10360 }
10361
10362 \anchor{out}{\northeast\pgf@y=0pt}
10363 \anchor{bout}{\right\pgf@y=0pt}
10364
10365
10366 \anchor{left}{\left}% edges of component minus leads
10367 \anchor{right}{\right}
10368
10369 \anchor{north east}{\northeast}% see \Compass macro
10370 \anchor{south west}{\southwest}
10371 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10372 \pgfpoint{0cm}{\pgf@circ@res@up}}
10373 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10374 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10375 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10376 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10377 \pgfpoint{\pgf@circ@res@left}{0cm}}
10378 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10379 \pgfpoint{0cm}{\pgf@circ@res@down}}
10380 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10381 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10382 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10383 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10384 \pgfpoint{\pgf@circ@res@right}{0cm}}
10385
10386 \backgroundpath{
10387 \pgfsetcolor{\ctikzvalof{color}}
10388 #3
10389 }
10390 }
10391 }
10392 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10393 \pgfcircdeclarelogicport{and}{1}{
10394 \pgfextracty{\pgf@circ@res@temp}{\step}%
10395 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10396 \pgf@circ@res@count = \inputs\relax
10397 \ifpgfcirc@draw@leads
10398 %input leads
10399 \loop\ifnum\pgf@circ@res@count>0
10400 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10401 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10402 \pgfpathlineto{\pgfpoint
10403 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
10404 {\pgf@circ@res@temp}}
10405 \advance\pgf@circ@res@count by -1
10406 \repeat
10407 \fi
10408 % output lead
10409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10410 \pgfpathlineto{\pgfpoint
10411 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right}
10412 {0pt}}
10413 \pgfusepath{draw}
10414
10415
10416 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10417 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
10418
10419 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10421 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
10422 \pgfpathclose
10423 \pgf@circ@draworfill
10424 }
10425 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10426 \pgfcircdeclarelogicport{nand}{1}{
10427 \pgfextracty{\pgf@circ@res@temp}{\step}%
10428 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10429 \pgf@circ@res@count = \inputs\relax
10430 \ifpgfcirc@draw@leads
10431 %input leads
10432 \loop\ifnum\pgf@circ@res@count>0
10433 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10435 \pgfpathlineto{\pgfpoint
10436 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
10437 {\pgf@circ@res@temp}}
10438 \advance\pgf@circ@res@count by -1
10439 \repeat
10440 \fi
10441
10442 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10443 \pgfpathlineto{\pgfpoint
10444 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
10445
10446 \pgfusepath{draw}
10447 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10448 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
10449 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
10450 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10451
10452 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10453 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10454 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
10455 \pgfpathclose
10456
10457 \pgfpathellipse
10458 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
10459 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10460 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10461
10462 \pgf@circ@draworfill
10463 }
10464 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10465 \pgfcircdeclarelogicport{nor}{2}{
10466 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10467 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
10468 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10469 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10470 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10471 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10472
10473 \pgfextracty{\pgf@circ@res@temp}{\step}%
10474 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10475 \pgf@circ@res@count = \inputs\relax
10476 \ifpgfcirc@draw@leads
10477 %input leads
10478 \loop\ifnum\pgf@circ@res@count>0
10479 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10480 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10481 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10482 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10484 \advance\pgf@circ@res@count by -1
10485 \repeat
10486 \fi
10487
10488 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10490 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10491
10492 \pgfusepath{draw}
10493
10494 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10495
10496 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10497 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
10498 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10499 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10500
10501 % main shape
10502 \ifpgfcirc@roundy@or@shapes
10503 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10504 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10505 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10506 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10507 \pgfpathclose
10508 \else
10509 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10510 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10511 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10512 \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}}
10513 \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}}
10514 \pgfpathclose
10515 \fi
10516
10517 % not dot
10518 \pgfpathellipse
10519 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10520 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10521 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10522
10523 \pgf@circ@draworfill
10524 }
10525 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10526 \pgfcircdeclarelogicport{or}{2}{
10527 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10528 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
10529 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10530 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10531 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10532 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10533
10534 \pgfextracty{\pgf@circ@res@temp}{\step}%
10535 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10536 \pgf@circ@res@count = \inputs\relax
10537 \ifpgfcirc@draw@leads
10538 %input leads
10539 \loop\ifnum\pgf@circ@res@count>0
10540 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10541 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10542 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10543 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10544 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10545 \advance\pgf@circ@res@count by -1
10546 \repeat
10547 \fi
10548
10549 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10550 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10551 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10552
10553 \pgfusepath{draw}
10554
10555 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10556
10557 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10558
10559 % main shape
10560 \ifpgfcirc@roundy@or@shapes
10561 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10562 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10563 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10564 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10565 \pgfpathclose
10566 \else
10567 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10568 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10569 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10570 \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}}
10571 \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}}
10572 \pgfpathclose
10573 \fi
10574
10575 \pgf@circ@draworfill
10576 }
10577 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10578 \pgfcircdeclarelogicport{xor}{3}{
10579 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
10580 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
10581 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10582 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10583 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10584 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10585 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10586 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10587 % this compensates for the effect of the line width on the gap between the arcs
10588 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10589 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10590
10591 \pgfextracty{\pgf@circ@res@temp}{\step}%
10592 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10593 \pgf@circ@res@count = \inputs\relax
10594 \ifpgfcirc@draw@leads
10595 %input leads
10596 \loop\ifnum\pgf@circ@res@count>0
10597 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10598 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10599 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10600 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10601 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10602 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10603 \advance\pgf@circ@res@count by -1
10604 \repeat
10605 \fi
10606
10607 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10608 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10609 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10610
10611 \pgfusepath{draw}
10612
10613 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10614
10615 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
10616
10617 % main shape
10618 \ifpgfcirc@roundy@or@shapes
10619 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10620 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10621 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10622 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10623 \pgfpathclose
10624 \else
10625 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10627 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10628 \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}}
10629 \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}}
10630 \pgfpathclose
10631 \fi
10632 \pgf@circ@draworfill
10633
10634 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10635
10636 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10637 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10638
10639 \pgfusepath{draw}
10640 }
10641 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10642 \pgfcircdeclarelogicport{xnor}{3}{
10643 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
10644 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
10645 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10646 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10647 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10648 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10649 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10650 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10651 % this compensates for the effect of the line width on the gap between the arcs
10652 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10653 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10654
10655 \pgfextracty{\pgf@circ@res@temp}{\step}%
10656 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10657 \pgf@circ@res@count = \inputs\relax
10658 \ifpgfcirc@draw@leads
10659 %input leads
10660 \loop\ifnum\pgf@circ@res@count>0
10661 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10662 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10663 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10664 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10665 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10667 \advance\pgf@circ@res@count by -1
10668 \repeat
10669 \fi
10670
10671 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10674
10675 \pgfusepath{draw}
10676
10677 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10678
10679 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
10680 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
10681 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10682 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10683
10684 % main shape
10685 \ifpgfcirc@roundy@or@shapes
10686 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10687 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10688 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10689 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10690 \pgfpathclose
10691 \else
10692 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10693 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10694 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10695 \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}}
10696 \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}}
10697 \pgfpathclose
10698 \fi
10699
10700 \pgfpathellipse
10701 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10702 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10703 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10704 \pgf@circ@draworfill
10705
10706 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
10707 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10708
10709 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10710 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10711
10712 \pgfusepath{draw}
10713 }
10714
10715 %%% Original one-input ports
10716
10717 \pgfdeclareshape{american not port}{
10718 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10719 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10720 \anchor{center}{\pgfpointorigin}
10721 \savedanchor\northwest{%
10722 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10723 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10724 \pgf@y=.5\pgf@y
10725 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10726 \pgf@x=.5\pgf@x
10727 }
10728 \anchor{in}{
10729 \northwest
10730 \pgf@y=0pt
10731 }
10732 \anchor{in 1}{
10733 \northwest
10734 \pgf@y=0pt
10735 }
10736 \anchor{bin}{
10737 \northwest
10738 \pgf@y=0pt
10739 }
10740 \anchor{bin 1}{
10741 \northwest
10742 \pgf@y=0pt
10743 \pgf@x=0.7\pgf@x
10744 }
10745 \anchor{out}{
10746 \northwest
10747 \pgf@y=0pt
10748 \pgf@x=-\pgf@x
10749 }
10750 \anchor{bout}{
10751 \northwest
10752 \pgf@y=0pt
10753 \pgf@x=-0.7\pgf@x
10754 }
10755 \anchor{center}{
10756 \pgfpointorigin
10757 }
10758 \anchor{east}{
10759 \northwest
10760 \pgf@y=0pt
10761 \pgf@x=-\pgf@x
10762 }
10763 \anchor{west}{
10764 \northwest
10765 \pgf@y=0pt
10766 }
10767 \anchor{south}{
10768 \northwest
10769 \pgf@x=0pt
10770 \pgf@y=-\pgf@y
10771 }
10772 \anchor{north}{
10773 \northwest
10774 \pgf@x=0pt
10775 }
10776 \anchor{south west}{
10777 \northwest
10778 \pgf@y=-\pgf@y
10779 }
10780 \anchor{north east}{
10781 \northwest
10782 \pgf@x=-\pgf@x
10783 }
10784 \anchor{north west}{
10785 \northwest
10786 }
10787 \anchor{south east}{
10788 \northwest
10789 \pgf@x=-\pgf@x
10790 \pgf@y=-\pgf@y
10791 }
10792 \backgroundpath{
10793 \pgfsetcolor{\ctikzvalof{color}}
10794
10795 \northwest
10796 \pgf@circ@res@up = \pgf@y
10797 \pgf@circ@res@down = -\pgf@y
10798 \pgf@circ@res@right = -\pgf@x
10799 \pgf@circ@res@left = \pgf@x
10800
10801 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
10802
10803 \pgfscope
10804 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10805 \pgftransformxshift{.7\pgf@circ@res@left}
10806 \pgf@circ@res@step=\pgf@circ@res@right
10807 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10808 \pgf@circ@res@step=.7\pgf@circ@res@step
10809
10810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
10811 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10812 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10813 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
10814 \pgf@circ@draworfill
10815 \pgfpathellipse
10816 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
10817 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
10818 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
10819 \pgf@circ@draworfill
10820 \endpgfscope
10821
10822 \ifpgfcirc@draw@leads
10823 %input leads
10824 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10825 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10826 \fi
10827
10828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10829 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
10830
10831 \pgfusepath{draw}
10832 }
10833 }
10834
10835 \pgfdeclareshape{american buffer port}{
10836 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10837 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10838 \anchor{center}{\pgfpointorigin}
10839 \savedanchor\northwest{%
10840 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10841 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10842 \pgf@y=.5\pgf@y
10843 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10844 \pgf@x=.5\pgf@x
10845 }
10846 \anchor{in}{
10847 \northwest
10848 \pgf@y=0pt
10849 }
10850 \anchor{in 1}{
10851 \northwest
10852 \pgf@y=0pt
10853 }
10854 \anchor{bin}{
10855 \northwest
10856 \pgf@y=0pt
10857 }
10858 \anchor{bin 1}{
10859 \northwest
10860 \pgf@y=0pt
10861 \pgf@x=0.7\pgf@x
10862 }
10863 \anchor{out}{
10864 \northwest
10865 \pgf@y=0pt
10866 \pgf@x=-\pgf@x
10867 }
10868 \anchor{bout}{
10869 \northwest
10870 \pgf@y=0pt
10871 \pgf@x=-0.7\pgf@x
10872 }
10873 \anchor{center}{
10874 \pgfpointorigin
10875 }
10876 \anchor{east}{
10877 \northwest
10878 \pgf@y=0pt
10879 \pgf@x=-\pgf@x
10880 }
10881 \anchor{west}{
10882 \northwest
10883 \pgf@y=0pt
10884 }
10885 \anchor{south}{
10886 \northwest
10887 \pgf@x=0pt
10888 \pgf@y=-\pgf@y
10889 }
10890 \anchor{north}{
10891 \northwest
10892 \pgf@x=0pt
10893 }
10894 \anchor{south west}{
10895 \northwest
10896 \pgf@y=-\pgf@y
10897 }
10898 \anchor{north east}{
10899 \northwest
10900 \pgf@x=-\pgf@x
10901 }
10902 \anchor{north west}{
10903 \northwest
10904 }
10905 \anchor{south east}{
10906 \northwest
10907 \pgf@x=-\pgf@x
10908 \pgf@y=-\pgf@y
10909 }
10910 \backgroundpath{
10911 \pgfsetcolor{\ctikzvalof{color}}
10912
10913 \northwest
10914 \pgf@circ@res@up = \pgf@y
10915 \pgf@circ@res@down = -\pgf@y
10916 \pgf@circ@res@right = -\pgf@x
10917 \pgf@circ@res@left = \pgf@x
10918
10919 \pgfscope
10920 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10921 \pgftransformxshift{.7\pgf@circ@res@left}
10922 \pgf@circ@res@step=\pgf@circ@res@right
10923 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10924 \pgf@circ@res@step=.7\pgf@circ@res@step
10925
10926 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
10927 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10928 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10929 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
10930 \pgf@circ@draworfill
10931 \endpgfscope
10932
10933 \ifpgfcirc@draw@leads
10934 %input leads
10935 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10936 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10937 \fi
10938
10939 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10940 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
10941
10942 \pgfusepath{draw}
10943 }
10944 }
10945 \pgfdeclareshape{invschmitt}{
10946 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10947 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10948 \anchor{center}{\pgfpointorigin}
10949 \savedanchor\northwest{%
10950 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10951 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10952 \pgf@y=.5\pgf@y
10953 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10954 \pgf@x=.5\pgf@x
10955 }
10956 \anchor{in}{
10957 \northwest
10958 \pgf@y=0pt
10959 }
10960 \anchor{in 1}{
10961 \northwest
10962 \pgf@y=0pt
10963 }
10964 \anchor{bin}{
10965 \northwest
10966 \pgf@y=0pt
10967 \pgf@x=0.7\pgf@x
10968 }
10969 \anchor{bin 1}{
10970 \northwest
10971 \pgf@y=0pt
10972 \pgf@x=0.7\pgf@x
10973 }
10974 \anchor{out}{
10975 \northwest
10976 \pgf@y=0pt
10977 \pgf@x=-\pgf@x
10978 }
10979 \anchor{bout}{
10980 \northwest
10981 \pgf@y=0pt
10982 \pgf@x=-0.7\pgf@x
10983 }
10984 \anchor{center}{
10985 \pgfpointorigin
10986 }
10987 \anchor{east}{
10988 \northwest
10989 \pgf@y=0pt
10990 \pgf@x=-\pgf@x
10991 }
10992 \anchor{west}{
10993 \northwest
10994 \pgf@y=0pt
10995 }
10996 \anchor{south}{
10997 \northwest
10998 \pgf@x=0pt
10999 \pgf@y=-\pgf@y
11000 }
11001 \anchor{north}{
11002 \northwest
11003 \pgf@x=0pt
11004 }
11005 \anchor{south west}{
11006 \northwest
11007 \pgf@y=-\pgf@y
11008 }
11009 \anchor{north east}{
11010 \northwest
11011 \pgf@x=-\pgf@x
11012 }
11013 \anchor{north west}{
11014 \northwest
11015 }
11016 \anchor{south east}{
11017 \northwest
11018 \pgf@x=-\pgf@x
11019 \pgf@y=-\pgf@y
11020 }
11021 \backgroundpath{
11022 \pgfsetcolor{\ctikzvalof{color}}
11023
11024 \northwest
11025 \pgf@circ@res@up = \pgf@y
11026 \pgf@circ@res@down = -\pgf@y
11027 \pgf@circ@res@right = -\pgf@x
11028 \pgf@circ@res@left = \pgf@x
11029
11030 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11031
11032 \pgfscope
11033 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11034 \pgftransformxshift{.7\pgf@circ@res@left}
11035 \pgf@circ@res@step=\pgf@circ@res@right
11036 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11037 \pgf@circ@res@step=.7\pgf@circ@res@step
11038
11039 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11040 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11041 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11042 \pgfpathclose
11043 \pgf@circ@draworfill
11044 \pgfpathellipse
11045 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11046 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11047 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11048 \pgf@circ@draworfill
11049 \endpgfscope
11050
11051 \ifpgfcirc@draw@leads
11052 %input leads
11053 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11054 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11055 \fi
11056
11057 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11058 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11059 \pgfusepath{draw}
11060 %draw inner shape
11061
11062 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11063
11064 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11065 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11066 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11067 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11068 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11069 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11070 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11071 \pgfusepath{draw}
11072
11073 }
11074 }
11075
11076 \pgfdeclareshape{schmitt}{
11077 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11078 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11079 \anchor{center}{\pgfpointorigin}
11080 \savedanchor\northwest{%
11081 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11082 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11083 \pgf@y=.5\pgf@y
11084 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11085 \pgf@x=.5\pgf@x
11086 }
11087 \anchor{in}{
11088 \northwest
11089 \pgf@y=0pt
11090 }
11091 \anchor{in 1}{
11092 \northwest
11093 \pgf@y=0pt
11094 }
11095 \anchor{bin}{
11096 \northwest
11097 \pgf@y=0pt
11098 \pgf@x=0.7\pgf@x
11099 }
11100 \anchor{bin 1}{
11101 \northwest
11102 \pgf@y=0pt
11103 \pgf@x=0.7\pgf@x
11104 }
11105 \anchor{out}{
11106 \northwest
11107 \pgf@y=0pt
11108 \pgf@x=-\pgf@x
11109 }
11110 \anchor{bout}{
11111 \northwest
11112 \pgf@y=0pt
11113 \pgf@x=-.7\pgf@x
11114 }
11115 \anchor{center}{
11116 \pgfpointorigin
11117 }
11118 \anchor{east}{
11119 \northwest
11120 \pgf@y=0pt
11121 \pgf@x=-\pgf@x
11122 }
11123 \anchor{west}{
11124 \northwest
11125 \pgf@y=0pt
11126 }
11127 \anchor{south}{
11128 \northwest
11129 \pgf@x=0pt
11130 \pgf@y=-\pgf@y
11131 }
11132 \anchor{north}{
11133 \northwest
11134 \pgf@x=0pt
11135 }
11136 \anchor{south west}{
11137 \northwest
11138 \pgf@y=-\pgf@y
11139 }
11140 \anchor{north east}{
11141 \northwest
11142 \pgf@x=-\pgf@x
11143 }
11144 \anchor{north west}{
11145 \northwest
11146 }
11147 \anchor{south east}{
11148 \northwest
11149 \pgf@x=-\pgf@x
11150 \pgf@y=-\pgf@y
11151 }
11152 \backgroundpath{
11153 \pgfsetcolor{\ctikzvalof{color}}
11154
11155
11156 \northwest
11157 \pgf@circ@res@up = \pgf@y
11158 \pgf@circ@res@down = -\pgf@y
11159 \pgf@circ@res@right = -\pgf@x
11160 \pgf@circ@res@left = \pgf@x
11161
11162 \pgfscope
11163 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11164 \pgftransformxshift{.7\pgf@circ@res@left}
11165 \pgf@circ@res@step=\pgf@circ@res@right
11166 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11167 \pgf@circ@res@step=.7\pgf@circ@res@step
11168
11169 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11170 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11171 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11172 \pgfpathclose
11173 \pgf@circ@draworfill
11174 \endpgfscope
11175
11176 \ifpgfcirc@draw@leads
11177 %input leads
11178 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11179 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11180 \fi
11181
11182 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11183 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
11184 \pgfusepath{draw}
11185 %draw inner shape
11186
11187 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11188
11189 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11190 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11191 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11192 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11193 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11194 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11195 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11196 \pgfusepath{draw}
11197
11198 }
11199 }
11200
11201
11202 %%% start european logic ports, from John Kormylo
11203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11204 %%
11205
11206 % #1 - name
11207 % #2 - text inside
11208 % #3 - number of inputs
11209 % #4 = is it a not?
11210 %
11211 % option to add a circle for not-output, see
11212 % https://github.com/circuitikz/circuitikz/issues/385
11213 %
11214 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
11215 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
11216 \ctikzset{tripoles/european not shape/.initial=ocirc}
11217 \ctikzset{tripoles/european not symbol/.is choice}
11218 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
11219 \ctikzset{tripoles/european not symbol/circle/.code={%
11220 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
11221 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
11222 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
11223
11224 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
11225 \pgfdeclareshape{european #1 port}
11226 {
11227 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11228 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11229 \saveddimen{\boutshift}{%
11230 \ifpgf@circ@european@port@circle
11231 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11232 \edef\pgf@temp{ocirc}
11233 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
11234 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
11235 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11236 \else % it's ieee not circ
11237 \pgf@circ@notradius % defined together with ieeestd ports
11238 \pgf@x=2\pgf@circ@res@temp
11239 \fi
11240 \else
11241 \pgf@x=0pt
11242 \fi
11243 }
11244 \savedmacro\resize{% automatic
11245 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11246 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11247 \pgf@circ@res@up = .5\pgf@circ@res@up
11248 \pgf@circ@res@down = -\pgf@circ@res@up
11249 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
11250 \pgf@circ@res@right = .5\pgf@circ@res@right
11251 \pgf@circ@res@left = -\pgf@circ@res@right
11252 }%
11253 \savedmacro\inputs{% get number of inputs
11254 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11255 \ifnum\pgf@circ@res@count=0
11256 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
11257 \fi
11258 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11259 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11260 \def\inputs{\the\pgf@circ@res@count}%
11261 }%
11262 \savedanchor\step{% 1/2 gap at edges
11263 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11264 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11265 \divide\pgf@circ@res@step by #3
11266 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11267 }%
11268 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
11269 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
11270 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11271 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
11272 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
11273
11274 \anchor{center}{\origin}% for backwards compatibility
11275 % the text anchor overlaps the logic symbol
11276 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
11277 % create input anchors
11278 \ifnum#3=1\relax
11279 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11280 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11281 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11282 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11283 \else
11284 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
11285 \pgfmathloop%
11286 \ifnum\pgfmathcounter>#3%
11287 \else%
11288 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
11289 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
11290 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11291 }%
11292 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
11293 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
11294 }%
11295 %}{}%
11296 \repeatpgfmathloop%
11297 }
11298 \fi
11299 \anchor{out}{\northeast\pgf@y=0pt}
11300 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11301
11302 \anchor{left}{\left}% edges of component minus leads
11303 \anchor{right}{\right}
11304
11305 \anchor{north east}{\northeast}% see \Compass macro
11306 \anchor{south west}{\southwest}
11307 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11308 \pgfpoint{0cm}{\pgf@circ@res@up}}
11309 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11310 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11311 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11312 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
11313 \pgfpoint{\pgf@circ@res@left}{0cm}}
11314 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11315 \pgfpoint{0cm}{\pgf@circ@res@down}}
11316 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11317 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11318 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11319 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
11320 \pgfpoint{\pgf@circ@res@right}{0cm}}
11321
11322 \backgroundpath{
11323 \pgfsetcolor{\ctikzvalof{color}}
11324 \pgfstartlinewidth=\pgflinewidth
11325 \pgfscope
11326 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11327 \pgfpathrectanglecorners
11328 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
11329 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
11330 \pgf@circ@draworfill
11331 \endpgfscope
11332 \ifpgfcirc@draw@leads
11333 %input leads
11334 \ifnum#3=1\relax
11335 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
11336 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11337 \else
11338 \pgfextracty{\pgf@circ@res@temp}{\step}%
11339 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11340 %\pgf@circ@res@count = #3\relax% redundant
11341 \loop\ifnum\pgf@circ@res@count>0
11342 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11343 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11344 \pgfpathlineto{\pgfpoint
11345 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
11346 {\pgf@circ@res@temp}}
11347 \advance\pgf@circ@res@count by -1
11348 \repeat
11349 \fi
11350 \fi
11351 %
11352 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11353 \pgfpathlineto{%
11354 \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
11355 %
11356 \pgfusepath{draw}
11357 %
11358 \edef\pgf@temp{not}
11359 \edef\pgf@circ@temp{#4}
11360 \ifx\pgf@temp\pgf@circ@temp % is a not
11361 \ifpgf@circ@european@port@circle
11362 \pgfscope
11363 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11364 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
11365 % reset linewidth for IEEE ports, otherwise they will multiply...
11366 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
11367 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
11368 \endpgfscope
11369 \else
11370 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
11371 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
11372 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
11373 \pgfusepath{draw}
11374 \fi
11375 \fi
11376 %
11377 \pgfpathmoveto{\pgfpointorigin}
11378 \pgftext{#2}
11379 }
11380 }
11381 }
11382 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
11383 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
11384 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
11385 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
11386 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
11387 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
11388 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
11389 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
11390
11391 %% end european logic ports
11392
11393 %%%%%%%%%%%%%%%%%%%%%%%%
11394 %% Transistors
11395 %%%%%%%%%%%%%%%%%%%%%%%%
11396
11397
11398 \long\def\pgfcircdeclaretransistor#1#2#3{
11399 \pgfdeclareshape{#1}
11400 {
11401 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
11402 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11403 \anchor{center}{
11404 \pgfpointorigin
11405 }
11406 \savedanchor\northeast{% upper right
11407 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11408 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
11409 \pgf@y=.5\pgf@y
11410 \pgf@x=0pt
11411 }
11412 \savedanchor\left{%center left
11413 \pgf@y=0pt
11414 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11415 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
11416 }
11417 \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
11418 \pgf@y=0pt
11419 \pgf@x=0pt
11420 }
11421 \anchor{text}{
11422 \northeast
11423 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11424 \ifpgf@circuit@transisors@fixlabels
11425 \ifpgf@circuit@fet@bodydiode
11426 % try to put the text to the right of the flyback diode
11427 \pgfmathsetlength{\pgf@circ@res@other}{(
11428 \ctikzvalof{tripoles/#1/bodydiode distance}*
11429 \ctikzvalof{tripoles/#1/width} +
11430 \ctikzvalof{tripoles/#1/bodydiode scale}*
11431 \ctikzvalof{bipoles/diode/height}/2
11432 )*\pgf@circ@scaled@Rlen}
11433 \advance\pgf@x by \pgf@circ@res@other
11434 \fi
11435 % add a bit of space to avoid central (substrate) terminal if drawn
11436 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
11437 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11438 \else
11439 \pgf@y=.7\pgf@y
11440 \pgf@x= \pgf@circ@scaled@Rlen
11441 \pgf@x=0.1\pgf@x
11442 \fi
11443 }
11444 \anchor{pathstart}{ % south
11445 \northeast
11446 \pgf@y=-\pgf@y
11447 }
11448 \anchor{pathend}{
11449 \northeast
11450 }
11451 \anchor{north}{
11452 \northeast
11453 \pgf@circ@res@step=\pgf@y
11454 \left
11455 \pgf@y=\pgf@circ@res@step
11456 \pgf@x=.5\pgf@x
11457 }
11458 \anchor{west}{
11459 \left
11460 }
11461 \anchor{east}{
11462 \northeast
11463 \pgf@y=0pt
11464 }
11465 \anchor{south}{
11466 \northeast
11467 \pgf@circ@res@step=\pgf@y
11468 \left
11469 \pgf@y=-\pgf@circ@res@step
11470 \pgf@x=.5\pgf@x
11471 }
11472 \anchor{south west}{
11473 \northeast
11474 \pgf@circ@res@step=\pgf@y
11475 \left
11476 \pgf@y=-\pgf@circ@res@step
11477 }
11478 \anchor{north east}{
11479 \northeast
11480 }
11481 \anchor{north west}{
11482 \northeast
11483 \pgf@circ@res@step=\pgf@y
11484 \left
11485 \pgf@y=\pgf@circ@res@step
11486 }
11487 \anchor{south east}{
11488 \northeast
11489 \pgf@y=-\pgf@y
11490 }
11491 \anchor{B}{
11492 \northeast
11493 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11494 \left
11495 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11496 }
11497 \anchor{base}{
11498 \northeast
11499 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11500 \left
11501 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11502 }
11503 \anchor{bulk}{ %added by Burak Kelleci
11504 \northeast
11505 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11506 \right
11507 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11508 }
11509 \anchor{nobulk}{ %added by Burak Kelleci
11510 \left
11511 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
11512 }
11513 \anchor{G}{
11514 \northeast
11515 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11516 \left
11517 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11518 }
11519 \anchor{gate}{
11520 \northeast
11521 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11522 \left
11523 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11524 }
11525 \anchor{nobase}{
11526 \left
11527 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
11528 }
11529 \anchor{nogate}{
11530 \left
11531 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
11532 }
11533 \anchor{E}{
11534 \northeast
11535 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11536 }
11537 \anchor{emitter}{
11538 \northeast
11539 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11540 }
11541 \anchor{C}{
11542 \northeast
11543 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11544 }
11545 \anchor{collector}{
11546 \northeast
11547 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11548 }
11549 \anchor{S}{
11550 \northeast
11551 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11552 }
11553 \anchor{source}{
11554 \northeast
11555 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11556 }
11557 \anchor{D}{
11558 \northeast
11559 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11560 }
11561 \anchor{drain}{
11562 \northeast
11563 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11564 }
11565 \anchor{body C in}{
11566 \northeast
11567 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11568 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
11569 }
11570 \anchor{body E in}{
11571 \northeast
11572 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11573 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
11574 }
11575 \anchor{body C out}{
11576 \northeast
11577 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11578 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
11579 \pgf@y=\pgf@ya
11580 \left
11581 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
11582 \pgf@y=\pgf@ya
11583 }
11584 \anchor{body E out}{
11585 \northeast
11586 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11587 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
11588 \pgf@y=\pgf@ya
11589 \left
11590 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
11591 \pgf@y=\pgf@ya
11592 }
11593 #2
11594 \backgroundpath{
11595 \pgftransformationadjustments
11596 \pgfsetcolor{\ctikzvalof{color}}
11597 %
11598 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
11599 \pgf@circuit@trans@ntypetrue
11600 \else
11601 \pgf@circuit@trans@ntypefalse
11602 \fi
11603 \northeast
11604 \pgf@circ@res@up = \pgf@y
11605 \pgf@circ@res@down = -\pgf@y
11606 \pgf@circ@res@right = \pgf@x
11607 \left
11608 \pgf@circ@res@left = \pgf@x
11609 \pgf@circ@scaled@Rlen=\scaledRlen
11610 %
11611 #3
11612 % BODY DIODE
11613 \ifpgf@circuit@fet@bodydiode
11614 \drawbodydiode{#1}
11615 \fi
11616 %
11617 }
11618 }
11619 }
11620
11621 \long\def\drawbodydiode#1{
11622 \pgfscope
11623 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
11624 \pgftransformrotate{90}
11625 % diode scale and bodydiode scale interacts. We want the size of the diode
11626 % proportional to the transistor, so we will:
11627 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
11628 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
11629 \pgftransformscale{\@@BDscale}
11630 \ifpgf@circuit@fulldiode
11631 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
11632 \else
11633 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
11634 \fi
11635 \endpgfscope
11636 % Draw stroke line
11637 \ifpgf@circuit@strokediode
11638 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
11639 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
11640 \pgfusepath{stroke}
11641 \fi
11642 %Draw upper connection to body diode
11643 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
11644 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11645 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
11646 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11647 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
11648 \pgfusepath{draw}
11649 \pgfscope
11650 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
11651 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11652 \pgftransformscale{0.5}
11653 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
11654 \endpgfscope{}
11655 %Draw lower connection to body diode
11656 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
11657 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11658 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11659 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
11660 \pgfusepath{draw}
11661 \pgfscope
11662 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11663 \pgftransformscale{0.5}
11664 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
11665 \endpgfscope
11666 }
11667
11668 \long\def\declarebpt#1{
11669 \pgfcircdeclaretransistor{#1}{
11670 \anchor{inner up}{
11671 \northeast
11672 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
11673 }
11674 \anchor{inner down}{
11675 \northeast
11676 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
11677 }
11678 }{
11679 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11680 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11681 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11682 \pgfpathlineto{\pgfpoint
11683 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11684 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
11685 \pgfusepath{draw}
11686
11687 % drawing base
11688 \pgfscope
11689 \pgfpathmoveto{\pgfpoint
11690 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11691 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11692 \pgfpathlineto{\pgfpoint
11693 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11694 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11695 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11696 \ifpgf@circuit@bpt@schottky
11697 % upper
11698 \pgfpathmoveto{\pgfpoint
11699 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11700 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11701 \pgfpathlineto{\pgfpoint
11702 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11703 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
11704 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
11705 \pgfpathlineto{\pgfpoint
11706 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
11707 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
11708 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
11709 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
11710 \pgfpathlineto{\pgfpoint
11711 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
11712 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
11713 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11714 % % lower
11715 \pgfpathmoveto{\pgfpoint
11716 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11717 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11718 \pgfpathlineto{\pgfpoint
11719 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11720 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
11721 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
11722 \pgfpathlineto{\pgfpoint
11723 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
11724 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
11725 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
11726 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
11727 \pgfpathlineto{\pgfpoint
11728 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
11729 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
11730 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11731 \fi
11732 \pgfusepath{draw}
11733 \endpgfscope
11734
11735 \pgfpathmoveto{\pgfpoint
11736 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11737 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
11738 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11739 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
11740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11741 \pgfusepath{draw}
11742 %draw arrow depending on type of transistor
11743 \pgfscope
11744 \pgfslopedattimetrue
11745 \pgfallowupsidedownattimetrue
11746 \pgfresetnontranslationattimefalse
11747 \edef\@@anchor{center}
11748 \ifpgf@circuit@trans@ntype
11749 \ifpgf@circuit@trans@arrowatend
11750 \edef\@@anchor{btip}
11751 \pgftransformlineattime{1.0}{%
11752 \pgfpoint%
11753 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11754 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
11755 }{%
11756 \pgfpoint{\pgf@circ@res@right}%
11757 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
11758 }
11759 \else
11760 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
11761 \pgfpoint%
11762 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11763 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
11764 }{%
11765 \pgfpoint{\pgf@circ@res@right}%
11766 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
11767 }
11768 \fi
11769 \else % p-type
11770 \ifpgf@circuit@trans@arrowatend
11771 \edef\@@anchor{tip}
11772 \pgftransformlineattime{1.0}{%
11773 \pgfpoint{\pgf@circ@res@right}%
11774 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
11775 }{%
11776 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11777 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
11778 }
11779 \else
11780 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
11781 \pgfpoint{\pgf@circ@res@right}%
11782 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
11783 }{%
11784 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
11785 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
11786 }
11787 \fi
11788 \fi
11789 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
11790 \endpgfscope
11791
11792 \ifpgf@circuit@bpt@drawphoto
11793 \pgfscope
11794 \pgfsetarrowsstart{latexslim}
11795 \pgfpathmoveto{\pgfpointadd{\pgfpoint
11796 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11797 {\pgf@circ@res@up+\pgf@circ@res@down}}
11798 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
11799 \pgfpathlineto{\pgfpointadd{\pgfpoint
11800 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11801 {\pgf@circ@res@up+\pgf@circ@res@down}}
11802 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
11803 \pgfusepath{draw}
11804 \pgfpathmoveto{\pgfpointadd{\pgfpoint
11805 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11806 {\pgf@circ@res@up+\pgf@circ@res@down}}
11807 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
11808 \pgfpathlineto{\pgfpointadd{\pgfpoint
11809 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11810 {\pgf@circ@res@up+\pgf@circ@res@down}}
11811 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
11812 \pgfusepath{draw}
11813 \endpgfscope
11814 \else
11815 \ifpgf@circuit@bpt@drawbase
11816 \pgfpathmoveto{\pgfpoint
11817 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11818 {\pgf@circ@res@up+\pgf@circ@res@down}}
11819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
11820 \pgfusepath{draw}
11821 \fi
11822 \fi
11823 }
11824 }
11825
11826 \declarebpt{npn}
11827 \declarebpt{pnp}
11828 %
11829 % multi-emitter and multi-collector BJTs by Romano Giannetti
11830 %
11831 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
11832 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
11833 \pgfextracty{\pgf@circ@res@other}{\basedimension}
11834 \ifnum\cdir>0 % NPN, above
11835 \pgfpoint{\pgf@circ@res@temp}{%
11836 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
11837 \else % PNP, below
11838 \pgfpoint{\pgf@circ@res@temp}{%
11839 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
11840 \fi
11841 }
11842 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
11843 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
11844 \pgfextracty{\pgf@circ@res@other}{\basedimension}
11845 \ifnum\cdir<0 % PNP, above
11846 \pgfpoint{\pgf@circ@res@temp}{%
11847 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
11848 \else % PNP, below
11849 \pgfpoint{\pgf@circ@res@temp}{%
11850 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
11851 \fi
11852 }
11853
11854 \long\def\declarebjt#1{
11855 \pgfdeclareshape{bjt#1}{
11856 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
11857 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11858 % \cdir is 1 for npn, -1 for pnp
11859 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
11860 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
11861 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
11862 % step up or down for the additional C/Es
11863 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
11864 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
11865 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
11866 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
11867 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
11868 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
11869 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11870 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
11871 \pgf@y=.5\pgf@y
11872 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
11873 \pgf@x=.5\pgf@x
11874 }
11875 \savedanchor\northeast{% upper right
11876 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11877 \pgfmathsetlength{\pgf@circ@res@step}{%
11878 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
11879 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11880 \ifnum\cdir> 0
11881 \edef\numup{\numC}\edef\numdown{\numE}
11882 \else
11883 \edef\numup{\numE}\edef\numdown{\numC}
11884 \fi
11885 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
11886 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
11887 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11888 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
11889 \pgf@x=.5\pgf@x
11890 }
11891 \savedanchor\southeast{% lower right
11892 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11893 \pgfmathsetlength{\pgf@circ@res@step}{%
11894 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
11895 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11896 \ifnum\cdir> 0
11897 \edef\numup{\numC}\edef\numdown{\numE}
11898 \else
11899 \edef\numup{\numE}\edef\numdown{\numC}
11900 \fi
11901 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
11902 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
11903 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11904 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
11905 \pgf@x=.5\pgf@x
11906 }
11907 \savedanchor\southwest{% lower left
11908 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11909 \pgfmathsetlength{\pgf@circ@res@step}{%
11910 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
11911 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11912 \ifnum\cdir> 0
11913 \edef\numup{\numC}\edef\numdown{\numE}
11914 \else
11915 \edef\numup{\numE}\edef\numdown{\numC}
11916 \fi
11917 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
11918 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
11919 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11920 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
11921 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11922 }
11923 \anchor{center}{\pgfpointorigin}
11924 \anchor{north}{\northeast\pgf@x=0cm\relax}
11925 \anchor{east}{\northeast\pgf@y=0cm\relax}
11926 \anchor{south}{\southwest\pgf@x=0cm\relax}
11927 \anchor{west}{\southwest\pgf@y=0cm}
11928 \anchor{north east}{\northeast}
11929 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
11930 \anchor{south west}{\southwest}
11931 \anchor{south east}{\southeast}
11932
11933 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
11934 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
11935 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
11936 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
11937 % center of the base "bar"
11938 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
11939 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
11940 }
11941 % geometrical centers
11942 \anchor{vcenter}{\pgf@x=0cm\relax
11943 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
11944 }
11945 \anchor{gcenter}{%
11946 \northeast\pgf@xa=0.5\pgf@x
11947 \southwest\advance\pgf@xa by 0.5\pgf@x
11948 \pgf@x=\pgf@xa
11949 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
11950 }
11951 % external connections
11952 \anchor{E}{
11953 \ifnum\cdir>0% npn, emitter down
11954 \southeast
11955 \else
11956 \northeast
11957 \fi
11958 }% first emitter
11959 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
11960 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
11961 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
11962
11963 \backgroundpath{
11964 \pgftransformationadjustments
11965 \pgfsetcolor{\ctikzvalof{color}}
11966 %
11967 % set the type and up and down number of connections
11968 %
11969 \ifnum\cdir> 0
11970 \pgf@circuit@trans@ntypetrue
11971 \edef\numup{\numC}
11972 \edef\numdown{\numE}
11973 \else
11974 \pgf@circuit@trans@ntypefalse
11975 \edef\numup{\numE}
11976 \edef\numdown{\numC}
11977 \fi
11978 \basedimension
11979 \pgf@circ@res@up = \pgf@y
11980 \pgf@circ@res@down = -\pgf@y
11981 \pgf@circ@res@right = \pgf@x
11982 \pgf@circ@res@left = -\pgf@x
11983 \pgf@circ@scaled@Rlen=\scaledRlen
11984 \pgf@circ@res@step=\multistep
11985 %
11986 % set arrow positions options
11987 %
11988 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
11989 \ifpgf@circuit@trans@arrowatend
11990 \edef\@@pos{1.0}
11991 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
11992 \edef\@@anchor{btip}
11993 \else
11994 \edef\@@anchor{tip}
11995 \fi
11996 \fi
11997 %
11998 % Drawing upper connections
11999 %
12000 \pgfscope
12001 \pgf@circ@count@a=\numup\relax
12002 \pgfmathloop%
12003 \ifnum\pgf@circ@count@a>0
12004 \advance\pgf@circ@count@a-1\relax
12005 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12006 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
12007 \pgfpathmoveto{\pgfpoint
12008 {\pgf@circ@res@right}%
12009 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12010 \pgfpathlineto{\pgfpoint
12011 {\pgf@circ@res@right}%
12012 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12013 \else
12014 \pgfpathmoveto{\pgfpoint
12015 {\pgf@circ@res@right}%
12016 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12017 \fi
12018 \pgfpathlineto{\pgfpoint
12019 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12020 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
12021 \pgfsetroundcap % better when connecting to sloped lines
12022 \pgfusepath{draw}
12023 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
12024 \pgfscope
12025 \pgfslopedattimetrue
12026 \pgfallowupsidedownattimetrue
12027 \pgfresetnontranslationattimefalse
12028 \pgftransformlineattime{\@@pos}{%
12029 \pgfpoint
12030 {\pgf@circ@res@right}%
12031 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
12032 }{\pgfpoint
12033 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12034 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
12035 }
12036 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12037 \endpgfscope
12038 \fi
12039 \repeatpgfmathloop
12040 \endpgfscope
12041 %
12042 % Drawing base
12043 %
12044 \pgfscope
12045 \pgfpathmoveto{\pgfpoint
12046 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12047 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12048 \pgfpathlineto{\pgfpoint
12049 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12050 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12051 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12052 \ifpgf@circuit@bpt@schottky
12053 % upper
12054 \pgfpathmoveto{\pgfpoint
12055 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12056 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12057 \pgfpathlineto{\pgfpoint
12058 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12059 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12060 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12061 \pgfpathlineto{\pgfpoint
12062 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12063 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12064 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12065 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12066 \pgfpathlineto{\pgfpoint
12067 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12068 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12069 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12070 % lower
12071 \pgfpathmoveto{\pgfpoint
12072 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12073 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12074 \pgfpathlineto{\pgfpoint
12075 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12076 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12077 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12078 \pgfpathlineto{\pgfpoint
12079 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12080 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12081 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12082 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12083 \pgfpathlineto{\pgfpoint
12084 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12085 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12086 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12087 \fi
12088 \pgfsetroundcap % I like it more...
12089 \pgfusepath{draw}
12090 \endpgfscope
12091 %
12092 % draw base external connection
12093 %
12094 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
12095 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
12096 \pgfusepath{draw}
12097 %
12098 % Drawing lower connections
12099 %
12100 \pgfscope
12101 \pgf@circ@count@a=\numdown\relax
12102 \pgfmathloop%
12103 \ifnum\pgf@circ@count@a>0
12104 \advance\pgf@circ@count@a-1\relax
12105 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12106 \pgfpathmoveto{\pgfpoint
12107 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12108 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
12109 \pgfpathlineto{\pgfpoint
12110 {\pgf@circ@res@right}
12111 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
12112 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
12113 \pgfpathlineto{\pgfpoint
12114 {\pgf@circ@res@right}
12115 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
12116 \fi
12117 \pgfsetroundcap % better when connecting to sloped lines
12118 \pgfusepath{draw}
12119 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
12120 \pgfscope
12121 \pgfslopedattimetrue
12122 \pgfallowupsidedownattimetrue
12123 \pgfresetnontranslationattimefalse
12124 \pgftransformlineattime{\@@pos}{%
12125 \pgfpoint
12126 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12127 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
12128 }{\pgfpoint
12129 {\pgf@circ@res@right}%
12130 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
12131 }
12132 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12133 \endpgfscope
12134 \fi
12135 \repeatpgfmathloop
12136 \endpgfscope
12137 }
12138 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
12139 % and is executed just before a node is drawn.
12140 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
12141 % Start with the maximum collector number and go backwards.
12142 \pgf@circ@count@a=\numC\relax
12143 \pgfmathloop%
12144 \ifnum\pgf@circ@count@a>0
12145 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12146 % electrical contact, and the "border one" like `bpin 1` for labels.
12147 % they will coincide if `external pins width` is set to 0.
12148 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
12149 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
12150 }
12151 \advance\pgf@circ@count@a by -1\relax%
12152 \repeatpgfmathloop%
12153 % and emitters
12154 \pgf@circ@count@a=\numE\relax
12155 \pgfmathloop%
12156 \ifnum\pgf@circ@count@a>0
12157 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12158 % electrical contact, and the "border one" like `bpin 1` for labels.
12159 % they will coincide if `external pins width` is set to 0.
12160 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
12161 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
12162 }
12163 \advance\pgf@circ@count@a by -1\relax%
12164 \repeatpgfmathloop%
12165 }%
12166 }
12167 }
12168
12169 \declarebjt{npn}
12170 \declarebjt{pnp}
12171
12172 % end of multi-bjts
12173
12174 \long\def\declareigbt#1{
12175 \pgfcircdeclaretransistor{#1}{
12176 \anchor{inner up}{
12177 \northeast
12178 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
12179 }
12180 \anchor{inner down}{
12181 \northeast
12182 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
12183 }
12184 }
12185 {
12186 %draw upper connection
12187 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12188 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12189 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12190 \pgfpathlineto{\pgfpoint
12191 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12192 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
12193 \pgfusepath{draw}
12194
12195 %draw thicker gate lines
12196 \pgfscope
12197 \pgfscope
12198 \pgfpathmoveto{\pgfpoint
12199 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12200 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12201 \pgfpathlineto{\pgfpoint
12202 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12203 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12204 % set the normal thickness
12205 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12206 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
12207 \pgfsetlinewidth{\@@extrat\pgflinewidth}
12208 \pgfusepath{draw}
12209 \endpgfscope
12210 \pgfpathmoveto{\pgfpoint
12211 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12212 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12213 \pgfpathlineto{\pgfpoint
12214 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12215 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12216 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12217 \pgfusepath{draw}
12218 \endpgfscope
12219 %draw lower connection
12220 \pgfpathmoveto{\pgfpoint
12221 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12222 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
12223 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12224 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12225 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12226 \pgfusepath{draw}
12227 %draw arrow depending on type of transistor
12228 \pgfscope
12229 \pgfslopedattimetrue
12230 \pgfallowupsidedownattimetrue
12231 \pgfresetnontranslationattimefalse
12232 \ifpgf@circuit@trans@arrowatend
12233 \ifpgf@circuit@trans@ntype
12234 \edef\@@anchor{btip}\edef\@@pos{1.0}
12235 \else
12236 \edef\@@anchor{tip}\edef\@@pos{1.0}
12237 \fi
12238 \else
12239 \edef\@@anchor{center}\edef\@@pos{0.5}
12240 \fi
12241 \ifpgf@circuit@trans@ntype
12242 \pgftransformlineattime{\@@pos}{%
12243 \pgfpoint%
12244 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12245 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
12246 }{%
12247 \pgfpoint{\pgf@circ@res@right}%
12248 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
12249 }
12250 \else
12251 \pgftransformlineattime{\@@pos}{%
12252 \pgfpoint{\pgf@circ@res@right}%
12253 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
12254 }{%
12255 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12256 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
12257 }
12258 \fi
12259 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12260 \endpgfscope
12261 %draw gate
12262 \ifpgf@circuit@trans@ntype
12263 \pgfpathmoveto{\pgfpoint
12264 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12265 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12266 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
12267 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12268 \else
12269 \pgfpathmoveto{\pgfpoint
12270 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12271 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
12272 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
12273 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
12274 \fi
12275 \pgfusepath{draw}
12276 }
12277 }
12278
12279 \declareigbt{pigbt}
12280 \declareigbt{nigbt}
12281 \declareigbt{Lnigbt}
12282 \declareigbt{Lpigbt}
12283
12284 \pgfcircdeclaretransistor{nmos}{
12285 \anchor{inner up}{
12286 \northeast
12287 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
12288 }
12289 \anchor{inner down}{
12290 \northeast
12291 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
12292 }
12293 }{%
12294 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12295 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12296 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12297 \pgfpathlineto{\pgfpoint
12298 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12299 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12300
12301 \pgfpathmoveto{\pgfpoint
12302 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12303 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12304 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12305 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12306 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12307 \pgfusepath{draw}
12308
12309 \pgfscope
12310 \pgfpathmoveto{\pgfpoint
12311 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12312 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
12313 \pgfpathlineto{\pgfpoint
12314 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12315 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
12316 \pgfpathmoveto{\pgfpoint
12317 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12318 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12319 \pgfpathlineto{\pgfpoint
12320 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12321 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12322 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12323 \pgfusepath{draw}
12324 \endpgfscope
12325 \ifpgf@circuit@mos@arrows
12326 \pgfscope
12327 \ifpgf@circuit@trans@arrowatend
12328 \pgftransformshift{\pgfpoint
12329 {\pgf@circ@res@right}%
12330 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
12331 }
12332 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
12333 \else
12334 \pgfslopedattimetrue
12335 \pgfallowupsidedownattimetrue
12336 \pgfresetnontranslationattimefalse
12337 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
12338 \pgfpoint%
12339 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
12340 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
12341 }{%
12342 \pgfpoint
12343 {\pgf@circ@res@right}%
12344 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
12345 }
12346 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
12347 \fi
12348 \endpgfscope
12349 \fi
12350
12351 \ifpgf@circuit@bpt@drawgate
12352 \pgfpathmoveto{\pgfpoint
12353 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12354 {\pgf@circ@res@up+\pgf@circ@res@down}}
12355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12356 \pgfusepath{draw}
12357 \fi
12358
12359 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
12360 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12361 {\pgf@circ@res@up+\pgf@circ@res@down}}
12362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12363 {\pgf@circ@res@up+\pgf@circ@res@down}}
12364 \pgfusepath{draw}
12365 \fi
12366 }
12367
12368 \pgfcircdeclaretransistor{pmos}{
12369 \anchor{inner up}{
12370 \northeast
12371 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
12372 }
12373 \anchor{inner down}{
12374 \northeast
12375 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
12376 }
12377 }{%
12378 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12380 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12381 \pgfpathlineto{\pgfpoint
12382 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12383 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12384 \pgfusepath{draw}
12385
12386 \ifpgf@circuit@mos@arrows
12387 \pgfscope
12388 \ifpgf@circuit@trans@arrowatend
12389 \pgftransformshift{\pgfpoint
12390 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
12391 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12392 }
12393 \pgftransformrotate{180}
12394 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
12395 \else
12396 \pgfslopedattimetrue
12397 \pgfallowupsidedownattimetrue
12398 \pgfresetnontranslationattimefalse
12399 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
12400 \pgfpoint%
12401 {\pgf@circ@res@right}%
12402 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12403 }{%
12404 \pgfpoint
12405 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
12406 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12407 }
12408 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
12409 \fi
12410 \endpgfscope
12411 \fi
12412
12413 \pgfscope
12414 \pgfpathmoveto{\pgfpoint
12415 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12416 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
12417 \pgfpathlineto{\pgfpoint
12418 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12419 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
12420 \pgfpathmoveto{\pgfpoint
12421 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12422 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12423 \pgfpathlineto{\pgfpoint
12424 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12425 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12426 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12427 \pgfusepath{draw}
12428 \endpgfscope
12429
12430 \pgfpathmoveto{\pgfpoint
12431 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12432 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12433 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12434 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12436
12437
12438 \pgfusepath{draw}
12439 \ifpgf@circuit@bpt@drawgate
12440 \pgfpathmoveto{\pgfpoint
12441 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12442 {\pgf@circ@res@up+\pgf@circ@res@down}}
12443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12444 \pgfusepath{draw}
12445 \fi
12446
12447 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
12448 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12449 {\pgf@circ@res@up+\pgf@circ@res@down}}
12450 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12451 {\pgf@circ@res@up+\pgf@circ@res@down}}
12452 \pgfusepath{draw}
12453 \fi
12454
12455 \ifpgf@circuit@pmos@nocircle\else
12456 % we are not scaling the circle with the MOS --- I think it's better to have it
12457 % coherent with the poles/nodes of the rest of the circuit.
12458 \pgfpathcircle{\pgfpoint
12459 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
12460 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
12461 \ifpgf@circuit@pmos@emptycircle
12462 \pgfsetfillcolor{white}
12463 \fi
12464 \pgfusepath{draw,fill}
12465 \fi
12466 }
12467
12468 %% HEMT FET Transistor
12469 \pgfcircdeclaretransistor{hemt}{
12470 \anchor{inner up}{
12471 \northeast
12472 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
12473 }
12474 \anchor{inner down}{
12475 \northeast
12476 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
12477 }
12478 }{%
12479 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12480 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12481 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
12482 \pgfpathlineto{\pgfpoint
12483 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12484 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
12485
12486 \pgfpathmoveto{\pgfpoint
12487 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12488 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
12489 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12490 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
12491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12492 \pgfusepath{draw}
12493
12494 \pgfscope
12495 \pgfpathmoveto{\pgfpoint
12496 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12497 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
12498 \pgfpathlineto{\pgfpoint
12499 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12500 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
12501 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12502 \pgfusepath{draw}
12503 \endpgfscope
12504
12505 \pgfpathmoveto{\pgfpoint
12506 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12507 {\pgf@circ@res@up+\pgf@circ@res@down}}
12508 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12509 \pgfusepath{draw}
12510 }
12511
12512 \long\def\drawfetcore#1{
12513 \pgftransformationadjustments
12514 %top connection
12515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12516 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12517 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12518 \pgfpathlineto{\pgfpoint
12519 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12520 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12521 \pgfusepath{draw}
12522 \pgfscope
12523 \pgfpathmoveto{\pgfpoint
12524 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12525 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12526 \ifpgf@circuit@trans@depletiontype
12527 \pgfpathlineto{\pgfpoint
12528 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12529 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12530 \else
12531
12532 \pgfpathlineto{\pgfpoint
12533 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12534 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
12535 \pgfpathmoveto{\pgfpoint
12536 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12537 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
12538 \pgfpathlineto{\pgfpoint
12539 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12540 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
12541 \pgfpathmoveto{\pgfpoint
12542 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12543 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
12544 \pgfpathlineto{\pgfpoint
12545 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12546 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12547 \fi
12548 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12549 \pgfusepath{draw}
12550 \endpgfscope
12551 %Bulk connection line
12552 \pgfpathmoveto{\pgfpoint
12553 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12554 {\pgf@circ@res@up+\pgf@circ@res@down}}
12555 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12556 {\pgf@circ@res@up+\pgf@circ@res@down}}
12557
12558 %bottom connection
12559 \pgfpathmoveto{\pgfpoint
12560 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12561 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12563 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12564 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12565 \pgfusepath{draw}
12566
12567 %draw thick gate line
12568 \pgfscope
12569 \pgfpathmoveto{\pgfpoint
12570 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12571 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12572 \pgfpathlineto{\pgfpoint
12573 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12574 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12575 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12576 \pgfusepath{draw}
12577 \endpgfscope
12578
12579 % arrows
12580 \pgfscope
12581 \pgfslopedattimetrue
12582 \pgfallowupsidedownattimetrue
12583 \pgfresetnontranslationattimefalse
12584 \ifpgf@circuit@trans@arrowatend
12585 \ifpgf@circuit@trans@ntype
12586 \edef\@@anchor{tip}
12587 \edef\@@pos{1.0}
12588 \else
12589 \edef\@@anchor{btip}
12590 \edef\@@pos{0.0}
12591 \fi
12592 \else
12593 \edef\@@anchor{center}\edef\@@pos{0.6}
12594 \fi
12595 \pgftransformlineattime{\@@pos}{%
12596 \pgfpoint
12597 {\pgf@circ@res@right}%
12598 {\pgf@circ@res@up+\pgf@circ@res@down}%
12599 }{%
12600 \pgfpoint%
12601 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12602 {\pgf@circ@res@up+\pgf@circ@res@down}%
12603 }
12604 \ifpgf@circuit@trans@ntype
12605 \else
12606 \pgftransformrotate{180}
12607 \fi
12608 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12609 \endpgfscope
12610
12611 % GATE CONNECTION
12612 \ifpgf@circuit@bpt@drawgate
12613 \ifpgf@circuit@trans@ntype
12614 \pgfpathmoveto{\pgfpoint
12615 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12616 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12617 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12618 \else
12619 \pgfpathmoveto{\pgfpoint
12620 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12621 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12622 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12623 \fi
12624 \pgfusepath{draw}
12625 \fi
12626
12627 }
12628
12629 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
12630 {\pgfcircdeclaretransistor{#1}{
12631 \anchor{bulk}{\left\pgf@x=0pt}
12632 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
12633 \anchor{inner up}{
12634 \northeast
12635 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
12636 }
12637 \anchor{inner down}{
12638 \northeast
12639 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
12640 }
12641 #2
12642 }
12643 {#3}
12644 }
12645
12646 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
12647 \pgf@circuit@trans@depletiontypefalse
12648 \drawfetcore{nfet}
12649 }
12650
12651 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
12652 \pgf@circuit@trans@depletiontypefalse
12653 \drawfetcore{pfet}
12654 }
12655
12656 % N-CHANNEL IGFET ENHANCEMENT TYPE
12657 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
12658 \pgf@circuit@trans@depletiontypefalse
12659 \drawfetcore{nigfete}
12660
12661 % SOURCE CONNECTION
12662 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12663 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12664 \pgfusepath{draw}
12665
12666 % SOLDER DOT at source-bulk connection
12667 \ifpgf@circuit@fet@solderdot
12668 \pgfscope
12669 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12670 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
12671 \pgfnode{circ}{center}{}{}{}
12672 \endpgfscope{}
12673 \fi
12674 }
12675
12676 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
12677 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
12678 \pgf@circuit@trans@depletiontypefalse
12679 \drawfetcore{nigfetebulk}
12680 % SOLDER DOT at source-bulk connection
12681 \ifpgf@circuit@fet@solderdot
12682 \pgfscope
12683 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12684 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
12685 \pgfnode{circ}{center}{}{}{}
12686 \endpgfscope{}
12687 \fi
12688 }
12689
12690 % N-CHANNEL IGFET DEPLETION TYPE
12691 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
12692 \pgf@circuit@trans@depletiontypetrue
12693 \drawfetcore{nigfetd}
12694
12695 % SOURCE CONNECTION
12696 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12697 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12698 \pgfusepath{draw}
12699
12700 % SOLDER DOT at source-bulk connection
12701 \ifpgf@circuit@fet@solderdot
12702 \pgfscope
12703 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12704 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
12705 \pgfnode{circ}{center}{}{}{}
12706 \endpgfscope{}
12707 \fi
12708 }
12709
12710 % P-CHANNEL IGFET ENHANCEMENT TYPE
12711 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
12712 \pgf@circuit@trans@depletiontypefalse
12713 \drawfetcore{pigfete}
12714 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12715
12716 % SOURCE CONNECTION
12717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12718 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12719 \pgfusepath{draw}
12720
12721
12722 % SOLDER DOT at source-bulk connection
12723 \ifpgf@circuit@fet@solderdot
12724 \pgfscope
12725 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12726 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
12727 \pgfnode{circ}{center}{}{}{}
12728 \endpgfscope
12729 \fi
12730 }
12731
12732 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
12733 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
12734 \pgf@circuit@trans@depletiontypefalse
12735 \drawfetcore{pigfetebulk}
12736 }
12737
12738 % P-CHANNEL IGFET DEPLETION TYPE
12739 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
12740 \pgf@circuit@trans@depletiontypetrue
12741 \drawfetcore{pigfetd}
12742
12743 % SOURCE CONNECTION
12744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12746 \pgfusepath{draw}
12747
12748
12749 % SOLDER DOT at source-bulk connection
12750 \ifpgf@circuit@fet@solderdot
12751 \pgfscope
12752 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12753 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
12754 \pgfnode{circ}{center}{}{}{}
12755 \endpgfscope{}
12756 \fi
12757 }
12758
12759 \pgfcircdeclaretransistor{njfet}{
12760 \anchor{inner up}{
12761 \northeast
12762 \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
12763 }
12764 \anchor{inner down}{
12765 \northeast
12766 \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
12767 }
12768 }{%
12769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12770 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12771 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
12772 \pgfpathlineto{\pgfpoint
12773 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
12774 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
12775
12776 \pgfpathmoveto{\pgfpoint
12777 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
12778 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
12779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12780 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
12781 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12782 \pgfusepath{draw}
12783
12784 \pgfscope
12785 \pgfpathmoveto{\pgfpoint
12786 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
12787 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}}
12788 \pgfpathlineto{\pgfpoint
12789 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
12790 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}}
12791 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12792 \pgfusepath{draw}
12793 \endpgfscope
12794
12795 % arrow
12796 \pgfscope
12797 \pgfslopedattimetrue
12798 \pgfallowupsidedownattimetrue
12799 \pgfresetnontranslationattimefalse
12800 \ifpgf@circuit@trans@arrowatend
12801 \edef\@@anchor{tip}\edef\@@pos{1.0}
12802 \else
12803 \edef\@@anchor{center}\edef\@@pos{0.6}
12804 \fi
12805 \pgftransformlineattime{\@@pos}{%
12806 \pgfpoint{\pgf@circ@res@left}%
12807 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
12808 }{%
12809 \pgfpoint
12810 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
12811 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
12812 }
12813 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12814 \endpgfscope
12815
12816 \pgfpathmoveto{\pgfpoint
12817 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
12818 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
12819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12820 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
12821 \pgfusepath{draw}
12822 }
12823
12824 \pgfcircdeclaretransistor{pjfet}{
12825 \anchor{inner up}{
12826 \northeast
12827 \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
12828 }
12829 \anchor{inner down}{
12830 \northeast
12831 \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
12832 }
12833 }{%
12834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12836 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
12837 \pgfpathlineto{\pgfpoint
12838 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
12839 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
12840
12841 \pgfpathmoveto{\pgfpoint
12842 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
12843 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
12844 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12845 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
12846 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12847 \pgfusepath{draw}
12848
12849 \pgfscope
12850 \pgfpathmoveto{\pgfpoint
12851 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
12852 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}}
12853 \pgfpathlineto{\pgfpoint
12854 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
12855 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}}
12856 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12857 \pgfusepath{draw}
12858 \endpgfscope
12859
12860 \pgfscope
12861 \pgfslopedattimetrue
12862 \pgfallowupsidedownattimetrue
12863 \pgfresetnontranslationattimefalse
12864 \ifpgf@circuit@trans@arrowatend
12865 \edef\@@anchor{btip}\edef\@@pos{1.0}
12866 \else
12867 \edef\@@anchor{center}\edef\@@pos{0.4}
12868 \fi
12869 \pgftransformlineattime{\@@pos}{%
12870 \pgfpoint%
12871 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}%
12872 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
12873 }{%
12874 \pgfpoint{\pgf@circ@res@left}%
12875 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
12876 }
12877 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12878 \endpgfscope
12879
12880 \pgfpathmoveto{\pgfpoint
12881 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
12882 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
12883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12884 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
12885 \pgfusepath{draw}
12886 }
12887
12888 \pgfdeclaretransistorwrapperaddbulk{isfet}{}{%
12889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12890 % DRAIN CONNECTION
12891 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12892 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
12893 % DRAIN
12894 \pgfpathlineto{\pgfpoint
12895 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
12896 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
12897 \pgfusepath{draw}
12898
12899 % GATE, DEPLETION TYPE
12900 \pgfscope %% added
12901 \pgfpathmoveto{\pgfpoint
12902 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
12903 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
12904 \pgfpathlineto{\pgfpoint
12905 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
12906 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
12907 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
12908 \pgfusepath{draw} %% added
12909 \endpgfscope %% added
12910
12911 % BULK
12912 \pgfpathmoveto{\pgfpoint
12913 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
12914 {\pgf@circ@res@up+\pgf@circ@res@down}}
12915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
12916 {\pgf@circ@res@up+\pgf@circ@res@down}}
12917
12918 % SOURCE
12919 \pgfpathmoveto{\pgfpoint
12920 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
12921 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
12922 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12923 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
12924 % SOURCE CONNECTION
12925 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12927 \pgfusepath{draw}
12928
12929 % SOLDER DOT at source-bulk connection
12930 \ifpgf@circuit@fet@solderdot
12931 \pgfscope
12932 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12933 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
12934 \pgfnode{circ}{center}{}{}{}
12935 \endpgfscope{}
12936 \fi
12937 % ARROW
12938 \pgfscope
12939 \pgfslopedattimetrue
12940 \pgfallowupsidedownattimetrue
12941 \pgfresetnontranslationattimefalse
12942 \ifpgf@circuit@trans@arrowatend
12943 \edef\@@anchor{tip}\edef\@@pos{1.0}
12944 \else
12945 \edef\@@anchor{center}\edef\@@pos{0.6}
12946 \fi
12947 \pgftransformlineattime{\@@pos}{%
12948 \pgfpoint
12949 {\pgf@circ@res@right}%
12950 {\pgf@circ@res@up+\pgf@circ@res@down}%
12951 }{%
12952 \pgfpoint%
12953 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
12954 {\pgf@circ@res@up+\pgf@circ@res@down}%
12955 }
12956 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12957 \endpgfscope
12958 \pgfusepath{draw}
12959
12960 % Wavy lines
12961 \pgfscope
12962 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
12963 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12964 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12965 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12966 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12967 \pgfusepath{draw}
12968
12969 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
12970 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12971 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12972 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12973 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12974 \pgfusepath{draw}
12975
12976 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
12977 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12978 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12979 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12980 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
12981 \pgfusepath{draw}
12982 \endpgfscope
12983 }
12984
12985 % end of transistors
12986
12987 %%%%%%%%%%%%%
12988 %% Switches
12989 %%%%%%%%%%%%%
12990
12991 \pgfcircdeclarebipole{
12992 \anchor{out 1}{
12993 \northeast
12994 \pgf@y=0cm
12995 }
12996 \anchor{out 2}{
12997 \northeast
12998 \pgf@y=.8\pgf@y
12999 }
13000 }
13001 {\ctikzvalof{tripoles/toggleswitch/height 2}}
13002 {toggleswitch}
13003 {\ctikzvalof{tripoles/toggleswitch/height}}
13004 {\ctikzvalof{tripoles/toggleswitch/width}}
13005 {
13006
13007 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13008 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
13009 \pgfusepath{draw}
13010 \pgfscope
13011 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
13012 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
13013 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
13014 \pgfusepath{draw}
13015 \endpgfscope
13016
13017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13018 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
13019
13020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
13021 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
13022 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
13023 \pgfusepath{draw}
13024
13025
13026 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
13027 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
13028 \pgfusepath{draw}
13029
13030 \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}
13031 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
13032 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
13033 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
13034 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
13035 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
13036 \pgfusepath{draw}
13037 \pgfsetdash{}{0cm}
13038 }
13039
13040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13041 %% operational and instrumentation amplifiers
13042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13043
13044 \pgfdeclareshape{op amp}
13045 {
13046 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13047 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13048 \anchor{center}{\pgfpointorigin}
13049 \savedanchor\northwest{%
13050 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13051 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13052 \pgf@y=.5\pgf@y
13053 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13054 \pgf@x=.5\pgf@x
13055 }
13056 \savedanchor\left{%
13057 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13058 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13059 \pgf@x=.5\pgf@x
13060 \pgf@y=0pt
13061 }
13062 \anchor{south}{
13063 \northwest
13064 \pgf@y=-\pgf@y
13065 \pgf@x=0pt
13066 }
13067 \anchor{north}{
13068 \northwest
13069 \pgf@x=0pt
13070 }
13071 \savedanchor\left{%
13072 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13073 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13074 \pgf@x=.5\pgf@x
13075 \pgf@y=0pt
13076 }
13077 \savedanchor\inOneFixed{%
13078 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13079 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13080 \pgf@y=.5\pgf@y
13081 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
13082 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13083 \pgf@x=.5\pgf@x
13084 }
13085 \anchor{in up}{
13086 \inOneFixed
13087 }
13088 \anchor{in down}{
13089 \inOneFixed
13090 \pgf@y=-\pgf@y
13091 }
13092 \savedanchor\inOne{%
13093 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13094 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13095 \pgf@y=.5\pgf@y
13096 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
13097 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13098 \pgf@x=.5\pgf@x
13099 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13100 }
13101 \anchor{-}{
13102 \inOne
13103 }
13104 \anchor{+}{
13105 \inOne
13106 \pgf@y=-\pgf@y
13107 }
13108 \savedanchor\up{%
13109 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13110 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13111 \pgf@y=.5\pgf@y
13112 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13113 \pgf@x=.5\pgf@x
13114 \pgf@circ@res@up = \pgf@y
13115 \pgf@circ@res@right = -\pgf@x
13116 \pgf@circ@res@left = \pgf@x
13117 \pgfpointlineattime{
13118 \ctikzvalof{tripoles/op amp/up pos}}{
13119 \pgfpoint{
13120 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13121 {\pgf@circ@res@up}}
13122 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
13123 }
13124 \anchor{up}{
13125 \up
13126 }
13127 \anchor{down}{
13128 \up
13129 \pgf@y=-\pgf@y
13130 }
13131 \anchor{out}{
13132 \northwest
13133 \pgf@y=0pt
13134 \pgf@x=-\pgf@x
13135 }
13136 \anchor{west}{
13137 \left
13138 }
13139 \anchor{east}{
13140 \left
13141 \pgf@x=-\pgf@x
13142 }
13143
13144 % support for border anchors
13145 \savedanchor\leftedge{%
13146 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13147 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13148 \pgf@x=.5\pgf@x
13149 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
13150 \pgf@y=0pt
13151 }
13152 \anchor{leftedge}{\leftedge}
13153 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13154 \anchor{bin up}{
13155 \inOneFixed
13156 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13157 }
13158 \anchor{bin down}{
13159 \inOneFixed
13160 \pgf@y=-\pgf@y
13161 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13162 }
13163 \anchor{b-}{
13164 \inOne
13165 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13166 }
13167 \anchor{b+}{
13168 \inOne
13169 \pgf@y=-\pgf@y
13170 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13171 }
13172 \anchor{bout}{
13173 \leftedge
13174 \pgf@y=0pt
13175 \pgf@x=-\pgf@x
13176 }
13177 % end border anchors
13178 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13179 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13180 \anchor{north west}{ \northwest }
13181 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13182
13183 \anchor{text}{
13184 \ifpgf@circ@center@text
13185 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13186 \else
13187 \leftedge
13188 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13189 \fi
13190 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13191 }
13192
13193 \backgroundpath{
13194 \pgfsetcolor{\ctikzvalof{color}}
13195
13196 \northwest
13197 \pgf@circ@res@up = \pgf@y
13198 \pgf@circ@res@down = -\pgf@y
13199 \pgf@circ@res@right = -\pgf@x
13200 \pgf@circ@res@left = \pgf@x
13201 \pgf@circ@scaled@Rlen=\scaledRlen
13202
13203 % Triangle
13204 \pgfscope
13205 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13206 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13207 \pgf@circ@res@step=\pgf@circ@res@right
13208 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13209 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
13210
13211 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13212 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13213 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13214 \pgfpathclose
13215 \pgf@circ@draworfill
13216 \endpgfscope
13217
13218 % Negative input terminal
13219 \pgfpathmoveto{\pgfpoint
13220 {\pgf@circ@res@left}
13221 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
13222 \pgfpathlineto{\pgfpoint
13223 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13224 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
13225 \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}
13226
13227 % Positive input terminal
13228 \pgfpathmoveto{\pgfpoint
13229 {\pgf@circ@res@left}
13230 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
13231 \pgfpathlineto{\pgfpoint
13232 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13233 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
13234 \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}
13235
13236 % Output terminal
13237 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13238 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
13239 \pgfsetrectcap
13240 \pgfusepath{draw}
13241 }
13242 }
13243
13244 % Op amp shape as in european standard EN 60617
13245 \pgfdeclareshape{en amp}
13246 {
13247 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13248 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13249 \anchor{center}{\pgfpointorigin}
13250 \savedanchor\northwest{%
13251 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13252 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13253 \pgf@y=.5\pgf@y
13254 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13255 \pgf@x=.5\pgf@x
13256 }
13257 \savedanchor\left{%
13258 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13259 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13260 \pgf@x=.5\pgf@x
13261 \pgf@y=0pt
13262 }
13263 \anchor{south}{
13264 \northwest
13265 \pgf@y=-\pgf@y
13266 \pgf@x=0pt
13267 }
13268 \anchor{north}{
13269 \northwest
13270 \pgf@x=0pt
13271 }
13272 \savedanchor\inOneFixed{%
13273 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13274 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13275 \pgf@y=.5\pgf@y
13276 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
13277 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13278 \pgf@x=.5\pgf@x
13279 }
13280 \anchor{in up}{
13281 \inOneFixed
13282 }
13283 \anchor{in down}{
13284 \inOneFixed
13285 \pgf@y=-\pgf@y
13286 }
13287 \savedanchor\inOne{%
13288 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13289 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13290 \pgf@y=.5\pgf@y
13291 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
13292 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13293 \pgf@x=.5\pgf@x
13294 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13295 }
13296 \anchor{-}{
13297 \inOne
13298 }
13299 \anchor{+}{
13300 \inOne
13301 \pgf@y=-\pgf@y
13302 }
13303 \anchor{up}{
13304 \northwest
13305 \pgf@x=0pt
13306 }
13307 \anchor{down}{
13308 \northwest
13309 \pgf@x=0pt
13310 \pgf@y=-\pgf@y
13311 }
13312 \anchor{out}{
13313 \northwest
13314 \pgf@y=0pt
13315 \pgf@x=-\pgf@x
13316 }
13317 \anchor{west}{
13318 \left
13319 }
13320 \anchor{east}{
13321 \left
13322 \pgf@x=-\pgf@x
13323 }
13324 % support for border anchors
13325 \savedanchor\leftedge{%
13326 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13327 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13328 \pgf@x=.5\pgf@x
13329 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
13330 \pgf@y=0pt
13331 }
13332 \anchor{leftedge}{\leftedge}
13333 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13334 \anchor{bin up}{
13335 \inOneFixed
13336 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13337 }
13338 \anchor{bin down}{
13339 \inOneFixed
13340 \pgf@y=-\pgf@y
13341 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13342 }
13343 \anchor{b-}{
13344 \inOne
13345 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13346 }
13347 \anchor{b+}{
13348 \inOne
13349 \pgf@y=-\pgf@y
13350 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13351 }
13352 \anchor{bout}{
13353 \leftedge
13354 \pgf@y=0pt
13355 \pgf@x=-\pgf@x
13356 }
13357 % end border anchors
13358 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13359 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13360 \anchor{north west}{ \northwest }
13361 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13362 \anchor{text}{
13363 \ifpgf@circ@center@text
13364 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13365 \else
13366 \leftedge
13367 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13368 \fi
13369 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13370 }
13371
13372 \backgroundpath{
13373 \pgfsetcolor{\ctikzvalof{color}}
13374 \northwest
13375 \pgf@circ@res@up = \pgf@y
13376 \pgf@circ@res@down = -\pgf@y
13377 \pgf@circ@res@right = -\pgf@x
13378 \pgf@circ@res@left = \pgf@x
13379 \pgf@circ@scaled@Rlen=\scaledRlen
13380
13381 \pgfscope
13382 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13383 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
13384 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
13385 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
13386 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
13387 \pgfpathclose
13388 \pgf@circ@draworfill
13389 \endpgfscope
13390
13391 \pgfpathmoveto{\pgfpoint
13392 {\pgf@circ@res@left}
13393 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
13394 \pgfpathlineto{\pgfpoint
13395 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
13396 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
13397 \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}
13398
13399 \pgfpathmoveto{\pgfpoint
13400 {\pgf@circ@res@left}
13401 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
13402 \pgfpathlineto{\pgfpoint
13403 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
13404 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
13405 \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}
13406
13407 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13408 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13409 \pgfsetrectcap
13410 \pgfusepath{draw}
13411
13412
13413 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
13414 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
13415 }
13416 }
13417
13418 % Fully differential output op amp
13419 % Contributed by Kristofer M. Monisit
13420 \pgfdeclareshape{fd op amp}
13421 {
13422 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13423 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13424 \anchor{center}{\pgfpointorigin}
13425 \savedanchor\northwest{%
13426 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13427 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13428 \pgf@y=.5\pgf@y
13429 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13430 \pgf@x=.5\pgf@x
13431 }
13432 \savedanchor\outline{%
13433 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13434 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13435 \pgf@y=.5\pgf@y
13436 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13437 \pgf@x=.5\pgf@x
13438 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
13439 }
13440 \anchor{south}{
13441 \northwest
13442 \pgf@y=-\pgf@y\pgf@x=0pt\relax
13443 }
13444 \anchor{north}{
13445 \northwest\pgf@x=0pt\relax
13446 }
13447 \savedanchor\left{%
13448 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13449 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13450 \pgf@x=.5\pgf@x
13451 \pgf@y=0pt
13452 }
13453 \savedanchor\inOneFixed{%
13454 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13455 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13456 \pgf@y=.5\pgf@y
13457 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
13458 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13459 \pgf@x=.5\pgf@x
13460 }
13461 \anchor{in up}{
13462 \inOneFixed
13463 }
13464 \anchor{in down}{
13465 \inOneFixed
13466 \pgf@y=-\pgf@y
13467 }
13468 \savedanchor\inOne{%
13469 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13470 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13471 \pgf@y=.5\pgf@y
13472 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
13473 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13474 \pgf@x=.5\pgf@x
13475 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13476 }
13477 \anchor{-}{
13478 \inOne
13479 }
13480 \anchor{+}{
13481 \inOne
13482 \pgf@y=-\pgf@y
13483 }
13484 \savedanchor\up{%
13485 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13486 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13487 \pgf@y=.5\pgf@y
13488 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13489 \pgf@x=.5\pgf@x
13490 \pgf@circ@res@up = \pgf@y
13491 \pgf@circ@res@right = -\pgf@x
13492 \pgf@circ@res@left = \pgf@x
13493 \pgfpointlineattime{
13494 \ctikzvalof{tripoles/fd op amp/up pos}}{
13495 \pgfpoint{
13496 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13497 {\pgf@circ@res@up}}
13498 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
13499 }
13500 \anchor{up}{
13501 \up
13502 }
13503 \anchor{down}{
13504 \up
13505 \pgf@y=-\pgf@y
13506 }
13507 \anchor{out up}{
13508 \northwest
13509 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13510 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13511 }
13512 \anchor{out down}{
13513 \northwest
13514 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13515 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13516 }
13517 \anchor{out +}{
13518 \outline
13519 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13520 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13521 }
13522 \anchor{out -}{
13523 \outline
13524 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13525 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13526 }
13527 % support for border anchors
13528 \savedanchor\leftedge{%
13529 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13530 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13531 \pgf@x=.5\pgf@x
13532 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13533 \pgf@y=0pt
13534 }
13535 \anchor{leftedge}{\leftedge}
13536 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13537 \anchor{bin up}{
13538 \inOneFixed
13539 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13540 }
13541 \anchor{bin down}{
13542 \inOneFixed
13543 \pgf@y=-\pgf@y
13544 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13545 }
13546 \anchor{b-}{
13547 \inOne
13548 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13549 }
13550 \anchor{b+}{
13551 \inOne
13552 \pgf@y=-\pgf@y
13553 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13554 }
13555 \anchor{bout}{
13556 \leftedge
13557 \pgf@y=0pt
13558 \pgf@x=-\pgf@x
13559 }
13560 \anchor{bout +}{
13561 \outline
13562 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13563 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13564 {\pgfpoint{\pgf@xa}{0pt}}
13565 {\pgfpoint{0pt}{\pgf@ya}}
13566 }
13567 \anchor{bout -}{
13568 \outline
13569 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13570 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13571 {\pgfpoint{\pgf@xa}{0pt}}
13572 {\pgfpoint{0pt}{\pgf@ya}}
13573 \pgf@y=-\pgf@y
13574 }
13575 \anchor{bout up}{
13576 \northwest
13577 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13578 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13579 {\pgfpoint{\pgf@xa}{0pt}}
13580 {\pgfpoint{0pt}{\pgf@ya}}
13581 }
13582 \anchor{bout down}{
13583 \northwest
13584 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13585 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13586 {\pgfpoint{\pgf@xa}{0pt}}
13587 {\pgfpoint{0pt}{\pgf@ya}}
13588 \pgf@y=-\pgf@y
13589 }
13590 % end border anchors
13591 \anchor{west}{
13592 \left
13593 }
13594 \anchor{east}{
13595 \left
13596 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13597 }
13598 \anchor{out}{% should not be used
13599 \left
13600 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13601 }
13602 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13603 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
13604 \anchor{north west}{ \northwest }
13605 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
13606 \anchor{text}{
13607 \ifpgf@circ@center@text
13608 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13609 \else
13610 \leftedge
13611 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13612 \fi
13613 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13614 }
13615 \backgroundpath{
13616 \pgfsetcolor{\ctikzvalof{color}}
13617
13618 \northwest
13619 \pgf@circ@res@up = \pgf@y
13620 \pgf@circ@res@down = -\pgf@y
13621 \pgf@circ@res@right = -\pgf@x
13622 \pgf@circ@res@left = \pgf@x
13623 \pgf@circ@scaled@Rlen=\scaledRlen
13624
13625 % Triangle
13626 % Includes output terminals in the traingular shape
13627 % to ensure that diagonal joins are properly displayed
13628 % we first draw the main triangle and the leads with normal thickness,
13629 % and the redraw the main triangle with the component shape
13630 \pgfscope
13631 % shift origin a bit to ease calculations
13632 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13633 \pgf@circ@res@step=\pgf@circ@res@right
13634 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13635 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
13636
13637 % Initial point (right vertex)
13638 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13639
13640 % Negative output terminal
13641 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
13642 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
13643 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
13644
13645 % Top vertex
13646 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13647
13648 % Bottom vertex
13649 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13650
13651 % Positive output terminal
13652 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
13653 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
13654 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
13655
13656 % Right vertex
13657 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13658
13659 \pgfpathclose
13660 \pgfusepath{stroke}
13661
13662 % ok, now we'll redraw the triangle with the class specific
13663 % thickness and optionally fill
13664
13665 \pgfscope
13666 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
13667
13668 % Initial point (right vertex)
13669 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13670 % Top vertex
13671 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13672 % Bottom vertex
13673 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13674
13675 \pgfpathclose
13676 \pgf@circ@draworfill
13677 \endpgfscope % thick and fill
13678 \endpgfscope % shift
13679
13680 % Negative input terminal
13681 \pgfpathmoveto{\pgfpoint
13682 {\pgf@circ@res@left}
13683 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
13684 \pgfpathlineto{\pgfpoint
13685 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13686 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
13687 \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}
13688
13689 % Positive input terminal
13690 \pgfpathmoveto{\pgfpoint
13691 {\pgf@circ@res@left}
13692 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
13693 \pgfpathlineto{\pgfpoint
13694 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13695 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
13696 \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}
13697
13698 % Negative output terminal label
13699 \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}
13700
13701 % Positive output terminal label
13702 \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}
13703
13704 \pgfsetrectcap
13705 \pgfusepath{draw}
13706 }
13707 }
13708
13709
13710 % Instrumentation amplifier with differential output
13711 \pgfdeclareshape{fd inst amp}
13712 {
13713 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13714 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13715 % when tikz calls the anchor it wants the relative position in the lengths
13716 % \pgf@x \pgf@y
13717 % \pgfpoint* functions set that variables
13718 % anchors are visible outside and run on use
13719 \anchor{center}{\pgfpointorigin}
13720 % savedanchors are internals and run on node creation (not use)
13721 % bounding-box top left
13722 \savedanchor\northwest{%
13723 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13724 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13725 \pgf@y=.5\pgf@y
13726 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13727 \pgf@x=.5\pgf@x
13728 }
13729 \anchor{nw}{
13730 \northwest
13731 }
13732 \anchor{south}{
13733 \northwest
13734 \pgf@y=-\pgf@y\pgf@x=0pt\relax
13735 }
13736 \anchor{north}{
13737 \northwest\pgf@x=0pt\relax
13738 }
13739 \savedanchor\left{%
13740 \pgf@y=0pt
13741 }
13742 \anchor{leftedge}
13743 {\left
13744 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
13745 }
13746 \savedanchor\inOneFixed{%
13747 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13748 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13749 \pgf@y=.5\pgf@y
13750 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
13751 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13752 \pgf@x=.5\pgf@x
13753 }
13754 \anchor{in up}{
13755 \inOneFixed
13756 }
13757 \anchor{in down}{
13758 \inOneFixed
13759 \pgf@y=-\pgf@y
13760 }
13761 \savedanchor\inOne{%
13762 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13763 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13764 \pgf@y=.5\pgf@y
13765 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
13766 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13767 \pgf@x=.5\pgf@x
13768 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13769 }
13770 \anchor{-}{
13771 \inOne
13772 }
13773 \anchor{+}{
13774 \inOne
13775 \pgf@y=-\pgf@y
13776 }
13777 \savedanchor\up{%
13778 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13779 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13780 \pgf@y=.5\pgf@y
13781 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13782 \pgf@x=.5\pgf@x
13783 \pgf@circ@res@up = \pgf@y
13784 \pgf@circ@res@right = -\pgf@x
13785 \pgf@circ@res@left = \pgf@x
13786 \pgfpointlineattime{
13787 \ctikzvalof{tripoles/fd inst amp/up pos}}{
13788 \pgfpoint{
13789 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
13790 {\pgf@circ@res@up}}
13791 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
13792 }
13793 \anchor{up}{
13794 \up
13795 }
13796 \anchor{down}{
13797 \up
13798 \pgf@y=-\pgf@y
13799 }
13800 % reference voltage input anchors.
13801 \savedanchor\refv{%
13802 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13803 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13804 \pgf@y=.5\pgf@y
13805 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13806 \pgf@x=.5\pgf@x
13807 \pgf@circ@res@up = \pgf@y
13808 \pgf@circ@res@right = -\pgf@x
13809 \pgf@circ@res@left = \pgf@x
13810 \pgfpointlineattime{
13811 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
13812 \pgfpoint{
13813 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
13814 {\pgf@circ@res@up}}
13815 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
13816 }
13817 % we need both because they are normally drawn under the amp, and if you
13818 % mirror it vertically you need them
13819 \anchor{refv up}{
13820 \refv
13821 }
13822 \anchor{refv down}{
13823 \refv
13824 \pgf@y=-\pgf@y
13825 }
13826 \savedanchor\outport{
13827 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13828 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13829 \pgf@y=.5\pgf@y
13830 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
13831 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13832 \pgf@x=-.5\pgf@x
13833 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
13834 }
13835 \anchor{out}{
13836 \outport
13837 \pgf@y=0pt
13838 }
13839 \anchor{out +}{
13840 \outport
13841 }
13842 \anchor{out -}{
13843 \outport
13844 \pgf@y=-\pgf@y
13845 }
13846 \savedanchor\outportfixed{
13847 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13848 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
13849 \pgf@y=.5\pgf@y
13850 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
13851 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13852 \pgf@x=-.5\pgf@x
13853 }
13854 \anchor{out up}{
13855 \outportfixed
13856 }
13857 \anchor{out down}{
13858 \outportfixed
13859 \pgf@y=-\pgf@y
13860 }
13861 % support for border anchors
13862 \savedanchor\leftedge{%
13863 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13864 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
13865 \pgf@x=.5\pgf@x
13866 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
13867 \pgf@y=0pt
13868 }
13869 \anchor{leftedge}{\leftedge}
13870 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13871 \anchor{bin up}{
13872 \inOneFixed
13873 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13874 }
13875 \anchor{bin down}{
13876 \inOneFixed
13877 \pgf@y=-\pgf@y
13878 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13879 }
13880 \anchor{b-}{
13881 \inOne
13882 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13883 }
13884 \anchor{b+}{
13885 \inOne
13886 \pgf@y=-\pgf@y
13887 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13888 }
13889 \anchor{bout}{
13890 \leftedge
13891 \pgf@x=-\pgf@x \pgf@y=0pt
13892 }
13893 \anchor{bout +}{
13894 \outport
13895 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
13896 }
13897 \anchor{bout -}{
13898 \outport
13899 \pgf@y=-\pgf@y
13900 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
13901 }
13902 \anchor{bout up}{
13903 \outportfixed
13904 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
13905 }
13906 \anchor{bout down}{
13907 \outportfixed
13908 \pgf@y=-\pgf@y
13909 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
13910 }
13911 % end border anchors
13912 %
13913 \anchor{west}{
13914 \left
13915 }
13916 \anchor{east}{
13917 \left
13918 \pgf@x=-\pgf@x
13919 }
13920 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13921 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13922 \anchor{north west}{ \northwest }
13923 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13924 \anchor{text}{
13925 \ifpgf@circ@center@text
13926 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13927 \else
13928 \leftedge
13929 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13930 \fi
13931 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13932 }
13933
13934 % let's start drawing the component
13935 \backgroundpath{
13936 \pgfsetcolor{\ctikzvalof{color}}
13937 %
13938 \northwest
13939 \pgf@circ@res@up = \pgf@y
13940 \pgf@circ@res@down = -\pgf@y
13941 \pgf@circ@res@right = -\pgf@x
13942 \pgf@circ@res@left = \pgf@x
13943 \pgf@circ@scaled@Rlen=\scaledRlen
13944 % main component, normally in thicker lines
13945 \pgfscope
13946 \newdimen\pgf@circ@res@right@double
13947 \pgf@circ@res@right@double=2\pgf@circ@res@right
13948
13949 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13950 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
13951 \pgf@circ@res@step=\pgf@circ@res@right
13952 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13953 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
13954 %first point (near output)
13955 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
13956 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
13957 \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}}
13958 % and then to the input "front up", "down", to the output short side "down"
13959 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13960 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13961 \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}}
13962 % ...and close
13963 \pgfpathclose
13964 \pgf@circ@draworfill
13965 \endpgfscope
13966
13967 % input terminal up
13968 \pgfpathmoveto{\pgfpoint
13969 {\pgf@circ@res@left}
13970 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
13971 %
13972 \pgfpathlineto{\pgfpoint
13973 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
13974 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
13975 %
13976 \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}
13977
13978 % input terminal down
13979 \pgfpathmoveto{\pgfpoint
13980 {\pgf@circ@res@left}
13981 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
13982 %
13983 \pgfpathlineto{\pgfpoint
13984 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
13985 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
13986 \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}
13987
13988 % output leads down and up
13989 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
13990 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
13991 \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}
13992
13993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
13994 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
13995 \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}
13996 %
13997 \pgfsetrectcap
13998 \pgfusepath{draw}
13999 }
14000 }
14001
14002 % Transconductance amplifier (Transkonduktanzverstärker)
14003 \pgfdeclareshape{gm amp}
14004 {
14005 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14006 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14007 \anchor{center}{\pgfpointorigin}
14008 \savedanchor\northwest{%
14009 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14010 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14011 \pgf@y=.5\pgf@y
14012 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14013 \pgf@x=.5\pgf@x
14014 }
14015 \anchor{south}{
14016 \northwest
14017 \pgf@y=-\pgf@y
14018 }
14019 \anchor{north}{
14020 \northwest
14021 }
14022 \savedanchor\left{%
14023 \pgf@y=0pt
14024 }
14025 \anchor{leftedge}
14026 {\left
14027 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14028 }
14029 \savedanchor\inOneFixed{%
14030 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14031 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14032 \pgf@y=.5\pgf@y
14033 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
14034 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14035 \pgf@x=.5\pgf@x
14036 }
14037 \anchor{in up}{
14038 \inOneFixed
14039 }
14040 \anchor{in down}{
14041 \inOneFixed
14042 \pgf@y=-\pgf@y
14043 }
14044 \savedanchor\inOne{%
14045 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14046 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14047 \pgf@y=.5\pgf@y
14048 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
14049 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14050 \pgf@x=.5\pgf@x
14051 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14052 }
14053 \anchor{-}{
14054 \inOne
14055 }
14056 \anchor{+}{
14057 \inOne
14058 \pgf@y=-\pgf@y
14059 }
14060 \savedanchor\up{%
14061 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14062 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14063 \pgf@y=.5\pgf@y
14064 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14065 \pgf@x=.5\pgf@x
14066 \pgf@circ@res@up = \pgf@y
14067 \pgf@circ@res@right = -\pgf@x
14068 \pgf@circ@res@left = \pgf@x
14069 \pgfpointlineattime{
14070 \ctikzvalof{tripoles/gm amp/up pos}}{
14071 \pgfpoint{
14072 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14073 {\pgf@circ@res@up}}
14074 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
14075 }
14076 \anchor{up}{
14077 \up
14078 }
14079 \anchor{down}{
14080 \up
14081 \pgf@y=-\pgf@y
14082 }
14083 \anchor{out}{
14084 \northwest
14085 \pgf@y=0pt
14086 \pgf@x=-\pgf@x
14087 }
14088 % support for border anchors
14089 \savedanchor\leftedge{%
14090 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14091 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14092 \pgf@x=.5\pgf@x
14093 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
14094 \pgf@y=0pt
14095 }
14096 \anchor{leftedge}{\leftedge}
14097 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14098 \anchor{bin up}{
14099 \inOneFixed
14100 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14101 }
14102 \anchor{bin down}{
14103 \inOneFixed
14104 \pgf@y=-\pgf@y
14105 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14106 }
14107 \anchor{b-}{
14108 \inOne
14109 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14110 }
14111 \anchor{b+}{
14112 \inOne
14113 \pgf@y=-\pgf@y
14114 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14115 }
14116 \anchor{bout}{
14117 \leftedge
14118 \pgf@y=0pt
14119 \pgf@x=-\pgf@x
14120 }
14121 % end border anchors
14122 \anchor{west}{
14123 \left
14124 }
14125 \anchor{east}{
14126 \left
14127 \pgf@x=-\pgf@x
14128 }
14129 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14130 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14131 \anchor{north west}{ \northwest }
14132 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14133
14134 \anchor{text}{
14135 \ifpgf@circ@center@text
14136 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14137 \else
14138 \leftedge
14139 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14140 \fi
14141 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14142 }
14143 \backgroundpath{
14144 \pgfsetcolor{\ctikzvalof{color}}
14145
14146 \northwest
14147 \pgf@circ@res@up = \pgf@y
14148 \pgf@circ@res@down = -\pgf@y
14149 \pgf@circ@res@right = -\pgf@x
14150 \pgf@circ@res@left = \pgf@x
14151 \pgf@circ@scaled@Rlen=\scaledRlen
14152
14153 \pgfscope
14154 \newdimen\pgf@circ@res@right@double
14155 \pgf@circ@res@right@double=2\pgf@circ@res@right
14156
14157 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14158 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14159 \pgf@circ@res@step=\pgf@circ@res@right
14160 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14161 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
14162 %Umrandung:
14163 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
14164 \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
14165 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
14166 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
14167 \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
14168 \pgfpathclose
14169 \pgf@circ@draworfill
14170 \endpgfscope
14171
14172 \pgfpathmoveto{\pgfpoint
14173 {\pgf@circ@res@left}
14174 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
14175 \pgfpathlineto{\pgfpoint
14176 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14177 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
14178 \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}
14179
14180
14181 \pgfpathmoveto{\pgfpoint
14182 {\pgf@circ@res@left}
14183 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
14184 \pgfpathlineto{\pgfpoint
14185 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14186 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
14187 \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}
14188
14189 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14190 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
14191 \pgfsetrectcap
14192 \pgfusepath{draw}
14193
14194 }
14195 }
14196
14197 % Instrumentation amplifier
14198 \pgfdeclareshape{inst amp}
14199 {
14200 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14201 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14202 % when tikz calls the anchor it wants the relative position in the lengths
14203 % \pgf@x \pgf@y
14204 % \pgfpoint* functions set that variables
14205 % anchors are visible outside and run on use
14206 \anchor{center}{\pgfpointorigin}
14207 % savedanchors are internals and run on node creation (not use)
14208 % bounding-box top left
14209 \savedanchor\northwest{%
14210 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14211 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14212 \pgf@y=.5\pgf@y
14213 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14214 \pgf@x=.5\pgf@x
14215 }
14216 \anchor{nw}{
14217 \northwest
14218 }
14219 \anchor{south}{
14220 \northwest
14221 \pgf@y=-\pgf@y
14222 }
14223 \anchor{north}{
14224 \northwest
14225 }
14226 \savedanchor\left{%
14227 \pgf@y=0pt
14228 }
14229 \anchor{leftedge}
14230 {\left
14231 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14232 }
14233 \savedanchor\inOneFixed{%
14234 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14235 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14236 \pgf@y=.5\pgf@y
14237 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
14238 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14239 \pgf@x=.5\pgf@x
14240 }
14241 \anchor{in up}{
14242 \inOneFixed
14243 }
14244 \anchor{in down}{
14245 \inOneFixed
14246 \pgf@y=-\pgf@y
14247 }
14248 \savedanchor\inOne{%
14249 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14250 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14251 \pgf@y=.5\pgf@y
14252 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
14253 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14254 \pgf@x=.5\pgf@x
14255 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14256 }
14257 \anchor{-}{
14258 \inOne
14259 }
14260 \anchor{+}{
14261 \inOne
14262 \pgf@y=-\pgf@y
14263 }
14264 \savedanchor\up{%
14265 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14266 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14267 \pgf@y=.5\pgf@y
14268 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14269 \pgf@x=.5\pgf@x
14270 \pgf@circ@res@up = \pgf@y
14271 \pgf@circ@res@right = -\pgf@x
14272 \pgf@circ@res@left = \pgf@x
14273 \pgfpointlineattime{
14274 \ctikzvalof{tripoles/inst amp/up pos}}{
14275 \pgfpoint{
14276 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14277 {\pgf@circ@res@up}}
14278 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14279 }
14280 \anchor{up}{
14281 \up
14282 }
14283 \anchor{down}{
14284 \up
14285 \pgf@y=-\pgf@y
14286 }
14287 % reference voltage input anchors.
14288 \savedanchor\refv{%
14289 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14290 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14291 \pgf@y=.5\pgf@y
14292 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14293 \pgf@x=.5\pgf@x
14294 \pgf@circ@res@up = \pgf@y
14295 \pgf@circ@res@right = -\pgf@x
14296 \pgf@circ@res@left = \pgf@x
14297 \pgfpointlineattime{
14298 \ctikzvalof{tripoles/inst amp/refv pos}}{
14299 \pgfpoint{
14300 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14301 {\pgf@circ@res@up}}
14302 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14303 }
14304 % we need both because they are normally drawn under the amp, and if you
14305 % mirror it vertically you need them
14306 \anchor{refv up}{
14307 \refv
14308 }
14309 \anchor{refv down}{
14310 \refv
14311 \pgf@y=-\pgf@y
14312 }
14313 \anchor{out}{
14314 \northwest
14315 \pgf@y=0pt
14316 \pgf@x=-\pgf@x
14317 }
14318 % support for border anchors
14319 \savedanchor\leftedge{%
14320 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14321 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14322 \pgf@x=.5\pgf@x
14323 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
14324 \pgf@y=0pt
14325 }
14326 \anchor{leftedge}{\leftedge}
14327 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14328 \anchor{bin up}{
14329 \inOneFixed
14330 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14331 }
14332 \anchor{bin down}{
14333 \inOneFixed
14334 \pgf@y=-\pgf@y
14335 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14336 }
14337 \anchor{b-}{
14338 \inOne
14339 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14340 }
14341 \anchor{b+}{
14342 \inOne
14343 \pgf@y=-\pgf@y
14344 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14345 }
14346 \anchor{bout}{
14347 \leftedge
14348 \pgf@y=0pt
14349 \pgf@x=-\pgf@x
14350 }
14351 % end border anchors
14352 \anchor{west}{
14353 \left
14354 }
14355 \anchor{east}{
14356 \left
14357 \pgf@x=-\pgf@x
14358 }
14359 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14360 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14361 \anchor{north west}{ \northwest }
14362 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14363
14364 \anchor{text}{
14365 \ifpgf@circ@center@text
14366 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14367 \else
14368 \leftedge
14369 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14370 \fi
14371 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14372 }
14373
14374 % let's start drawing the component
14375 \backgroundpath{
14376 \pgfsetcolor{\ctikzvalof{color}}
14377 %
14378 \northwest
14379 \pgf@circ@res@up = \pgf@y
14380 \pgf@circ@res@down = -\pgf@y
14381 \pgf@circ@res@right = -\pgf@x
14382 \pgf@circ@res@left = \pgf@x
14383 \pgf@circ@scaled@Rlen=\scaledRlen
14384
14385 % main component, normally in thicker lines
14386 \pgfscope
14387 \newdimen\pgf@circ@res@right@double
14388 \pgf@circ@res@right@double=2\pgf@circ@res@right
14389
14390 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14391 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14392 \pgf@circ@res@step=\pgf@circ@res@right
14393 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14394 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
14395 %first point (near output)
14396 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
14397 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
14398 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14399 % and then to the input "front up", "down", to the output short side "down"
14400 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14401 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14402 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
14403 % ...and close
14404 \pgfpathclose
14405 \pgf@circ@draworfill
14406 \endpgfscope
14407
14408 % Negative input terminal
14409 \pgfpathmoveto{\pgfpoint
14410 {\pgf@circ@res@left}
14411 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
14412 %
14413 \pgfpathlineto{\pgfpoint
14414 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14415 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
14416 %
14417 \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}
14418
14419 % Positive input terminal
14420 \pgfpathmoveto{\pgfpoint
14421 {\pgf@circ@res@left}
14422 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
14423 %
14424 \pgfpathlineto{\pgfpoint
14425 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14426 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
14427 \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}
14428
14429 % Output terminal
14430 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14431 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
14432 %
14433 \pgfsetrectcap
14434 \pgfusepath{draw}
14435 }
14436 }
14437
14438 % Instrumentation amplifier with terminals for gain resistance between inputs
14439 \pgfdeclareshape{inst amp ra}
14440 {
14441 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14442 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14443 \anchor{center}{\pgfpointorigin}
14444 % bounding-box top left
14445 \savedanchor\northwest{%
14446 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14447 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14448 \pgf@y=.5\pgf@y
14449 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14450 \pgf@x=.5\pgf@x
14451 }
14452 \anchor{nw}{
14453 \northwest
14454 }
14455 \anchor{south}{
14456 \northwest
14457 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14458 }
14459 \anchor{north}{
14460 \northwest\pgf@x=0pt\relax
14461 }
14462 \savedanchor\left{%
14463 \pgf@y=0pt
14464 }
14465 \anchor{leftedge}
14466 {\left
14467 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14468 }
14469 % inputs (+-)
14470 \savedanchor\inOneFixed{%
14471 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14472 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14473 \pgf@y=.5\pgf@y
14474 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
14475 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14476 \pgf@x=.5\pgf@x
14477 }
14478 \anchor{in up}{
14479 \inOneFixed
14480 }
14481 \anchor{in down}{
14482 \inOneFixed
14483 \pgf@y=-\pgf@y
14484 }
14485 \savedanchor\inOne{%
14486 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14487 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14488 \pgf@y=.5\pgf@y
14489 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
14490 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14491 \pgf@x=.5\pgf@x
14492 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14493 }
14494 \anchor{-}{
14495 \inOne
14496 }
14497 \anchor{+}{
14498 \inOne
14499 \pgf@y=-\pgf@y
14500 }
14501 % R ampli anchors. They are by default at 20% more than R-length distance
14502 % you can change that with the `ra pos` key (use 0.5 for one-R).
14503 \savedanchor\raOneFixed{%
14504 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14505 \pgf@y=\pgf@circ@scaled@Rlen
14506 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
14507 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14508 \pgf@x=.5\pgf@x
14509 }
14510 \anchor{ra up}{
14511 \raOneFixed
14512 }
14513 \anchor{ra down}{
14514 \raOneFixed
14515 \pgf@y=-\pgf@y
14516 }
14517 \savedanchor\raOne{%
14518 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14519 \pgf@y=\pgf@circ@scaled@Rlen
14520 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
14521 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14522 \pgf@x=.5\pgf@x
14523 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14524 }
14525 \anchor{ra-}{
14526 \raOne
14527 }
14528 \anchor{ra+}{
14529 \raOne
14530 \pgf@y=-\pgf@y
14531 }
14532 % power supplies
14533 \savedanchor\up{%
14534 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14535 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14536 \pgf@y=.5\pgf@y
14537 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14538 \pgf@x=.5\pgf@x
14539 \pgf@circ@res@up = \pgf@y
14540 \pgf@circ@res@right = -\pgf@x
14541 \pgf@circ@res@left = \pgf@x
14542 \pgfpointlineattime{
14543 \ctikzvalof{tripoles/inst amp ra/up pos}}{
14544 \pgfpoint{
14545 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14546 {\pgf@circ@res@up}}
14547 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
14548 }
14549 \anchor{up}{
14550 \up
14551 }
14552 \anchor{down}{
14553 \up
14554 \pgf@y=-\pgf@y
14555 }
14556 % reference voltage input anchors.
14557 \savedanchor\refv{%
14558 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14559 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14560 \pgf@y=0.5\pgf@y
14561 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14562 \pgf@x=0.5\pgf@x
14563 \pgf@circ@res@up = \pgf@y
14564 \pgf@circ@res@right = -\pgf@x
14565 \pgf@circ@res@left = \pgf@x
14566 \pgfpointlineattime{
14567 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
14568 \pgfpoint{
14569 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14570 {\pgf@circ@res@up}}
14571 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
14572 }
14573 % we need both because they are normally drawn under the amp, and if you
14574 % mirror it vertically you need them
14575 \anchor{refv up}{
14576 \refv
14577 }
14578 \anchor{refv down}{
14579 \refv
14580 \pgf@y=-\pgf@y
14581 }
14582 \anchor{out}{
14583 \northwest
14584 \pgf@y=0pt
14585 \pgf@x=-\pgf@x
14586 }
14587 % support for border anchors
14588 \savedanchor\leftedge{%
14589 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14590 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14591 \pgf@x=.5\pgf@x
14592 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
14593 \pgf@y=0pt
14594 }
14595 \anchor{leftedge}{\leftedge}
14596 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14597 \anchor{bin up}{
14598 \inOneFixed
14599 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14600 }
14601 \anchor{bin down}{
14602 \inOneFixed
14603 \pgf@y=-\pgf@y
14604 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14605 }
14606 \anchor{b-}{
14607 \inOne
14608 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14609 }
14610 \anchor{b+}{
14611 \inOne
14612 \pgf@y=-\pgf@y
14613 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14614 }
14615 \anchor{bra up}{
14616 \raOneFixed
14617 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14618 }
14619 \anchor{bra down}{
14620 \raOneFixed
14621 \pgf@y=-\pgf@y
14622 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14623 }
14624 \anchor{bra-}{
14625 \raOne
14626 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14627 }
14628 \anchor{bra+}{
14629 \raOne
14630 \pgf@y=-\pgf@y
14631 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14632 }
14633 \anchor{bout}{
14634 \leftedge
14635 \pgf@y=0pt
14636 \pgf@x=-\pgf@x
14637 }
14638 % end border anchors
14639 \anchor{west}{
14640 \left
14641 }
14642 \anchor{east}{
14643 \left
14644 \pgf@x=-\pgf@x
14645 }
14646 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14647 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14648 \anchor{north west}{ \northwest }
14649 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14650
14651 \anchor{text}{
14652 \ifpgf@circ@center@text
14653 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14654 \else
14655 \leftedge
14656 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14657 \fi
14658 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14659 }
14660
14661 % drawing of the component
14662 \backgroundpath{
14663 \pgfsetcolor{\ctikzvalof{color}}
14664
14665 \northwest
14666 \pgf@circ@res@up = \pgf@y
14667 \pgf@circ@res@down = -\pgf@y
14668 \pgf@circ@res@right = -\pgf@x
14669 \pgf@circ@res@left = \pgf@x
14670 \pgf@circ@scaled@Rlen=\scaledRlen
14671
14672 \newdimen\pgf@circ@res@right@double
14673 \pgf@circ@res@right@double=2\pgf@circ@res@right
14674
14675 % main component, normally in thicker lines
14676 \pgfscope
14677 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14678 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14679 \pgf@circ@res@step=\pgf@circ@res@right
14680 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14681 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
14682 %primer punto: la linea de salida (lado componente)
14683 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
14684 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
14685 \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}}
14686 % and then to the input "front up", "down", to the output short side "down"
14687 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14688 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14689 \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}}
14690 % ...and close
14691 \pgfpathclose
14692 \pgf@circ@draworfill
14693 \endpgfscope
14694
14695 % ra terminal -
14696 \pgfpathmoveto{\pgfpoint
14697 {\pgf@circ@res@left}
14698 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
14699 %
14700 \pgfpathlineto{\pgfpoint
14701 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14702 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
14703 % ra terminal +
14704 \pgfpathmoveto{\pgfpoint
14705 {\pgf@circ@res@left}
14706 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
14707 %
14708 \pgfpathlineto{\pgfpoint
14709 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14710 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
14711
14712 % Negative input terminal
14713 \pgfpathmoveto{\pgfpoint
14714 {\pgf@circ@res@left}
14715 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
14716 %
14717 \pgfpathlineto{\pgfpoint
14718 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14719 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
14720 %
14721 \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}
14722
14723 % Positive input terminal
14724 \pgfpathmoveto{\pgfpoint
14725 {\pgf@circ@res@left}
14726 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
14727 %
14728 \pgfpathlineto{\pgfpoint
14729 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14730 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
14731 \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}
14732
14733 % Output terminal
14734 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14735 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
14736 %
14737 \pgfsetrectcap
14738 \pgfusepath{draw}
14739 }
14740 }
14741
14742 % Buffer
14743 % Contributed by Danilo Piazzalunga
14744 \pgfdeclareshape{buffer}
14745 {
14746 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14747 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14748 \anchor{center}{\pgfpointorigin}
14749 \savedanchor\northwest{%
14750 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14751 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
14752 \pgf@y=.5\pgf@y
14753 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
14754 \pgf@x=.5\pgf@x
14755 }
14756 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
14757 \anchor{west}{ \northwest \pgf@y=0pt }
14758 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
14759 \anchor{north}{ \northwest \pgf@x=0pt }
14760 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14761 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14762 \anchor{north west}{ \northwest }
14763 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14764 \savedanchor\left{%
14765 \pgf@y=0pt
14766 }
14767 \anchor{in}{
14768 \northwest
14769 \pgf@y=0pt
14770 }
14771 \anchor{out}{
14772 \northwest
14773 \pgf@y=0pt
14774 \pgf@x=-\pgf@x
14775 }
14776 \anchor{bin}{
14777 \northwest
14778 \pgf@y=0pt
14779 \pgf@x=0.7\pgf@x
14780 }
14781 \anchor{bout}{
14782 \northwest
14783 \pgf@y=0pt
14784 \pgf@x=-0.7\pgf@x
14785 }
14786
14787 \anchor{text}{
14788 \ifpgf@circ@center@text
14789 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14790 \else
14791 \northwest
14792 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
14793 \fi
14794 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14795 }
14796
14797 \backgroundpath{
14798 \pgfsetcolor{\ctikzvalof{color}}
14799
14800 \northwest
14801 \pgf@circ@res@up = \pgf@y
14802 \pgf@circ@res@down = -\pgf@y
14803 \pgf@circ@res@right = -\pgf@x
14804 \pgf@circ@res@left = \pgf@x
14805 \pgf@circ@scaled@Rlen=\scaledRlen
14806 \pgfscope
14807 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14808 \pgftransformxshift{.7\pgf@circ@res@left}
14809 \pgf@circ@res@step=\pgf@circ@res@right
14810 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14811 \pgf@circ@res@step=.7\pgf@circ@res@step
14812
14813 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14814 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14815 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14816 \pgfpathclose
14817 \pgf@circ@draworfill
14818 \endpgfscope
14819
14820 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14821 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
14822
14823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14824 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
14825
14826 \pgfusepath{draw}
14827 }
14828 }
14829
14830 % plain amplifier, no symbols
14831 \pgfdeclareshape{plain amp}
14832 {
14833 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14834 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14835 \anchor{center}{\pgfpointorigin}
14836 \savedanchor\northwest{%
14837 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14838 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
14839 \pgf@y=.5\pgf@y
14840 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
14841 \pgf@x=.5\pgf@x
14842 }
14843 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
14844 \anchor{west}{ \northwest \pgf@y=0pt }
14845 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
14846 \anchor{north}{ \northwest \pgf@x=0pt }
14847 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14848 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14849 \anchor{north west}{ \northwest }
14850 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14851 \savedanchor\left{%
14852 \pgf@y=0pt
14853 }
14854 \savedanchor\inOne{%
14855 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14856 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
14857 \pgf@y=.5\pgf@y
14858 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
14859 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
14860 \pgf@x=.5\pgf@x
14861 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14862 }
14863 \savedanchor\inOneFixed{%
14864 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14865 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
14866 \pgf@y=.5\pgf@y
14867 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
14868 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
14869 \pgf@x=.5\pgf@x
14870 }
14871 \anchor{-}{
14872 \inOne
14873 }
14874 \anchor{+}{
14875 \inOne
14876 \pgf@y=-\pgf@y
14877 }
14878 \anchor{in up}{
14879 \inOneFixed
14880 }
14881 \anchor{in down}{
14882 \inOneFixed
14883 \pgf@y=-\pgf@y
14884 }
14885 % support for border anchors
14886 \savedanchor\leftedge{%
14887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14888 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
14889 \pgf@x=.5\pgf@x
14890 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
14891 \pgf@y=0pt
14892 }
14893 \anchor{leftedge}{\leftedge}
14894 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14895 \anchor{bin up}{
14896 \inOneFixed
14897 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14898 }
14899 \anchor{bin down}{
14900 \inOneFixed
14901 \pgf@y=-\pgf@y
14902 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14903 }
14904 \anchor{b-}{
14905 \inOne
14906 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14907 }
14908 \anchor{b+}{
14909 \inOne
14910 \pgf@y=-\pgf@y
14911 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14912 }
14913 \anchor{bout}{
14914 \leftedge
14915 \pgf@y=0pt
14916 \pgf@x=-\pgf@x
14917 }
14918 % end border anchors
14919 \savedanchor\up{%
14920 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14921 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
14922 \pgf@y=.5\pgf@y
14923 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
14924 \pgf@x=.5\pgf@x
14925 \pgf@circ@res@up = \pgf@y
14926 \pgf@circ@res@right = -\pgf@x
14927 \pgf@circ@res@left = \pgf@x
14928 \pgfpointlineattime{
14929 \ctikzvalof{tripoles/plain amp/up pos}}{
14930 \pgfpoint{
14931 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
14932 {\pgf@circ@res@up}}
14933 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
14934 }
14935 \anchor{up}{
14936 \up
14937 }
14938 \anchor{down}{
14939 \up
14940 \pgf@y=-\pgf@y
14941 }
14942 \anchor{out}{
14943 \northwest
14944 \pgf@y=0pt
14945 \pgf@x=-\pgf@x
14946 }
14947
14948 \anchor{text}{
14949 \ifpgf@circ@center@text
14950 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14951 \else
14952 \leftedge
14953 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14954 \fi
14955 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14956 }
14957
14958 \backgroundpath{
14959 \pgfsetcolor{\ctikzvalof{color}}
14960
14961 \northwest
14962 \pgf@circ@res@up = \pgf@y
14963 \pgf@circ@res@down = -\pgf@y
14964 \pgf@circ@res@right = -\pgf@x
14965 \pgf@circ@res@left = \pgf@x
14966
14967 \pgfscope
14968 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14969 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
14970 \pgf@circ@res@step=\pgf@circ@res@right
14971 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14972 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
14973
14974 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
14975 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14976 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14977 \pgfpathclose
14978 \pgf@circ@draworfill
14979 \endpgfscope
14980 \pgfpathmoveto{\pgfpoint
14981 {\pgf@circ@res@left}
14982 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
14983 \pgfpathlineto{\pgfpoint
14984 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
14985 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
14986
14987
14988 \pgfpathmoveto{\pgfpoint
14989 {\pgf@circ@res@left}
14990 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
14991 \pgfpathlineto{\pgfpoint
14992 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
14993 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
14994
14995 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14996 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
14997
14998 \pgfusepath{draw}
14999 }
15000 }
15001
15002 % plain amplifier, no symbols, one input
15003 \pgfdeclareshape{plain mono amp}
15004 {
15005 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15006 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15007 \anchor{center}{\pgfpointorigin}
15008 \savedanchor\northwest{%
15009 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15010 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15011 \pgf@y=.5\pgf@y
15012 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15013 \pgf@x=.5\pgf@x
15014 }
15015 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15016 \anchor{west}{ \northwest \pgf@y=0pt }
15017 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15018 \anchor{north}{ \northwest \pgf@x=0pt }
15019 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15020 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15021 \anchor{north west}{ \northwest }
15022 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15023 \savedanchor\left{%
15024 \pgf@y=0pt
15025 }
15026 \savedanchor\inOne{%
15027 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15028 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15029 \pgf@x=.5\pgf@x
15030 \pgf@y=0pt\relax
15031 }
15032 \anchor{in}{
15033 \inOne
15034 }
15035 % support for border anchors
15036 \savedanchor\leftedge{%
15037 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15038 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15039 \pgf@x=.5\pgf@x
15040 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
15041 \pgf@y=0pt
15042 }
15043 \anchor{leftedge}{\leftedge}
15044 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15045 \anchor{bin}{
15046 \inOne
15047 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15048 }
15049 \anchor{bout}{
15050 \leftedge
15051 \pgf@y=0pt
15052 \pgf@x=-\pgf@x
15053 }
15054 % end border anchors
15055 \savedanchor\up{%
15056 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15057 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15058 \pgf@y=.5\pgf@y
15059 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15060 \pgf@x=.5\pgf@x
15061 \pgf@circ@res@up = \pgf@y
15062 \pgf@circ@res@right = -\pgf@x
15063 \pgf@circ@res@left = \pgf@x
15064 \pgfpointlineattime{
15065 \ctikzvalof{tripoles/plain amp/up pos}}{
15066 \pgfpoint{
15067 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15068 {\pgf@circ@res@up}}
15069 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15070 }
15071 \anchor{up}{
15072 \up
15073 }
15074 \anchor{down}{
15075 \up
15076 \pgf@y=-\pgf@y
15077 }
15078 \anchor{out}{
15079 \northwest
15080 \pgf@y=0pt
15081 \pgf@x=-\pgf@x
15082 }
15083
15084 \anchor{text}{
15085 \ifpgf@circ@center@text
15086 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15087 \else
15088 \leftedge
15089 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15090 \fi
15091 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15092 }
15093 \backgroundpath{
15094 \pgfsetcolor{\ctikzvalof{color}}
15095
15096 \northwest
15097 \pgf@circ@res@up = \pgf@y
15098 \pgf@circ@res@down = -\pgf@y
15099 \pgf@circ@res@right = -\pgf@x
15100 \pgf@circ@res@left = \pgf@x
15101
15102 \pgfscope
15103 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15104 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15105 \pgf@circ@res@step=\pgf@circ@res@right
15106 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15107 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
15108
15109 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15110 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15111 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15112 \pgfpathclose
15113 \pgf@circ@draworfill
15114 \endpgfscope
15115 \pgfpathmoveto{\pgfpoint
15116 {\pgf@circ@res@left}
15117 {0pt}}
15118 \pgfpathlineto{\pgfpoint
15119 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15120 {0pt}}
15121
15122 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15123 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15124
15125 \pgfusepath{draw}
15126 }
15127 }
15128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15129 %% electromechanical device (motor/generator)
15130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15131
15132 \pgfdeclareshape{elmech}
15133 {
15134 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
15135 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15136 \savedanchor\northwest{
15137 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15138 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
15139 \pgf@y=.5\pgf@y
15140 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
15141 \pgf@x=.5\pgf@x
15142 }
15143 \anchor{center}{
15144 \pgfpointorigin
15145 }
15146 \anchor{text}{
15147 \pgfpointorigin
15148 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
15149 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
15150 }
15151 \anchor{left}{%
15152 \northwest
15153 \pgf@y=0pt
15154 }
15155 \anchor{right}{%
15156 \northwest
15157 \pgf@y=0pt
15158 \pgf@x=-\pgf@x
15159 }
15160 \anchor{top}{
15161 \northwest
15162 \pgf@x=0pt
15163 }
15164 \anchor{pathstart}{
15165 \northwest
15166 \pgf@x=0pt
15167 }
15168 \anchor{pathend}{
15169 \northwest
15170 \pgf@x=0pt
15171 \pgf@y=-\pgf@y
15172 }
15173 \anchor{bottom}{
15174 \northwest
15175 \pgf@x=0pt
15176 \pgf@y=-\pgf@y
15177 }
15178 \anchor{center}{
15179 \pgf@y=0pt
15180 \pgf@x=0pt
15181 }
15182 \anchor{east}{
15183 \northwest
15184 \pgf@y=0pt
15185 \pgf@x=-\pgf@x
15186 }
15187 \anchor{west}{
15188 \northwest
15189 \pgf@y=0pt
15190 }
15191 \anchor{south}{
15192 \northwest
15193 \pgf@x=0pt
15194 \pgf@y=-\pgf@y
15195 }
15196 \anchor{north}{
15197 \northwest
15198 \pgf@x=0pt
15199 }
15200 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15201 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15202 \anchor{north west}{ \northwest }
15203 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15204 \anchorborder{%
15205 \@tempdima=\pgf@x\@tempdimb=\pgf@y
15206 \northwest\pgf@circ@res@other=-\pgf@x
15207 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
15208 }
15209 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
15210 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
15211 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
15212 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
15213 \anchor{block up right}{
15214 \northwest
15215 % remember that pgf@x is negative
15216 % center of the block is at 0.5*H+W*cos(30)/2
15217 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15218 \pgf@x=-0.5\pgf@x
15219 }
15220 \anchor{block up left}{
15221 \northwest
15222 % remember that pgf@x is negative
15223 % center of the block is at 0.5*H+W*cos(30)/2
15224 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15225 \pgf@x=0.5\pgf@x
15226 }
15227 \anchor{block down right}{
15228 \northwest
15229 % remember that pgf@x is negative
15230 % center of the block is at 0.5*H+W*cos(30)/2
15231 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15232 \pgf@y=-\pgf@y
15233 \pgf@x=-0.5\pgf@x
15234 }
15235 \anchor{block down left}{
15236 \northwest
15237 % remember that pgf@x is negative
15238 % center of the block is at 0.5*H+W*cos(30)/2
15239 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15240 \pgf@y=-\pgf@y
15241 \pgf@x=0.5\pgf@x
15242 }
15243 \behindbackgroundpath{
15244 \pgfsetcolor{\ctikzvalof{color}}
15245 \pgf@circ@scaled@Rlen=\scaledRlen
15246 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
15247 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
15248 \pgfscope
15249 \pgfstartlinewidth=\pgflinewidth
15250 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15251 \pgfscope % clip the bar: whole size minus the circle
15252 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
15253 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15254 \pgfseteorule
15255 \pgfusepath{clip}
15256 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
15257 \pgfsetfillcolor{\ctikzvalof{color}}
15258 \pgfusepath{fill, draw}
15259 \endpgfscope
15260 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15261 \ifx\tikz@fillcolor\pgfutil@empty
15262 % set the default fill color to white
15263 \pgfsetfillcolor{white}
15264 % ...but override it if the class is defined!
15265 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
15266 \else
15267 \pgfsetfillcolor{\tikz@fillcolor}
15268 \pgfusepath{draw, fill}
15269 \fi
15270 \endpgfscope
15271 }
15272 }
15273
15274 %%%%%%%%%%%%%%%%%%%
15275 %% Magnetron
15276 %%%%%%%%%%%%%%%%%%%
15277
15278 \pgfdeclareshape{magnetron}
15279 {
15280 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
15281 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15282 \savedanchor\northwest{
15283 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15284 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15285 \pgf@y=.5\pgf@y
15286 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15287 \pgf@x=.5\pgf@x
15288 }
15289 \anchor{center}{
15290 \pgfpointorigin
15291 }
15292 \anchor{anode}{
15293 \northwest
15294 \pgf@x=0pt
15295 \pgf@y=-\pgf@y
15296 }
15297 \anchor{cathode1}{
15298 \northwest
15299 \pgf@circ@res@step=\pgf@y
15300 \pgfmathparse{cos(105)}
15301 \pgf@x=\pgfmathresult\pgf@circ@res@step
15302 \pgfmathparse{sin(105)}
15303 \pgf@y=\pgfmathresult\pgf@circ@res@step
15304 %\pgfpointorigin
15305 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
15306 }
15307 \anchor{cathode2}{
15308 \northwest
15309 \pgf@circ@res@step=\pgf@y
15310 \pgfmathparse{cos(75)}
15311 \pgf@x=\pgfmathresult\pgf@circ@res@step
15312 \pgfmathparse{sin(75)}
15313 \pgf@y=\pgfmathresult\pgf@circ@res@step
15314 %\pgfpointorigin
15315 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
15316 }
15317 \anchor{text}{
15318 \pgfpointorigin
15319 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
15320 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
15321 }
15322 \anchor{left}{%
15323 \northwest
15324 \pgf@y=0pt
15325 }
15326 \anchor{right}{%
15327 \northwest
15328 \pgf@y=0pt
15329 \pgf@x=-\pgf@x
15330 }
15331 \anchor{top}{
15332 \northwest
15333 \pgf@x=0pt
15334 }
15335 \anchor{pathstart}{
15336 \northwest
15337 \pgf@x=0pt
15338 }
15339 \anchor{pathend}{
15340 \northwest
15341 \pgf@x=0pt
15342 \pgf@y=-\pgf@y
15343 }
15344 \anchor{bottom}{
15345 \northwest
15346 \pgf@x=0pt
15347 \pgf@y=-\pgf@y
15348 }
15349 \anchor{center}{
15350 \pgf@y=0pt
15351 \pgf@x=0pt
15352 }
15353 \anchor{east}{
15354 \northwest
15355 \pgf@y=0pt
15356 \pgf@x=-\pgf@x
15357 }
15358 \anchor{west}{
15359 \northwest
15360 \pgf@y=0pt
15361 }
15362 \anchor{south}{
15363 \northwest
15364 \pgf@x=0pt
15365 \pgf@y=-\pgf@y
15366 }
15367 \anchor{north}{
15368 \northwest
15369 \pgf@x=0pt
15370 }
15371 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15372 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15373 \anchor{north west}{ \northwest }
15374 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15375 \backgroundpath{
15376 \pgfsetcolor{\ctikzvalof{color}}
15377 \pgf@circ@scaled@Rlen=\scaledRlen
15378 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15379 \northwest
15380 \pgf@circ@res@up = \pgf@y
15381 \pgf@circ@res@down = -\pgf@y
15382 \pgf@circ@res@right = -\pgf@x
15383 \pgf@circ@res@left = \pgf@x
15384 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
15385
15386 \pgfscope
15387 \pgfstartlinewidth=\pgflinewidth
15388 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15389 %create outer circle
15390 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
15391 \pgf@circ@draworfill
15392 %create chambers
15393 \foreach \angle in {45,135,225,315}{
15394 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
15395 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
15396 }
15397 \pgfsetroundcap
15398 \pgfusepath{draw}
15399 \pgfscope
15400 %draw connection from outside
15401 %anode
15402 \pgfsetlinewidth{\pgfstartlinewidth}
15403 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
15404 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
15405 %cathodes
15406 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
15407 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15408 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
15409 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15410 \pgfsetbuttcap
15411 \pgfusepath{draw}
15412 \endpgfscope
15413 %create cathode
15414 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15415 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
15416 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15417 \pgfusepath{draw}
15418 %create anode
15419 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
15420 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
15421
15422 \pgfsetbuttcap
15423 \pgfusepath{draw}
15424 \endpgfscope
15425 }
15426 }
15427
15428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15429 % Electronic tubes, submitted by J. op den Brouw
15430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15431
15432 % Draw tube outline
15433 \def\pgf@circ@tubes@drawtube{%
15434 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
15435 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15436 \pgfutil@tempdima=\pgf@circ@res@right
15437 \advance\pgfutil@tempdima by -\pgf@circ@res@up
15438 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
15439 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
15440 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
15441 \pgfpatharc{270}{90}{\pgf@circ@res@up}
15442 \else
15443 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
15444 \pgfutil@tempdima=\pgf@circ@res@up
15445 \advance\pgfutil@tempdima by -\pgf@circ@res@right
15446 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
15447 \pgfpatharc{180}{0}{\pgf@circ@res@right}
15448 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
15449 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
15450 \fi
15451 \pgfpathclose
15452 }
15453
15454 %% The diode (tube), triode, tetrode and pentode only differ in the
15455 %% number of grids. So we construct a generic declare function in
15456 %% which we can put code for the grid anchors and grid drawing code
15457 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
15458 \long\def\pgfcircdeclaretube#1#2#3{%
15459 \pgfdeclareshape{#1}{
15460 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
15461 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15462 \anchor{center}{
15463 \pgfpointorigin
15464 }
15465 \savedanchor\northwest{%
15466 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15467 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15468 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15469 % x and y should be half the Rlen
15470 \pgf@y=\pgf@circ@res@up
15471 \pgf@y=.5\pgf@y
15472 \pgf@x=-\pgf@circ@res@right
15473 \pgf@x=.5\pgf@x
15474 }
15475 \anchor{north} {%
15476 \northwest
15477 \pgf@x=0pt
15478 }
15479 \anchor{east}{%
15480 \northwest
15481 \pgf@x=-\pgf@x
15482 \pgf@y=0pt
15483 }
15484 \anchor{south}{%
15485 \northwest
15486 \pgf@y=-\pgf@y
15487 \pgf@x=0pt
15488 }
15489 \anchor{west}{%
15490 \northwest
15491 \pgf@y=0pt
15492 }
15493 \anchor{north west}{%
15494 \northwest
15495 }
15496 \anchor{north east}{%
15497 \northwest
15498 \pgf@x=-\pgf@x
15499 }
15500 \anchor{south east}{
15501 \northwest
15502 \pgf@x=-\pgf@x
15503 \pgf@y=-\pgf@y
15504 }
15505 \anchor{south west}{
15506 \northwest
15507 \pgf@y=-\pgf@y
15508 }
15509 \anchor{anode} {%
15510 \northwest
15511 \pgf@x=0pt
15512 }
15513 \anchor{cathode}{%
15514 \northwest
15515 \pgf@y=-\pgf@y
15516 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
15517 }
15518 \anchor{cathode 1}{%
15519 \northwest
15520 \pgf@y=-\pgf@y
15521 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
15522 }
15523 \anchor{cathode 2}{%
15524 \northwest
15525 \pgf@y=-\pgf@y
15526 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
15527 }
15528 \anchor{filament 1}{%
15529 \northwest
15530 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15531 \pgf@x=\pgfmathresult\pgf@x
15532 \pgf@y=-\pgf@y
15533 }
15534 \anchor{filament 2}{%
15535 \northwest
15536 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15537 \pgf@x=-\pgfmathresult\pgf@x
15538 \pgf@y=-\pgf@y
15539 }
15540
15541 % Extra anchors
15542 #2
15543
15544 \backgroundpath{
15545 \pgfscope
15546 % Line width for tripoles
15547 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15548 \pgf@circ@scaled@Rlen=\scaledRlen
15549
15550 % Setup to draw tube
15551 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15552 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15553 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
15554 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15555
15556 % Tube outline
15557 \pgf@circ@tubes@drawtube
15558
15559 % Setup to draw grid, filament, anode and cathode
15560 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15561 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15562 \pgf@circ@res@up=0.5\pgf@circ@res@up
15563 \pgf@circ@res@right=0.5\pgf@circ@res@right
15564
15565 % Tube fill color (if any)
15566 \pgf@circ@draworfill
15567
15568 % Grid drawing
15569 #3
15570
15571 % Filament (is not drawn by default)
15572 \ifpgf@circuit@tubes@filament
15573 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
15574 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
15575 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15576 \pgf@xa=\pgfmathresult\pgf@circ@res@right
15577 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
15578 \pgf@ya=\pgfmathresult\pgf@circ@res@up
15579 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
15580 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
15581 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
15582 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
15583 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
15584 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
15585 \pgf@circuit@tubes@filamentfalse
15586 \fi
15587
15588 % Anode (or plate)
15589 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
15590 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15591 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15592 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15593
15594 % Cathode
15595 \ifpgf@circuit@tubes@nocathode
15596 \pgf@circuit@tubes@nocathodefalse
15597 \else
15598 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
15599 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
15600 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
15601 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
15602 \ifpgf@circuit@tubes@fullcathode
15603 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
15604 \pgf@circuit@tubes@fullcathodefalse
15605 \else
15606 \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}}
15607 \fi
15608 \fi
15609
15610 % Draw the background
15611 \pgfusepath{draw}
15612 \endpgfscope
15613 }
15614 }
15615 }
15616
15617 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
15618
15619 \pgfcircdeclaretube{triode}
15620 {
15621 \anchor{grid} {% should not be used
15622 \northwest
15623 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15624 }
15625 \anchor{control} {%
15626 \northwest
15627 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15628 }
15629 }
15630 {
15631 % Grid protrusion
15632 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15633 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15634 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15635 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15636 % Grid dashes: calculations
15637 \pgf@xb=2\pgf@circ@res@right
15638 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
15639 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
15640 \multiply\pgf@circ@count@a by 2\relax
15641 \advance\pgf@circ@count@a by 1\relax
15642 \advance\pgf@circ@res@step by -\pgf@xa
15643 \divide\pgf@circ@res@step by \pgf@circ@count@a
15644 % Grid dashes: draw
15645 \pgf@circ@res@temp=\pgf@xa
15646 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
15647 \loop
15648 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15649 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15650 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15651 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15652 \advance\pgf@circ@count@a by-1
15653 \ifnum\pgf@circ@count@a>0\relax
15654 \repeat
15655 }
15656
15657 \pgfcircdeclaretube{tetrode}
15658 {
15659 \anchor{grid} {% should not be used
15660 \northwest
15661 \pgfutil@tempdima=\pgf@y
15662 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15663 \pgf@y=0.5\pgf@y
15664 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15665 }
15666 \anchor{control} {%
15667 \northwest
15668 \pgfutil@tempdima=\pgf@y
15669 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15670 \pgf@y=0.5\pgf@y
15671 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15672 }
15673 \anchor{screen} {%
15674 \northwest
15675 \pgfutil@tempdima=\pgf@y
15676 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
15677 \pgf@y=0.5\pgf@y
15678 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15679 }
15680 }
15681 {
15682 % Grid x/y points
15683 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15684 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15685 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
15686 \pgfutil@tempdimb=-\pgfutil@tempdima
15687 \pgfutil@tempdima=0.5\pgfutil@tempdima
15688 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15689 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
15690 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15691 % Grid protrusion
15692 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
15693 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
15694 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
15695 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
15696 % Grid dashes: calculations
15697 \pgf@xb=2\pgf@circ@res@right
15698 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
15699 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
15700 \multiply\pgf@circ@count@a by 2\relax
15701 \advance\pgf@circ@count@a by 1\relax
15702 \advance\pgf@circ@res@step by -\pgf@xa
15703 \divide\pgf@circ@res@step by \pgf@circ@count@a
15704 % Grid dashes: draw
15705 \pgf@circ@res@temp=\pgf@xa
15706 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
15707 \loop
15708 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15709 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
15710 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
15711 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
15712 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
15713 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15714 \advance\pgf@circ@count@a by-1
15715 \ifnum\pgf@circ@count@a>0\relax
15716 \repeat
15717 }
15718
15719 \pgfcircdeclaretube{pentode}
15720 {
15721 \anchor{grid} {% should not be used
15722 \northwest
15723 \pgfutil@tempdima=\pgf@y
15724 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15725 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15726 }
15727 \anchor{control} {%
15728 \northwest
15729 \pgfutil@tempdima=\pgf@y
15730 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15731 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15732 }
15733 \anchor{screen} {%
15734 \northwest
15735 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15736 }
15737 \anchor{suppressor} {%
15738 \northwest
15739 \pgfutil@tempdima=\pgf@y
15740 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
15741 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15742 }
15743 }
15744 {
15745 % Grid x/y points
15746 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15747 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15748 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
15749 \pgfutil@tempdimb=-\pgfutil@tempdima
15750 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15751 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15752 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15753 % Grid protrusion
15754 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
15755 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
15756 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
15757 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
15758 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
15759 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
15760 % Grid dashes: calculations
15761 \pgf@xb=2\pgf@circ@res@right
15762 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
15763 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
15764 \multiply\pgf@circ@count@a by 2\relax
15765 \advance\pgf@circ@count@a by 1\relax
15766 \advance\pgf@circ@res@step by -\pgf@xa
15767 \divide\pgf@circ@res@step by \pgf@circ@count@a
15768 % Grid dashes: draw
15769 \pgf@circ@res@temp=\pgf@xa
15770 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
15771 \loop
15772 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15773 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
15774 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
15775 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
15776 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
15777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
15778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
15779 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15780 \advance\pgf@circ@count@a by-1
15781 \ifnum\pgf@circ@count@a>0\relax
15782 \repeat
15783 }
15784
15785 \pgfcircdeclaretube{pentode suppressor to cathode}
15786 {
15787 \anchor{grid} {% should not be used
15788 \northwest
15789 \pgfutil@tempdima=\pgf@y
15790 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15791 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15792 }
15793 \anchor{control} {%
15794 \northwest
15795 \pgfutil@tempdima=\pgf@y
15796 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15797 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15798 }
15799 \anchor{screen} {%
15800 \northwest
15801 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15802 }
15803 }
15804 {
15805 % Grid x/y points
15806 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15807 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15808 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
15809 \pgfutil@tempdimb=-\pgfutil@tempdima
15810 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15811 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15812 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
15813 % Grid protrusion
15814 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
15815 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
15816 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
15817 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
15818 % Grid dashes: calculations
15819 \pgf@xb=2\pgf@circ@res@right
15820 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
15821 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
15822 \multiply\pgf@circ@count@a by 2\relax
15823 \advance\pgf@circ@count@a by 1\relax
15824 \advance\pgf@circ@res@step by -\pgf@xa
15825 \divide\pgf@circ@res@step by \pgf@circ@count@a
15826 % Grid dashes: draw
15827 \pgf@circ@res@temp=\pgf@xa
15828 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
15829 \loop
15830 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15831 \ifnum\pgf@circ@count@a>1\relax
15832 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
15833 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
15834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
15835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
15836 \fi
15837 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
15838 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
15839 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15840 \advance\pgf@circ@count@a by-1
15841 \ifnum\pgf@circ@count@a>0\relax
15842 \repeat
15843 % Grid: connection from suppressor to cathode
15844 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
15845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
15846 \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}}
15847
15848 }
15849
15850 %%%---------- close: tex/pgfcirctripoles
15851 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
15852 %%%---------- open: tex/pgfcircquadpoles.tex
15853 % Copyright 2018-2026 by Romano Giannetti
15854 % Copyright 2015-2026 by Stefan Lindner
15855 % Copyright 2013-2026 by Stefan Erhardt
15856 % Copyright 2007-2026 by Massimo Redaelli
15857 %
15858 % This file may be distributed and/or modified
15859 %
15860 % 1. under the LaTeX Project Public License and/or
15861 % 2. under the GNU Public License.
15862 %
15863 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
15864
15865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15866 %% Quadripoles
15867
15868 \long\def\pgfcircdeclarequadpole#1#2#3{
15869 \pgfdeclareshape{#1}
15870 {
15871 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
15872 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15873 % shapename
15874 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
15875 \anchor{center}{
15876 \northwest
15877 \pgf@x=0pt
15878 \pgf@y=0pt
15879 }
15880 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
15881 \savedanchor\northwest{%
15882 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15883 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
15884 \pgf@y=.5\pgf@y
15885 \pgf@x=.5\pgf@circ@scaled@Rlen
15886 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
15887 }
15888 %% we define the upper right (positive coord) dot (which is B1)
15889 \savedanchor{\innerdot}{%
15890 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15891 \pgf@xa=.5\pgf@circ@scaled@Rlen
15892 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
15893 % by default use the cute inductor size
15894 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
15895 % check if it's american
15896 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
15897 \edef\pgf@temp{american}
15898 \ifx\pgf@circ@temp\pgf@temp
15899 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
15900 \fi
15901 % check if it's european
15902 \edef\pgf@temp{european}
15903 \ifx\pgf@circ@temp\pgf@temp
15904 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
15905 \fi
15906 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
15907 }
15908 \savedanchor{\outerdot}{%
15909 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15910 \pgf@xa=.5\pgf@circ@scaled@Rlen
15911 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
15912 % by default use the cute inductor size
15913 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
15914 % check if it's american
15915 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
15916 \edef\pgf@temp{american}
15917 \ifx\pgf@circ@temp\pgf@temp
15918 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
15919 \fi
15920 % check if it's european
15921 \edef\pgf@temp{european}
15922 \ifx\pgf@circ@temp\pgf@temp
15923 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
15924 \fi
15925 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
15926 }
15927 \anchor{A2}{
15928 \northwest
15929 \pgf@y=-\pgf@y
15930 }
15931 \anchor{B1}{
15932 \northwest
15933 \pgf@x=-\pgf@x
15934 }
15935 \anchor{A1}{
15936 \northwest
15937 }
15938 \anchor{B2}{
15939 \northwest
15940 \pgf@x=-\pgf@x
15941 \pgf@y=-\pgf@y
15942 }
15943 %% dot's anchors
15944 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
15945 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
15946 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
15947 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
15948 \anchor{inner dot B1}{\innerdot}
15949 \anchor{outer dot B1}{\outerdot}
15950 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
15951 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
15952 % geographical
15953 \anchor{north}{
15954 \northwest
15955 \pgf@x=0pt
15956 }
15957 \anchor{south}{
15958 \northwest
15959 \pgf@x=0pt
15960 \pgf@y=-\pgf@y
15961 }
15962 \anchor{west}{
15963 \northwest
15964 \pgf@y=0pt
15965 }
15966 \anchor{east}{
15967 \northwest
15968 \pgf@y=0pt
15969 \pgf@x=-\pgf@x
15970 }
15971 \anchor{south west}{
15972 \northwest
15973 \pgf@y=-\pgf@y
15974 }
15975 \anchor{north east}{
15976 \northwest
15977 \pgf@x=-\pgf@x
15978 }
15979 \anchor{north west}{
15980 \northwest
15981 }
15982 \anchor{south east}{
15983 \northwest
15984 \pgf@x=-\pgf@x
15985 \pgf@y=-\pgf@y
15986 }
15987 \anchor{base}{
15988 \northwest
15989 \pgf@x=0pt
15990 }
15991 #3
15992 \backgroundpath{
15993 \pgfsetcolor{\ctikzvalof{color}}
15994
15995 \northwest
15996 \pgf@circ@res@up = \pgf@y
15997 \pgf@circ@res@down = -\pgf@y
15998 \pgf@circ@res@right = -\pgf@x
15999 \pgf@circ@res@left = \pgf@x
16000 #2
16001 }
16002 }
16003 }
16004
16005
16006 \def\pgf@circ@drawtransformerbasicanchor{
16007 \ctikzvalof{quadpoles/trans/height}
16008 \anchor{AA2}{
16009 \northwest
16010 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16011 \pgf@x=.7\pgf@x
16012 \pgf@y=-\pgf@y
16013 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16014 }
16015 \anchor{BB1}{
16016 \northwest
16017 \pgf@x=-\pgf@x
16018 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16019 \pgf@x=.7\pgf@x
16020 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16021 }
16022 \anchor{AA1}{
16023 \northwest
16024 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16025 \pgf@x=.7\pgf@x
16026 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16027 }
16028 \anchor{BB2}{
16029 \northwest
16030 \pgf@x=-\pgf@x
16031 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16032 \pgf@x=.7\pgf@x
16033 \pgf@y=-\pgf@y
16034 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16035 }
16036 }
16037
16038 %% Null styles that can be used to change individually the L1 and L2
16039 %% inductors of the transformer.
16040
16041 \ctikzset{transformer L1/.style={}}
16042 \ctikzset{transformer L2/.style={}}
16043
16044 \def\pgf@circ@drawtransformerbasicbody{
16045 \pgfscope
16046 \pgfslopedattimetrue
16047 \pgfallowupsidedownattimetrue
16048 \pgftransformlineattime{.5}{%
16049 \pgfpoint%
16050 {\stretto\pgf@circ@res@left}%
16051 {\pgf@circ@res@up}%
16052 }{%
16053 \pgfpoint
16054 {\stretto\pgf@circ@res@left}%
16055 {\pgf@circ@res@down}%
16056 }
16057
16058 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
16059 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
16060 \def\pgf@temp{european}%
16061 \ifx\pgf@temp\pgf@circ@temp%
16062 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16063 \else%
16064 \def\pgf@temp{cute}
16065 \ifx\pgf@temp\pgf@circ@temp%
16066 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16067 \else%
16068 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16069 \fi%
16070 \fi%
16071
16072
16073 \endpgfscope
16074 \pgfscope
16075 \pgfslopedattimetrue
16076 \pgfallowupsidedownattimetrue
16077 \pgftransformlineattime{.5}{%
16078 \pgfpoint%
16079 {\stretto\pgf@circ@res@right}%
16080 {\pgf@circ@res@down}%
16081 }{%
16082 \pgfpoint
16083 {\stretto\pgf@circ@res@right}%
16084 {\pgf@circ@res@up}%
16085 }
16086
16087 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
16088 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
16089 \def\pgf@temp{european}%
16090 \ifx\pgf@temp\pgf@circ@temp%
16091 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16092 \else%
16093 \def\pgf@temp{cute}
16094 \ifx\pgf@temp\pgf@circ@temp%
16095 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16096 \else%
16097 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16098 \fi%
16099 \fi%
16100
16101 \endpgfscope
16102
16103 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
16104 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
16105 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
16106
16107 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
16108 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
16109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
16110
16111 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
16112 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
16113 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
16114
16115 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
16116 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
16117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
16118
16119 \pgfusepath{draw}
16120
16121 }
16122
16123
16124 \pgfcircdeclarequadpole{transformer}{
16125 \pgf@circ@drawtransformerbasicbody
16126 }{\pgf@circ@drawtransformerbasicanchor}
16127
16128 \pgfcircdeclarequadpole{transformer core}{
16129
16130 \pgf@circ@drawtransformerbasicbody
16131
16132 % use the chocke line thickness
16133 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
16134
16135 % Find the distance from center for the lines representing the core
16136 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
16137 % of the whole component, now as a fraction of the distance between coils, to be
16138 % compatible with the quadpoles "inner" style.
16139 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
16140
16141 \pgfmoveto{\pgfpoint%
16142 {\pgf@circ@res@other}%
16143 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
16144 }
16145 \pgflineto{
16146 \pgfpoint%
16147 {\pgf@circ@res@other}%
16148 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
16149 }
16150
16151 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
16152 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
16153 \pgfmoveto{\pgfpoint%
16154 {\pgf@circ@res@other}%
16155 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
16156 }
16157 \pgflineto{
16158 \pgfpoint%
16159 {\pgf@circ@res@other}%
16160 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
16161 }
16162
16163 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
16164 \pgfusepath{draw}
16165 }{\pgf@circ@drawtransformerbasicanchor}
16166
16167
16168 \pgfcircdeclarequadpole{gyrator}{
16169
16170 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
16171 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
16172 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
16173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
16174
16175 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
16176 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
16177 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
16178 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
16179
16180 \pgfusepath{draw}
16181
16182 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
16183 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
16184 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
16185 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
16186 \pgfpathclose
16187 \pgf@circ@draworfill
16188
16189 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
16190 \pgfpatharc{90}{270}{\pgf@circ@res@other}
16191 \pgfpathclose
16192 \pgf@circ@draworfill
16193 }{}
16194
16195 %%%%%%%%%%%%%%%%%%%%
16196 %% Block elements
16197 %%%%%%%%%%%%%%%%%%%%
16198
16199 \pgfdeclareshape{mixer}
16200 {
16201 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16202 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16203 \savedanchor\northwest{
16204 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16205 \ifpgf@circuit@boxed
16206 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16207 \pgf@y=.5\pgf@y
16208 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16209 \pgf@x=.5\pgf@x
16210 \else
16211 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16212 \pgf@y=.5\pgf@y
16213 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16214 \pgf@x=.5\pgf@x
16215 \fi
16216 }
16217 \anchor{center}{
16218 \pgfpointorigin
16219 }
16220 \anchor{left}{%
16221 \northwest
16222 \pgf@y=0pt
16223 }
16224 \anchor{1}{
16225 \northwest
16226 \pgf@y=0pt
16227 }
16228 \anchor{2}{
16229 \northwest
16230 \pgf@y=-\pgf@y
16231 \pgf@x=0pt
16232 }
16233 \anchor{3}{
16234 \northwest
16235 \pgf@y=0pt
16236 \pgf@x=-\pgf@x
16237 }
16238 \anchor{4}{
16239 \northwest
16240 \pgf@y=\pgf@y
16241 \pgf@x=0pt
16242 }
16243 \anchor{in 1}{
16244 \northwest
16245 \pgf@y=0pt
16246 }
16247 \anchor{in1}{
16248 \northwest
16249 \pgf@y=0pt
16250 }
16251 \anchor{in}{
16252 \northwest
16253 \pgf@y=0pt
16254 }
16255 \anchor{in 2}{
16256 \northwest
16257 \pgf@y=-\pgf@y
16258 \pgf@x=0pt
16259 }
16260 \anchor{in2}{
16261 \northwest
16262 \pgf@y=-\pgf@y
16263 \pgf@x=0pt
16264 }
16265 \anchor{out}{
16266 \northwest
16267 \pgf@y=0pt
16268 \pgf@x=-\pgf@x
16269 }
16270 \anchor{center}{
16271 \pgf@y=0pt
16272 \pgf@x=0pt
16273 }
16274 \anchor{east}{
16275 \northwest
16276 \pgf@y=0pt
16277 \pgf@x=-\pgf@x
16278 }
16279 \anchor{west}{
16280 \northwest
16281 \pgf@y=0pt
16282 }
16283 \anchor{south}{
16284 \northwest
16285 \pgf@x=0pt
16286 \pgf@y=-\pgf@y
16287 }
16288 \anchor{north}{
16289 \northwest
16290 \pgf@x=0pt
16291 }
16292 \anchor{south west}{
16293 \northwest
16294 \pgf@y=-\pgf@y
16295 }
16296 \anchor{north east}{
16297 \northwest
16298 \pgf@x=-\pgf@x
16299 }
16300 \anchor{north west}{
16301 \northwest
16302 }
16303 \anchor{south east}{
16304 \northwest
16305 \pgf@x=-\pgf@x
16306 \pgf@y=-\pgf@y
16307 }
16308 \backgroundpath{
16309 \pgfsetcolor{\ctikzvalof{color}}
16310 \pgf@circ@scaled@Rlen=\scaledRlen
16311
16312 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16313
16314 \pgfscope
16315 \pgfstartlinewidth=\pgflinewidth
16316
16317 % draw outer box
16318 \ifpgf@circuit@boxed
16319 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16320 \fi
16321
16322 % draw outer circle
16323 \ifpgf@circuit@boxed
16324 \pgf@circ@res@step=.7\pgf@circ@res@step
16325 \pgfsetdash{}{0pt} % draw solid circle if boxed
16326 \else
16327 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16328 \fi
16329 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16330 \pgf@circ@draworfill
16331
16332 % draw inner stuff
16333 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16334 \pgfsetlinewidth{\pgfstartlinewidth}
16335 \pgfpathmoveto{\pgfpointorigin}
16336 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
16337 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
16338 \pgfpathmoveto{\pgfpointorigin}
16339 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
16340 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
16341 \pgfusepath{draw}
16342
16343 \endpgfscope
16344 }
16345 }
16346
16347 \pgfdeclareshape{adder}
16348 {
16349 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16350 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16351 \savedanchor\northwest{
16352 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16353 \ifpgf@circuit@boxed
16354 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16355 \pgf@y=.5\pgf@y
16356 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16357 \pgf@x=.5\pgf@x
16358 \else
16359 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16360 \pgf@y=.5\pgf@y
16361 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16362 \pgf@x=.5\pgf@x
16363 \fi
16364 }
16365 \anchor{center}{
16366 \pgfpointorigin
16367 }
16368 \anchor{left}{%
16369 \northwest
16370 \pgf@y=0pt
16371 }
16372 \anchor{1}{
16373 \northwest
16374 \pgf@y=0pt
16375 }
16376 \anchor{2}{
16377 \northwest
16378 \pgf@y=-\pgf@y
16379 \pgf@x=0pt
16380 }
16381 \anchor{3}{
16382 \northwest
16383 \pgf@y=0pt
16384 \pgf@x=-\pgf@x
16385 }
16386 \anchor{4}{
16387 \northwest
16388 \pgf@y=\pgf@y
16389 \pgf@x=0pt
16390 }
16391 \anchor{in 1}{
16392 \northwest
16393 \pgf@y=0pt
16394 }
16395 \anchor{in1}{
16396 \northwest
16397 \pgf@y=0pt
16398 }
16399 \anchor{in}{
16400 \northwest
16401 \pgf@y=0pt
16402 }
16403 \anchor{in 2}{
16404 \northwest
16405 \pgf@y=-\pgf@y
16406 \pgf@x=0pt
16407 }
16408 \anchor{in2}{
16409 \northwest
16410 \pgf@y=-\pgf@y
16411 \pgf@x=0pt
16412 }
16413 \anchor{out}{
16414 \northwest
16415 \pgf@y=0pt
16416 \pgf@x=-\pgf@x
16417 }
16418 \anchor{center}{
16419 \pgf@y=0pt
16420 \pgf@x=0pt
16421 }
16422 \anchor{east}{
16423 \northwest
16424 \pgf@y=0pt
16425 \pgf@x=-\pgf@x
16426 }
16427 \anchor{west}{
16428 \northwest
16429 \pgf@y=0pt
16430 }
16431 \anchor{south}{
16432 \northwest
16433 \pgf@x=0pt
16434 \pgf@y=-\pgf@y
16435 }
16436 \anchor{north}{
16437 \northwest
16438 \pgf@x=0pt
16439 }
16440 \anchor{south west}{
16441 \northwest
16442 \pgf@y=-\pgf@y
16443 }
16444 \anchor{north east}{
16445 \northwest
16446 \pgf@x=-\pgf@x
16447 }
16448 \anchor{north west}{
16449 \northwest
16450 }
16451 \anchor{south east}{
16452 \northwest
16453 \pgf@x=-\pgf@x
16454 \pgf@y=-\pgf@y
16455 }
16456 \backgroundpath{
16457 \pgfsetcolor{\ctikzvalof{color}}
16458 \pgf@circ@scaled@Rlen=\scaledRlen
16459
16460 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16461
16462 \pgfscope
16463 \pgfstartlinewidth=\pgflinewidth
16464
16465 % draw outer box
16466 \ifpgf@circuit@boxed
16467 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16468 \fi
16469
16470 % draw outer circle
16471 \ifpgf@circuit@boxed
16472 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16473 \pgfsetdash{}{0pt} % draw solid circle if boxed
16474 \else
16475 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16476 \fi
16477 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16478 \pgf@circ@draworfill
16479
16480 % draw inner stuff
16481 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16482 \pgfsetlinewidth{\pgfstartlinewidth}
16483
16484 \pgfpathmoveto{\pgfpointorigin}
16485 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
16486 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
16487 \pgfpathmoveto{\pgfpointorigin}
16488 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
16489 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
16490 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16491 \pgfusepath{draw}
16492
16493 \endpgfscope
16494 }
16495 }
16496
16497 \pgfdeclareshape{oscillator}
16498 {
16499 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16500 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16501 \savedanchor\northwest{
16502 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16503 \ifpgf@circuit@boxed
16504 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16505 \pgf@y=.5\pgf@y
16506 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16507 \else
16508 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
16509 \pgf@y=.5\pgf@y
16510 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
16511 \fi
16512 }
16513 \anchor{center}{
16514 \pgfpointorigin
16515 }
16516 \anchor{north}{
16517 \northwest
16518 \pgf@x=.5\pgf@x
16519 }
16520 \anchor{south}{
16521 \northwest
16522 \pgf@x=.5\pgf@x
16523 \pgf@y=-\pgf@y
16524 }
16525 \anchor{east}{
16526 \northwest
16527 \pgf@y=0pt
16528 \pgf@x=0pt
16529 }
16530 \anchor{west}{
16531 \northwest
16532 \pgf@y=0pt
16533 }
16534 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
16535 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
16536 \anchor{north west}{ \northwest }
16537 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16538 \anchor{text}{
16539 \pgf@x=-2\pgf@x
16540 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16541 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
16542 }
16543 \backgroundpath{
16544 \pgfsetcolor{\ctikzvalof{color}}
16545 \pgf@circ@scaled@Rlen=\scaledRlen
16546
16547 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
16548
16549 \pgfscope
16550 \pgfstartlinewidth=\pgflinewidth
16551
16552 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
16553
16554 % draw outer box
16555 \ifpgf@circuit@boxed{}
16556 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16557 \fi
16558
16559 % draw outer circle
16560 \ifpgf@circuit@boxed
16561 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16562 \pgfsetdash{}{0pt} % draw solid circle if boxed
16563 \else
16564 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16565 \fi
16566 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16567 \pgf@circ@draworfill
16568
16569 % draw inner sine waves
16570 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16571 \pgfsetlinewidth{\pgfstartlinewidth}
16572 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
16573 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
16574 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
16575 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
16576 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
16577 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
16578
16579 \pgfusepath{draw}
16580
16581 \endpgfscope
16582 }
16583 }
16584
16585 \pgfdeclareshape{circulator}
16586 {
16587 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16588 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16589 \savedanchor\northwest{
16590 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16591 \ifpgf@circuit@boxed
16592 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16593 \pgf@y=.5\pgf@y
16594 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16595 \pgf@x=.5\pgf@x
16596 \else
16597 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16598 \pgf@y=.5\pgf@y
16599 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16600 \pgf@x=.5\pgf@x
16601 \fi
16602 }
16603 \anchor{center}{
16604 \pgfpointorigin
16605 }
16606 \anchor{left}{%
16607 \northwest
16608 \pgf@y=0pt
16609 }
16610 \anchor{1}{
16611 \northwest
16612 \pgf@y=0pt
16613 }
16614 \anchor{2}{
16615 \northwest
16616 \pgf@y=0pt
16617 \pgf@x=-\pgf@x
16618 }
16619 \anchor{3}{
16620 \northwest
16621 \pgf@y=-\pgf@y
16622 \pgf@x=0pt
16623 }
16624 \anchor{east}{
16625 \northwest
16626 \pgf@y=0pt
16627 \pgf@x=-\pgf@x
16628 }
16629 \anchor{west}{
16630 \northwest
16631 \pgf@y=0pt
16632 }
16633 \anchor{south}{
16634 \northwest
16635 \pgf@x=0pt
16636 \pgf@y=-\pgf@y
16637 }
16638 \anchor{north}{
16639 \northwest
16640 \pgf@x=0pt
16641 }
16642 \anchor{south west}{
16643 \northwest
16644 \pgf@y=-\pgf@y
16645 }
16646 \anchor{north east}{
16647 \northwest
16648 \pgf@x=-\pgf@x
16649 }
16650 \anchor{north west}{
16651 \northwest
16652 }
16653 \anchor{south east}{
16654 \northwest
16655 \pgf@x=-\pgf@x
16656 \pgf@y=-\pgf@y
16657 }
16658 \backgroundpath{
16659 \pgfsetcolor{\ctikzvalof{color}}
16660 \pgf@circ@scaled@Rlen=\scaledRlen
16661
16662 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16663
16664 \pgfscope
16665 \pgfstartlinewidth=\pgflinewidth
16666
16667 % draw outer box
16668 \ifpgf@circuit@boxed
16669 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16670 \fi
16671
16672 % draw outer circle
16673 \ifpgf@circuit@boxed{}
16674 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16675 \pgfsetdash{}{0pt} % draw solid circle if boxed
16676 \else
16677 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16678 \fi
16679 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16680 \pgf@circ@draworfill
16681
16682 % inner arrow
16683 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16684 \pgfsetlinewidth{\pgfstartlinewidth}
16685
16686 \pgfsetarrowsend{latex}
16687 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
16688 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
16689 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
16690 \pgfusepath{draw}
16691
16692 \endpgfscope
16693 }
16694 }
16695
16696 %% gridnode
16697 \pgfdeclareshape{gridnode}
16698 {
16699 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16700 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16701 \savedanchor\northwest{
16702 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16703 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
16704 \pgf@y=.5\pgf@y
16705 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
16706 \pgf@x=.5\pgf@x
16707 }
16708 \anchor{center}{
16709 \pgfpointorigin
16710 }
16711
16712 \anchor{north}{
16713 \northwest
16714 \pgf@x=0pt
16715 }
16716 \anchor{up}{
16717 \northwest
16718 \pgf@x=0pt
16719 }
16720 \anchor{south}{
16721 \northwest
16722 \pgf@x=0pt
16723 \pgf@y=-\pgf@y
16724 }
16725 \anchor{down}{
16726 \northwest
16727 \pgf@x=0pt
16728 \pgf@y=-\pgf@y
16729 }
16730 \anchor{east}{
16731 \northwest
16732 \pgf@y=0pt
16733 \pgf@x=-\pgf@x
16734 }
16735 \anchor{right}{
16736 \northwest
16737 \pgf@y=0pt
16738 \pgf@x=-\pgf@x
16739 }
16740 \anchor{west}{
16741 \northwest
16742 \pgf@y=0pt
16743 }
16744 \anchor{left}{
16745 \northwest
16746 \pgf@y=0pt
16747 }
16748 \anchor{south west}{
16749 \northwest
16750 \pgf@y=-\pgf@y
16751 }
16752 \anchor{north east}{
16753 \northwest
16754 \pgf@x=-\pgf@x
16755 \relax
16756 }
16757 \anchor{north west}{
16758 \northwest
16759 }
16760 \anchor{south east}{
16761 \northwest
16762 \pgf@x=-\pgf@x
16763 \pgf@y=-\pgf@y
16764 }
16765 \anchor{text}{
16766 \pgf@x=-2\pgf@x
16767 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16768 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
16769 }
16770 \backgroundpath{
16771 \pgfsetcolor{\ctikzvalof{color}}
16772 \pgf@circ@scaled@Rlen=\scaledRlen
16773
16774 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
16775
16776 \northwest
16777 \pgf@circ@res@up = \pgf@y
16778 \pgf@circ@res@down = -\pgf@y
16779 \pgf@circ@res@right = -\pgf@x
16780 \pgf@circ@res@left = \pgf@x
16781
16782 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
16783 \divide \pgf@circ@res@step by 2
16784
16785 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
16786 \pgf@circ@res@other = \pgf@circ@res@left
16787 \advance\pgf@circ@res@other by \pgf@circ@res@step
16788
16789 \ifpgf@circuit@dashed
16790 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
16791 \fi
16792
16793 % draw outer box
16794 \pgf@circ@twoportbox
16795
16796
16797 \ifpgf@circuit@inputarrow
16798 {
16799 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
16800 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
16801 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
16802 }
16803 \fi
16804
16805 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16806 \pgfsetarrows{-} %never draw arrows
16807 \pgfsetlinewidth{0.05mm}
16808
16809 % draw grid
16810 \foreach \line in {-1,-.5,...,1}
16811 {
16812 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
16813 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
16814
16815 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
16816 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
16817 }
16818
16819 %prevent from draw the inner cross twice
16820 \foreach \line in {-.5,0,...,.5}
16821 {
16822 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
16823 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
16824
16825 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
16826 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
16827 }
16828 \pgfusepath{draw}
16829 }
16830 }
16831
16832
16833 % Wilkinson divider
16834 \pgfdeclareshape{wilkinson}{
16835 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16836 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16837 \savedanchor\northwest{%
16838 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16839 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
16840 \pgf@y=.5\pgf@y
16841 \pgf@x= \pgf@circ@scaled@Rlen
16842 \pgf@x=.5\pgf@x
16843 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
16844 }
16845 \anchor{center}{
16846 \northwest
16847 \pgf@x=0pt
16848 \pgf@y=0pt
16849 }
16850 \anchor{north}{
16851 \northwest
16852 \pgf@x=0pt
16853 }
16854 \anchor{south}{
16855 \northwest
16856 \pgf@x=0pt
16857 \pgf@y=-\pgf@y
16858 }
16859 \anchor{west}{
16860 \northwest
16861 \pgf@y=0pt
16862 }
16863 \anchor{east}{
16864 \northwest
16865 \pgf@y=0pt
16866 \pgf@x=-\pgf@x
16867 }
16868 \anchor{south west}{
16869 \northwest
16870 \pgf@y=-\pgf@y
16871 }
16872 \anchor{north east}{
16873 \northwest
16874 \pgf@x=-\pgf@x
16875 }
16876 \anchor{north west}{
16877 \northwest
16878 }
16879 \anchor{south east}{
16880 \northwest
16881 \pgf@x=-\pgf@x
16882 \pgf@y=-\pgf@y
16883 }
16884 \anchor{in}{
16885 \northwest
16886 \pgf@y=0pt
16887 }
16888 \anchor{out1}{
16889 \northwest
16890 \pgf@x=-\pgf@x
16891 \pgf@y=-0.5\pgf@y
16892 }
16893 \anchor{out2}{
16894 \northwest
16895 \pgf@x=-\pgf@x
16896 \pgf@y=0.5\pgf@y
16897 }
16898 \anchor{text}{
16899 \northwest
16900 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
16901 \pgf@x=-.5\wd\pgfnodeparttextbox
16902 }
16903 \backgroundpath{
16904 \pgfsetcolor{\ctikzvalof{color}}
16905 \pgf@circ@scaled@Rlen=\scaledRlen
16906
16907 \northwest
16908 \pgf@circ@res@up = \pgf@y
16909 \pgf@circ@res@down = -\pgf@y
16910 \pgf@circ@res@right = -\pgf@x
16911 \pgf@circ@res@left = \pgf@x
16912
16913 \pgfstartlinewidth=\pgflinewidth
16914
16915 % draw outer box
16916 \pgf@circ@twoportbox
16917
16918 % draw inner stuff
16919 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16920 \pgfsetarrows{-} %never draw arrows
16921 \pgfsetlinewidth{\pgfstartlinewidth}
16922 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
16923 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
16924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
16925 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
16926 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
16927 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
16928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
16929
16930 \pgfusepath{draw}
16931
16932 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16933 % draw inner resisitor - european or american style is recognised
16934 {
16935 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
16936 \pgftransformrotate{90}
16937
16938 % calculate size of resistor
16939 \ifpgf@circuit@europeanresistor
16940 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
16941 \pgftransformscale{\pgfmathresult}
16942 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
16943 \else
16944 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
16945 \pgftransformscale{\pgfmathresult}
16946 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
16947 \fi
16948 }
16949
16950 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
16951 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
16952
16953 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
16954 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
16955 \pgfusepath{draw}
16956
16957 }
16958 }
16959
16960 %% couplers generics
16961 \long\def\pgfcircdeclarefourport#1#2{
16962
16963 \pgfdeclareshape{#1}{
16964 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16965 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16966 \anchor{center}{
16967 \northwest
16968 \pgf@x=0pt
16969 \pgf@y=0pt
16970 }
16971 \savedanchor\northwest{%
16972 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16973 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
16974 \pgf@y=.5\pgf@y
16975 \pgf@x=.5\pgf@circ@scaled@Rlen
16976 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
16977 }
16978 \anchor{north}{
16979 \northwest
16980 \pgf@x=0pt
16981 }
16982 \anchor{south}{
16983 \northwest
16984 \pgf@x=0pt
16985 \pgf@y=-\pgf@y
16986 }
16987 \anchor{west}{
16988 \northwest
16989 \pgf@y=0pt
16990 }
16991 \anchor{east}{
16992 \northwest
16993 \pgf@y=0pt
16994 \pgf@x=-\pgf@x
16995 }
16996 \anchor{south west}{
16997 \northwest
16998 \pgf@y=-\pgf@y
16999 }
17000 \anchor{north east}{
17001 \northwest
17002 \pgf@x=-\pgf@x
17003 }
17004 \anchor{north west}{
17005 \northwest
17006 }
17007 \anchor{south east}{
17008 \northwest
17009 \pgf@x=-\pgf@x
17010 \pgf@y=-\pgf@y
17011 }
17012 \anchor{port1}{
17013 \northwest
17014 \pgf@y=-0.5\pgf@y
17015 }
17016 \anchor{port2}{
17017 \northwest
17018 \pgf@x=-\pgf@x
17019 \pgf@y=-0.5\pgf@y
17020 }
17021 \anchor{port3}{
17022 \northwest
17023 \pgf@x=-\pgf@x
17024 \pgf@y=0.5\pgf@y
17025 }
17026 \anchor{port4}{
17027 \northwest
17028 \pgf@y=0.5\pgf@y
17029 }
17030 \anchor{1}{
17031 \northwest
17032 \pgf@y=-0.5\pgf@y
17033 }
17034 \anchor{2}{
17035 \northwest
17036 \pgf@x=-\pgf@x
17037 \pgf@y=-0.5\pgf@y
17038 }
17039 \anchor{3}{
17040 \northwest
17041 \pgf@x=-\pgf@x
17042 \pgf@y=0.5\pgf@y
17043 }
17044 \anchor{4}{
17045 \northwest
17046 \pgf@y=0.5\pgf@y
17047 }
17048
17049 \anchor{text}{
17050 \northwest
17051 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
17052 \pgf@x=-.5\wd\pgfnodeparttextbox
17053 }
17054 \backgroundpath{
17055 \pgfsetcolor{\ctikzvalof{color}}
17056
17057 \northwest
17058 \pgf@circ@res@up = \pgf@y
17059 \pgf@circ@res@down = -\pgf@y
17060 \pgf@circ@res@right = -\pgf@x
17061 \pgf@circ@res@left = \pgf@x
17062 \pgf@circ@scaled@Rlen=\scaledRlen
17063
17064 \pgfstartlinewidth=\pgflinewidth
17065
17066 % draw outer box
17067 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17068 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17069 \pgf@circ@draworfill
17070
17071 % draw inner stuff
17072 #2
17073
17074 % draw inner text
17075 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
17076 }
17077 }
17078 }
17079
17080 % four-port
17081 \pgfcircdeclarefourport{fourport}{}
17082
17083 % straight coupler
17084 \pgfcircdeclarefourport{coupler}{
17085 \pgfsetlinewidth{\pgfstartlinewidth}
17086 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
17087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17088 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
17089 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17090 \pgfusepath{draw}
17091
17092 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
17093 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
17094 \pgfsetarrows{latex-latex}
17095 \pgfusepath{draw}
17096 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
17097 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
17098 \pgfsetarrows{latex-latex}
17099 \pgfusepath{draw}
17100 }
17101
17102 % "bended" coupler
17103 \pgfcircdeclarefourport{coupler2}{
17104 \pgfsetlinewidth{\pgfstartlinewidth}
17105 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
17106 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17107 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
17108 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17109 \pgfusepath{draw}
17110
17111 \pgfscope
17112 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
17113 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
17114 \pgfsetarrowsend{latex}
17115 \pgfusepath{draw}
17116 \endpgfscope
17117 \pgfscope
17118 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
17119 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
17120 \pgfsetarrowsend{latex}
17121 \pgfusepath{draw}
17122 \endpgfscope
17123 \pgfscope
17124 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
17125 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
17126 \pgfsetarrowsend{latex}
17127 \pgfusepath{draw}
17128 \endpgfscope
17129 \pgfscope
17130 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
17131 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
17132 \pgfsetarrowsend{latex}
17133 \pgfusepath{draw}
17134 \endpgfscope
17135 }
17136
17137 %%%---------- close: tex/pgfcircquadpoles
17138 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
17139 %%%---------- open: tex/pgfcircmultipoles.tex
17140 % Copyright 2018-2026 by Romano Giannetti
17141 % Copyright 2015-2026 by Stefan Lindner
17142 % Copyright 2013-2026 by Stefan Erhardt
17143 % Copyright 2007-2026 by Massimo Redaelli
17144 %
17145 % This file may be distributed and/or modified
17146 %
17147 % 1. under the LaTeX Project Public License and/or
17148 % 2. under the GNU Public License.
17149 %
17150 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
17151
17152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17153 %% Multipoles by Romano Giannetti
17154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17155
17156 %%%%%%%%%
17157 %% Chips
17158 %%%%%%%%%
17159
17160 % let's use the same shifts everywhere, no magic numbers
17161 \def\pgf@circ@dip@pin@shift{0.5}
17162 \def\pgf@circ@qfp@pin@shift{0.25}
17163
17164 % derived from https://tex.stackexchange.com/a/146753/38080
17165 % original author Mark Wibrow
17166 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
17167 % a lot of thanks to @marmot for the un-rotation hint
17168 % https://tex.stackexchange.com/a/473571/38080
17169
17170 % DIP (dual in line package) chips
17171
17172 \pgfdeclareshape{dipchip}{
17173 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
17174 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17175 \savedmacro\numpins{%
17176 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
17177 \def\numpins{\the\pgf@circ@count@a}
17178 }
17179 \savedanchor\centerpoint{%
17180 \pgf@x=-.5\wd\pgfnodeparttextbox%
17181 \pgf@y=-.5\ht\pgfnodeparttextbox%
17182 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
17183 }%
17184 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
17185 \anchor{center}{\origin}
17186 \anchor{text}{\centerpoint}% to adjust text
17187 \saveddimen\height{%
17188 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17189 \pgfmathsetlength\pgf@x{((\numpins)
17190 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
17191 }%
17192 \saveddimen{\chipspacing}{
17193 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17194 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
17195 \saveddimen{\width}{
17196 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17197 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
17198 \saveddimen{\extshift}{
17199 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17200 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
17201 % standard anchors
17202 \savedanchor\northwest{%
17203 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17204 \pgfmathsetlength\pgf@y{0.5*((\numpins)
17205 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
17206 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
17207 }
17208 \anchor{dot}{\northwest
17209 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
17210 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
17211 }
17212 \anchor{nw}{\northwest}
17213 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
17214 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17215 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
17216 \anchor{north west}{\northwest}
17217 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
17218 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
17219 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
17220 \anchor{n}{\northwest\pgf@x=0pt }
17221 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17222 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17223 \anchor{w}{\northwest\pgf@y=0pt }
17224 \anchor{north}{\northwest\pgf@x=0pt }
17225 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17226 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17227 \anchor{west}{\northwest\pgf@y=0pt }
17228 % start drawing
17229 \backgroundpath{%
17230 \northwest
17231 \pgf@circ@res@up = \pgf@y
17232 \pgf@circ@res@down = -\pgf@y
17233 \pgf@circ@res@right = -\pgf@x
17234 \pgf@circ@res@left = \pgf@x
17235 \pgf@circ@scaled@Rlen=\scaledRlen
17236 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
17237 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
17238 \pgfscope% (for the line width)
17239 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17240 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
17241 \pgf@circ@draworfill
17242 %% upside mark
17243 \ifpgf@circuit@chip@topmark
17244 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
17245 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
17246 \fi
17247 \pgfusepath{stroke}%
17248 \pgfsetcolor{\ctikzvalof{color}}
17249 % Adding the pin number
17250 \ifpgf@circuit@chip@shownumbers
17251 \pgf@circ@count@a=\numpins\relax
17252 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17253 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
17254 \ifpgf@circuit@chip@straightnumbers
17255 \pgfgettransformentries\a\b\temp\temp\temp\temp
17256 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
17257 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
17258 \else
17259 \pgfmathsetmacro{\rot}{0}
17260 \pgfmathsetmacro{\quadrant}{0}
17261 \fi
17262 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
17263 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
17264 \pgfmathloop%
17265 \ifnum\pgf@circ@count@a>0
17266 \ifcase\quadrant % rotation 0
17267 % left
17268 \pgf@circ@count@c=\pgf@circ@count@a
17269 \pgftext[left,
17270 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17271 rotate=\rot]{\mytext}
17272 % right
17273 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17274 \pgftext[right,
17275 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17276 rotate=\rot]{\mytext}
17277 \or % rotation -90
17278 % left
17279 \pgf@circ@count@c=\pgf@circ@count@a
17280 \pgftext[top,
17281 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17282 rotate=\rot]{\mytext}
17283 % right
17284 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17285 \pgftext[bottom,
17286 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17287 rotate=\rot]{\mytext}
17288 \or %rotation 180
17289 % left
17290 \pgf@circ@count@c=\pgf@circ@count@a
17291 \pgftext[right,
17292 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17293 rotate=\rot]{\mytext}
17294 % right
17295 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17296 \pgftext[left,
17297 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17298 rotate=\rot]{\mytext}
17299 \or % rotation +90
17300 % left
17301 \pgf@circ@count@c=\pgf@circ@count@a
17302 \pgftext[bottom,
17303 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17304 rotate=\rot]{\mytext}
17305 % right
17306 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17307 \pgftext[top,
17308 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17309 rotate=\rot]{\mytext}
17310 \fi
17311 \advance\pgf@circ@count@a-1\relax%
17312 \repeatpgfmathloop
17313 \fi
17314 \endpgfscope
17315 \ifdim\pgf@circ@res@other>0pt
17316 \pgfscope
17317 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17318 \pgf@circ@count@a=\numpins\relax
17319 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17320 \pgfmathloop%
17321 \ifnum\pgf@circ@count@a>0
17322 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
17323 \ifnum\padfrac>0
17324 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
17325 % left side pads
17326 \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}}
17327 \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}}
17328 \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}}
17329 \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}}
17330 % right side pads
17331 \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}}
17332 \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}}
17333 \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}}
17334 \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}}
17335 \else
17336 % left side pins
17337 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17338 \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}}
17339 % right side pins
17340 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17341 \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}}
17342 \fi
17343 \advance\pgf@circ@count@a by -1\relax%
17344 \repeatpgfmathloop
17345 \pgfusepath{stroke}
17346 \endpgfscope
17347 \fi
17348 }%
17349 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17350 % and is executed just before a node is drawn.
17351 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
17352 % Start with the maximum pin number and go backwards.
17353 \pgf@circ@count@a=\numpins\relax
17354 \pgfmathloop%
17355 \ifnum\pgf@circ@count@a>0
17356 % we will create two anchors per pin: the "normal one" like `pin 1` for the
17357 % electrical contact, and the "border one" like `bpin 1` for labels.
17358 % they will coincide if `external pins width` is set to 0.
17359 \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
17360 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
17361 }
17362 \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
17363 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
17364 }
17365 \advance\pgf@circ@count@a by -1\relax%
17366 \repeatpgfmathloop%
17367 }%
17368 }
17369
17370 % QFP (quad flat package) chips
17371
17372 \pgfdeclareshape{qfpchip}{
17373 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
17374 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17375 \savedmacro\numpins{%
17376 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
17377 \def\numpins{\the\pgf@circ@count@a}
17378 }
17379 \savedanchor\centerpoint{%
17380 \pgf@x=-.5\wd\pgfnodeparttextbox%
17381 \pgf@y=-.5\ht\pgfnodeparttextbox%
17382 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
17383 }%
17384 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
17385 \anchor{center}{\origin}
17386 \anchor{text}{\centerpoint}% to adjust text
17387 \saveddimen\height{%
17388 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17389 \pgfmathsetlength\pgf@x{((\numpins+2)
17390 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17391 }%
17392 \saveddimen\width{%
17393 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17394 \pgfmathsetlength\pgf@x{((\numpins+2)
17395 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17396 }%
17397 \saveddimen{\chipspacing}{
17398 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17399 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
17400 \saveddimen{\extshift}{
17401 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17402 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
17403 % standard anchors
17404 \savedanchor\northwest{%
17405 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17406 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
17407 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17408 \pgf@x=-\pgf@y
17409 }
17410 \anchor{dot}{\northwest
17411 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
17412 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
17413 }
17414 \anchor{nw}{\northwest}
17415 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
17416 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17417 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
17418 \anchor{north west}{\northwest}
17419 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
17420 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
17421 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
17422 \anchor{n}{\northwest\pgf@x=0pt }
17423 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17424 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17425 \anchor{w}{\northwest\pgf@y=0pt }
17426 \anchor{north}{\northwest\pgf@x=0pt }
17427 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17428 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17429 \anchor{west}{\northwest\pgf@y=0pt }
17430 % start drawing
17431 \backgroundpath{%
17432 \northwest
17433 \pgf@circ@res@up = \pgf@y
17434 \pgf@circ@res@down = -\pgf@y
17435 \pgf@circ@res@right = -\pgf@x
17436 \pgf@circ@res@left = \pgf@x
17437 \pgf@circ@scaled@Rlen=\scaledRlen
17438 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
17439 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
17440 \pgfscope% (for the line width)
17441 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17442 %% upside mark
17443 \ifpgf@circuit@chip@topmark
17444 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
17445 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
17446 \else
17447 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
17448 \fi
17449 %% rest of the shape
17450 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
17451 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
17452 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
17453 \pgfpathclose
17454 \pgf@circ@draworfill
17455 % Adding the pin number
17456 \pgfsetcolor{\ctikzvalof{color}}
17457 \ifpgf@circuit@chip@shownumbers
17458 \pgf@circ@count@a=\numpins%
17459 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
17460 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
17461 \ifpgf@circuit@chip@straightnumbers
17462 \pgfgettransformentries\a\b\temp\temp\temp\temp
17463 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
17464 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
17465 \else
17466 \pgfmathsetmacro{\rot}{0}
17467 \pgfmathsetmacro{\quadrant}{0}
17468 \fi
17469 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
17470 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
17471 \pgfmathloop%
17472 \ifnum\pgf@circ@count@a>0
17473 \ifcase\quadrant % rotation 0
17474 % left
17475 \pgf@circ@count@c=\pgf@circ@count@a
17476 \pgftext[left,
17477 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17478 rotate=\rot]{\mytext}
17479 % bottom
17480 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17481 \pgftext[bottom,
17482 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17483 rotate=\rot]{\mytext}
17484 % right
17485 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17486 \pgftext[right,
17487 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17488 rotate=\rot]{\mytext}
17489 % top
17490 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17491 \pgftext[top,
17492 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17493 rotate=\rot]{\mytext}
17494 \or % rotation -90
17495 % left
17496 \pgf@circ@count@c=\pgf@circ@count@a
17497 \pgftext[top,
17498 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17499 rotate=\rot]{\mytext}
17500 % bottom
17501 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17502 \pgftext[left,
17503 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17504 rotate=\rot]{\mytext}
17505 % right
17506 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17507 \pgftext[bottom,
17508 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17509 rotate=\rot]{\mytext}
17510 % top
17511 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17512 \pgftext[right,
17513 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17514 rotate=\rot]{\mytext}
17515 \or %rotation 180
17516 % left
17517 \pgf@circ@count@c=\pgf@circ@count@a
17518 \pgftext[right,
17519 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17520 rotate=\rot]{\mytext}
17521 % bottom
17522 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17523 \pgftext[top,
17524 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17525 rotate=\rot]{\mytext}
17526 % right
17527 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17528 \pgftext[left,
17529 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17530 rotate=\rot]{\mytext}
17531 % top
17532 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17533 \pgftext[bottom,
17534 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17535 rotate=\rot]{\mytext}
17536 \or % rotation +90
17537 % left
17538 \pgf@circ@count@c=\pgf@circ@count@a
17539 \pgftext[bottom,
17540 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17541 rotate=\rot]{\mytext}
17542 % bottom
17543 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17544 \pgftext[right,
17545 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17546 rotate=\rot]{\mytext}
17547 % right
17548 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17549 \pgftext[top,
17550 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17551 rotate=\rot]{\mytext}
17552 % top
17553 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17554 \pgftext[left,
17555 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17556 rotate=\rot]{\mytext}
17557 \fi
17558 \advance\pgf@circ@count@a-1\relax%
17559 \repeatpgfmathloop
17560 \fi
17561 \endpgfscope
17562 \ifdim\pgf@circ@res@other>0pt
17563 \pgfscope
17564 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17565 \pgf@circ@count@a=\numpins%
17566 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
17567 \pgfmathloop%
17568 \ifnum\pgf@circ@count@a>0
17569 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
17570 \ifnum\padfrac>0
17571 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
17572 % left side pads
17573 \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}}
17574 \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}}
17575 \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}}
17576 \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}}
17577 % bottom side pads
17578 \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}}
17579 \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}}
17580 \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}}
17581 \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}}
17582 % right side pads
17583 \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}}
17584 \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}}
17585 \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}}
17586 \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}}
17587 % top side pads
17588 \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}}
17589 \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}}
17590 \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}}
17591 \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}}
17592 \else
17593 % left side pins
17594 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17595 \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}}
17596 % bottom side pins
17597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
17598 \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}}
17599 % right side pins
17600 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17601 \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}}
17602 % top side pins
17603 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
17604 \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}}
17605 \fi
17606 \advance\pgf@circ@count@a-1\relax%
17607 \repeatpgfmathloop
17608 \pgfusepath{stroke}
17609 \endpgfscope
17610 \fi
17611 }%
17612 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17613 % and is executed just before a node is drawn.
17614 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
17615 % Start with the maximum pin number and go backwards.
17616 \pgf@circ@count@a=\numpins%
17617 \pgfmathloop%
17618 \ifnum\pgf@circ@count@a>0
17619 \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
17620 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
17621 }
17622 \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
17623 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
17624 }
17625 \advance\pgf@circ@count@a-1\relax%
17626 \repeatpgfmathloop%
17627 }%
17628 }
17629
17630 %% anchors for DIP
17631 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17632 \c@pgf@countc=\numpins\relax
17633 \divide\c@pgf@countc by 2
17634 \ifnum #1 > \the\c@pgf@countc
17635 % right side
17636 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
17637 \else
17638 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
17639 \fi
17640 }
17641
17642 %% anchors for QFP
17643 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17644 \c@pgf@countc=\numpins\relax
17645 \divide\c@pgf@countc by 4
17646 \ifnum #1 > \the\c@pgf@countc
17647 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
17648 \ifnum #1 > \the\c@pgf@countb
17649 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
17650 \ifnum #1 > \the\c@pgf@countb
17651 % 3*npins/4 < pin, top side
17652 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
17653 \else
17654 % 2*npins/4 < pin <= 3*npins/4, right side
17655 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
17656 \fi
17657 \else
17658 % npins/4 < pin <= 2*npins/4, bottom side
17659 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
17660 \fi
17661 \else
17662 % <= npins/4, left side
17663 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
17664 \fi
17665 }
17666
17667 %%%%%%%%%%%%%%%%%
17668 %% Rotary Switch
17669 %%%%%%%%%%%%%%%%%
17670
17671 \pgfdeclareshape{rotaryswitch}
17672 {
17673 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
17674 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17675 \savedanchor\northeast{%
17676 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17677 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
17678 % the magic number is 0.25/cos(35)
17679 % try to recalculate it for the actual switch
17680 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
17681 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
17682 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
17683 \edef\r{\ctikzvalof{nodes width}}
17684 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
17685 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
17686 }
17687 \savedanchor\northwest{%
17688 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17689 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
17690 % the magic number is 0.25/cos(35)
17691 % try to recalculate it for the actual switch
17692 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
17693 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
17694 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
17695 \edef\r{\ctikzvalof{nodes width}}
17696 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
17697 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
17698 }
17699 \savedanchor\central{%
17700 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17701 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
17702 % the magic number is 0.25/cos(35)
17703 % try to recalculate it for the actual switch
17704 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
17705 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
17706 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
17707 \edef\r{\ctikzvalof{nodes width}}
17708 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
17709 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
17710 }
17711 % external square limits
17712 \savedanchor\extnorthwest{%
17713 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17714 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
17715 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
17716 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
17717 \pgf@x=2.5\pgf@x % external square size
17718 \pgf@y=-\pgf@x %square thing when angle=180?
17719 }
17720 \saveddimen{\width}{
17721 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17722 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
17723 % radius of the connector
17724 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
17725 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
17726 % shapename
17727 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
17728 % shape type
17729 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
17730 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
17731 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
17732 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
17733 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
17734 % mid of the lever, to stack switches
17735 %\anchor{mid}{\midlever}
17736 \anchor{mid}{\northwest
17737 \pgf@circ@res@temp=-\pgf@x
17738 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
17739 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
17740 }
17741 % center anchors
17742 \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
17743 % horizontal angles
17744 \anchor{in}{ \northwest \pgf@y=0pt}
17745 \anchor{ain}{ \northwest \pgf@y=0pt}
17746
17747 \anchor{center}{ \central \pgf@y=0pt }
17748 \anchor{east}{ \northeast \pgf@y=0pt }
17749 \anchor{west}{ \northwest \pgf@y=0pt }
17750 \anchor{south}{ \central \pgf@y=-\pgf@y }
17751 \anchor{north}{ \central }
17752 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17753 \anchor{north east}{ \northeast }
17754 \anchor{north west}{ \northwest }
17755 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
17756
17757 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
17758 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
17759 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
17760 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
17761 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
17762 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
17763 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
17764 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
17765 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
17766
17767 \backgroundpath{
17768 \pgfsetcolor{\ctikzvalof{color}}
17769 \pgf@circ@res@right = \width
17770 \pgf@circ@res@left = -\width
17771
17772 \pgfscope %wiper
17773 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
17774 \pgf@circ@res@temp=\radius\relax
17775 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
17776 \pgfsetlinewidth{2\pgf@circ@res@temp}
17777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
17778 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
17779 \pgfsetroundcap\pgfusepath{draw}
17780 \endpgfscope
17781
17782 \ifpgf@circ@rotaryarrow
17783 \pgfscope % arrow
17784 \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
17785 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
17786 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
17787 \pgftransformrotate{\wiper}
17788 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
17789 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
17790 \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
17791 \pgfusepath{draw}
17792 \endpgfscope
17793 \fi
17794
17795 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
17796 \pgf@circ@count@a=\channels\relax
17797 \pgfmathsetmacro{\currenta}{-\angle}
17798 \pgfmathloop%
17799 \ifnum\pgf@circ@count@a>0
17800 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
17801 \pgfscope
17802 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
17803 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
17804 \endpgfscope
17805 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
17806 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
17807 \advance\pgf@circ@count@a by -1\relax%
17808 \repeatpgfmathloop
17809
17810 \pgfscope % input
17811 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
17812 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
17813 \endpgfscope
17814 }
17815 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17816 % and is executed just before a node is drawn.
17817 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
17818 % Start with the maximum pin number and go backwards.
17819 \pgf@circ@count@a=\channels\relax
17820 \pgfmathloop%
17821 \ifnum\pgf@circ@count@a>0
17822 % we will create two anchors per pin: the "normal one" like `pin 1` for the
17823 % electrical contact, and the "border one" like `bpin 1` for labels.
17824 % they will coincide if `external pins width` is set to 0.
17825 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
17826 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
17827 }
17828 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
17829 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
17830 }
17831 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
17832 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
17833 }
17834 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
17835 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}%
17836 }
17837 \advance\pgf@circ@count@a by -1\relax%
17838 \repeatpgfmathloop%
17839 }%
17840 }
17841
17842 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
17843 \pgf@circ@res@temp=\width
17844 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
17845 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
17846 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
17847 \advance\pgf@x by -\pgf@circ@res@temp
17848 }
17849
17850 \def\pgf@circ@rotarysqanchor#1{% external square anchors
17851 \pgf@circ@res@temp=\width
17852 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
17853 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
17854 \advance\pgf@x by -\pgf@circ@res@temp
17855 }
17856
17857 %%%%%%%%%%%%%%%%%%%%%%%%%%
17858 % Seven segments displays
17859 %%%%%%%%%%%%%%%%%%%%%%%%%%
17860
17861 \pgfdeclareshape{bare7seg}{
17862 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
17863 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17864 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
17865 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
17866 \ifpgf@circ@sevenseg@dot
17867 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
17868 \else
17869 \pgf@x=0pt
17870 \fi
17871 }
17872 % The object extension is more or less (-width/2,-width) to (width/2,width)
17873 % and adjusted for line thickness (both sides) and eventually the dot
17874 \saveddimen{\width}{
17875 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17876 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
17877 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
17878 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
17879 \savedanchor{\southwest}{% both negative
17880 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17881 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
17882 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
17883 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
17884 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
17885 }
17886 \savedanchor{\northeast}{% both positive
17887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17888 \ifpgf@circ@sevenseg@dot
17889 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
17890 \else
17891 \pgf@circ@res@other=0pt
17892 \fi
17893 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
17894 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
17895 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
17896 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
17897 }
17898 \savedanchor{\topright}{% anchor without the box sep and the thickness
17899 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17900 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
17901 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
17902 }
17903 \anchor{center}{\pgfpointorigin}
17904 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
17905 \anchor{north east}{\northeast}
17906 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
17907 \anchor{south west}{\southwest}
17908 \anchor{north}{\northeast\pgf@x=0pt}
17909 \anchor{east}{\northeast\pgf@y=0pt}
17910 \anchor{south}{\southwest\pgf@x=0pt}
17911 \anchor{west}{\southwest\pgf@y=0pt}
17912 \anchor{a}{\topright\pgf@x=0pt}
17913 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
17914 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
17915 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
17916 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
17917 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
17918 \anchor{g}{\pgfpointorigin}
17919 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
17920 \behindbackgroundpath{%
17921 \southwest % I do not want the dot here, it will stick out
17922 \pgf@circ@res@up = -\pgf@y
17923 \pgf@circ@res@down = \pgf@y
17924 \pgf@circ@res@right = \pgf@x
17925 \pgf@circ@res@left = -\pgf@x
17926 \pgfscope
17927 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17928 \pgfsetcolor{\ctikzvalof{color}}
17929 \pgfpathrectanglecorners%
17930 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17931 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
17932 \ifpgf@circ@sevenseg@box
17933 \pgf@circ@draworfill
17934 \else
17935 \pgf@circ@maybefill
17936 \fi
17937 \endpgfscope
17938 \edef\bits{\ctikzvalof{seven seg/bits}}
17939 \pgfscope
17940 \pfg@circ@sseg@drawbits{\bits}
17941 \endpgfscope
17942 \pgfscope
17943 \ifpgf@circ@sevenseg@dot
17944 \pgf@circ@sseg@drawdots
17945 \fi
17946 \endpgfscope
17947 }
17948 }
17949
17950 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
17951 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
17952 }
17953 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
17954 \ifnum #1 > 0\relax
17955 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
17956 \else
17957 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
17958 \fi
17959 \pgfpathmoveto{\pgfpoint{#2}{#3}}
17960 \pgfpathlineto{\pgfpoint{#4}{#5}}
17961 \pgfusepath{draw}
17962 }
17963 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
17964 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
17965 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
17966 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
17967 % \pgfsetroundcap
17968 \pgfsetarrowsstart{Triangle Cap[]}
17969 \pgfsetarrowsend{Triangle Cap[]}
17970 % segments
17971 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
17972 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
17973 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
17974 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
17975 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
17976 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
17977 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
17978 }
17979 \def\pgf@circ@sseg@drawdots{% dots
17980 \edef\what{empty}
17981 \ifx\what\pgf@circ@sevenseg@dotstate
17982 % do nothing
17983 \else
17984 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
17985 \edef\what{off}
17986 \ifx\what\pgf@circ@sevenseg@dotstate
17987 % dot off
17988 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
17989 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
17990 \else
17991 % dot on
17992 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
17993 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
17994 \fi
17995 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
17996 \pgfusepath{draw,fill}
17997 \fi
17998 }
17999
18000
18001 %%%%%%
18002 %%%%%% Flip-flops
18003 %%%%%%
18004
18005 % Flip flops are a specialized kind of dipchip.
18006 % they have a class by themselves
18007
18008 %% flip flop definitions --- by default empty
18009 %% pin texts
18010 \ctikzset{multipoles/flipflop/t1/.initial={}}
18011 \ctikzset{multipoles/flipflop/t2/.initial={}}
18012 \ctikzset{multipoles/flipflop/t3/.initial={}}
18013 \ctikzset{multipoles/flipflop/t4/.initial={}}
18014 \ctikzset{multipoles/flipflop/t5/.initial={}}
18015 \ctikzset{multipoles/flipflop/t6/.initial={}}
18016 \ctikzset{multipoles/flipflop/tu/.initial={}}
18017 \ctikzset{multipoles/flipflop/td/.initial={}}
18018 % pin clock wedge flags
18019 \ctikzset{multipoles/flipflop/c1/.initial={0}}
18020 \ctikzset{multipoles/flipflop/c2/.initial={0}}
18021 \ctikzset{multipoles/flipflop/c3/.initial={0}}
18022 \ctikzset{multipoles/flipflop/c4/.initial={0}}
18023 \ctikzset{multipoles/flipflop/c5/.initial={0}}
18024 \ctikzset{multipoles/flipflop/c6/.initial={0}}
18025 \ctikzset{multipoles/flipflop/cu/.initial={0}}
18026 \ctikzset{multipoles/flipflop/cd/.initial={0}}
18027 % pin negation circle flags
18028 \ctikzset{multipoles/flipflop/n1/.initial={0}}
18029 \ctikzset{multipoles/flipflop/n2/.initial={0}}
18030 \ctikzset{multipoles/flipflop/n3/.initial={0}}
18031 \ctikzset{multipoles/flipflop/n4/.initial={0}}
18032 \ctikzset{multipoles/flipflop/n5/.initial={0}}
18033 \ctikzset{multipoles/flipflop/n6/.initial={0}}
18034 \ctikzset{multipoles/flipflop/nu/.initial={0}}
18035 \ctikzset{multipoles/flipflop/nd/.initial={0}}
18036
18037
18038 % Thanks to @marmot
18039 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
18040
18041 % default set of flip flops
18042 \tikzset{
18043 % async
18044 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
18045 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
18046 % sync
18047 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
18048 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
18049 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
18050 % additional features
18051 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
18052 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
18053 }
18054
18055 %
18056 % commodity macro to draw the clock wedges. They leave the size of the
18057 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
18058 %
18059 \def\pgf@circ@do@wedge@left{
18060 \pgf@circ@res@temp=0pt\relax
18061 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
18062 \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}}
18063 \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}}
18064 \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}}
18065 \pgfusepath{stroke}
18066 \pgf@circ@res@temp=\wedge
18067 \fi
18068 }
18069 \def\pgf@circ@do@wedge@right{
18070 \pgf@circ@res@temp=0pt\relax
18071 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
18072 \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}}
18073 \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}}
18074 \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}}
18075 \pgfusepath{stroke}
18076 \pgf@circ@res@temp=-\wedge
18077 \fi
18078 }
18079 \def\pgf@circ@do@wedge@up{
18080 \pgf@circ@res@temp=0pt\relax
18081 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
18082 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
18083 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
18084 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
18085 \pgfusepath{stroke}
18086 \pgf@circ@res@temp=-\wedge
18087 \fi
18088 }
18089 \def\pgf@circ@do@wedge@down{
18090 \pgf@circ@res@temp=0pt\relax
18091 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
18092 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
18093 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
18094 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
18095 \pgfusepath{stroke}
18096 \pgf@circ@res@temp=\wedge
18097 \fi
18098 }
18099 % generic flip-flop shape
18100 \pgfdeclareshape{flipflop}{
18101 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
18102 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18103 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18104 \savedmacro\numpins{\def\numpins{6}}
18105 \savedanchor\centerpoint{%
18106 \pgf@x=-.5\wd\pgfnodeparttextbox%
18107 \pgf@y=-.5\ht\pgfnodeparttextbox%
18108 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18109 }%
18110 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
18111 \anchor{center}{\origin}
18112 \anchor{text}{\centerpoint}% to adjust text
18113 \saveddimen\height{%
18114 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18115 \pgfmathsetlength\pgf@x{((\numpins)
18116 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18117 }%
18118 \saveddimen{\chipspacing}{
18119 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18120 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
18121 \saveddimen{\width}{
18122 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18123 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
18124 \saveddimen{\extshift}{
18125 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18126 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18127 % standard anchors
18128 \savedanchor\northwest{%
18129 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18130 \pgfmathsetlength\pgf@y{0.5*((\numpins)
18131 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18132 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
18133 }
18134 \anchor{dot}{\northwest
18135 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
18136 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
18137 }
18138 \anchor{nw}{\northwest}
18139 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18140 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18141 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18142 \anchor{north west}{\northwest}
18143 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18144 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18145 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18146 \anchor{n}{\northwest\pgf@x=0pt }
18147 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18148 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18149 \anchor{w}{\northwest\pgf@y=0pt }
18150 \anchor{north}{\northwest\pgf@x=0pt }
18151 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18152 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18153 \anchor{west}{\northwest\pgf@y=0pt }
18154 % upper and lower pin
18155 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
18156 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
18157 \anchor{bup}{\northwest\pgf@x=0pt }
18158 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18159 % start drawing
18160 \backgroundpath{%
18161 \northwest
18162 \pgf@circ@res@up = \pgf@y
18163 \pgf@circ@res@down = -\pgf@y
18164 \pgf@circ@res@right = -\pgf@x
18165 \pgf@circ@res@left = \pgf@x
18166 \pgf@circ@scaled@Rlen=\scaledRlen
18167 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
18168 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
18169 \pgfsetcolor{\ctikzvalof{color}}
18170 \pgfscope% (for the line width)
18171 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18172 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
18173 \pgf@circ@draworfill
18174 \pgfusepath{stroke}%
18175 \endpgfscope
18176 % Adding the pin number
18177 \pgf@circ@count@a=\numpins\relax
18178 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18179 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
18180 \ifpgf@circuit@chip@straightnumbers
18181 \pgfgettransformentries\a\b\temp\temp\temp\temp
18182 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
18183 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
18184 \else
18185 \pgfmathsetmacro{\rot}{0}
18186 \pgfmathsetmacro{\quadrant}{0}
18187 \fi
18188 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
18189 % text
18190 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
18191 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
18192 \pgf@circ@strut\space}
18193 % \typeout{TEXT\space\mytext}
18194 \pgfmathloop%
18195 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
18196 \pgf@circ@res@temp=0pt\relax
18197 \ifnum\pgf@circ@count@a>0
18198 \ifcase\quadrant % rotation 0
18199 % left
18200 \pgf@circ@count@c=\pgf@circ@count@a
18201 \pgf@circ@do@wedge@left
18202 % \typeout{TEXT Left Q1\space\mytext}
18203 \pgftext[left,
18204 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},
18205 rotate=\rot]{\mytext}
18206 % right
18207 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18208 \pgf@circ@do@wedge@right
18209 \pgftext[right,
18210 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},
18211 rotate=\rot]{\mytext}
18212 \or % rotation -90
18213 % left
18214 \pgf@circ@count@c=\pgf@circ@count@a
18215 \pgf@circ@do@wedge@left
18216 \pgftext[top,
18217 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},
18218 rotate=\rot]{\mytext}
18219 % right
18220 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18221 \pgf@circ@do@wedge@right
18222 \pgftext[bottom,
18223 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},
18224 rotate=\rot]{\mytext}
18225 \or %rotation 180
18226 % left
18227 \pgf@circ@count@c=\pgf@circ@count@a
18228 \pgf@circ@do@wedge@left
18229 \pgftext[right,
18230 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},
18231 rotate=\rot]{\mytext}
18232 % right
18233 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18234 \pgf@circ@do@wedge@right
18235 \pgftext[left,
18236 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},
18237 rotate=\rot]{\mytext}
18238 \or % rotation +90
18239 % left
18240 \pgf@circ@count@c=\pgf@circ@count@a
18241 \pgf@circ@do@wedge@left
18242 \pgftext[bottom,
18243 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},
18244 rotate=\rot]{\mytext}
18245 % right
18246 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18247 \pgf@circ@do@wedge@right
18248 \pgftext[top,
18249 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},
18250 rotate=\rot]{\mytext}
18251 \fi
18252 \advance\pgf@circ@count@a-1\relax%
18253 \repeatpgfmathloop
18254 % Now the up and down text
18255 % up
18256 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
18257 \pgf@circ@do@wedge@up
18258 \ifcase\quadrant % rotation 0
18259 \pgftext[top,
18260 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18261 rotate=\rot]{\mytext}
18262 \or % rotation -90
18263 \pgftext[right,
18264 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18265 rotate=\rot]{\mytext}
18266 \or %rotation 180
18267 \pgftext[bottom,
18268 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18269 rotate=\rot]{\mytext}
18270 \or % rotation +90
18271 \pgftext[left,
18272 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18273 rotate=\rot]{\mytext}
18274 \fi
18275 % down
18276 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
18277 \pgf@circ@do@wedge@down
18278 \ifcase\quadrant % rotation 0
18279 \pgftext[bottom,
18280 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18281 rotate=\rot]{\mytext}
18282 \or % rotation -90
18283 \pgftext[left,
18284 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18285 rotate=\rot]{\mytext}
18286 \or %rotation 180
18287 \pgftext[top,
18288 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18289 rotate=\rot]{\mytext}
18290 \or % rotation +90
18291 \pgftext[right,
18292 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18293 rotate=\rot]{\mytext}
18294 \fi
18295 % external pins
18296 \ifdim\pgf@circ@res@other>0pt
18297 \pgfscope
18298 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18299 \pgf@circ@count@a=\numpins\relax
18300 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18301 \pgfmathloop%
18302 \ifnum\pgf@circ@count@a>0
18303 % left side pins
18304 \pgf@circ@count@c=\pgf@circ@count@a
18305 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
18306 %% Or'ing tests in core TeX is tough
18307 \edef\@@or{0}
18308 % Just expand the key the minimum needed
18309 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
18310 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18311 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
18312 \ifnum\@@tmp>0\edef\@@or{1}\fi
18313 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18314 \ifnum\@@tmp>0\edef\@@or{1}\fi
18315 \ifnum\@@or>0
18316 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18317 \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}}
18318 \pgfusepath{stroke}
18319 \fi
18320 % right side pins
18321 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18322 \edef\@@or{0}
18323 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
18324 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18325 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
18326 \ifnum\@@tmp>0\edef\@@or{1}\fi
18327 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18328 \ifnum\@@tmp>0\edef\@@or{1}\fi
18329 % \typeout{TEST\space\@@tmp\space\@@x}
18330 \ifnum\@@or>0
18331 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18332 \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}}
18333 \pgfusepath{stroke}
18334 \fi
18335 \advance\pgf@circ@count@a by -1\relax%
18336 \repeatpgfmathloop
18337 % up side
18338 \edef\@@or{0}
18339 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
18340 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18341 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
18342 \ifnum\@@tmp>0\edef\@@or{1}\fi
18343 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18344 \ifnum\@@tmp>0\edef\@@or{1}\fi
18345 % \typeout{TEST\space\@@tmp\space\@@x}
18346 \ifnum\@@or>0
18347 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18348 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
18349 \pgfusepath{stroke}
18350 \fi
18351 % down side
18352 \edef\@@or{0}
18353 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
18354 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18355 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
18356 \ifnum\@@tmp>0\edef\@@or{1}\fi
18357 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18358 \ifnum\@@tmp>0\edef\@@or{1}\fi
18359 % \typeout{TEST\space\@@tmp\space\@@x}
18360 \ifnum\@@or>0
18361 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18362 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
18363 \pgfusepath{stroke}
18364 \fi
18365 \endpgfscope
18366 \fi % external pin width >0
18367 %
18368 % draw "inverting" circles on outputs, they must be last
18369 %
18370 \pgfscope
18371 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18372 \pgf@circ@count@a=\numpins\relax
18373 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18374 \pgfmathloop%
18375 \ifnum\pgf@circ@count@a>0
18376 % left side pins
18377 \pgf@circ@count@c=\pgf@circ@count@a
18378 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18379 \ifnum\@@tmp>0\pgfscope
18380 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18381 \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
18382 \endpgfscope\fi
18383 % right side pins
18384 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18385 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18386 \ifnum\@@tmp>0\pgfscope
18387 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18388 \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
18389 \endpgfscope\fi
18390 \advance\pgf@circ@count@a by -1\relax%
18391 \repeatpgfmathloop
18392 % up side
18393 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18394 \ifnum\@@tmp>0\pgfscope
18395 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
18396 \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
18397 \endpgfscope\fi
18398 % down side
18399 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
18400 \ifnum\@@tmp>0\pgfscope
18401 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
18402 \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
18403 \endpgfscope\fi
18404 \endpgfscope
18405 }%
18406 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
18407 % and is executed just before a node is drawn.
18408 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
18409 % Start with the maximum pin number and go backwards.
18410 \pgf@circ@count@a=\numpins\relax
18411 \pgfmathloop%
18412 \ifnum\pgf@circ@count@a>0
18413 % we will create two anchors per pin: the "normal one" like `pin 1` for the
18414 % electrical contact, and the "border one" like `bpin 1` for labels.
18415 % they will coincide if `external pins width` is set to 0.
18416 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
18417 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
18418 }
18419 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
18420 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
18421 }
18422 \advance\pgf@circ@count@a by -1\relax%
18423 \repeatpgfmathloop%
18424 }%
18425 }
18426
18427 %
18428 % MUX-DEMUXES
18429 %
18430 % Thanks to @marmot
18431 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
18432 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
18433 \tikzset{one bit adder/.style={muxdemux,
18434 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
18435 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
18436 \tikzset{ALU/.style={muxdemux,
18437 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
18438 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
18439 %generic mux-demux shape
18440 \pgfdeclareshape{muxdemux}{
18441 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
18442 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18443 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18444 % pins on the four sides
18445 % \savedmacro\NL{%
18446 % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
18447 % \def\NL{\the\pgf@circ@count@a}
18448 % }
18449 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
18450 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
18451 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
18452 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
18453 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
18454 % topleft and topright sizes
18455 \savedanchor{\topleft}{%
18456 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18457 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
18458 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18459 }
18460 \savedanchor{\topright}{%
18461 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18462 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
18463 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18464 }
18465 \savedanchor{\insetnortheast}{%
18466 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18467 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
18468 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
18469 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
18470 }
18471 \saveddimen{\insethright}{
18472 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18473 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
18474 \saveddimen{\extshift}{
18475 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18476 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18477 \savedanchor{\northwest}{%
18478 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18479 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
18480 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18481 }
18482 \anchor{nw}{\northwest}
18483 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18484 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18485 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18486 \anchor{north west}{\northwest}
18487 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18488 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18489 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18490 \anchor{n}{\northwest\pgf@x=0pt }
18491 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18492 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18493 \anchor{w}{\northwest\pgf@y=0pt }
18494 \anchor{north}{\northwest\pgf@x=0pt }
18495 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18496 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18497 \anchor{west}{\northwest\pgf@y=0pt }
18498 \anchor{center}{\pgfpointorigin}
18499 \anchor{top right}{\topright}
18500 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
18501 \anchor{right}{\topright\pgf@y=0pt\relax}
18502 \anchor{top left}{\topleft}
18503 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
18504 \anchor{left}{\topleft\pgf@y=0pt\relax}
18505 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18506 \divide\pgf@y by 2 \pgf@x=0pt\relax}
18507 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18508 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
18509 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
18510 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
18511 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
18512 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
18513 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
18514 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
18515 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
18516 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
18517 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
18518 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
18519 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
18520 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
18521 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
18522 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
18523 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
18524 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
18525 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18526 \divide\pgf@y by 2
18527 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
18528 \divide\pgf@y by 2 \pgf@x=0pt\relax}
18529 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18530 \divide\pgf@y by 2
18531 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
18532 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
18533 \anchor{text}{%
18534 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18535 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
18536 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
18537 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
18538 \pgf@y=-.5\ht\pgfnodeparttextbox%
18539 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18540 }%
18541 \backgroundpath{%
18542 \topleft
18543 \pgf@circ@res@up = \pgf@y
18544 \pgf@circ@res@down = -\pgf@y
18545 \pgf@circ@res@left = \pgf@x
18546 \topright
18547 \pgf@circ@res@other = \pgf@y
18548 \pgf@circ@res@right = \pgf@x
18549 \insetnortheast
18550 \pgf@circ@res@step = \pgf@x
18551 \pgf@circ@res@temp = \pgf@y
18552 %
18553 % external block
18554 %
18555 \pgfscope% (for the line width)
18556 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18557 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
18558 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
18559 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
18560 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
18561 % inset, starting down
18562 \ifdim\pgf@circ@res@temp>0pt % inset
18563 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
18564 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
18565 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
18566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
18567 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
18568 \fi
18569 \pgfpathclose
18570 \pgf@circ@draworfill
18571 \endpgfscope
18572 % now we have to draw the pins, if needed
18573 \ifdim\extshift>0pt\ifpgfcirc@draw@leads\pgfscope % let's avoid too much indent
18574 % Ok, we have to draw the leads (a.k.a. pins)
18575 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18576 % We mimic the anchors here --- probably there is a better way
18577 % left pins
18578 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
18579 \pgf@circ@count@a=\NL\relax
18580 \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
18581 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18582 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18583 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
18584 % we have to check oddity
18585 \ifodd\NL
18586 \ifnum\NL=1
18587 % only centerpin, step should not be used, but anyway...
18588 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
18589 \else
18590 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
18591 \fi
18592 \else
18593 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
18594 \fi
18595 \else % no inset
18596 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
18597 \fi
18598 \pgfmathloop%
18599 \ifnum\pgf@circ@count@a>0
18600 %%%%%
18601 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
18602 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
18603 % for lower pins we have to shift them down
18604 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
18605 \ifodd\NL
18606 % odd number of pins
18607 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
18608 % centerpin!
18609 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18610 \ifnum\squarepins>0
18611 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
18612 \else
18613 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
18614 \fi
18615 \else
18616 \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}}
18617 \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}}
18618 \fi
18619 \else
18620 % even numer of pins: just go down
18621 \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}}
18622 \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}}
18623 \fi
18624 \else
18625 % nothing need for #1<=NL/2
18626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18627 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18628 \fi
18629 \else
18630 % no inset
18631 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18632 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18633 \fi
18634 %%%%%
18635 \advance\pgf@circ@count@a by -1\relax%
18636 \repeatpgfmathloop\fi%
18637 % right pins
18638 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
18639 \pgfmathloop%
18640 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
18641 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
18642 \ifnum\pgf@circ@count@a>0
18643 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18644 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18645 \advance\pgf@circ@count@a by -1\relax%
18646 \repeatpgfmathloop\fi%
18647 % bottom pins
18648 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
18649 \pgfmathloop%
18650 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18651 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18652 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
18653 \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}
18654 \ifnum\pgf@circ@count@a>0
18655 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18656 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
18657 \ifnum\squarepins>0
18658 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18659 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
18660 \else
18661 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18662 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
18663 \fi
18664 \advance\pgf@circ@count@a by -1\relax%
18665 \repeatpgfmathloop\fi%
18666 % top pins
18667 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
18668 \pgfmathloop%
18669 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18670 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18671 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
18672 \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}
18673 \ifnum\pgf@circ@count@a>0
18674 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18675 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
18676 \ifnum\squarepins>0
18677 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18678 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
18679 \else
18680 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18681 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
18682 \fi
18683 \advance\pgf@circ@count@a by -1\relax%
18684 \repeatpgfmathloop\fi%
18685 % end drawing pins; stroke them
18686 \pgfusepath{stroke}
18687 \endpgfscope\fi\fi
18688 }
18689 % let's start adding anchors
18690 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
18691 % left side anchors
18692 \pgf@circ@count@a=\NL\relax
18693 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
18694 \pgfmathloop%
18695 \ifnum\pgf@circ@count@a>0
18696 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
18697 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
18698 % external leads, and the "border one" like `blpin 1` for internal ones.
18699 % they will coincide if `external pins width` is set to 0.
18700 \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
18701 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
18702 }
18703 \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
18704 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
18705 }
18706 \advance\pgf@circ@count@a by -1\relax%
18707 \repeatpgfmathloop%
18708 % right anchors
18709 \pgf@circ@count@a=\NR\relax
18710 \pgfmathloop%
18711 \ifnum\pgf@circ@count@a>0
18712 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
18713 % external leads, and the "border one" like `brpin 1` for internal ones.
18714 % they will coincide if `external pins width` is set to 0.
18715 \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
18716 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
18717 }
18718 \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
18719 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
18720 }
18721 \advance\pgf@circ@count@a by -1\relax%
18722 \repeatpgfmathloop%
18723 % bottom anchors
18724 \pgf@circ@count@a=\NB\relax
18725 \pgfmathloop%
18726 \ifnum\pgf@circ@count@a>0
18727 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
18728 % external leads, and the "border one" like `bbpin 1` for internal ones.
18729 % they will coincide if `external pins width` is set to 0.
18730 \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
18731 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
18732 }
18733 \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
18734 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
18735 }
18736 \advance\pgf@circ@count@a by -1\relax%
18737 \repeatpgfmathloop%
18738 % top anchors
18739 \pgf@circ@count@a=\NT\relax
18740 \pgfmathloop%
18741 \ifnum\pgf@circ@count@a>0
18742 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
18743 % external leads, and the "border one" like `btpin 1` for internal ones.
18744 % they will coincide if `external pins width` is set to 0.
18745 \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
18746 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
18747 }
18748 \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
18749 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
18750 }
18751 \advance\pgf@circ@count@a by -1\relax%
18752 \repeatpgfmathloop%
18753 }%
18754 }
18755
18756 %% left anchors for muxdemux
18757
18758 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
18759 \topleft
18760 \pgf@xa=\pgf@x
18761 \pgf@ya=\pgf@y
18762 \insetnortheast
18763 \pgf@xb=\pgf@x
18764 \pgf@yb=\pgf@y
18765 \ifnum#1>\NL
18766 \PackageError{circuitikz}{%
18767 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
18768 which has been defined with \NL\space left pins%
18769 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
18770 \fi
18771 \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
18772 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
18773 \ifnum\NL>1
18774 \ifdim\pgf@yb>0pt % check if we have an inset
18775 % we have to check oddity
18776 \ifodd\NL
18777 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
18778 \else
18779 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
18780 \fi
18781 \else % no inset
18782 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
18783 \fi
18784 \ifdim\pgf@yb>0pt % check if we have an inset
18785 \ifnum#1>\pgf@circ@count@a\relax
18786 % for lower pins we have to shift them down
18787 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
18788 \ifodd\NL
18789 % odd number of pins
18790 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
18791 % centerpin!
18792 \ifnum#2=0\relax
18793 \pgfpoint{\pgf@xb}{0pt}
18794 \else
18795 \ifnum\squarepins>0
18796 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
18797 \else
18798 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
18799 \fi
18800 \fi
18801 \else
18802 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
18803 \fi
18804 \else
18805 % even numer of pins: just go down
18806 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
18807 \fi
18808 \else
18809 % nothing need for #1<=NL/2
18810 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
18811 \fi
18812 \else
18813 % no inset
18814 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
18815 \fi
18816 \else
18817 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
18818 \fi
18819 }
18820
18821 % right anchors
18822 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
18823 \topright
18824 \pgf@xa=\pgf@x
18825 \pgf@ya=\pgf@y
18826 \ifnum#1>\NR
18827 \PackageError{circuitikz}{%
18828 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
18829 which has been defined with \NR\space right pins%
18830 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
18831 \fi
18832 \ifnum\NR>1
18833 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
18834 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
18835 \else
18836 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
18837 \fi
18838 }
18839
18840 % bottom anchors
18841 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
18842 \topleft
18843 \pgf@xa=\pgf@x
18844 \pgf@ya=\pgf@y
18845 \topright
18846 \pgf@xb=\pgf@x
18847 \pgf@yb=\pgf@y
18848 \ifnum#1>\NB
18849 \PackageError{circuitikz}{%
18850 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
18851 which has been defined with \NB\space bottom pins%
18852 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
18853 \fi
18854 \ifnum\NB>0
18855 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
18856 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
18857 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
18858 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
18859 \ifnum#2=0\relax
18860 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
18861 \else
18862 \ifnum\squarepins>0\relax
18863 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
18864 \else
18865 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
18866 \fi
18867 \fi
18868 \else
18869 % should not happen, give the same as pin 1 anyway
18870 \ifnum#2=0\relax
18871 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
18872 \else
18873 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
18874 \fi
18875 \fi
18876 }
18877
18878 % top anchors
18879 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
18880 \topleft
18881 \pgf@xa=\pgf@x
18882 \pgf@ya=\pgf@y
18883 \topright
18884 \pgf@xb=\pgf@x
18885 \pgf@yb=\pgf@y
18886 \ifnum#1>\NT
18887 \PackageError{circuitikz}{%
18888 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
18889 which has been defined with \NT\space top pins%
18890 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
18891 \fi
18892 \ifnum\NT>0
18893 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
18894 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
18895 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
18896 \ifnum#2=0\relax
18897 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
18898 \else
18899 \ifnum\squarepins>0
18900 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
18901 \else
18902 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
18903 \fi
18904 \fi
18905 \else
18906 % should not happen, give the same as pin 1 anyway
18907 \ifnum#2=0\relax
18908 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
18909 \else
18910 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
18911 \fi
18912 \fi
18913 }
18914
18915 %% IEEE standard logic ports module
18916 %%
18917 %% Original multi-input code from John Kormylo at tex.stackexchange.com
18918 %% Help by TheTeXnician <[email protected]>
18919 %% Suggested idea and example code by Jason Sachs <[email protected]>
18920 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
18921 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
18922 %% Everything is in the same place here --- more or less; first step to move towards
18923 %% a module interface for circutikz
18924 %%
18925
18926 % base parameters for ieeestd ports.
18927
18928 \ctikzset{ieeestd ports/.is family}
18929 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
18930 % the value of 0.4 is the standard pin distance for a port with height=num pins
18931 % and matches the chip distance
18932 \ctikzset{ieeestd ports/baselen/.initial=0.4}
18933 % these are in term of baselen; width depends on height (fixed proportions)
18934 \ctikzset{ieeestd ports/height/.initial=2}
18935 \ctikzset{ieeestd ports/pin length/.initial=0.7}
18936 % the standard "not" circle should be 1/6.5 of height (diameter);
18937 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
18938 \ctikzset{ieeestd ports/not radius/.initial=0.154}
18939 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
18940 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
18941 % xor/xnor leads go full in in IEEE; let this be optional
18942 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
18943 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
18944 %
18945 % base size of a small external schmitt symbol
18946 %
18947 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
18948 %
18949 % input management
18950 % we are using the same /tikz/number inputs than the legacy ports
18951 %
18952 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
18953 %
18954 % integrate with the other logic ports
18955 %
18956 \ctikzset{logic ports/ieee/.code= {\pgf@circuit@europeanlogicportfalse
18957 \tikzset{and port/.style={shape=ieeestd and port}}%
18958 \tikzset{or port/.style={shape=ieeestd or port}}%
18959 \tikzset{xor port/.style={shape=ieeestd xor port}}%
18960 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
18961 \tikzset{not port/.style={shape=ieeestd not port}}%
18962 \tikzset{nand port/.style={shape=ieeestd nand port}}%
18963 \tikzset{nor port/.style={shape=ieeestd nor port}}%
18964 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
18965 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
18966 \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}%
18967 }}
18968 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
18969 %
18970 % the base angle for the or port. See the drawings. This will not change with height
18971 %
18972 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
18973 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
18974 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
18975 {%
18976 \ifnum#1>\inputs
18977 \PackageError{circuitikz}{%
18978 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
18979 which has been defined with \inputs\space pins%
18980 }{Please check the manual about logic ports; if you press return I'll try to continue}
18981 \fi
18982 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
18983 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
18984 \pgf@circ@res@step=\pind
18985 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
18986 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
18987 }%
18988
18989 % #1 = \pgfmathcounter #2=type
18990 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
18991 \def\pgf@circ@ieeeport@baseinput#1#2%
18992 {%
18993 \ifnum#1>\inputs
18994 \PackageError{circuitikz}{%
18995 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
18996 which has been defined with \inputs\space pins%
18997 }{Please check the manual about logic ports; if you press return I'll try to continue}
18998 \fi
18999 % Find the vertical position (this is the same for any port)
19000 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
19001 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
19002 % rack (extended) pins; they are the same for all the ports
19003 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19004 % above: 1..K (included)
19005 % below: inputs-K..inputs
19006 % Find the pins on the rack; they are 1...
19007 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19008 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
19009 % border anchors for rack should be ok
19010 \pgfextractx{\pgf@circ@res@left}{\topleft}
19011 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
19012 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
19013 % we have finished if we are in the rack
19014 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
19015 % we are on the inner ports; we have to do the hard work here
19016 % and and nand
19017 \ifnum #2=1
19018 \relax % It's an and/nand, all border ports are on the rack line
19019 \fi
19020 % or and nor
19021 \ifnum #2=2
19022 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19023 \fi
19024 % xor and xnor
19025 \ifnum #2=3\relax
19026 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19027 \fi
19028 \fi\fi
19029 }%
19030 % inner base ports for xor types port
19031 % #1 = \pgfmathcounter #2=type
19032 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
19033 \def\pgf@circ@ieeeport@innerbaseinput#1%
19034 {%
19035 \ifnum#1>\inputs
19036 \PackageError{circuitikz}{%
19037 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
19038 which has been defined with \inputs\space pins%
19039 }{Please check the manual about logic ports; if you press return I'll try to continue}
19040 \fi
19041 % Find the vertical position (this is the same for any port)
19042 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
19043 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
19044 % rack (extended) pins; they are the same for all the ports
19045 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19046 % above: 1..K (included)
19047 % below: inputs-K..inputs
19048 % Find the pins on the rack; they are 1...
19049 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19050 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
19051 % border anchors for rack should be ok
19052 \pgfextractx{\pgf@circ@res@left}{\topleft}
19053 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
19054 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
19055 % we have finished if we are in the rack
19056 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
19057 % we are on the inner ports; we have to do the hard work here
19058 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19059 \fi\fi
19060 }%
19061
19062 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
19063 \def\pgf@circ@ieeestd@baselen{%
19064 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19065 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
19066 }
19067 \def\pgf@circ@ieeestd@stdH{%
19068 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19069 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
19070 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
19071 }
19072 \def\pgf@circ@ieeestd@pinlen{%
19073 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19074 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
19075 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
19076 }
19077 \def\pgf@circ@ieeestd@xorbar{%
19078 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19079 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
19080 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
19081 }
19082 %% Not circle
19083 \def\pgf@circ@notradius{
19084 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
19085 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
19086 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
19087 }
19088 %% Find (in ...@other) the height of the rack
19089 \def\pgf@circ@findrackH{%
19090 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
19091 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
19092 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19093 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
19094 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
19095 \pgf@circ@ieeestd@stdH
19096 \multiply\pgf@circ@res@temp by 2\relax% full height
19097 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
19098 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
19099 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
19100 }
19101 %%
19102 \def\pgf@circ@find@ieeeport@up{% leave it in up
19103 % Normal port limits
19104 \pgf@circ@ieeestd@stdH
19105 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
19106 % rack top size
19107 \pgf@circ@findrackH
19108 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
19109 \pgf@circ@res@up=\pgf@circ@res@other
19110 \else
19111 \fi
19112 }
19113 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
19114 % Normal port limits
19115 \pgf@circ@ieeestd@stdH
19116 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
19117 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
19118 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
19119 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
19120 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19121 % this is the normal left border
19122 % For the or or xor port, the limit can be the pointy thing (in case the
19123 % pinlen is zero or too small)
19124 % add to the body margin the or/nor peak:
19125 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
19126 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
19127 \advance\pgf@circ@res@right by \pgf@circ@res@other
19128 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19129 \fi
19130 % add to the body margin the xor/xnor distance
19131 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
19132 \pgf@circ@ieeestd@xorbar
19133 \advance\pgf@circ@res@right by \pgf@circ@res@temp
19134 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19135 \fi
19136 % and if this exceeds the normal margin, this is it
19137 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19138 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
19139 \pgf@circ@res@left=\pgf@circ@res@right
19140 \fi
19141 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19142 \pgf@circ@res@left=-\pgf@circ@res@left
19143 }
19144 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
19145 % Normal port limits
19146 \pgf@circ@ieeestd@stdH
19147 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
19148 \pgf@circ@notradius
19149 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
19150 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
19151 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
19152 \pgf@circ@res@right=\pgf@circ@res@other
19153 \fi
19154 }
19155 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
19156 % Normal port limits
19157 \pgf@circ@ieeestd@stdH
19158 % notice 0.8660254 is cos(30)
19159 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
19160 \pgf@circ@notradius
19161 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
19162 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
19163 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
19164 \pgf@circ@res@right=\pgf@circ@res@other
19165 \fi
19166 }
19167
19168
19169 %%% ieeestd multi-input ports
19170 %%% #1: name
19171 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
19172 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
19173 %%% #4: drawing for the port
19174 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
19175 \pgfdeclareshape{ieeestd #1 port}%
19176 {%
19177 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19178 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19179 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19180 \saveddimen{\baselen}{%
19181 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
19182 }
19183 \saveddimen{\stdH}{% This is HALF the height of the inner port
19184 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
19185 }
19186 \saveddimen{\notdiameter}{
19187 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
19188 }
19189 \saveddimen{\pind}{% pin distance;
19190 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
19191 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
19192 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19193 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
19194 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
19195 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
19196 \divide\pgf@x by \pgf@circ@count@b
19197 }
19198 \saveddimen{\pinlen}{%
19199 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
19200 }
19201 \saveddimen{\xorbar}{%
19202 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
19203 }
19204 % anchors for the body (no pins included here)
19205 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
19206 \pgf@circ@ieeestd@stdH
19207 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
19208 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19209 }
19210 \savedanchor{\topleft}{%
19211 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
19212 \pgf@circ@ieeestd@stdH
19213 \pgf@circ@res@other=0pt\relax
19214 \ifnum #2 = 2\relax% "or" or "nor" gates.
19215 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
19216 \fi
19217 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
19218 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
19219 +\pgf@circ@res@right}
19220 \fi
19221 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
19222 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19223 }
19224 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
19225 \pgf@circ@ieeestd@stdH
19226 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
19227 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19228 }
19229 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
19230 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
19231 \pgf@circ@ieeestd@stdH
19232 % #3 is =1 if the port is a negated output one
19233 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
19234 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19235 }
19236 % geographical anchors --- must be rectangulars!
19237 \savedanchor{\northwest}{%
19238 \pgf@circ@find@ieeeport@up
19239 \pgf@circ@find@ieeeport@left{#2}
19240 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
19241 \pgf@x=\pgf@circ@res@left
19242 \pgf@y=\pgf@circ@res@up
19243 }
19244 \savedanchor{\southwest}{%
19245 \pgf@circ@find@ieeeport@up
19246 \pgf@circ@find@ieeeport@left{#2}
19247 \pgf@x=\pgf@circ@res@left
19248 \pgf@y=-\pgf@circ@res@up
19249 }
19250 \savedanchor{\southeast}{%
19251 \pgf@circ@find@ieeeport@up
19252 \pgf@circ@find@ieeeport@right{#3}
19253 \pgf@x=\pgf@circ@res@right
19254 \pgf@y=-\pgf@circ@res@up
19255 }
19256 \savedanchor{\northeast}{%
19257 \pgf@circ@find@ieeeport@up
19258 \pgf@circ@find@ieeeport@right{#3}
19259 \pgf@x=\pgf@circ@res@right
19260 \pgf@y=\pgf@circ@res@up
19261 }
19262 \savedmacro\inputs{% get number of inputs
19263 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
19264 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
19265 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
19266 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
19267 \def\inputs{\the\pgf@circ@count@a}%
19268 }%
19269 \savedmacro\inners{% get number of "inner" inputs (for racks)
19270 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
19271 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
19272 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19273 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
19274 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
19275 % \typeout{INNER is \the\pgf@circ@count@b}%
19276 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
19277 \def\inners{\the\pgf@circ@count@b}%
19278 }%
19279 \anchor{center}{\pgfpointorigin}
19280 \anchor{text}{
19281 \ifpgf@circ@center@text
19282 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19283 \else
19284 \pgf@circ@ieeestd@stdH
19285 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
19286 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19287 \fi
19288 }
19289 % create input anchors
19290 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
19291 \pgf@circ@count@a=\inputs
19292 \pgfmathloop%
19293 \ifnum\pgfmathcounter>\pgf@circ@count@a%
19294 \else%
19295 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
19296 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
19297 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
19298 }%
19299 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
19300 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
19301 }%
19302 \ifnum #2 = 3\relax % xor/xnor inner border pins
19303 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
19304 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
19305 }%
19306 \fi
19307 %}{}%
19308 \repeatpgfmathloop%
19309 }
19310 % output anchor
19311 \anchor{out}{%
19312 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
19313 \advance\pgf@circ@res@other by\pinlen
19314 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
19315 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
19316 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
19317 \fi
19318 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
19319 }
19320 \anchor{bout}{\bottomright\pgf@y=0pt}
19321
19322 \anchor{body right}{\bodyright\pgf@y=0pt}
19323 \anchor{right}{\bottomright\pgf@y=0pt}
19324 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
19325 \anchor{left}{% central edge of the component
19326 \bodyleft\pgf@y=0pt
19327 \ifnum #2=3\relax
19328 \advance\pgf@x by -\xorbar
19329 \fi
19330 }
19331 \anchor{up}{%
19332 \bodyleft
19333 \ifnum #2 > 1 % pointy shapes
19334 \pgf@circ@ieeestd@stdH
19335 % horizontal coordinate where the right semicircle starts
19336 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
19337 % vertical drop of the circle at the above coordinate
19338 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
19339 \advance \pgf@y by -\pgf@circ@res@step
19340 \fi
19341 \pgf@x=0pt
19342 }
19343 \anchor{down}{%
19344 \bodyleft
19345 \ifnum #2 > 1 % pointy shapes
19346 \pgf@circ@ieeestd@stdH
19347 % horizontal coordinate where the right semicircle starts
19348 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
19349 % vertical drop of the circle at the above coordinate
19350 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
19351 \advance \pgf@y by -\pgf@circ@res@step
19352 \fi
19353 \pgf@y=-\pgf@y\pgf@x=0pt
19354 }
19355
19356 % geographical anchors
19357 \anchor{nw}{\northwest}
19358 \anchor{ne}{\northeast}
19359 \anchor{se}{\southeast}
19360 \anchor{sw}{\southwest}
19361 \anchor{north west}{\northwest}
19362 \anchor{north east}{\northeast}
19363 \anchor{south east}{\southeast}
19364 \anchor{south west}{\southwest}
19365 % over 0,0 even if asymmetric
19366 % will break if the geocoords are not rectangular
19367 \anchor{n}{\northwest\pgf@x=0pt\relax}
19368 \anchor{e}{\northeast\pgf@y=0pt\relax}
19369 \anchor{s}{\southwest\pgf@x=0pt\relax}
19370 \anchor{w}{\northwest\pgf@y=0pt\relax}
19371 \anchor{north}{\northwest\pgf@x=0pt\relax}
19372 \anchor{east}{\northeast\pgf@y=0pt\relax}
19373 \anchor{south}{\southwest\pgf@x=0pt\relax}
19374 \anchor{west}{\northwest\pgf@y=0pt\relax}
19375
19376 \backgroundpath{
19377 \pgfscope
19378 \pgfsetcolor{\ctikzvalof{color}}
19379 #4
19380 \endpgfscope
19381 % output lead:
19382 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
19383 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
19384 \advance\pgf@circ@res@other by \pinlen\relax
19385 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
19386 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19387 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
19388 \pgfusepath{draw}
19389 \fi
19390 \ifnum #3=1\relax\pgfscope
19391 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
19392 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
19393 \endpgfscope\fi
19394 }
19395 }
19396 }
19397
19398 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
19399 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
19400 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
19401 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
19402 }
19403 %
19404 % ieeestd "and" and "nand"
19405 %
19406 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
19407 \pgf@circ@count@a = \inputs\relax
19408 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
19409 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
19410 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19411 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
19412 \ifpgfcirc@draw@leads
19413 %input leads --- all the same for AND ports
19414 \loop\ifnum\pgf@circ@count@a>0
19415 \advance\pgf@circ@res@temp by -\pind
19416 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
19417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
19418 \advance\pgf@circ@count@a by -1
19419 \repeat
19420 \fi
19421 \pgfusepath{draw}
19422 %% Body. let's start from the top left
19423 \pgfscope
19424 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19425 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
19426 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
19427 \pgfpatharc{90}{-90}{\stdH}
19428 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
19429 \pgfpathclose
19430 \pgf@circ@draworfill
19431 % rack now; skip if not needed.
19432 % \typeout{WHAT\space \inputs\space \inners}
19433 \ifnum\inputs>\inners
19434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19436 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
19437 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19438 \pgfusepath{draw}
19439 \fi
19440 \endpgfscope
19441 }
19442 %
19443 % or/nor and xor/xnor are practically the same. Let factor out everything
19444 % the argument #1 is put just before the drawing of the inner pins
19445 % the argument #2 is put after the drawing of the body
19446 %
19447 \long\def\pgf@circ@ieeeport@orxor#1#2{%
19448 \pgf@circ@count@a = \inputs\relax
19449 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
19450 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
19451 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19452 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
19453 % rack (extended) pins; they are the same for all the ports
19454 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19455 % above: 1..K (included)
19456 % below: inputs-K..inputs
19457 % Find the pins on the rack; they are 1...
19458 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19459 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
19460 \ifpgfcirc@draw@leads
19461 %input leads --- for or ports
19462 \loop\ifnum\pgf@circ@count@a>0
19463 \pgfextractx{\pgf@circ@res@right}{\topleft}
19464 \advance\pgf@circ@res@temp by -\pind
19465 % this is the height; let's find the "right" position
19466 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
19467 % inner pins
19468 % \typeout{INNER\space\pgf@circ@count@a}
19469 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
19470 % hook for xor/xnor
19471 #1
19472 \fi\fi
19473 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
19474 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
19475 \pgfusepath{draw}
19476 \advance\pgf@circ@count@a by -1
19477 \repeat
19478 \fi
19479 %% Body. let's start from the top left
19480 \pgfscope
19481 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19482 % it should start here, but with this trick the close comes out better.
19483 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19484 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
19485 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
19486 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
19487 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
19488 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
19489 %% this should be 2 and 2; but the round part is not a perfect circle that way
19490 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
19491 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19492 \pgfpathclose
19493 \pgf@circ@draworfill
19494 % hook for xor/xnor
19495 #2
19496 % rack now; skip if not needed.
19497 % \typeout{WHAT\space \inputs\space \inners}
19498 \ifnum\inputs>\inners
19499 \pgfextractx{\pgf@circ@res@left}{\topleft}
19500 \pgfextracty{\pgf@circ@res@down}{\topleft}
19501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19503 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
19504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19505 \pgfusepath{draw}
19506 \fi
19507 \endpgfscope
19508 }
19509 %
19510 % ieeestd "or" and "nor"
19511 %
19512 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
19513 \pgf@circ@ieeeport@orxor{}{}
19514 }
19515 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
19516 \pgf@circ@ieeeport@orxor{
19517 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
19518 \ifnum\@@tmp=0\relax
19519 % move pin start to the left to leave the xor gap free (not standard)
19520 \advance\pgf@circ@res@right by -\xorbar
19521 \fi
19522 }{%
19523 % add the xor/xnor bar
19524 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
19525 % see the comment on the main body about the 2.2
19526 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19527 \pgfusepath{draw}
19528 }
19529 }
19530 %
19531 % Buffer and inverters
19532 %
19533 % #1: name
19534 % #2: polarity
19535 % #3: content
19536 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
19537 \pgfdeclareshape{ieeestd #1 port}%
19538 {%
19539 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19540 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19541 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19542 \saveddimen{\baselen}{%
19543 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
19544 }
19545 \saveddimen{\stdH}{% This is HALF the height of the inner port
19546 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
19547 }
19548 \saveddimen{\notdiameter}{
19549 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
19550 }
19551 \saveddimen{\pinlen}{%
19552 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
19553 }
19554 % anchors for the body (no pins included here)
19555 % Notice that 0.8660254 is cos(30)
19556 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
19557 \pgf@circ@ieeestd@stdH
19558 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19559 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19560 }
19561 \savedanchor{\topleft}{%
19562 \pgf@circ@ieeestd@stdH
19563 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19564 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19565 }
19566 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
19567 \pgf@circ@ieeestd@stdH
19568 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
19569 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19570 }
19571 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
19572 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
19573 \pgf@circ@ieeestd@stdH
19574 % #2 is =1 if the port is a negated output one
19575 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
19576 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19577 }
19578 % geographical anchors --- must be rectangulars!
19579 \savedanchor{\northwest}{%
19580 \pgf@circ@ieeestd@stdH
19581 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19582 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19583 }
19584 \savedanchor{\southwest}{%
19585 \pgf@circ@ieeestd@stdH
19586 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19587 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19588 }
19589 \savedanchor{\southeast}{%
19590 \pgf@circ@ieeestd@stdH
19591 \pgf@circ@res@up=\pgf@circ@res@temp
19592 \pgf@circ@find@ieeeport@not@right{#2}
19593 \pgf@x=\pgf@circ@res@right
19594 \pgf@y=-\pgf@circ@res@up
19595 }
19596 \savedanchor{\northeast}{%
19597 \pgf@circ@ieeestd@stdH
19598 \pgf@circ@res@up=\pgf@circ@res@temp
19599 \pgf@circ@find@ieeeport@not@right{#2}
19600 \pgf@x=\pgf@circ@res@right
19601 \pgf@y=\pgf@circ@res@up
19602 }
19603 \anchor{center}{\pgfpointorigin}
19604 \anchor{text}{
19605 \ifpgf@circ@center@text
19606 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19607 \else
19608 \pgf@circ@ieeestd@stdH
19609 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19610 \fi
19611 }
19612 % input anchors
19613 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
19614 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
19615 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
19616 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
19617 % output anchors
19618 \anchor{out}{%
19619 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
19620 \advance\pgf@circ@res@other by\pinlen
19621 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
19622 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
19623 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
19624 \fi
19625 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
19626 }
19627 \anchor{bout}{\bottomright\pgf@y=0pt}
19628
19629 \anchor{body right}{\bodyright\pgf@y=0pt}
19630 \anchor{right}{\bottomright\pgf@y=0pt}
19631 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
19632 \anchor{left}{% central edge of the component
19633 \pgf@circ@ieeestd@xorbar% save \xorbar in temp
19634 \bodyleft\pgf@y=0pt\advance\pgf@x by -\pgf@circ@res@temp
19635 }
19636 \anchor{up}{%
19637 \bodyleft
19638 \pgf@y=+0.5\pgf@y\pgf@x=0pt
19639 }
19640 \anchor{down}{%
19641 \bodyleft
19642 \pgf@y=-0.5\pgf@y\pgf@x=0pt
19643 }
19644
19645 % geographical anchors
19646 \anchor{nw}{\northwest}
19647 \anchor{ne}{\northeast}
19648 \anchor{se}{\southeast}
19649 \anchor{sw}{\southwest}
19650 \anchor{north west}{\northwest}
19651 \anchor{north east}{\northeast}
19652 \anchor{south east}{\southeast}
19653 \anchor{south west}{\southwest}
19654 % over 0,0 even if asymmetric
19655 % will break if the geocoords are not rectangular
19656 \anchor{n}{\northwest\pgf@x=0pt\relax}
19657 \anchor{e}{\northeast\pgf@y=0pt\relax}
19658 \anchor{s}{\southwest\pgf@x=0pt\relax}
19659 \anchor{w}{\northwest\pgf@y=0pt\relax}
19660 \anchor{north}{\northwest\pgf@x=0pt\relax}
19661 \anchor{east}{\northeast\pgf@y=0pt\relax}
19662 \anchor{south}{\southwest\pgf@x=0pt\relax}
19663 \anchor{west}{\northwest\pgf@y=0pt\relax}
19664
19665 \backgroundpath{
19666 \pgfscope
19667 \pgfsetcolor{\ctikzvalof{color}}
19668 #3
19669 \endpgfscope
19670 % output lead:
19671 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
19672 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
19673 \advance\pgf@circ@res@other by \pinlen\relax
19674 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
19675 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19676 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
19677 \pgfusepath{draw}
19678 \fi
19679 \ifnum #2=1\relax\pgfscope
19680 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
19681 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
19682 \endpgfscope\fi
19683 }
19684 }
19685 }
19686
19687 %%% #1 direct name #2 negated name #3 drawing (without output)
19688 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
19689 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
19690 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
19691 }
19692
19693 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
19694 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19695 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
19696 \pgfextractx{\pgf@circ@res@right}{\bodyright}
19697 % \draw input pin
19698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
19699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
19700 \pgfusepath{draw}
19701 \pgfscope
19702 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19704 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19705 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19706 \pgfpathclose
19707 \pgf@circ@draworfill
19708 \endpgfscope
19709 }
19710
19711 \pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{%
19712 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19713 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
19714 \pgfextractx{\pgf@circ@res@right}{\bodyright}
19715 % \draw input pin
19716 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
19717 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
19718 \pgfusepath{draw}
19719 \pgfscope
19720 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19721 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19722 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19723 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19724 \pgfpathclose
19725 \pgf@circ@draworfill
19726 \endpgfscope
19727 % draw schmitt symbol in normal line thickness
19728 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
19729 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
19730 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
19731 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
19732 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
19733 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
19734 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
19735 \pgfusepath{draw}
19736 }
19737
19738
19739 \pgfdeclareshape{schmitt symbol}{
19740 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19741 \anchor{center}{\pgfpointorigin}
19742 \savedanchor\northwest{%
19743 \pgf@circ@ieeestd@stdH
19744 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
19745 \pgf@x=-1.5\pgf@y
19746 }
19747 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
19748 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
19749 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
19750 \anchor{west}{\northwest\pgf@y=0pt}
19751 \anchor{w}{\northwest \pgf@y=0pt}
19752 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
19753 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19754 \anchor{north}{\northwest\pgf@x=0pt}
19755 \anchor{n}{\northwest\pgf@x=0pt}
19756 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
19757 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
19758 \anchor{north west}{\northwest}
19759 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19760 \backgroundpath{
19761 \pgfscope
19762 \pgfsetcolor{\ctikzvalof{color}}
19763 \pgfextractx{\pgf@circ@res@left}{\northwest}
19764 \pgfextracty{\pgf@circ@res@up}{\northwest}
19765 \pgf@circ@res@left=0.7\pgf@circ@res@left
19766 \pgf@circ@res@up=0.7\pgf@circ@res@up
19767 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19768 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
19769 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
19770 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
19771 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
19772 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
19773 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19774 \pgfusepath{draw}
19775 \endpgfscope
19776 }
19777 }
19778
19779 \pgfdeclareshape{notcirc}{
19780 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19781 \anchor{center}{\pgfpointorigin}
19782 \savedanchor\northwest{%
19783 \pgf@circ@notradius
19784 \pgf@y=\pgf@circ@res@temp
19785 \pgf@x=-\pgf@y
19786 }
19787 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
19788 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
19789 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
19790 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
19791 \anchor{left}{\northwest\pgf@y=0pt}
19792 \anchor{west}{\northwest\pgf@y=0pt}
19793 \anchor{w}{\northwest \pgf@y=0pt}
19794 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
19795 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
19796 \anchor{north}{\northwest\pgf@x=0pt}
19797 \anchor{n}{\northwest\pgf@x=0pt}
19798 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
19799 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
19800 \anchor{north west}{\northwest}
19801 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
19802 \anchorborder{
19803 \pgf@circ@res@left=\pgf@x
19804 \pgf@circ@res@up=\pgf@y
19805 \northwest\pgf@circ@res@temp=\pgf@y
19806 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
19807 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
19808 }
19809 \behindforegroundpath{
19810 \pgfscope
19811 \northwest\pgf@circ@res@temp=\pgf@y
19812 \pgfsetcolor{\ctikzvalof{color}}
19813 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19814 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
19815 \ifx\tikz@fillcolor\pgfutil@empty
19816 % set the default fill color to white
19817 \pgfsetfillcolor{white}
19818 % ...but override it if the class is defined!
19819 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
19820 \else
19821 \pgfsetfillcolor{\tikz@fillcolor}
19822 \fi
19823 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
19824 \pgfusepath{draw,fill}
19825 \endpgfscope
19826 }
19827 }
19828
19829
19830 %%%---------- close: tex/pgfcircmultipoles
19831
19832 %%%%%%%%%%% Springe nach tex/pgfcirclabel
19833 %%%---------- open: tex/pgfcirclabel.tex
19834 % Copyright 2018-2026 by Romano Giannetti
19835 % Copyright 2015-2026 by Stefan Lindner
19836 % Copyright 2013-2026 by Stefan Erhardt
19837 % Copyright 2007-2026 by Massimo Redaelli
19838 %
19839 % This file may be distributed and/or modified
19840 %
19841 % 1. under the LaTeX Project Public License and/or
19842 % 2. under the GNU Public License.
19843 %
19844 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
19845
19846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19847 %% Bipole label positioning
19848
19849 %% bipole labels and annotation extra style
19850
19851 \ctikzset{bipole label style/.style={}}
19852 \tikzset{bipole label style/.code={
19853 \ctikzset{bipole label style/.style={#1}}
19854 }}
19855 \tikzset{bipole label append style/.code={
19856 \ctikzset{bipole label style/.append style={#1}}
19857 }}
19858 \ctikzset{bipole annotation style/.style={}}
19859 \tikzset{bipole annotation style/.code={
19860 \ctikzset{bipole annotation style/.style={#1}}
19861 }}
19862 \tikzset{bipole annotation append style/.code={
19863 \ctikzset{bipole annotation style/.append style={#1}}
19864 }}
19865
19866 %% Options
19867 \ctikzset{label/.style = { l=#1 } }
19868 \ctikzset{l/.code = {
19869 \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
19870 \ctikzsetvalof{bipole/label/unit}{}
19871 \ifpgf@circ@siunitx
19872 \pgf@circ@handleSI{#1}
19873 \ifpgf@circ@siunitx@res
19874 \edef\pgf@temp{\pgf@circ@handleSI@val}
19875 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
19876 \edef\pgf@temp{\pgf@circ@handleSI@unit}
19877 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
19878 \else
19879 \fi
19880 \else
19881 \fi
19882 }}
19883
19884 \ctikzset{label above/.code = {
19885 l=#1,
19886 \circuitikzbasekey/bipole/label/position=90 }
19887 }
19888
19889 \ctikzset{l^/.style = {
19890 l=#1,
19891 \circuitikzbasekey/bipole/label/position=90 }
19892 }
19893
19894 \ctikzset{label below/.code = {
19895 l=#1,
19896 \circuitikzbasekey/bipole/label/position=-90 }
19897 }
19898
19899 \ctikzset{l_/.style = {
19900 l=#1,
19901 \circuitikzbasekey/bipole/label/position=-90 }
19902 }
19903
19904 \ctikzset{annotation/.style = { a=#1 } }
19905 \ctikzset{a/.code = {
19906 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
19907 \ctikzsetvalof{bipole/annotation/unit}{}
19908 \ifpgf@circ@siunitx
19909 \pgf@circ@handleSI{#1}
19910 \ifpgf@circ@siunitx@res
19911 \edef\pgf@temp{\pgf@circ@handleSI@val}
19912 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
19913 \edef\pgf@temp{\pgf@circ@handleSI@unit}
19914 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
19915 \else
19916 \fi
19917 \else
19918 \fi
19919 }}
19920
19921 \ctikzset{annotation above/.code = {
19922 a=#1,
19923 \circuitikzbasekey/bipole/annotation/position=90 }
19924 }
19925
19926 \ctikzset{a^/.style = {
19927 a=#1,
19928 \circuitikzbasekey/bipole/annotation/position=90 }
19929 }
19930
19931 \ctikzset{annotation below/.code = {
19932 a=#1,
19933 \circuitikzbasekey/bipole/annotation/position=-90 }
19934 }
19935 \ctikzset{a_/.style = {
19936 a=#1,
19937 \circuitikzbasekey/bipole/annotation/position=-90 }
19938 }
19939
19940 % This is to adjust spacing for the labels so that they are not cramped on components
19941 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
19942
19943 \def\pgf@circ@drawlabels#1{
19944 \pgfextra{
19945 % This function will be called with argument #1 equal
19946 % to "label" or "annotation" form pgfcircpath.tex.
19947 % pgf@circ@direction is the direction of the path,
19948 % its value is set in pgfcircpath.tex
19949 \pgfmathsubtract{\pgf@circ@direction}{90}
19950 \pgfmathround{\pgfmathresult} % avoid precision loss errors
19951 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
19952
19953 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
19954 \ifnum \pgf@circ@temp < 0
19955 \pgfmathadd{\pgf@circ@labanc}{180}
19956 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
19957 \fi
19958 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
19959 %
19960 % normalize the angle values
19961 %
19962 \pgfmathmod{\pgf@circ@labanc}{360}
19963 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
19964 %
19965 \ifpgf@circuit@bipole@inverted
19966 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
19967 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
19968 \fi
19969 %
19970 \ifnum \ctikzvalof{mirror value} = -1
19971 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
19972 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
19973 \fi
19974 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
19975 }
19976 %Firstly, place a coordinate directly at the edge of the shape
19977 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor)
19978 %now decide, which labels should be drawn
19979 \pgfextra{
19980 \edef\pgf@temp{\ctikzvalof{label/align}}
19981 \def\pgf@circ@temp{straight}
19982 }
19983 \ifx\pgf@temp\pgf@circ@temp %straight
19984 \pgf@circ@drawreglabels{#1}
19985 \else
19986 \pgfextra{\def\pgf@circ@temp{rotate}}
19987 \ifx\pgf@temp\pgf@circ@temp %rotate
19988 \pgf@circ@drawrotlabels{#1}
19989 \else% smart
19990 \pgf@circ@drawsmartlabels{#1}
19991 \fi
19992 \fi
19993 }
19994
19995
19996 \def\pgf@circ@drawsmartlabels#1{
19997 \pgfextra{
19998 \pgfmathmod{\pgf@circ@direction}{90}
19999 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20000 }
20001 \ifnum \pgfcircmathresult > 20
20002 \ifnum \pgfcircmathresult < 70
20003 \pgf@circ@drawrotlabels{#1}
20004 \else
20005 \pgf@circ@drawreglabels{#1}
20006 \fi
20007 \else
20008 \pgf@circ@drawreglabels{#1}
20009 \fi
20010 }
20011
20012
20013 \def\pgf@circ@drawrotlabels#1{
20014 \pgfextra{
20015 % scale the distances in function of zoom, so that they are not
20016 % dependent on it but on font size. Thanks to @marmot
20017 % https://tex.stackexchange.com/a/476018/38080
20018 % the coeffcient is adjusted so that the distance is more or less
20019 % the same for rotated labels and straight ones (although it will
20020 % depend on the font, so it's not exact).
20021 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
20022 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
20023 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
20024 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale}
20025 \ifnum \ctikzvalof{bipole/#1/position}>0
20026 %we need some more space for placement below, due to mid-anchor
20027 \else % we do not have <= in \ifnum...
20028 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
20029 \fi
20030 %Calculate rotation of the label from direction and strip decimals
20031 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20032 % rotate the label at second or third quadrant:
20033 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
20034 \pgfmathsubtract{\pgf@circ@direction}{180}
20035 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20036 %invert the space relationships due to rotated strings
20037 \ifnum \ctikzvalof{bipole/#1/position}>0
20038 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
20039 \fi
20040 \fi\fi
20041 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}
20042 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20043 }
20044 % reset cm is not working correctly here
20045 (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor)
20046 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
20047 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
20048 }
20049
20050 \def\pgf@circ@drawreglabels#1{
20051 %Now calculate all shape positions
20052 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
20053 %All points between will be addressed by angled-anchors:
20054 \pgfextra{
20055 % scale ex-distance to make it independent on scale
20056 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
20057 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
20058 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
20059 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
20060 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale}
20061 \pgfmathadd{\pgf@circ@labanc}{90}
20062 \pgfmathround{\pgfmathresult}
20063 \def\pgf@circ@labanctext{\pgf@circ@labanc}
20064 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20065 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
20066 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20067 }
20068 %Values around 90 are at both y-axis
20069 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
20070 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
20071 \ifnum \pgf@circ@labpos > 180
20072 \ifnum \ctikzvalof{bipole/#1/position} > 0
20073 \pgfextra{\def\pgf@circ@labanctext{mid west}}
20074 \else
20075 \pgfextra{\def\pgf@circ@labanctext{mid east}}
20076 \fi
20077 \else
20078 \ifnum \ctikzvalof{bipole/#1/position} > 0
20079 \pgfextra{\def\pgf@circ@labanctext{mid east}}
20080 \else
20081 \pgfextra{\def\pgf@circ@labanctext{mid west}}
20082 \fi
20083 \fi
20084 \fi\fi
20085 %Values between -5 and 5 are at pos /neg x-axis
20086 \pgfextra{\def\uffa{}\newdimen\realshift\realshift=\dimexpr1pt\relax}
20087 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
20088 \ifnum \ctikzvalof{bipole/#1/position} < 0
20089 \ifnum \pgf@circ@labanc > 90
20090 % using base coordinate instead of south to naturally align
20091 % symbols with descendants; but this invalidate the effect of
20092 % the inner sep, so recover it by shifting the anchor
20093 % reset cm is not working sometime, use @marmot solution
20094 % see https://tex.stackexchange.com/a/476018/38080
20095 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20096 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20097 \else
20098 \pgfextra{\def\pgf@circ@labanctext{north}}%north
20099 \fi
20100 \else
20101 \ifnum \pgf@circ@labanc < 90
20102 % shift, as above
20103 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20104 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20105 \else
20106 \ifnum \pgf@circ@labanc > 180
20107 % this shouldn't happen, but somehow it does (270 degree anchors)
20108 % shift, as above
20109 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20110 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20111 \else
20112 \pgfextra{\def\pgf@circ@labanctext{north}}%north
20113 \fi
20114 \fi
20115 \fi
20116 \fi\fi
20117 (labelcoor) node[anchor=\pgf@circ@labanctext,
20118 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
20119 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
20120 }
20121 }
20122
20123 \def\pgf@circ@finallabels#1{%
20124 \edef\pgf@temp{}%
20125 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
20126 \ifx\pgf@temp\pgf@circ@temp%
20127 \ctikzvalof{bipole/#1/name}%
20128 \else%
20129 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
20130 \fi%
20131 }
20132
20133 \ctikzset{text/.style={t=#1}}
20134 \ctikzset{t/.code={%
20135 \ctikzsetvalof{bipoles/twoport/text}{#1}%
20136 }}
20137
20138 %%%% Stacked labels
20139 %
20140 % stacked labels by Romano Giannetti [email protected]
20141 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
20142 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
20143 %
20144 % labels are in a tabular, globally aligned:
20145 % vertically with key l2 valign (default c)
20146 % c: center t: top b: bottom
20147 % horizontally with key l2 align (default l)
20148 % l: left c: centered r: right
20149 % you can switch sides using l2_=... and l2^=...
20150 % syntax is l2_ = line1 and line2 (same for l2^)
20151 %
20152 \ctikzset{%
20153 l2 valign/.store in=\ltwo@valign, l2 valign=c,
20154 l2 halign/.store in=\ltwo@halign, l2 halign=l,
20155 }
20156 \ctikzset{l2base/.code n args={2}{
20157 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
20158 \bgroup
20159 \setlength{\tabcolsep}{2pt}%
20160 \def\ltwo@tabu{\tabular[\ltwo@valign]}%
20161 \expandafter\ltwo@tabu\expandafter{\ltwo@halign}%
20162 #1\\ #2%
20163 \endtabular
20164 \egroup
20165 }%
20166 \ctikzsetvalof{bipole/label/unit}{}
20167 \ifpgf@circ@siunitx
20168 \pgf@circ@handleSI{#2}
20169 \ifpgf@circ@siunitx@res
20170 \edef\pgf@temp{\pgf@circ@handleSI@val}
20171 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
20172 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20173 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
20174 \else
20175 \fi
20176 \else
20177 \fi
20178 }}
20179 \ctikzset{l2/.style args={#1 and #2}{
20180 l2base={#1}{#2},
20181 \circuitikzbasekey/bipole/label/position=90 }
20182 }
20183 \ctikzset{l2 above/.style args={#1 and #2}{
20184 l2base={#1}{#2},
20185 \circuitikzbasekey/bipole/label/position=90 }
20186 }
20187 \ctikzset{l2^/.style args={#1 and #2}{
20188 l2base={#1}{#2},
20189 \circuitikzbasekey/bipole/label/position=90 }
20190 }
20191 \ctikzset{l2 below/.style args={#1 and #2}{
20192 l2base={#1}{#2},
20193 \circuitikzbasekey/bipole/label/position=-90 }
20194 }
20195 \ctikzset{l2_/.style args={#1 and #2}{
20196 l2base={#1}{#2},
20197 \circuitikzbasekey/bipole/label/position=-90 }
20198 }
20199
20200 %%%---------- close: tex/pgfcirclabel
20201 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
20202 %%%---------- open: tex/pgfcircvoltage.tex
20203 % Copyright 2018-2026 by Romano Giannetti
20204 % Copyright 2015-2026 by Stefan Lindner
20205 % Copyright 2013-2026 by Stefan Erhardt
20206 % Copyright 2007-2026 by Massimo Redaelli
20207 %
20208 % This file may be distributed and/or modified
20209 %
20210 % 1. under the LaTeX Project Public License and/or
20211 % 2. under the GNU Public License.
20212 %
20213 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
20214
20215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20216 %% Voltage management
20217
20218 %% styles
20219 \ctikzset{bipole voltage style/.style={}}
20220 \tikzset{bipole voltage style/.code={
20221 \ctikzset{bipole voltage style/.style={#1}}
20222 }}
20223 \tikzset{bipole voltage append style/.code={
20224 \ctikzset{bipole voltage style/.append style={#1}}
20225 }}
20226
20227 \ctikzset{v^>/.style = {
20228 v = #1,
20229 \circuitikzbasekey/bipole/voltage/direction = forward,
20230 \circuitikzbasekey/bipole/voltage/position = above
20231 }
20232 }
20233
20234 \ctikzset{v^</.style = {
20235 v = #1,
20236 \circuitikzbasekey/bipole/voltage/direction = backward,
20237 \circuitikzbasekey/bipole/voltage/position = above
20238 }
20239 }
20240
20241 \ctikzset{v_>/.style = {
20242 v = #1,
20243 \circuitikzbasekey/bipole/voltage/direction = forward,
20244 \circuitikzbasekey/bipole/voltage/position = below
20245 }
20246 }
20247
20248 \ctikzset{v_</.style = {
20249 v = #1,
20250 \circuitikzbasekey/bipole/voltage/direction = backward,
20251 \circuitikzbasekey/bipole/voltage/position = below
20252 }
20253 }
20254
20255 \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
20256 \ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
20257 \ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
20258 \ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
20259
20260 % Default position varies whether the component is a voltage source
20261 % or not
20262 \ctikzset{v/.code = {
20263 \ifpgf@circuit@bipole@isvoltage
20264 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
20265 \circuitikzbasekey/bipole/voltage/direction=forward}
20266 \else
20267 \ifpgf@circ@oldvoltagedirection
20268 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20269 \circuitikzbasekey/bipole/voltage/direction=backward}
20270 \else
20271 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20272 \circuitikzbasekey/bipole/voltage/direction=forward}
20273 \fi
20274 \fi
20275 \ifpgf@circ@oldvoltagedirection
20276 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
20277 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20278 \circuitikzbasekey/bipole/voltage/direction=forward}
20279 \fi\fi
20280 \else
20281 \ifpgf@circuit@bipole@iscurrent
20282 \ifpgf@circuit@bipole@current@backward
20283 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20284 \circuitikzbasekey/bipole/voltage/direction=forward}
20285 \else
20286 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20287 \circuitikzbasekey/bipole/voltage/direction=backward}
20288 \fi\fi\fi
20289 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
20290 \ctikzsetvalof{bipole/voltage/label/unit}{}
20291 \ifpgf@circ@siunitx
20292 \pgf@circ@handleSI{#1}
20293 \ifpgf@circ@siunitx@res
20294 \edef\pgf@temp{\pgf@circ@handleSI@val}
20295 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
20296 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20297 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
20298 \else
20299 \fi
20300 \else
20301 \fi
20302 }
20303 }
20304
20305 % american voltage font selection and symbol definition
20306 % the default font command is {} --- nothing
20307 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
20308 %
20309 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
20310 %
20311 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
20312 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
20313
20314 %%
20315 \def\setscaledRlenforclass{%
20316 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
20317 \ifdefined\ctikzclass
20318 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
20319 \pgfkeysifdefined{\pgf@temp}
20320 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20321 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
20322 \else
20323 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
20324 \fi
20325 }
20326
20327 %% Output routine for generic bipoles
20328
20329 \def\pgf@circ@drawvoltagegeneric{
20330 \pgfextra{
20331 % \typeout{NAME:\ctikzvalof{bipole/name}}
20332 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
20333 \pgfkeysifdefined{\pgf@temp}
20334 {
20335 \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}
20336 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
20337 }
20338 {
20339 \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance}
20340 {
20341 \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}}
20342 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
20343 }
20344 {%calculate default value from part height
20345 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
20346 \pgfkeysifdefined{\pgf@temp}
20347 {
20348 \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
20349 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen+0.2\pgf@circ@scaled@Rlen)}
20350 }
20351 {
20352 \edef\tmpdistfromline{(.5\pgf@circ@scaled@Rlen)} %fallback to fixed value
20353 }
20354 }
20355 }
20356 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
20357 \ifnum \ctikzvalof{mirror value}=-1
20358 \ifpgf@circuit@bipole@inverted
20359 \ifpgf@circuit@bipole@voltage@straight
20360 \def\distfromline{\tmpdistfromline}
20361 \else
20362 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20363 \fi
20364 \else
20365 \ifpgf@circuit@bipole@voltage@straight
20366 \def\distfromline{-\tmpdistfromline}
20367 \else
20368 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20369 \fi
20370 \fi
20371 \else
20372 \ifpgf@circuit@bipole@inverted
20373 \ifpgf@circuit@bipole@voltage@straight
20374 \def\distfromline{-\tmpdistfromline}
20375 \else
20376 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20377 \fi
20378 \else
20379 \ifpgf@circuit@bipole@voltage@straight
20380 \def\distfromline{\tmpdistfromline}
20381 \else
20382 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20383 \fi
20384 \fi
20385 \fi
20386 \ifpgf@circuit@bipole@voltage@below
20387 \def\pgf@circ@voltage@angle{90}
20388 \else
20389 \def\pgf@circ@voltage@angle{-90}
20390 \fi
20391 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
20392 \pgfkeysifdefined{\pgf@temp}
20393 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
20394 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
20395 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
20396 \pgfkeysifdefined{\pgf@temp}
20397 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
20398 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
20399 \edef\shiftv{\ctikzvalof{voltage/shift}}
20400 % additional per-bipole voltage shift (internal)
20401 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}
20402 \pgfkeysifdefined{\pgf@temp}
20403 {
20404 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}}
20405 }
20406 {
20407 \edef\addvshift{0}
20408 }
20409 \newdimen{\absvshift}
20410 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
20411 % put this to true to see the voltage label coordinate anchors
20412 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
20413 }
20414 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
20415 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
20416 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorstartnode)$)
20417 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
20418 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$)
20419
20420 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
20421 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorendnode)$)
20422 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
20423 coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$)
20424
20425 \ifpgf@circuit@bipole@voltage@below
20426 \ifpgf@circ@debugv
20427 node [ocirc, fill=red] at (anchorstartnode) {}
20428 node [ocirc, fill=blue] at (anchorendnode) {}
20429 node [ocirc, fill=green] at (pgfcirc@Vto) {}
20430 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
20431 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
20432 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
20433 \fi
20434 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$)
20435 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
20436 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
20437 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
20438 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
20439 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
20440 \ifpgf@circ@debugv
20441 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
20442 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
20443 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
20444 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
20445 \fi
20446 \else
20447 \ifpgf@circ@debugv
20448 node [ocirc, fill=red] at (anchorstartnode) {}
20449 node [ocirc, fill=blue] at (anchorendnode) {}
20450 node [ocirc, fill=green] at (pgfcirc@Vto) {}
20451 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
20452 node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {}
20453 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {}
20454 \fi
20455 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
20456 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
20457 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
20458 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
20459 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
20460 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
20461 \ifpgf@circ@debugv
20462 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
20463 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
20464 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
20465 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
20466 \fi
20467 \fi
20468
20469 \ifpgf@circuit@europeanvoltage
20470 \ifpgf@circuit@bipole@voltage@straight
20471 \ifpgf@circuit@bipole@voltage@backward
20472 (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
20473 \else
20474 (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
20475 \fi
20476 \else
20477 \ifpgf@circuit@bipole@voltage@backward
20478 (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) ..
20479 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
20480 (pgfcirc@Vfrom)
20481 \else
20482 (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) ..
20483 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
20484 (pgfcirc@Vto)
20485 \fi
20486 \fi
20487 \else % american
20488 \ifx\@@kind\@@open % open circuit; put + and - directly on it
20489 \ifpgf@circuit@bipole@voltage@backward
20490 \ifpgf@circ@oldvoltagedirection
20491 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20492 anchor=center]{\pgf@circ@avplus}
20493 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20494 anchor=center]{\pgf@circ@avminus}
20495 \else
20496 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20497 anchor=center]{\pgf@circ@avminus}
20498 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20499 anchor=center]{\pgf@circ@avplus}
20500 \fi
20501 \else
20502 \ifpgf@circ@oldvoltagedirection
20503 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20504 anchor=center]{\pgf@circ@avminus}
20505 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20506 anchor=center]{\pgf@circ@avplus}
20507 \else
20508 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20509 anchor=center]{\pgf@circ@avplus}
20510 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20511 anchor=center]{\pgf@circ@avminus}
20512 \fi
20513 \fi
20514 \else % not open circuit
20515 \ifpgf@circuit@bipole@voltage@backward
20516 \ifpgf@circ@oldvoltagedirection
20517 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20518 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20519 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20520 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20521 \else
20522 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20523 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20524 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20525 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20526 \fi
20527 \else
20528 \ifpgf@circ@oldvoltagedirection
20529 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20530 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20531 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20532 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20533 \else
20534 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20535 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20536 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20537 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20538 \fi
20539 \fi
20540 \fi
20541 \fi
20542 }
20543
20544 %% Output routine for voltage sources
20545 \def\pgf@circ@drawvoltagegenerator{
20546 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
20547 % it's not perfect, but I can't find the way to do it correctly...
20548 \pgfextra{
20549 \edef\shiftv{\ctikzvalof{voltage/shift}}
20550 \edef\bumpa{\ctikzvalof{voltage/bump a}}
20551 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
20552 }
20553 \ifpgf@circuit@bipole@voltage@below
20554 coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
20555 coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
20556 \else
20557 coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
20558 coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
20559 \fi
20560 % fix the (unused in this case) Vcont1/2 coords for label placement along the line
20561 coordinate (pgfcirc@Vcont1) at (pgfcirc@Vto)
20562 coordinate (pgfcirc@Vcont2) at (pgfcirc@Vfrom)
20563 \ifpgf@circuit@europeanvoltage
20564 \ifpgf@circuit@bipole@voltage@backward
20565 (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vfrom)
20566 \else
20567 (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vto)
20568 \fi
20569 \else% american voltage
20570 \ifpgf@circuit@bipole@voltageoutsideofsymbol
20571 % if it is a battery, must put + and -
20572
20573 \ifpgf@circ@fixbatteries
20574 \ifpgf@circuit@bipole@voltage@backward
20575 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20576 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20577 \else
20578 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20579 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20580 \fi
20581 \else
20582 \ifpgf@circuit@bipole@voltage@backward
20583 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20584 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20585 \else
20586 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20587 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20588 \fi
20589 \fi
20590 \fi
20591 \fi
20592 }
20593
20594 %% Output routine
20595 %% this is the entry point
20596 %%
20597 \def\pgf@circ@drawvoltage{% node name
20598 \pgfextra{ %WARNING: indentation is probably wrong
20599 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20600 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
20601 \ifpgf@circuit@bipole@voltage@below
20602 \def\pgf@circ@bipole@voltage@label@anchor{north west}
20603 \else
20604 \def\pgf@circ@bipole@voltage@label@anchor{south east}
20605 \fi
20606 \fi\fi
20607 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
20608 \ifpgf@circuit@bipole@voltage@below
20609 \def\pgf@circ@bipole@voltage@label@anchor{west}
20610 \else
20611 \def\pgf@circ@bipole@voltage@label@anchor{east}
20612 \fi
20613 \fi\fi
20614 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
20615 \ifpgf@circuit@bipole@voltage@below
20616 \def\pgf@circ@bipole@voltage@label@anchor{south west}
20617 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
20618 \fi
20619 \fi\fi
20620 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
20621 \ifpgf@circuit@bipole@voltage@below
20622 \def\pgf@circ@bipole@voltage@label@anchor{south}
20623 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
20624 \fi
20625 \fi\fi
20626 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
20627 \ifpgf@circuit@bipole@voltage@below
20628 \def\pgf@circ@bipole@voltage@label@anchor{south east}
20629 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
20630 \fi
20631 \fi\fi
20632 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
20633 \ifpgf@circuit@bipole@voltage@below
20634 \def\pgf@circ@bipole@voltage@label@anchor{east}
20635 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
20636 \fi
20637 \fi\fi
20638 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
20639 \ifpgf@circuit@bipole@voltage@below
20640 \def\pgf@circ@bipole@voltage@label@anchor{north east}
20641 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
20642 \fi
20643 \fi\fi
20644 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
20645 \ifpgf@circuit@bipole@voltage@below
20646 \def\pgf@circ@bipole@voltage@label@anchor{north}
20647 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
20648 \fi
20649 \fi\fi
20650 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
20651 \ifpgf@circuit@bipole@voltage@below
20652 \def\pgf@circ@bipole@voltage@label@anchor{north}
20653 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
20654 \fi
20655 \fi\fi
20656
20657 % this must be set *before* changing for mirroring and inverting; in that case
20658 % the xscale/yscale parameters take it into account
20659 \ifpgf@circuit@bipole@voltage@below
20660 \def\pgf@circ@bipole@voltage@label@where{-90}
20661 \else
20662 \def\pgf@circ@bipole@voltage@label@where{90}
20663 \fi
20664
20665 % magic to counteract the scale and yscale effects (there should be a better way...)
20666 \ifnum \ctikzvalof{mirror value}=-1
20667 \ifpgf@circuit@bipole@voltage@below
20668 \pgf@circuit@bipole@voltage@belowfalse
20669 \else
20670 \pgf@circuit@bipole@voltage@belowtrue
20671 \fi
20672 \fi
20673
20674 \ifpgf@circuit@bipole@inverted
20675 \ifpgf@circuit@bipole@voltage@below
20676 \pgf@circuit@bipole@voltage@belowfalse
20677 \else
20678 \pgf@circuit@bipole@voltage@belowtrue
20679 \fi
20680 \fi
20681
20682 % take into account scaling
20683 \setscaledRlenforclass
20684
20685 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
20686 \pgfkeysifdefined{\pgf@temp}
20687 { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} }
20688 { \edef\eudist{\ctikzvalof{voltage/european label distance}} }
20689 % find the height of the bipole or use a default value
20690 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
20691 \pgfkeysifdefined{\pgf@temp}
20692 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
20693 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
20694 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
20695 \newdimen{\alshift}
20696 % this is more or less the same of the legacy code; we shift the american label a bit
20697 % outside the (+) -- (-) line
20698 \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight}
20699 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
20700 % set the macro for detecting open
20701 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
20702 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
20703 % \typeout{KIND\space\@@kind}
20704 }%end pgfextra
20705
20706 \ifpgf@circuit@bipole@isvoltage
20707 \pgf@circ@drawvoltagegenerator
20708 \else
20709 \pgf@circ@drawvoltagegeneric
20710 \fi
20711
20712 % \pgfextra{\typeout{LABEL\space KIND:\@@kind\space OPEN:\@@open}}
20713
20714 \ifpgf@circuit@bipole@voltage@straight
20715 coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $)
20716 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
20717 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
20718 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
20719 \else
20720 \ifpgf@circuit@europeanvoltage
20721 coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$)
20722 \else
20723 coordinate (Vlab) at ($(pgfcirc@Vfrom)!0.5!(pgfcirc@Vto)$)
20724 \ifpgf@circuit@bipole@isvoltage\else
20725 % add a bit of space for american labels above their symbols in the normal case. You can avoid that
20726 % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights)
20727 coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vto)$)
20728 \fi
20729 \fi
20730
20731 \ifpgf@circuit@europeanvoltage
20732 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
20733 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
20734 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
20735 \else % american voltages
20736 \ifx\@@kind\@@open
20737 coordinate (Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
20738 node [anchor=center, inner sep=2pt,
20739 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
20740 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
20741 \else
20742 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
20743 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
20744 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
20745 \fi
20746 \fi
20747 \fi
20748 }%end drawvoltages
20749 %%%---------- close: tex/pgfcircvoltage
20750 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
20751 %%%---------- open: tex/pgfcirccurrent.tex
20752 % Copyright 2018-2026 by Romano Giannetti
20753 % Copyright 2015-2026 by Stefan Lindner
20754 % Copyright 2013-2026 by Stefan Erhardt
20755 % Copyright 2007-2026 by Massimo Redaelli
20756 %
20757 % This file may be distributed and/or modified
20758 %
20759 % 1. under the LaTeX Project Public License and/or
20760 % 2. under the GNU Public License.
20761 %
20762 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
20763
20764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20765 %% Current handling
20766
20767 %% styles
20768 \ctikzset{bipole current style/.style={}}
20769 \tikzset{bipole current style/.code={
20770 \ctikzset{bipole current style/.style={#1}}
20771 }}
20772 \tikzset{bipole current append style/.code={
20773 \ctikzset{bipole current style/.append style={#1}}
20774 }}
20775
20776 %% Options
20777 \ctikzset{i^>/.style = {
20778 i = #1,
20779 \circuitikzbasekey/bipole/current/direction = forward,
20780 \circuitikzbasekey/bipole/current/x position = after,
20781 \circuitikzbasekey/bipole/current/y position = above
20782 }
20783 }
20784
20785 \ctikzset{i_>/.style = {
20786 i = #1,
20787 \circuitikzbasekey/bipole/current/direction = forward,
20788 \circuitikzbasekey/bipole/current/x position = after,
20789 \circuitikzbasekey/bipole/current/y position = below
20790 }
20791 }
20792
20793 \ctikzset{i>^/.style = {
20794 i = #1,
20795 \circuitikzbasekey/bipole/current/direction = forward,
20796 \circuitikzbasekey/bipole/current/x position = before,
20797 \circuitikzbasekey/bipole/current/y position = above
20798 }
20799 }
20800
20801 \ctikzset{i>_/.style = {
20802 i = #1,
20803 \circuitikzbasekey/bipole/current/direction = forward,
20804 \circuitikzbasekey/bipole/current/x position = before,
20805 \circuitikzbasekey/bipole/current/y position = below
20806 }
20807 }
20808
20809 \ctikzset{i^</.style = {
20810 i = #1,
20811 \circuitikzbasekey/bipole/current/direction = backward,
20812 \circuitikzbasekey/bipole/current/x position = after,
20813 \circuitikzbasekey/bipole/current/y position = above
20814 }
20815 }
20816
20817 \ctikzset{i_</.style = {
20818 i = #1,
20819 \circuitikzbasekey/bipole/current/direction = backward,
20820 \circuitikzbasekey/bipole/current/x position = after,
20821 \circuitikzbasekey/bipole/current/y position = below
20822 }
20823 }
20824
20825 \ctikzset{i<^/.style = {
20826 i = #1,
20827 \circuitikzbasekey/bipole/current/direction = backward,
20828 \circuitikzbasekey/bipole/current/x position = before,
20829 \circuitikzbasekey/bipole/current/y position = above
20830 }
20831 }
20832
20833 \ctikzset{i<_/.style = {
20834 i = #1,
20835 \circuitikzbasekey/bipole/current/direction = backward,
20836 \circuitikzbasekey/bipole/current/x position = before,
20837 \circuitikzbasekey/bipole/current/y position = below
20838 }
20839 }
20840
20841 \ctikzset{i/.code = {
20842 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
20843 \circuitikzbasekey/bipole/current/x position = after,
20844 \circuitikzbasekey/bipole/current/y position = above }
20845 \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
20846 \ctikzsetvalof{bipole/current/label/unit}{}
20847 \ifpgf@circ@siunitx
20848 \pgf@circ@handleSI{#1}
20849 \ifpgf@circ@siunitx@res
20850 \edef\pgf@temp{\pgf@circ@handleSI@val}
20851 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
20852 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20853 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
20854 \else
20855 \fi
20856 \else
20857 \fi
20858 %reverse current direction for voltage sources
20859 \ifpgf@circ@oldvoltagedirection\else
20860 \ifpgf@circuit@bipole@isvoltage
20861 \ifpgf@circuit@bipole@voltage@backward
20862 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
20863 \circuitikzbasekey/bipole/current/x position = after,
20864 \circuitikzbasekey/bipole/current/y position = below }
20865 \else
20866 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
20867 \circuitikzbasekey/bipole/current/x position = before,
20868 \circuitikzbasekey/bipole/current/y position = above }
20869 \fi\fi\fi
20870 }
20871 }
20872
20873 \ifpgf@circ@oldvoltagedirection
20874 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
20875 \else
20876 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
20877 \fi
20878 \ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
20879 \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
20880 \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
20881
20882 %% Output routine
20883 \def\pgf@circ@drawcurrent{
20884 \pgfextra{
20885 \edef\pgf@circ@ffffff{\pgf@circ@direction}
20886 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
20887
20888 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
20889 \ifpgf@circuit@bipole@current@below
20890 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
20891 \fi
20892 \fi\fi
20893 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
20894 \ifpgf@circuit@bipole@current@below
20895 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
20896 \fi
20897 \fi\fi
20898 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
20899 \ifpgf@circuit@bipole@current@below
20900 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
20901 \fi
20902 \fi\fi
20903 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
20904 \ifpgf@circuit@bipole@current@below
20905 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
20906 \fi
20907 \fi\fi
20908 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
20909 \ifpgf@circuit@bipole@current@below
20910 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
20911 \fi
20912 \fi\fi
20913 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
20914 \ifpgf@circuit@bipole@current@below
20915 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
20916 \fi
20917 \fi\fi
20918 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
20919 \ifpgf@circuit@bipole@current@below
20920 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
20921 \fi
20922 \fi\fi
20923 \ifnum\pgfcircmathresult <5
20924 \ifpgf@circuit@bipole@current@below
20925 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
20926 \fi
20927 \fi
20928 \ifnum\pgfcircmathresult >355
20929 \ifpgf@circuit@bipole@current@below
20930 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
20931 \fi
20932 \fi
20933
20934 \ifpgf@circuit@bipole@current@below
20935 \def\pgf@circ@bipole@current@label@where{-90}
20936 \else
20937 \def\pgf@circ@bipole@current@label@where{+90}
20938 \fi
20939 }
20940
20941 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
20942 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
20943 (\tikztostart)--(\tikztotarget)
20944 \else% normal bipole or source
20945 \ifpgf@circuit@bipole@current@before
20946 (\tikztostart)--(anchorstartnode)
20947 \else
20948 (anchorendnode)--(\tikztotarget)
20949 \fi
20950 \fi
20951 \ifpgf@circuit@bipole@current@backward
20952 \pgfextra{
20953 \pgfmathsubtract{\pgf@circ@ffffff}{180}
20954 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20955 }
20956 \fi
20957 coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff,
20958 anchor=center](Iarrow)
20959 (Iarrow.\pgf@circ@bipole@current@label@where)
20960 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
20961 (\ctikzvalof{bipole/name}current){\pgf@circ@finallabels{current/label}}
20962 }
20963
20964 %%%---------- close: tex/pgfcirccurrent
20965 %%%%%%%%%%% Springe nach tex/pgfcircflow
20966 %%%---------- open: tex/pgfcircflow.tex
20967 % Copyright 2018-2026 by Romano Giannetti
20968 % Copyright 2015-2026 by Stefan Lindner
20969 % Copyright 2013-2026 by Stefan Erhardt
20970 % Copyright 2007-2026 by Massimo Redaelli
20971 %
20972 % This file may be distributed and/or modified
20973 %
20974 % 1. under the LaTeX Project Public License and/or
20975 % 2. under the GNU Public License.
20976 %
20977 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
20978
20979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20980 %% flow handling
20981
20982 %% styles
20983 \ctikzset{bipole flow style/.style={}}
20984 \tikzset{bipole flow style/.code={
20985 \ctikzset{bipole flow style/.style={#1}}
20986 }}
20987 \tikzset{bipole flow append style/.code={
20988 \ctikzset{bipole flow style/.append style={#1}}
20989 }}
20990
20991 %% Options
20992 \ctikzset{f^>/.style = {
20993 f = #1,
20994 \circuitikzbasekey/bipole/flow/direction = forward,
20995 \circuitikzbasekey/bipole/flow/x position = after,
20996 \circuitikzbasekey/bipole/curflowrent/y position = above
20997 }
20998 }
20999
21000 \ctikzset{f_>/.style = {
21001 f = #1,
21002 \circuitikzbasekey/bipole/flow/direction = forward,
21003 \circuitikzbasekey/bipole/flow/x position = after,
21004 \circuitikzbasekey/bipole/flow/y position = below
21005 }
21006 }
21007
21008 \ctikzset{f>^/.style = {
21009 f = #1,
21010 \circuitikzbasekey/bipole/flow/direction = forward,
21011 \circuitikzbasekey/bipole/flow/x position = before,
21012 \circuitikzbasekey/bipole/flow/y position = above
21013 }
21014 }
21015
21016 \ctikzset{f>_/.style = {
21017 f = #1,
21018 \circuitikzbasekey/bipole/flow/direction = forward,
21019 \circuitikzbasekey/bipole/flow/x position = before,
21020 \circuitikzbasekey/bipole/flow/y position = below
21021 }
21022 }
21023
21024 \ctikzset{f^</.style = {
21025 f = #1,
21026 \circuitikzbasekey/bipole/flow/direction = backward,
21027 \circuitikzbasekey/bipole/flow/x position = after,
21028 \circuitikzbasekey/bipole/flow/y position = above
21029 }
21030 }
21031
21032 \ctikzset{f_</.style = {
21033 f = #1,
21034 \circuitikzbasekey/bipole/flow/direction = backward,
21035 \circuitikzbasekey/bipole/flow/x position = after,
21036 \circuitikzbasekey/bipole/flow/y position = below
21037 }
21038 }
21039
21040 \ctikzset{f<^/.style = {
21041 f = #1,
21042 \circuitikzbasekey/bipole/flow/direction = backward,
21043 \circuitikzbasekey/bipole/flow/x position = before,
21044 \circuitikzbasekey/bipole/flow/y position = above
21045 }
21046 }
21047
21048 \ctikzset{f<_/.style = {
21049 f = #1,
21050 \circuitikzbasekey/bipole/flow/direction = backward,
21051 \circuitikzbasekey/bipole/flow/x position = before,
21052 \circuitikzbasekey/bipole/flow/y position = below
21053 }
21054 }
21055
21056 \ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
21057 \ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
21058 \ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
21059 \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
21060
21061 \ctikzset{f/.code = {
21062 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
21063 \circuitikzbasekey/bipole/flow/x position = after,
21064 \circuitikzbasekey/bipole/flow/y position = above }
21065 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
21066 \ctikzsetvalof{bipole/flow/label/unit}{}
21067 \ifpgf@circ@siunitx
21068 \pgf@circ@handleSI{#1}
21069 \ifpgf@circ@siunitx@res
21070 \edef\pgf@temp{\pgf@circ@handleSI@val}
21071 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
21072 \edef\pgf@temp{\pgf@circ@handleSI@unit}
21073 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
21074 \else
21075 \fi
21076 \else
21077 \fi
21078 }
21079 }
21080
21081 %% Output routine
21082 \def\pgf@circ@drawflow{
21083 \pgfextra{
21084 \edef\pgf@circ@ffffff{\pgf@circ@direction}
21085 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
21086
21087 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
21088 \ifpgf@circuit@bipole@flow@below
21089 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
21090 \fi
21091 \fi\fi
21092 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
21093 \ifpgf@circuit@bipole@flow@below
21094 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
21095 \fi
21096 \fi\fi
21097 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
21098 \ifpgf@circuit@bipole@flow@below
21099 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
21100 \fi
21101 \fi\fi
21102 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
21103 \ifpgf@circuit@bipole@flow@below
21104 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
21105 \fi
21106 \fi\fi
21107 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
21108 \ifpgf@circuit@bipole@flow@below
21109 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
21110 \fi
21111 \fi\fi
21112 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
21113 \ifpgf@circuit@bipole@flow@below
21114 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
21115 \fi
21116 \fi\fi
21117 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
21118 \ifpgf@circuit@bipole@flow@below
21119 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
21120 \fi
21121 \fi\fi
21122 \ifnum\pgfcircmathresult <5
21123 \ifpgf@circuit@bipole@flow@below
21124 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21125 \fi
21126 \fi
21127 \ifnum\pgfcircmathresult >355
21128 \ifpgf@circuit@bipole@flow@below
21129 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21130 \fi
21131 \fi
21132
21133 \ifpgf@circuit@bipole@flow@below
21134 \def\pgf@circ@bipole@flow@label@where{-90}
21135 \else
21136 \def\pgf@circ@bipole@flow@label@where{+90}
21137 \fi
21138 }
21139
21140 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
21141 \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line
21142 (\tikztostart)--(\tikztotarget)
21143 \else% normal bipole or source
21144 \ifpgf@circuit@bipole@flow@before
21145 (\tikztostart)--(anchorstartnode)
21146 \else
21147 (anchorendnode)--(\tikztotarget)
21148 \fi
21149 \fi
21150 \pgfextra{
21151 \ifpgf@circuit@bipole@flow@backward
21152 \ifpgf@circuit@bipole@flow@below
21153 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21154 \else
21155 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21156 \fi
21157 \pgfmathsubtract{\pgf@circ@ffffff}{180}
21158 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21159 \else
21160 \ifpgf@circuit@bipole@flow@below
21161 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21162 \else
21163 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21164 \fi
21165 \fi
21166 }
21167 coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset, anchor=center](Farrowpos)
21168 (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
21169 (\ctikzvalof{bipole/name}flow){\pgf@circ@finallabels{flow/label}}
21170 }
21171
21172 %%%---------- close: tex/pgfcircflow
21173
21174 % defaults
21175
21176 \setupmodule
21177 [current=european,
21178 voltage=european,
21179 resistor=american,
21180 inductor=cute,
21181 logic=american,
21182 siunitx=true,
21183 arrowmos=false]
21184
21185 \processaction
21186 [\currentmoduleparameter{voltage}]
21187 [european=>\ctikzset{voltage=european},
21188 american=>\ctikzset{voltage=american}]
21189
21190 \processaction
21191 [\currentmoduleparameter{current}]
21192 [european=>\ctikzset{ current=european},
21193 american=>\ctikzset{ current=american}]
21194
21195 \processaction
21196 [\currentmoduleparameter{label}]
21197 [straight=>\ctikzset{label/align = straight},
21198 align=>\ctikzset{label/align = rotate},
21199 smart=>\ctikzset{label/align = smart}]
21200
21201 \processaction
21202 [\currentmoduleparameter{resistor}]
21203 [european=>\ctikzset{ resistor=european},
21204 american=>\ctikzset{ resistor=american}]
21205
21206 \processaction
21207 [\currentmoduleparameter{inductor}]
21208 [european=>\ctikzset{ inductor=european},
21209 american=>\ctikzset{ inductor=american},
21210 cute=>\ctikzset{ inductor=cute}]
21211
21212 \processaction
21213 [\currentmoduleparameter{diode}]
21214 [full=>\ctikzset{ diode=full},
21215 empty=>\ctikzset{ diode=empty}]
21216
21217 \processaction
21218 [\currentmoduleparameter{logic}]
21219 [european=>\ctikzset{ logic ports=european},
21220 american=>\ctikzset{ logic ports=american}]
21221
21222 \processaction
21223 [\currentmoduleparameter{siunitx}]
21224 [true=>\def\SI#1#2{#1\,#2}
21225 \def\ampere{\rm{A}}
21226 \def\volt{\rm{V}}
21227 \def\ohm{\Omega}
21228 \def\siemens{\rm{S}}
21229 \def\farad{\rm{F}}
21230 \def\henry{\rm{H}}
21231 \def\second{\rm{s}}
21232 \def\coulomb{\rm{C}}
21233 \def\siemens{\rm{S}}
21234 \def\radians{\rm{rad}}
21235 \def\milli{\rm{m}}
21236 \def\micro{\mu}
21237 \def\nano{\rm{n}}
21238 \def\pico{\rm{p}}
21239 \def\kilo{\rm{k}}
21240 \def\mega{\rm{M}}
21241 \def\giga{\rm{G}}
21242 \def\tera{\rm{T}},
21243 false=>]
21244 % \s!default=>\pgf@circ@siunitxtrue,
21245
21246 \processaction
21247 [\currentmoduleparameter{arrowmos}]
21248 [true=>\pgf@circuit@mos@arrowstrue,
21249 false=>\pgf@circuit@mos@arrowsfalse]
21250 % \s!default=>\pgf@circuit@mos@arrowstrue,
21251
21252
21253 \ifpgf@circ@siunitx
21254 % nothing! siunitx and xstrings don't work in context
21255 \fi
21256
21257
21258 % Context specific
21259
21260 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
21261
21262 %%%%%%%%%%% Springe nach tex/pgfcircpath
21263 %%%---------- open: tex/pgfcircpath.tex
21264 % Copyright 2018-2026 by Romano Giannetti
21265 % Copyright 2015-2026 by Stefan Lindner
21266 % Copyright 2013-2026 by Stefan Erhardt
21267 % Copyright 2007-2026 by Massimo Redaelli
21268 %
21269 % This file may be distributed and/or modified
21270 %
21271 % 1. under the LaTeX Project Public License and/or
21272 % 2. under the GNU Public License.
21273 %
21274 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21275
21276
21277 \def\pgf@circ@direction{0.0}
21278
21279 % Names
21280 \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
21281 \ctikzset{n/.code = {
21282 \pgfkeys{/tikz/circuitikz/bipole/name=#1}
21283 }}
21284
21285 % Reflect the node along
21286 \ctikzset{mirrored/.is choice}
21287 \ctikzset{mirror value/.initial=1}
21288 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
21289 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
21290 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
21291
21292 % Invert node along path
21293 \ctikzset{inverted/.is choice}
21294 \ctikzset{invert value/.initial=1}
21295 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
21296 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
21297 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
21298 \newif\ifpgf@circuit@bipole@inverted
21299 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
21300
21301 \newif\ifpgf@circuit@bipole@voltage@backward
21302 \ctikzset{bipole/voltage/direction/.is choice}
21303 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
21304 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
21305
21306 % Initialize paths
21307 \def\pgfcircresetpath{
21308 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
21309 bipole/inverted=false, bipole/kind=,
21310 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
21311 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
21312 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
21313 bipole/current/y position=above, bipole/current/direction=forward,
21314 mirrored=false
21315 }
21316 }
21317
21318 %% Helper function for path-function to ensure using anchors between nodes
21319 \def\set@explicit@center@anchor#1{
21320 \pgfutil@ifundefined{pgf@sh@ns@#1}
21321 {
21322 %This coordinate is no node(but a relative position or a coordinate), no further handling needed
21323 }{
21324 \pgfutil@in@.{#1}
21325 \ifpgfutil@in@
21326 % Anchor is used, do nothing!
21327 \else%
21328 \let\tikz@moveto@waiting=\relax
21329 \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting
21330 \edef#1{#1.center}%ensure using center anchor
21331 \fi
21332 }
21333 }
21334
21335
21336 %% Generic bipole path
21337 %% I am not user what the second argument is needed for
21338 \def\pgf@circ@bipole@path#1#2{
21339
21340 \pgfextra{
21341 \set@explicit@center@anchor{\tikztostart}
21342 \set@explicit@center@anchor{\tikztotarget}
21343 \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
21344 \ctikzset{bipole/kind = #1}
21345 \edef\pgf@temp{\ctikzvalof{bipole/name}}
21346 \def\pgf@circ@temp{}
21347 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
21348 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
21349 \ctikzset{bipole/name = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...)
21350 \fi
21351 }
21352
21353 (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
21354 (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
21355 \pgfextra{
21356 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
21357 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
21358 % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed
21359 % \pgfmathround{\pgfmathresult}
21360 \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path
21361 % \typeout{DIRECTION:\pgf@circ@direction}
21362 \pgfsyssoftpath@setcurrentpath{\myp@th}
21363 }
21364 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21365 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21366 \else
21367 --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
21368 \fi
21369 ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
21370 node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
21371 (\ctikzvalof{bipole/name}) {}
21372 \ifpgf@circuit@bipole@inverted
21373 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
21374 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
21375 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
21376 \else
21377 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
21378 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
21379 \fi
21380 \else
21381 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
21382 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
21383 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
21384 \else
21385 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
21386 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
21387 \fi
21388 \fi
21389 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21390 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21391 \else
21392 (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
21393 (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
21394 \fi
21395
21396 \drawpoles
21397 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
21398 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
21399 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi
21400 \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
21401 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi
21402 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21403 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21404 (\ctikzvalof{bipole/name}end)%Move to end of path
21405 \else
21406 ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
21407 %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
21408
21409 \fi
21410 % reset
21411 \pgfextra{
21412 \pgfcircresetpath
21413 }
21414 \tikztonodes%draw pending nodes an path
21415 }
21416
21417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21418 %% Handling of terminals
21419
21420 \ctikzset{bipole/nodes/.is family}
21421 \ctikzset{bipole/nodes/left/.initial=none}
21422 \ctikzset{bipole/nodes/right/.initial=none}
21423 \tikzset{bipole nodes/.style n args={2}{%
21424 \circuitikzbasekey/bipole/nodes/left=#1,
21425 \circuitikzbasekey/bipole/nodes/right=#2
21426 }
21427 }
21428
21429 %% Easily usable styles
21430
21431 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21432 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21433 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
21434 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21435 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
21436 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21437 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21438 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
21439 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
21440 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
21441 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21442 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
21443 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
21444 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21445 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21446
21447 % rectjoinfill workarounds
21448
21449 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
21450 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
21451 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21452 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21453 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21454 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21455 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21456 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21457 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21458
21459 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
21460
21461 \def\drawpoles{
21462 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
21463 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
21464 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
21465 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
21466 }
21467
21468 %% Path definitions
21469 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
21470 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
21471 \def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
21472 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
21473 \def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}}
21474 \def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}}
21475 \def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}}
21476 \def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}}
21477 \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
21478 \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}}
21479 \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}}
21480 %% polar capacitor is deprectaed, use curved capacitor instead
21481 \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}}
21482 \def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}}
21483 \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
21484 \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
21485 \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
21486 \def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
21487 \def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
21488 \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
21489 \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
21490 \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
21491 \def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}}
21492 \def\pgf@circ@inductor@path#1{%
21493 \pgfextra{
21494 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21495 \def\pgf@temp{european}%
21496 }
21497 \ifx\pgf@temp\pgf@circ@temp%
21498 \pgf@circ@europeaninductor@path{#1}%
21499 \else%
21500 \pgfextra{ \def\pgf@temp{cute} }%
21501 \ifx\pgf@temp\pgf@circ@temp%
21502 \pgf@circ@cuteinductor@path{#1}%
21503 \else%
21504 \pgf@circ@americaninductor@path{#1}%
21505 \fi%
21506 \fi%
21507 }
21508 \def\pgf@circ@vinductor@path#1{
21509 \pgfextra{
21510 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21511 \def\pgf@temp{european}%
21512 }
21513 \ifx\pgf@temp\pgf@circ@temp%
21514 \pgf@circ@veuropeaninductor@path{#1}%
21515 \else%
21516 \pgfextra{ \def\pgf@temp{cute} }%
21517 \ifx\pgf@temp\pgf@circ@temp%
21518 \pgf@circ@vcuteinductor@path{#1}%
21519 \else%
21520 \pgf@circ@vamericaninductor@path{#1}%
21521 \fi%
21522 \fi%
21523 }
21524 \def\pgf@circ@inductivesens@path#1{%
21525 \pgfextra{
21526 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21527 \def\pgf@temp{european}%
21528 }
21529 \ifx\pgf@temp\pgf@circ@temp%
21530 \pgf@circ@europeaninductivesens@path{#1}%
21531 \else%
21532 \pgfextra{ \def\pgf@temp{cute} }%
21533 \ifx\pgf@temp\pgf@circ@temp%
21534 \pgf@circ@cuteinductivesens@path{#1}%
21535 \else%
21536 \pgf@circ@americaninductivesens@path{#1}%
21537 \fi%
21538 \fi%
21539 }
21540 \def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
21541 \def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}}
21542 \def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}}
21543 \def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}}
21544 \def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}}
21545 \def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}}
21546 \def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}}
21547 \def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}}
21548 \def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}}
21549 \def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}}
21550 \def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}}
21551 \def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}}
21552 \def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}}
21553 \def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}}
21554 \def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}}
21555 \def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}}
21556 \def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}}
21557 \def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}}
21558 \def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}}
21559 \def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}}
21560 \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}}
21561 \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}}
21562 \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}}
21563 \def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}}
21564 \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}}
21565 \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}}
21566 \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}}
21567 \def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}}
21568 \def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}}
21569 \def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}}
21570 \def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}}
21571 \def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}}
21572 \def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}}
21573 \def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}}
21574 \def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}}
21575 \def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}}
21576 \def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}}
21577 \def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}}
21578 \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}}
21579 \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}}
21580 \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}}
21581 \def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}}
21582 \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
21583 \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
21584 \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}}
21585 \def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}}
21586 \def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}}
21587 \def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}}
21588 \def\pgf@circ@empty@path#1{}
21589 \def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}}
21590 \def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}}
21591 \def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}}
21592 \def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}}
21593 \def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}}
21594 \def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}}
21595 \def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}}
21596 \def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}}
21597 \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}}
21598 \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}}
21599 \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}}
21600 \def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}}
21601 \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}}
21602 \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}}
21603 \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}}
21604
21605 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
21606 \def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}}
21607 \def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}}
21608
21609 \def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
21610 \def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
21611 \def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
21612 \def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
21613 \def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
21614 \def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
21615 \def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
21616 \def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}}
21617 \def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}}
21618 \def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}}
21619 \def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}}
21620 \def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}}
21621 \def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}}
21622 \def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}}
21623 \def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}}
21624 \def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}}
21625 \def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}}
21626 \def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}}
21627 \def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}}
21628 %
21629 \def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}}
21630 \def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}}
21631 \def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}}
21632 \def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}}
21633
21634 %%Mechanical
21635 \def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
21636 \def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}}
21637 \def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
21638 \def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
21639 \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
21640
21641 %% Styles
21642
21643 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
21644 \def\compattikzset#1{\tikzset{\comnpatname#1}}
21645
21646 %\def\ctikzsetbipole#1#2{%
21647 % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
21648 %}
21649
21650 \compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
21651 \compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}}
21652 \compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
21653 \compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
21654 \compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
21655 \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}
21656 \compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}}
21657 \compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}}
21658 \compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}}
21659 \compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}}
21660 \compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}}
21661 \compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}}
21662 \compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}}
21663 \compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
21664 \compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}}
21665 \compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}}
21666 \compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}}
21667 \compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}}
21668 \compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}}
21669 \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}}
21670 \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
21671 \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
21672 % polar capacitor is deprecated, use curved capacitor instead
21673 \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}}
21674 \compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}}
21675 \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
21676 \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
21677 \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21678 \compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21679 \compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21680 \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
21681 \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
21682 \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
21683 \compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}}
21684 \compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
21685 \compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}}
21686 \compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}}
21687 \compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}}
21688 \compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}}
21689 \compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}}
21690 \compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}}
21691 \compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}}
21692 \compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}}
21693 \compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}}
21694 \compattikzset{transmission line/.style = {tline = #1}}
21695 \compattikzset{TL/.style = {tline = #1}}
21696 \compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}}
21697 \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}}
21698 \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21699 \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21700 \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21701 \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}}
21702 \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}}
21703 \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21704 \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21705 \compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21706 \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 }}
21707 \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 }}
21708 \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 }}
21709 \compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21710 \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}}
21711 \compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21712
21713 \compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21714 \compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
21715 \compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21716 \compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
21717
21718
21719 \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}}
21720 \compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}}
21721 \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}}
21722 \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}}
21723 \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}}
21724 \compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}}
21725 \compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}}
21726 \compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}}
21727
21728 \compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}}
21729 \compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}}
21730
21731 \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}}
21732 \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}}
21733 \compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}}
21734 \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}}
21735 \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}}
21736 \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}}
21737
21738 \compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
21739 \compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
21740 \compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
21741 \compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
21742 \compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
21743 \compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
21744 \compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}
21745 \compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}}
21746 \compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}}
21747 \compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}}
21748 \compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}}
21749 \compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}}
21750 \compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}}
21751 \compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}}
21752 \compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}}
21753 \compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}}
21754 \compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}}
21755 \compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}}
21756 \compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}}
21757 %
21758 \compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}}
21759 \compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}}
21760 \compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}}
21761 \compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}}
21762
21763 % % % % % %
21764 % % Begin of Diodes
21765 % % % % % %
21766
21767 \def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}}
21768 \def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}}
21769 \def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}}
21770 \def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}}
21771 \def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}}
21772 \def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}}
21773 \def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}}
21774 \def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}}
21775 \def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}}
21776 \def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}}
21777 \def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}}
21778 \def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}}
21779 \def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}}
21780 \def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}}
21781 \def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}}
21782 \def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}}
21783 \def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}}
21784 \def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}}
21785
21786 \compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}}
21787 \compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}}
21788 \compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}}
21789 \compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}}
21790 \compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}}
21791 \compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}}
21792 \compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}}
21793 \compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}}
21794 \compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}}
21795 \compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}}
21796 \compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}}
21797
21798 \compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}}
21799 \compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}}
21800 \compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}}
21801 \compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
21802 \compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}}
21803 \compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}}
21804 \compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}}
21805 \compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}}
21806 \compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}}
21807 \compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}}
21808 \compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}}
21809
21810 \compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}}
21811 \compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}}
21812 \compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}}
21813 \compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
21814 \compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}}
21815 \compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}}
21816 \compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}}
21817 \compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}}
21818 \compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}}
21819 %\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}}
21820
21821 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
21822
21823 \compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
21824 \compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
21825 \compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
21826 \compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
21827 \compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
21828 \compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
21829 \compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
21830 \compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
21831 \compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
21832 \compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
21833 \compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
21834
21835 %% Define Shortcuts
21836 \compattikzset{Do/.style = {\comnpatname empty diode}}
21837 \compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
21838 \compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
21839 \compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
21840 \compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
21841 \compattikzset{pDo/.style = {\comnpatname empty photodiode}}
21842 \compattikzset{leDo/.style = {\comnpatname empty led}}
21843 \compattikzset{VCo/.style = {\comnpatname empty varcap}}
21844 \compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
21845 \compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
21846 \compattikzset{Tro/.style = {\comnpatname empty triac}}
21847
21848 \compattikzset{D*/.style = {\comnpatname full diode}}
21849 \compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
21850 \compattikzset{zD*/.style = {\comnpatname full Zener diode}}
21851 \compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
21852 \compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
21853 \compattikzset{pD*/.style = {\comnpatname full photodiode}}
21854 \compattikzset{leD*/.style = {\comnpatname full led}}
21855 \compattikzset{VC*/.style = {\comnpatname full varcap}}
21856 \compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
21857 \compattikzset{Ty*/.style = {\comnpatname full thyristor}}
21858 \compattikzset{Tr*/.style = {\comnpatname full triac}}
21859
21860 \compattikzset{D/.style = {\comnpatname diode}}
21861 \compattikzset{tD/.style = {\comnpatname tunnel diode}}
21862 \compattikzset{zD/.style = {\comnpatname Zener diode}}
21863 \compattikzset{zzD/.style = {\comnpatname ZZener diode}}
21864 \compattikzset{sD/.style = {\comnpatname Schottky diode}}
21865 \compattikzset{pD/.style = {\comnpatname photodiode}}
21866 \compattikzset{leD/.style = {\comnpatname led}}
21867 \compattikzset{VC/.style = {\comnpatname varcap}}
21868 \compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
21869 \compattikzset{Ty/.style = {\comnpatname thyristor}}
21870 \compattikzset{Tr/.style = {\comnpatname triac}}
21871
21872 \compattikzset{D-/.style = {\comnpatname stroke diode}}
21873 \compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
21874 \compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
21875 \compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
21876 \compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
21877 \compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
21878 \compattikzset{leD-/.style = {\comnpatname stroke led}}
21879 \compattikzset{VC-/.style = {\comnpatname stroke varcap}}
21880 \compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
21881 \compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
21882 \compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
21883
21884 % % % % % %
21885 % % End of Diodes
21886 % % % % % %
21887
21888
21889 \compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}}
21890 \compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
21891 \compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}}
21892 \compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
21893 \compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
21894 \compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
21895 \compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
21896 \compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
21897 \compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
21898 \compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
21899 \compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
21900 \compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
21901 \compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
21902 \compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}}
21903
21904 \compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}}
21905 \compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}}
21906 \compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}}
21907 \tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}}
21908
21909 % cute switches
21910 %% closed cute switch
21911 \def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}}
21912 \compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}}
21913 \compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
21914
21915 %% open cute switch
21916 \def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}}
21917 \compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}}
21918 \compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
21919
21920 %% closing cute switch
21921 \def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}}
21922 \compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}}
21923 \compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
21924
21925 %% opening cute switch
21926 \def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}}
21927 \compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}}
21928 \compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
21929
21930
21931 % short forms
21932 \compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21933 \compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21934 \compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21935 \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}}
21936
21937 \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}}
21938 \compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@path, v=#1}}
21939 \compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}}
21940 \compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@ooosource@path, v=#1}}
21941
21942 \compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
21943 \compattikzset{isource/.style = {\comnpatname current source = #1}}
21944 \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
21945 \compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
21946 \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
21947 \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
21948 \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
21949 \compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
21950 \compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
21951 \compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
21952 \compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
21953
21954 \compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
21955 \compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
21956 \compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
21957 \compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
21958
21959 \compattikzset{R/.style= {\comnpatname resistor = #1}}
21960 \compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
21961 \compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
21962 \compattikzset{thR/.style= {\comnpatname thermistor = #1}}
21963 \compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
21964 \compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
21965 \compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
21966 \compattikzset{C/.style = {\comnpatname capacitor = #1}}
21967 \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
21968 %% pC is deprecated, use cC instead
21969 \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
21970 \compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
21971 \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
21972 \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
21973 \compattikzset{L/.style = {\comnpatname inductor = #1}}
21974 \compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
21975 \compattikzset{V/.style = {\comnpatname voltage source = #1}}
21976 \compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
21977 \compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
21978 \compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
21979 \compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
21980 \compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
21981 \def\pgf@temp#1{
21982 \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
21983 \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
21984 \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
21985 \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
21986 }
21987 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
21988 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
21989
21990 %current sources
21991 \compattikzset{I/.style = {\comnpatname current source = #1}}
21992 \compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
21993 \compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
21994 \compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
21995 \def\pgf@temp#1{
21996 \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
21997 \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
21998 \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
21999 \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
22000 }
22001 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
22002 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
22003 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
22004
22005 % cute sources
22006 \def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}}
22007 \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}}
22008 \compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
22009 \compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
22010
22011 \def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}}
22012 \compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22013 \compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
22014 \compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
22015
22016 \def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}}
22017 \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}}
22018 \compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
22019 \compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
22020
22021 \def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}}
22022 \compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22023 \compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
22024 \compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
22025
22026 % noise sources
22027 \def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}}
22028 \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}}
22029 \compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
22030 \compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
22031
22032 \def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}}
22033 \compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22034 \compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
22035 \compattikzset{nI/.style= {\comnpatname noise current source= #1}}
22036
22037 % resistive sensor american style
22038 \def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}}
22039 \compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}}
22040 \compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
22041 \compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}}
22042 \compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
22043
22044 \compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}}
22045 \compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
22046
22047 \compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}}
22048 \compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}}
22049 \compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}}
22050 \compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}}
22051 \compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
22052
22053 \compattikzset{Mr/.style = {\comnpatname memristor}}
22054
22055 \compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
22056 \compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
22057 \compattikzset{spst/.style = {\comnpatname switch = #1}}
22058
22059 \compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
22060
22061 \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
22062 \compattikzset{vss/.style = {\comnpatname vee = #1}}
22063
22064 % activate the to-style crossing
22065 \def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}}
22066 \compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}}
22067 \compattikzset{xing/.style= {\comnpatname crossing= #1}}
22068
22069 %% loudspeaker and microphone
22070
22071 \def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}}
22072 \compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}}
22073
22074 \def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}}
22075 \compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}}
22076
22077 % more instrument
22078 \def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}}
22079 \compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}}
22080 \def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}}
22081 \compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}}
22082 \def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}}
22083 \compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}}
22084 % current loop probes
22085 \def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}}
22086 \compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}}
22087 \def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}}
22088 \compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}}
22089 % qucs-style probes
22090 \def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}}
22091 \compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}}
22092 \def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}}
22093 \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}}
22094 \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}}
22095 \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}}
22096 % multiwire(s)
22097 \def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}}
22098 \compattikzset{bmultiwire/.style = {\circuitikzbasekey,
22099 /tikz/to path=\pgf@circ@bmultiwire@path, l=#1}}
22100 \def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}}
22101 \compattikzset{multiwire/.style = {\circuitikzbasekey,
22102 /tikz/to path=\pgf@circ@multiwire@path, l=#1}}
22103 \def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}}
22104 \compattikzset{tmultiwire/.style = {\circuitikzbasekey,
22105 /tikz/to path=\pgf@circ@tmultiwire@path, l=#1}}
22106
22107 % reed switches
22108 \def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}}
22109 \compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}}
22110
22111 % Transistor like bipoles
22112
22113 \def\pgf@circ@trans@path#1#2{
22114 \pgfextra{
22115 \edef\pgf@temp{\ctikzvalof{bipole/name}}
22116 \def\pgf@circ@temp{#2}
22117 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
22118 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
22119 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
22120 \fi
22121 }
22122 \ifpgf@circuit@bipole@inverted
22123 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
22124 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
22125 \else
22126 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
22127 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
22128 \fi
22129 \pgfextra{
22130 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
22131 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
22132 \pgfmathadd{\pgfmathresult}{-90}
22133 \pgfmathround{\pgfmathresult}
22134 \edef\pgf@circ@direction{\pgfmathresult}
22135 }
22136 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
22137 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
22138 (\ctikzvalof{bipole/name}) {}
22139 node {\ctikzvalof{bipole/label/name}}
22140 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
22141 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
22142 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
22143 \else
22144 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
22145 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
22146 \fi
22147 \drawpoles
22148 \pgfextra{
22149 \pgfcircresetpath
22150 }
22151 (\tikztotarget) \tikztonodes % e si continua
22152 }
22153
22154
22155 \def\pgf@circ@definetranspath#1{
22156 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
22157 }
22158
22159 \pgf@circ@definetranspath{elmech}
22160 \pgf@circ@definetranspath{nmos}
22161 \pgf@circ@definetranspath{pmos}
22162 \pgf@circ@definetranspath{hemt}
22163 \pgf@circ@definetranspath{npn}
22164 \pgf@circ@definetranspath{pnp}
22165 \pgf@circ@definetranspath{nfet}
22166 \pgf@circ@definetranspath{nigfete}
22167 \pgf@circ@definetranspath{nigfetd}
22168 \pgf@circ@definetranspath{nigfetebulk}
22169 \pgf@circ@definetranspath{pfet}
22170 \pgf@circ@definetranspath{pigfete}
22171 \pgf@circ@definetranspath{pigfetd}
22172 \pgf@circ@definetranspath{pigfetebulk}
22173 \pgf@circ@definetranspath{njfet}
22174 \pgf@circ@definetranspath{pjfet}
22175 \pgf@circ@definetranspath{pigbt}
22176 \pgf@circ@definetranspath{nigbt}
22177 \pgf@circ@definetranspath{Lpigbt}
22178 \pgf@circ@definetranspath{Lnigbt}
22179 %%%---------- close: tex/pgfcircpath
22180
22181 \catcode`\@=\tikzatcode
22182 \catcode`\|=\tikzbarcode
22183 \catcode`\!=\tikzexclaimcode
22184
22185 % define the environment
22186 \long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}
22187
22188 \protect
22189
22190 \stopmodule
22191
22192 \endinput