Debian Codegraph @

texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.7.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 % This module file is normally overriden by the provided m-circuitikz.tex
14 % in the newer ConTeXt distributions.
15 %
16 \startmodule[circuitikzgit]
17 \usemodule[tikz]
18
19 \def\pgfcircversion{1.7.2-a942a76}
20 \def\pgfcircversiondate{2025/03/21}
21 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
22
23
24 \usetikzlibrary[calc]
25 \usetikzlibrary[arrows.meta, bending]
26 \usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
27
28 \unprotect
29
30 \edef\tikzatcode{\the\catcode`\@}
31 \edef\tikzbarcode{\the\catcode`\|}
32 \edef\tikzexclaimcode{\the\catcode`\!}
33 \catcode`\@=11
34 \catcode`\|=12
35 \catcode`\!=12
36
37 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
38 %%%---------- open: tex/pgfcirc.defines.tex
39 % Copyright 2018-2026 by Romano Giannetti
40 % Copyright 2015-2026 by Stefan Lindner
41 % Copyright 2013-2026 by Stefan Erhardt
42 % Copyright 2007-2026 by Massimo Redaelli
43 %
44 % This file may be distributed and/or modified
45 %
46 % 1. under the LaTeX Project Public License and/or
47 % 2. under the GNU Public License.
48 %
49 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
50 %
51 % This file has folding marks for vim (See last line).
52 %
53
54 %
55 % This file is loaded *before* the options for the package are executed, mainly
56 % for the following three ifs
57 %
58 % these three ifs are fundamental for the package loading options;
59 % do not move away
60 \newif\ifpgf@circ@siunitx
61 \newif\ifpgf@circ@siunitx@res
62 \newif\ifpgf@circuit@compat
63
64 %% Key managements%<<<1
65
66 \long\def\pgf@circ@comment#1{}
67
68 \def\circuitikzbasekey{/tikz/circuitikz}
69
70 \pgfkeys{\circuitikzbasekey/.is family}
71
72 \def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
73 \let\ctikzset\circuitikzset
74 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
75 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
76
77 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
78 %%>>>
79
80 %% Temporary Counters and dimensions%<<<1
81 %% Temporary Counters
82 \newcount\pgf@circ@count@a
83 \newcount\pgf@circ@count@b
84 \newcount\pgf@circ@count@c
85 %%%%%%%%%%%%
86 %% Dimensions
87 % coordinate
88 \newdimen\pgf@circ@res@up
89 \newdimen\pgf@circ@res@down
90 \newdimen\pgf@circ@res@zero
91 \newdimen\pgf@circ@res@left
92 \newdimen\pgf@circ@res@right
93 \newdimen\pgf@circ@res@other
94 \newdimen\pgf@circ@res@step
95 \newdimen\pgf@circ@res@temp
96 % Base len for all circuitikz
97 \newdimen\pgf@circ@Rlen
98 % scaled length for internal use in scalable shapes
99 \newdimen\pgf@circ@scaled@Rlen
100 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
101 \pgf@circ@Rlen = 1.4cm
102 % by default scale is 1.0
103 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
104 % inital thickness
105 \newdimen \pgfstartlinewidth
106 %%>>>
107
108 %% Colors%<<<
109
110 % The following code is by @muzimuzhi --- see comment in
111 % https://github.com/circuitikz/circuitikz/issues/605#issuecomment-1030745366
112 \newif\ifpgf@circ@setcolor
113
114 % similar to how `/tikz/draw` and `/tikz/fill` are defined
115 %
116 % - `color=none`, \pgfusecolor is not executed at the beginning of node path(s)
117 % - `color` or `color=` (no or empty value), ignored
118 % - `color=<color name>`, \pgfusecolor{<color name>} will be executed
119 \ctikzset{
120 color/.code={%
121 \edef\pgf@circ@temp{#1}%
122 \ifx\pgf@circ@temp\pgf@nonetext
123 \pgf@circ@setcolorfalse
124 \else
125 \ifx\pgf@circ@temp\pgfutil@empty
126 \else
127 \pgf@circ@setcolortrue
128 \pgfkeyssetvalue{\circuitikzbasekey/color}{#1}%
129 \edef\ctikz@strokecolor{\ctikzvalof{color}}%
130 \fi
131 \fi
132 },
133 % init
134 color=none
135 }
136
137 \let\ctikz@strokecolor\pgfutil@empty
138 \let\ctikz@fillcolor\pgfutil@empty
139 % do our tracking of color
140 \pgfkeys{/tikz/color/.add code={}{%
141 \edef\ctikz@strokecolor{#1}\ctikzset{color={#1}}}}
142 % do our tracking of fill
143 \pgfkeys{/tikz/fill/.add code={}{%
144 \edef\ctikz@fillcolor{#1}}}
145 %
146 % This is to try to track the "implicit" color specification of Tikz,
147 % like \draw[red,...] ...; which are not exactly the same than saying
148 % \draw[color=red,...] ...;
149 % This is too dangerous to issue by default (it was in 1.5.0 and it
150 % was an error), so we will just define a command and tell it in the
151 % manual.
152 % It needs \usepackage{regexpatch} (which is not compatible with
153 % xpatch, unfortunately)
154 % I do not know how to do the xpatchcmd in ConTeXt...
155 %
156 \def\ctikzPatchImplicitColor{%
157 \ifpgfutil@format@is@latex
158 \pgfkeysgetvalue{/tikz/.unknown/.@cmd}{\my@temp}
159 \xpatchcmd*\my@temp % use starred-form to replace all (two places actually)
160 {\expandafter\tikz@addoption\expandafter}
161 {\edef\ctikz@strokecolor{\tikz@key}%
162 \expandafter\tikz@addoption\expandafter}
163 {}{%
164 \pgfutil@packagewarning{circuitikz}{%
165 Color patch failed, use only explicit color=... (see manual)}}
166 \pgfkeyslet{/tikz/.unknown/.@cmd}{\my@temp}
167 \else
168 \pgfutil@packagewarning{circuitikz}{%
169 Not on LaTeX: patch failed, ^^J%
170 use only explicit color=...(see manual).}
171 \fi
172 }
173 %
174 \def\pgf@circ@setcolor{%
175 \ifpgf@circ@setcolor
176 \pgfsetcolor{\ctikzvalof{color}}%
177 \fi
178 }%
179 %
180 % Try our best to set the fill color the same as the draw
181 % color. This needs the patch above
182 %
183 \def\pgf@circ@setfillcolorasdraw{%
184 \ifx\tikz@strokecolor\pgfutil@empty
185 % we do not have the stroke color. Resort to the
186 % last explicit color command; this will fail if
187 % the color is changed mid-draw.
188 % "Doctor, it hurts if I touch here..."
189 \ifx\ctikz@strokecolor\pgfutil@empty
190 % no info here. Try to use the current color.
191 \pgfsetfillcolor{.}%
192 \else
193 % Try with the last seen change-color command
194 \pgfsetfillcolor{\ctikz@strokecolor}
195 \fi
196 \else
197 % we have strokecolor, yay!
198 \pgfsetfillcolor{\tikz@strokecolor}
199 \fi
200 }
201 % we call this when we want to fill of the "draw"
202 % color. So if we have no explicit color, use ".".
203 \def\pgf@circ@fill@strokecolor{%
204 \pgf@circ@setfillcolorasdraw
205 }
206 % this is to select the \pgftext color; set it as
207 % the stroke color (\pgftext uses the fill color)
208 \def\pgf@circ@text@strokecolor{%
209 \pgf@circ@setfillcolorasdraw
210 }
211 % debug text
212 \def\pgf@circ@debug@colors{%
213 \pgfscope
214 \pgfsetcolor{black}%
215 \pgftext[y=10pt]{\tiny S:\tikz@strokecolor~T:\tikz@textcolor~F:\tikz@fillcolor}%
216 \pgftext[y=16pt]{\tiny CS:\ctikz@strokecolor~CF:\ctikz@fillcolor}%
217 \endpgfscope
218 }
219 %>>>
220
221
222 %% Macros for basic drawing%<<<
223 %
224 \long\gdef\pgf@circ@draw@component#1{%
225 \behindbackgroundpath{%
226 \pgf@circ@start@draw@hooks
227 #1%
228 \pgf@circ@end@draw@hooks
229 }%
230 }%
231 %
232 % auxiliary macros to reset some thing in paths, for background images.
233 % use with care and ALWAYS inside a \pgfscope, see here:
234 % https://matrix.to/#/!NuxCISwYQJuyWwNsEI:matrix.org/$vQO6luq1F66LJ79dERmaqKI46qMBcjStqYCPi725uZE?via=matrix.org&via=2krueger.de&via=im.f3l.de
235 % Thanks to @muzimuzhi
236 %
237 \def\pgf@circ@reset@arrows{%
238 \pgfsetshortenstart{+0pt}\pgfsetshortenend{+0pt}\pgfsetarrows{-}%
239 }
240 \def\pgf@circ@reset@rounded{%
241 \pgfsetcornersarced{\pgfpointorigin}%
242 }
243 \def\pgf@circ@reset@arrows@rounded{%
244 \pgf@circ@reset@arrows\pgf@circ@reset@rounded
245 }
246 \def\pgf@circ@adjustfill{%
247 \ifx\ctikz@fillcolor\pgfutil@empty
248 % do nothing
249 \else
250 \ifx\ctikz@fillcolor\pgf@nonetext
251 % do nothing
252 \else
253 \pgfsetfillcolor{\ctikz@fillcolor}%
254 \fi
255 \fi
256 }
257 %% Hook macros for the start and end of component drawing. The idea is that
258 %% specific macros overrides class macro that overrides generic macro
259 %% the generic macro is the one that resets arrows and curved path parameters
260 %% but let the path inherits the rest (dashed, etc.)
261
262 \def\pgf@circ@start@draw@hooks{%
263 % \typeout{SHAPE: \pgf@sm@shape@name}
264 \ifcsname ctikz@hook@start@draw@component@\pgf@sm@shape@name\endcsname
265 \csname ctikz@hook@start@draw@component@\pgf@sm@shape@name\endcsname
266 \else
267 \ifcsname ctikzclass\endcsname
268 \ifcsname ctikz@hook@start@draw@class@\ctikzclass\endcsname
269 \csname ctikz@hook@start@draw@class@\ctikzclass\endcsname
270 % class defined, but no hook, run generic hook
271 \else
272 \csname ctikz@hook@start@draw@default\endcsname
273 \fi
274 % we have no class, we did not run specific hook:run generic hook
275 \else
276 \csname ctikz@hook@start@draw@default\endcsname
277 \fi
278 \fi
279 }
280 \def\pgf@circ@end@draw@hooks{%
281 % \typeout{SHAPE: \pgf@sm@shape@name}
282 \ifcsname ctikz@hook@end@draw@component@\pgf@sm@shape@name\endcsname
283 \csname ctikz@hook@end@draw@component@\pgf@sm@shape@name\endcsname
284 \else
285 \ifcsname ctikzclass\endcsname
286 \ifcsname ctikz@hook@end@draw@class@\ctikzclass\endcsname
287 \csname ctikz@hook@end@draw@class@\ctikzclass\endcsname
288 % class defined, but no hook, run generic hook
289 \else
290 \csname ctikz@hook@end@draw@default\endcsname
291 \fi
292 % we have no class, we did not run specific hook:run generic hook
293 \else
294 \csname ctikz@hook@end@draw@default\endcsname
295 \fi
296 \fi
297 }
298 %
299 %% default hook is to stop the propagation of arrows parameters and
300 %% arced corners.
301 %
302 \def\ctikz@hook@start@draw@default{\pgf@circ@reset@arrows@rounded}
303 %
304 %
305 %>>>
306
307 %% check loaded TikZ/pgf version %<<<`
308 %
309 % parse the release date, thanks to Skillmon
310 % https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2231681032
311 % date can be yyyy-mm-dd or (older TikZ) yyyy/mm/dd
312 \begingroup
313 \pgfutil@protected\def\parsedate#1%
314 {%
315 \afterassignment\parsedate@month
316 \pgf@circ@count@a=#1\relax
317 }
318 \pgfutil@protected\def\parsedate@month#1%
319 {%
320 \afterassignment\parsedate@day
321 \pgf@circ@count@b=%
322 }
323 \pgfutil@protected\def\parsedate@day#1%
324 {%
325 \afterassignment\parsedate@cleanup
326 \pgf@circ@count@c=%
327 }
328 \def\parsedate@cleanup#1\relax{}%
329 \parsedate{\pgfrevisiondate}%
330 \xdef\ctikz@@pgfyear{\the\pgf@circ@count@a}%
331 \xdef\ctikz@@pgfmonth{\the\pgf@circ@count@b}%
332 \xdef\ctikz@@pgfday{\the\pgf@circ@count@c}%
333 \endgroup
334 % The following code thanks to Skillmon:
335 % https://tex.stackexchange.com/a/722570/38080
336 % modified by romano to check the date
337 \def\ctikz@@ifpgfafter@auxi#1#2%
338 {%
339 \ifnum#1
340 \ctikz@@ifpgfafter@auxii{#2}%
341 \fi
342 }
343 \def\ctikz@@ifpgfafter@auxii#1\fi#2\ctikz@@ifpgfafter#3{\fi#1}
344 \def\ctikz@@ifpgfafter#1-#2-#3#%
345 {%
346 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear>#1}\pgfutil@firstoftwo
347 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear<#1}\pgfutil@secondoftwo
348 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth>#2}\pgfutil@firstoftwo
349 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth<#2}\pgfutil@secondoftwo
350 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfday<#3}\pgfutil@secondoftwo
351 \pgfutil@gobble\ctikz@@ifpgfafter\pgfutil@firstoftwo
352 }
353 %
354 % usage \ctikz@@ifpgfafter 2023-01-16{true}{false}
355 % ^^^ no spaces here, braces needed.
356 %
357 %>>>
358
359 %% arrow tips macros and utilities %<<<1
360
361 % the default arrow is latexslim, which has been ported over old arrows library (deprecated)
362 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
363 % this was the original definition of latex' tips, renamed to avoid clashes
364 %
365 \pgfarrowsdeclare{latexslim}{latexslim}
366 {
367 \pgfutil@tempdima=0.28pt%
368 \advance\pgfutil@tempdima by.3\pgflinewidth%
369 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
370 \pgfarrowsrightextend{+6\pgfutil@tempdima}
371 }
372 {
373 \pgfutil@tempdima=0.28pt%
374 \advance\pgfutil@tempdima by.3\pgflinewidth%
375 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
376 \pgfpathcurveto
377 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
378 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
379 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
380 \pgfpathcurveto
381 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
382 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
383 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
384 \pgfpathcurveto
385 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
386 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
387 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
388 \pgfpathclose
389 \pgfusepathqfill
390 }
391 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
392 %% Jack Tap, see
393 %% https://github.com/circuitikz/circuitikz/issues/806
394 \pgfdeclarearrow{name=Jack Tap,
395 parameters = {%
396 \the\pgfarrowlength,%
397 \the\pgfarrowwidth,%
398 \ifpgfarrowswap s\fi%
399 \ifpgfarrowopen o\fi%
400 \ifpgfarrowroundjoin j\fi
401 \ifpgfarrowroundcap c\fi%
402 },
403 setup code = {
404 \pgfarrowssettipend{.5\pgfarrowlength}
405 \pgfarrowssetlineend{-.6\pgfarrowlength}
406 \pgfarrowssetvisualbackend{-.6\pgfarrowlength}
407 \pgfarrowssetbackend{-.6\pgfarrowlength}
408 % hull
409 \pgfarrowshullpoint{.5\pgfarrowlength}{0pt}
410 \pgfarrowshullpoint{0pt}{\pgfarrowwidth}
411 \pgfarrowshullpoint{-.6\pgfarrowlength}{0pt}
412 % Saves: Only the length:
413 \pgfarrowssavethe\pgfarrowlength
414 \pgfarrowssavethe\pgfarrowwidth
415 },
416 drawing code = {
417 \pgfsetdash{}{+0pt}
418 \pgfarrowlinewidth=\pgflinewidth
419 \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi
420 \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi
421 \pgfpathmoveto{\pgfqpoint{-.6\pgfarrowlength}{0pt}}
422 \pgfpathlineto{\pgfqpoint{-.5\pgfarrowlength}{0pt}}
423 \pgfpathlineto{\pgfqpoint{0pt}{\pgfarrowwidth}}
424 \pgfpathlineto{\pgfqpoint{.5\pgfarrowlength}{0pt}}
425 \ifpgfarrowopen
426 \pgfusepathqstroke
427 \else
428 \pgfpathclose
429 \ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi
430 \fi
431 },
432 defaults = {length = 0.3cm, width=0.15cm, open},
433 % cache=false, % breaks everything
434 }
435 % the new "fill without arg" will be in TikZ 3.1.11. Apply it here if we have an
436 % older version
437 \ctikz@@ifpgfafter 2023-01-16{\relax}{%
438 % thanks @muzimuzhi https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2229075269
439 % undo the fill/.value required key
440 \expandafter\let\csname pgfk@/pgf/arrow keys/fill/.@def\endcsname\@undefined
441 \pgfkeys{/pgf/arrow keys/fill/.code={%
442 \def\pgf@temp{#1}%
443 \ifx\pgf@temp\pgf@nonetext%
444 \pgfarrowsaddtooptions{\pgfarrowopentrue}%
445 \else\ifx\pgf@temp\pgfkeysnovalue@text%
446 \pgfarrowsaddtooptions{\pgfarrowopenfalse}%
447 \else
448 \pgfarrowsaddtooptions{\pgfarrowopenfalse\def\pgf@arrows@fill@color{#1}}%
449 \fi\fi
450 }}%
451 }
452 \tikzset{v/.tip={Jack Tap[swap]}, ^/.tip={Jack Tap},
453 vf/.tip={Jack Tap[swap,fill]}, ^f/.tip={Jack Tap[fill]}}
454 %
455 % select the arrows using available defaults.
456 \def\pgfcirc@arrow@default{default}
457 % choose the arrows to use. Use #2 and #3 if the key is equal to "default"
458 % arguments: type, default start, default end
459 \def\pgfcirc@set@arrows#1#2#3{%
460 \pgfkeysifdefined{\circuitikzbasekey/#1 start arrow}%
461 {\edef\@@start{\ctikzvalof{#1 start arrow}}}%
462 {\edef\@@start{\pgfcirc@arrow@default}}
463 \pgfkeysifdefined{\circuitikzbasekey/#1 end arrow}%
464 {\edef\@@end{\ctikzvalof{#1 end arrow}}}%
465 {\edef\@@end{\pgfcirc@arrow@default}}
466 \ifx\@@start\pgfcirc@arrow@default
467 \pgfsetarrowsstart{#2}%
468 \else
469 \pgfsetarrowsstart{\@@start}%
470 \fi
471 \ifx\@@end\pgfcirc@arrow@default
472 \pgfsetarrowsend{#3}%
473 \else
474 \pgfsetarrowsend{\@@end}%
475 \fi
476 }
477
478 \def\pgf@circ@declare@family@arrows#1{%
479 \ctikzset{#1 start arrow/.initial={default}}
480 \ctikzset{#1 end arrow/.initial={default}}
481 \tikzset{#1 start arrow/.style={\circuitikzbasekey/#1 start arrow={##1}}}
482 \tikzset{#1 end arrow/.style={\circuitikzbasekey/#1 end arrow={##1}}}
483 }
484 %%>>>
485
486 %% Macros to do things depending on the class%<<<1
487
488 \def\pgf@circ@setifdefinedfill#1#2{%
489 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
490 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
491 % \typeout{SETIFDEF:#1\space#2:}
492 \ifdefined\ctikzclass
493 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
494 {% yes, it's defined
495 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
496 \ifx\@@tmp\@@none % but it's none
497 \pgfusepath{#2}%
498 \else
499 \pgfsetfillcolor{\@@tmp}%
500 \pgfusepath{#1}%
501 \fi
502 }{% the class is defined but the fill key not; use #2
503 \pgfusepath{#2}%
504 }
505 \else
506 \pgfusepath{#2}%
507 \fi
508 }
509
510 %% Macro to fill or draw
511
512 \def\pgf@circ@draworfill{%
513 \ifx\tikz@fillcolor\pgfutil@empty
514 \ifx\ctikz@fillcolor\pgfutil@empty
515 \pgf@circ@setifdefinedfill{draw,fill}{draw}
516 \else
517 \ifx\ctikz@fillcolor\pgf@nonetext
518 \pgf@circ@setifdefinedfill{draw,fill}{draw}
519 \else
520 \pgfsetfillcolor{\ctikz@fillcolor}
521 \pgfusepath{draw, fill}
522 \fi
523 \fi
524 \else
525 \pgfsetfillcolor{\tikz@fillcolor}
526 \pgfusepath{draw, fill}
527 \fi
528 }
529
530 \def\pgf@circ@draworfillandclip{%
531 \ifx\tikz@fillcolor\pgfutil@empty
532 \ifx\ctikz@fillcolor\pgfutil@empty
533 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
534 \pgfusepath{draw, clip}
535 \else
536 \ifx\ctikz@fillcolor\pgf@nonetext
537 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
538 \pgfusepath{draw, clip}
539 \else
540 \pgfsetfillcolor{\ctikz@fillcolor}
541 \pgfusepath{draw, clip, fill}
542 \fi
543 \fi
544 \else
545 \pgfsetfillcolor{\tikz@fillcolor}
546 \pgfusepath{draw, clip, fill}
547 \fi
548 }
549
550 \def\pgf@circ@maybefill{%
551 % \typeout{MAYBEFILL\tikz@fillcolor}%
552 \ifx\tikz@fillcolor\pgfutil@empty
553 \ifx\ctikz@fillcolor\pgfutil@empty
554 \pgf@circ@setifdefinedfill{fill}{discard}
555 \else
556 \ifx\ctikz@fillcolor\pgf@nonetext
557 \pgf@circ@setifdefinedfill{fill}{discard}
558 \else
559 \pgfsetfillcolor{\ctikz@fillcolor}
560 \pgfusepath{fill}
561 \fi
562 \fi
563 \else
564 \pgfsetfillcolor{\tikz@fillcolor}
565 \pgfusepath{fill}
566 \fi
567 }
568
569 %% Macros for setting linewidth
570 % #1 is the legacy class (bipoles, tripoles) etc
571 % #2 is the reference linewidth
572 \def\pgf@circ@setlinewidth#1#2{%
573 \ifdefined\ctikzclass
574 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
575 {% yes, it's defined
576 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
577 \ifx\@@tmp\@@none % but it's none
578 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
579 \else
580 \pgfsetlinewidth{\@@tmp #2}%
581 \fi
582 }{ % key not defined, do the legacy thing
583 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
584 }% Ok, do nothing
585 \else % no class
586 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
587 \fi
588 }
589 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
590 \ctikzset{none/thickness/.initial=1.0} % do not touch
591
592 % set thickness relative to current thickness if exists class and key
593 \def\pgf@circ@set@relative@thickness#1{%
594 \ifdefined\ctikzclass
595 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/#1}
596 {% yes, it's defined
597 \pgfsetlinewidth{\ctikzvalof{\ctikzclass/#1}\pgflinewidth}%
598 }{}
599 \fi
600 }
601
602 % set the color and dash pattern for a subset of the shape, following keys #1/color
603 % and #1/dash. The keys must exist, and check for none or default for both
604 \def\pgf@circ@subset@color@dash#1{%
605 % You *must* be sure that this is called inside a \pgfscope!
606 \edef\@@none{none}\edef\@@default{default}
607 \edef\@@tmp{\ctikzvalof{#1/color}}
608 \ifx\@@tmp\@@default\else
609 \pgfsetcolor{\@@tmp}
610 \fi
611 \edef\@@tmp{\ctikzvalof{#1/dash}}
612 \ifx\@@tmp\@@default\else
613 \ifx\@@tmp\@@none
614 \pgfsetdash{}{0pt}% solid line, override dash
615 \else
616 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
617 \fi
618 \fi
619 }
620 % similar o the above, use the fill parameter to set fill or draw
621 % for a subset of the shape
622 \def\pgf@circ@subset@fill@or@draw#1{%
623 % You *must* be sure that this is called inside a \pgfscope!
624 \edef\@@none{none}\edef\@@default{default}
625 \edef\@@tmp{\ctikzvalof{#1/fill}}
626 \ifx\@@tmp\@@none
627 \pgfusepath{draw}
628 \else
629 \ifx\@@tmp\@@default\else
630 \pgfsetfillcolor{\@@tmp}
631 \fi
632 \pgfusepath{draw, fill}
633 \fi
634 }
635 % ...and for the thickness
636 \def\pgf@circ@subset@thickness#1{%
637 % You *must* be sure that this is called inside a \pgfscope!
638 \edef\@@default{default}
639 \edef\@@tmp{\ctikzvalof{#1/thickness}}
640 \ifx\@@tmp\@@default\else
641 \pgfsetlinewidth{\@@tmp\pgflinewidth}%
642 \fi
643 }
644 % set the text color (via \color) if the color is not default or none
645 % needed in some strange case (like bodydiode' dots)
646 \def\pgf@circ@maybe@color#1{%
647 \edef\@@none{none}\edef\@@default{default}%
648 \edef\@@tmp{\ctikzvalof{#1}}%
649 \ifx\@@tmp\@@default\else
650 \ifx\@@tmp\@@none\else
651 \color{\@@tmp}%
652 \fi
653 \fi
654 }
655
656 %%>>>
657
658 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
659 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
660
661 \ifpgfutil@format@is@latex
662 \long\def\pgf@circ@font@tiny{\tiny}
663 \long\def\pgf@circ@font@small{\small}
664 \long\def\pgf@circ@font@bold{\textbf}
665 \long\def\pgf@circ@font@boldmath{\boldmath}
666 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
667 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
668 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
669 \else\ifpgfutil@format@is@plain
670 \long\def\pgf@circ@font@tiny{\fiverm}
671 \long\def\pgf@circ@font@small{\sevenrm}
672 \long\def\pgf@circ@font@bold#1{{\bf#1}}
673 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
674 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
675 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
676 \long\def\pgf@circ@font@twelve{\twelverm} %
677 \else\ifpgfutil@format@is@context
678 \long\def\pgf@circ@font@tiny{\tfxx}
679 \long\def\pgf@circ@font@small{\tfx}
680 \long\def\pgf@circ@font@bold{\bold}
681 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
682 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
683 \long\def\pgf@circ@font@tenbm{\normal\bold}%
684 \long\def\pgf@circ@font@twelve{\tfa} %
685 \fi\fi\fi
686 % noop
687 \def\pgfcirc@nop#1{#1}% no operation, just strip {}
688 %
689 %
690 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
691 %
692 % this is needed to avoid problems with \ConTeXt
693 \ifcsname normalunexpanded\endcsname
694 \let\pgfcircutil@unexpanded\normalunexpanded
695 \else
696 \let\pgfcircutil@unexpanded\unexpanded
697 \fi
698 % minimally expand a pgfkey to check if it's {}/undefined or filled.
699 \def\unexpandedvalueof#1{%
700 \pgfcircutil@unexpanded\expandafter\expandafter
701 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
702 \def\pgf@circ@valueof@chk#1{%
703 \ifx\relax#1%
704 \expandafter\pgfutil@firstoftwo
705 \else
706 \expandafter\pgfutil@secondoftwo
707 \fi
708 {{}}% #1 is \relax, so consider empty
709 {\expandafter{#1}}% otherwise, leave the key after one more expansion
710 }%
711 %>>>
712
713 %% Generic macro for defining a bipole shape%<<<
714 % #1 - additional anchors
715 % #2 - lower y-size of the bipole (from the center).
716 % #3 - #shape is the name of the shape
717 % #4 - upper y-size of the bipole (from the center)
718 % #5 - width of the bipole
719 % #6 - macros drawing the bipole
720 %
721 \long\def\pgfcircdeclarebipole{%
722 \pgfcircdeclarebipolescaled{default}}
723
724 %% Generic macro for defining a bipole shape
725 % #1 - scale factor
726 % #2 - additional anchors
727 % #3 - lower y-size of the bipole (from the center).
728 % #4 - #shape is the name of the shape
729 % #5 - upper y-size of the bipole (from the center)
730 % #6 - width of the bipole
731 % #7 - macros drawing the bipole
732 %
733 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
734 % \typeout{Declaring bipole:\space #4,}
735 \pgfdeclareshape{#4shape}{
736 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
737 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
738 \savedanchor{\northeast}{
739 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
740 \pgf@y=#5\pgf@circ@scaled@Rlen
741 \pgf@y=.5\pgf@y
742 \pgf@x=#6\pgf@circ@scaled@Rlen
743 \pgf@x=.5\pgf@x
744 }
745 \savedanchor{\northeastborder}{
746 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
747 \pgf@y=#5\pgf@circ@scaled@Rlen
748 \pgf@y=.5\pgf@y
749 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
750 \pgf@x=#6\pgf@circ@scaled@Rlen
751 \pgf@x=.5\pgf@x
752 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
753 }
754 \savedanchor{\southwestborder}{
755 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
756 \pgf@y=-#3\pgf@circ@scaled@Rlen
757 \pgf@y=.5\pgf@y
758 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
759 \pgf@x=-#6\pgf@circ@scaled@Rlen
760 \pgf@x=.5\pgf@x
761 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
762 }
763 \savedanchor{\southwest}{
764 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
765 \pgf@y=-#3\pgf@circ@scaled@Rlen
766 \pgf@y=.5\pgf@y
767 \pgf@x=-#6\pgf@circ@scaled@Rlen
768 \pgf@x=.5\pgf@x
769 }
770 \savedanchor{\centerpoint}{
771 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
772 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
773 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
774 \pgfpointorigin % this is ok, it loads \pgf@x\pgf@y
775 \pgf@y=\pgf@circ@res@up
776 \advance\pgf@y by\pgf@circ@res@down
777 \pgf@y=.5\pgf@y
778 }
779 \anchor{center}{\pgfpointorigin}
780 \anchor{n}{\northeast\pgf@x=0cm }
781 \anchor{north east}{\northeast}
782 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
783 \anchor{ne}{\northeast}
784 \anchor{nw}{\northeast\pgf@x=-\pgf@x}
785 \anchor{e}{\northeast\pgf@y=0cm }
786 \anchor{s}{\southwest\pgf@x=0cm }
787 \anchor{south east}{\southwest\pgf@x=-\pgf@x}
788 \anchor{south west}{\southwest}
789 \anchor{se}{\southwest\pgf@x=-\pgf@x}
790 \anchor{sw}{\southwest}
791 \anchor{w}{\southwest\pgf@y=0cm }
792 \anchor{north}{\northeast\pgf@x=0cm }
793 \anchor{east}{\northeast\pgf@y=0cm }
794 \anchor{south}{\southwest\pgf@x=0cm }
795 \anchor{west}{\southwest\pgf@y=0cm }
796 \anchor{right}{\northeast\pgf@y=0cm }
797 \anchor{above}{\northeast\pgf@x=0cm }
798 \anchor{left}{\southwest\pgf@y=0cm }
799 \anchor{below}{\southwest\pgf@x=0cm }
800 \anchor{a}{\northeast\pgf@y=0cm }
801 \anchor{b}{\southwest\pgf@y=0cm }
802 \savedanchor{\textanchor}{%
803 \pgf@y=\ht\pgfnodeparttextbox
804 \pgf@x=-.5\wd\pgfnodeparttextbox
805 }
806 \anchor{text}{ \textanchor }
807 \anchorborder{%
808 \ifpgf@circuit@bipole@inverted
809 \pgf@circ@res@left=-\pgf@x
810 \pgf@circ@res@up=-\pgf@y
811 \else
812 \pgf@circ@res@left=\pgf@x
813 \pgf@circ@res@up=\pgf@y
814 \fi
815 \ifdim\pgf@circ@res@up>0cm
816 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
817 \else
818 \southwestborder
819 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
820 \fi
821 }
822 #2%
823 \pgf@circ@draw@component{
824 \pgf@circ@setcolor
825 \northeast
826 \pgf@circ@res@up = \pgf@y
827 \pgf@circ@res@zero = 0cm
828 \pgf@circ@res@left = -\pgf@x
829 \pgf@circ@res@right = \pgf@x
830 \southwest
831 \pgf@circ@res@down = \pgf@y
832 \pgf@circ@scaled@Rlen=\scaledRlen
833 \pgfstartlinewidth=\pgflinewidth
834 % we used to reset arced corners here --- now it's in the hooks. I hope.
835 #7%
836 \pgfsetlinewidth{\pgfstartlinewidth}
837 }
838 }
839 }% %>>>
840
841 %% anchor adjustment macros%<<<
842
843 % Extend the border anchor position by the specified factors on the right-top (north east corner)
844 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
845
846 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
847 \anchorborder{%
848 \ifpgf@circuit@bipole@inverted
849 \pgf@circ@res@left=-\pgf@x
850 \pgf@circ@res@up=-\pgf@y
851 \else
852 \pgf@circ@res@left=\pgf@x
853 \pgf@circ@res@up=\pgf@y
854 \fi
855 \ifdim\pgf@circ@res@up>0cm
856 \northeastborder
857 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
858 \else
859 \southwestborder
860 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
861 \fi
862 }
863 }
864
865 % Just up and down (very common)
866 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}%
867
868
869 % set of symmetrical, geographical anchors when a \northwest saved anchor is available
870 \long\def\pgfcirc@northwest@symmetric@geoanchors{%
871 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
872 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
873 \anchor{e}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
874 \anchor{left}{\northwest\pgf@y=0pt}
875 \anchor{west}{\northwest\pgf@y=0pt}
876 \anchor{w}{\northwest\pgf@y=0pt}
877 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
878 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
879 \anchor{north}{\northwest\pgf@x=0pt}
880 \anchor{n}{\northwest\pgf@x=0pt}
881 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
882 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
883 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
884 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
885 \anchor{north west}{\northwest}
886 \anchor{nw}{\northwest}
887 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
888 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
889 }
890 % the same, when we have \northeast (I know...)
891 \long\def\pgfcirc@northeast@symmetric@geoanchors{%
892 \anchor{north}{\northeast\pgf@x=0cm\relax}
893 \anchor{n}{\northeast\pgf@x=0cm\relax}
894 \anchor{east}{\northeast\pgf@y=0cm\relax}
895 \anchor{e}{\northeast\pgf@y=0cm\relax}
896 \anchor{right}{\northeast\pgf@y=0cm\relax}
897 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
898 \anchor{s}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
899 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
900 \anchor{w}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
901 \anchor{left}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
902 \anchor{north east}{\northeast}
903 \anchor{ne}{\northeast}
904 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
905 \anchor{nw}{\northeast\pgf@x=-\pgf@x}
906 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
907 \anchor{se}{\northeast\pgf@y=-\pgf@y}
908 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
909 \anchor{sw}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
910 }
911 %>>>
912
913 %% text position in some component.%<<<1
914 % (added with ieeestd logic ports. Maybe to be extended to other components,
915 % like amplifiers)
916 %
917 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
918 \tikzset{component text/.is choice}%
919 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
920 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
921 \ctikzset{component text/.is choice}%
922 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
923 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
924 \ctikzset{left text distance/.initial=0.3em}%
925 %>>>
926
927 %% voltage direction options%<<<1
928
929 \newif\ifpgf@circ@oldvoltagedirection % default false
930 \newif\ifpgf@circ@explicitvdir
931 \newif\ifpgf@circ@fixbatteries
932
933 \ctikzset{voltage dir/.is choice}
934 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
935 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
936 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
937 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
938 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
939 %>>>
940
941 %% bipole definitions for path component and text decorations%%<<<1
942 %
943 % Option "t=*" for nodes
944 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
945 \pgfkeys{/tikz/t1/.add code={}{\ctikzset{text in=#1}}}
946 \pgfkeys{/tikz/t2/.add code={}{\ctikzset{text out=#1}}}
947 %
948 \ctikzset{bipole/.is family}
949 \ctikzset{bipole/kind/.initial=}
950 \ctikzset{bipole/name/.initial=}
951 \newif\ifpgf@circuit@bipole@isvoltage
952 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
953 \newif\ifpgf@circuit@bipole@override@source@vif
954 \ctikzset{bipole/override source vif/.is if=pgf@circuit@bipole@override@source@vif}
955 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
956 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
957 \newif\ifpgf@circuit@bipole@strokedsymbol
958 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
959 \newif\ifpgf@circuit@bipole@iscurrent
960 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
961
962 \ctikzset{bipole/voltage/.is family}
963 \newif\ifpgf@circuit@bipole@voltage@backward
964 \ctikzset{bipole/voltage/direction/.is choice}
965 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
966 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
967 \newif\ifpgf@circuit@bipole@voltage@below
968 \ctikzset{bipole/voltage/position/.is choice}
969 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
970 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
971
972 \ctikzset{bipole/voltage/label/unit/.initial=}
973 \ctikzset{bipole/voltage/label/name/.initial=}
974
975 \ctikzset{bipole/current/.is family}
976 \newif\ifpgf@circuit@bipole@current@backward
977 \ctikzset{bipole/current/direction/.is choice}
978 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
979 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
980 \newif\ifpgf@circuit@bipole@current@before
981 \ctikzset{bipole/current/x position/.is choice}
982 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
983 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
984 \newif\ifpgf@circuit@bipole@current@below
985 \ctikzset{bipole/current/y position/.is choice}
986 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
987 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
988 \ctikzset{bipole/current/label/unit/.initial=}
989 \ctikzset{bipole/current/label/name/.initial=}
990
991 \ctikzset{bipole/flow/.is family}
992 \newif\ifpgf@circuit@bipole@flow@backward
993 \ctikzset{bipole/flow/direction/.is choice}
994 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
995 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
996 \newif\ifpgf@circuit@bipole@flow@before
997 \ctikzset{bipole/flow/x position/.is choice}
998 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
999 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
1000 \newif\ifpgf@circuit@bipole@flow@below
1001 \ctikzset{bipole/flow/y position/.is choice}
1002 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
1003 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
1004 \ctikzset{bipole/flow/label/unit/.initial=}
1005 \ctikzset{bipole/flow/label/name/.initial=}
1006 \ctikzset{flow/distance/.initial = .5}
1007 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
1008
1009 \ctikzset{bipole/label/.is family}
1010 \ctikzset{bipole/label/position/.initial=90}
1011 \ctikzset{bipole/label/unit/.initial=}
1012 \ctikzset{bipole/label/name/.initial=}
1013 \ctikzset{bipole/annotation/.is family}
1014 \ctikzset{bipole/annotation/position/.initial=-90}
1015 \ctikzset{bipole/annotation/unit/.initial=}
1016 \ctikzset{bipole/annotation/name/.initial=}
1017
1018
1019 \ctikzset{label/align/.is choice}
1020 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
1021 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
1022 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
1023 %%>>>
1024
1025 %% traditional styles %<<<1
1026 %
1027 \ctikzset{thickness/.initial=2}
1028 \ctikzset{bipoles/border margin/.initial=1.1}
1029 \ctikzset{bipoles/thickness/.initial=2}
1030 \ctikzset{tripoles/thickness/.initial=2}
1031 \ctikzset{quadpoles/thickness/.initial=2}
1032 \ctikzset{nodes width/.initial=.04}
1033 %%>>>
1034
1035 %% Styles definitions and macros%<<<1
1036
1037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
1038 %% main style definitions
1039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
1040
1041 % load a style file: search ctikzstyle-NAME.tex in path
1042 \def\ctikzloadstyle#1{%
1043 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
1044 \tikzerror{I did not find the circuitikz style #1}}%
1045 }
1046
1047 % load and enact a style
1048 \def\ctikzsetstyle#1{%
1049 \ctikzloadstyle{#1}%
1050 \tikzset{#1 circuit style}%
1051 }
1052
1053 % global style parameters
1054 \ctikzset{default/scale/.initial=1.0} % do not touch
1055 \ctikzset{default/fill/.initial=none} % do not touch
1056 \ctikzset{default/thickness/.initial=none} % do not touch
1057 % default is use as the generic default style for bipoles
1058
1059 % mostly bipoles:
1060
1061 \ctikzset{resistors/scale/.initial=1.0}
1062 \ctikzset{resistors/fill/.initial=none}
1063 \ctikzset{resistors/thickness/.initial=none}
1064 \ctikzset{resistors/modifier thickness/.initial=1}% relative to main thickness
1065
1066 \ctikzset{capacitors/scale/.initial=1.0}
1067 \ctikzset{capacitors/fill/.initial=none}
1068 \ctikzset{capacitors/thickness/.initial=none}
1069 \ctikzset{capacitors/modifier thickness/.initial=1}
1070
1071 \ctikzset{inductors/scale/.initial=1.0}
1072 \ctikzset{inductors/fill/.initial=none}
1073 \ctikzset{inductors/thickness/.initial=none}
1074 \ctikzset{inductors/modifier thickness/.initial=1}
1075
1076 \ctikzset{diodes/scale/.initial=1.0}
1077 \ctikzset{diodes/fill/.initial=none}
1078 \ctikzset{diodes/thickness/.initial=none}
1079 % we define opto arrows style here because they are used also
1080 % in transistors
1081 \ctikzset{opto arrows/.is family}
1082 \ctikzset{opto arrows/relative thickness/.initial=1}
1083 \ctikzset{opto arrows/color/.initial=default}
1084 \ctikzset{opto arrows/dash/.initial=default}
1085 \def\pgf@circ@set@optoarrow@style{%
1086 % You *must* be sure that this is called inside a \pgfscope!
1087 \pgfsetlinewidth{\ctikzvalof{opto arrows/relative thickness}\pgflinewidth}
1088 \pgf@circ@subset@color@dash{opto arrows}
1089 \pgfcirc@set@arrows{opto}{}{latexslim}
1090 }
1091
1092 \ctikzset{batteries/scale/.initial=1.0}
1093 \ctikzset{batteries/fill/.initial=none}
1094 \ctikzset{batteries/thickness/.initial=none}
1095
1096 \ctikzset{sources/scale/.initial=1.0}
1097 \ctikzset{sources/fill/.initial=none}
1098 \ctikzset{sources/thickness/.initial=none}
1099
1100 \ctikzset{csources/scale/.initial=1.0}
1101 \ctikzset{csources/fill/.initial=none}
1102 \ctikzset{csources/thickness/.initial=none}
1103
1104 \ctikzset{instruments/scale/.initial=1.0}
1105 \ctikzset{instruments/fill/.initial=none}
1106 \ctikzset{instruments/thickness/.initial=none}
1107
1108 \ctikzset{mechanicals/scale/.initial=1.0}
1109 \ctikzset{mechanicals/fill/.initial=none}
1110 \ctikzset{mechanicals/thickness/.initial=none}
1111
1112 \ctikzset{misc/scale/.initial=1.0}
1113 \ctikzset{misc/fill/.initial=none}
1114 \ctikzset{misc/thickness/.initial=none}
1115
1116 \ctikzset{blocks/scale/.initial=1.0}
1117 \ctikzset{blocks/fill/.initial=none}
1118 \ctikzset{blocks/thickness/.initial=none}
1119
1120 % mostly nodes
1121
1122 \ctikzset{grounds/scale/.initial=1.0}
1123 \ctikzset{grounds/fill/.initial=none}
1124 \ctikzset{grounds/thickness/.initial=none}
1125
1126 \ctikzset{power supplies/scale/.initial=1.0}
1127 \ctikzset{power supplies/fill/.initial=none}
1128 \ctikzset{power supplies/thickness/.initial=none}
1129
1130 \ctikzset{transistors/scale/.initial=1.0}
1131 \ctikzset{transistors/fill/.initial=none}
1132 \ctikzset{transistors/thickness/.initial=none}
1133 \ctikzset{transistors/modifier thickness/.initial=1}% relative to main thickness
1134
1135 \ctikzset{tubes/scale/.initial=1.0}
1136 \ctikzset{tubes/fill/.initial=none}
1137 \ctikzset{tubes/thickness/.initial=none}
1138
1139 \ctikzset{RF/scale/.initial=1.0}
1140 \ctikzset{RF/fill/.initial=none}
1141 \ctikzset{RF/thickness/.initial=none}
1142
1143 \ctikzset{electromechanicals/scale/.initial=1.0}
1144 \ctikzset{electromechanicals/fill/.initial=none}
1145 \ctikzset{electromechanicals/thickness/.initial=none}
1146
1147 % transformers go with inductors
1148 \ctikzset{amplifiers/scale/.initial=1.0}
1149 \ctikzset{amplifiers/fill/.initial=none}
1150 \ctikzset{amplifiers/thickness/.initial=none}
1151
1152 \ctikzset{switches/scale/.initial=1.0}
1153 \ctikzset{switches/fill/.initial=none}
1154 \ctikzset{switches/thickness/.initial=none}
1155
1156 \ctikzset{logic ports/scale/.initial=1.0}
1157 \ctikzset{logic ports/fill/.initial=none}
1158 \ctikzset{logic ports/thickness/.initial=none}
1159
1160 \ctikzset{flipflops/scale/.initial=1.0}
1161 \ctikzset{flipflops/fill/.initial=none}
1162 \ctikzset{flipflops/thickness/.initial=none}
1163
1164 \ctikzset{muxdemuxes/scale/.initial=1.0}
1165 \ctikzset{muxdemuxes/fill/.initial=none}
1166 \ctikzset{muxdemuxes/thickness/.initial=none}
1167
1168 \ctikzset{chips/scale/.initial=1.0}
1169 \ctikzset{chips/fill/.initial=none}
1170 \ctikzset{chips/thickness/.initial=none}
1171
1172 \ctikzset{displays/scale/.initial=1.0}
1173 \ctikzset{displays/fill/.initial=none}
1174 \ctikzset{displays/thickness/.initial=none}
1175 %
1176 % general styles
1177 %
1178 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
1179 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
1180 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
1181 %%>>>
1182
1183 %% voltage and current options%<<<1
1184 %
1185 \ctikzset{current arrow scale/.initial=16}
1186 \ctikzset{current/distance/.initial = .5}
1187
1188 \newif\ifpgf@circuit@europeancurrent
1189 \newif\ifpgf@circuit@europeanvoltage
1190 \newif\ifpgf@circuit@bipole@voltage@straight
1191 \newif\ifpgf@circuit@bipole@voltage@raised
1192
1193 \ctikzset{voltage/.is choice}
1194 %
1195 % straight is expected to be a subset of european, so disable it in american style
1196 %
1197 \ctikzset{voltage/american/.code = {%
1198 \pgf@circuit@europeanvoltagefalse
1199 \pgf@circuit@bipole@voltage@straightfalse
1200 \pgf@circuit@bipole@voltage@raisedfalse
1201 }}
1202 \ctikzset{voltage/raised/.code = {%
1203 \pgf@circuit@europeanvoltagefalse
1204 \pgf@circuit@bipole@voltage@straightfalse
1205 \pgf@circuit@bipole@voltage@raisedtrue
1206 }}
1207 \ctikzset{voltage/european/.code = {%
1208 \pgf@circuit@europeanvoltagetrue
1209 \pgf@circuit@bipole@voltage@straightfalse
1210 \pgf@circuit@bipole@voltage@raisedfalse
1211 }}
1212 \ctikzset{voltage/straight/.code = {%
1213 \pgf@circuit@europeanvoltagetrue
1214 \pgf@circuit@bipole@voltage@straighttrue
1215 \pgf@circuit@bipole@voltage@raisedfalse
1216 }}
1217 \ctikzset{voltage/curved/.code = {%
1218 \pgf@circuit@europeanvoltagetrue
1219 \pgf@circuit@bipole@voltage@straightfalse
1220 \pgf@circuit@bipole@voltage@raisedfalse
1221 }}
1222 % are these used?
1223 \ctikzset{current/.is choice}
1224 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
1225 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
1226
1227 % this is left for backward compatibility...
1228 \ctikzset{straight/.is choice}
1229 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
1230 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
1231 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
1232 %
1233 % voltage is used also to set parameters, apart for the /.is choice
1234 % above. I hope it is ok --- would be a mess otherwise
1235 %
1236 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
1237 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1238 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1239 %
1240 % keys for exporting voltage, current, flow anchors
1241 %
1242 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
1243 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
1244 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
1245 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
1246 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
1247 %
1248 % shaping the +/- sign, see pgfcircvoltage.tex
1249 \ctikzset{voltage/american font/.initial={}}
1250 \ctikzset{voltage/american plus/.initial={$+$}}
1251 % In the mayority of fonts, the size of - is smaller than +, so we have
1252 % unaligned signs when positioned independently.
1253 % See https://github.com/circuitikz/circuitikz/issues/721
1254 \ctikzset{voltage/american minus/.initial={$\vphantom{+}-$}}
1255 % here we start the voltage adjustments for special components.
1256 % default values:
1257 %
1258 % this is the distance of the "point" marking the voltage along the line
1259 % 0.0 is on the external nodes of the to path
1260 % 1.0 is cramped on the object
1261 % this can be overriden component by component
1262 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
1263 %
1264 % this is the distance from the line (perpendicular to) where the voltage is drawn.
1265 % It is global, and not adjustable by component (use the "label distance" or locally
1266 % if you need it)
1267 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
1268 %
1269 % bend paramenters for european arc. You can override them component-based
1270 \ctikzset{voltage/bump b/.initial=1.5}
1271 %
1272 % generator voltages symbols or arrows (always straight) are put along the
1273 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
1274 % center..angle line. It's called bump a because I don't know...
1275 %
1276 \ctikzset{voltage/bump a/.initial=1.2}
1277 %
1278 % these are the label distances FROM the drawings.
1279 % You can override them component by component.
1280 \ctikzset{voltage/european label distance/.initial=1.4}
1281 \ctikzset{voltage/straight label distance/.initial=1.4}
1282 \ctikzset{voltage/american label distance/.initial=1.4}
1283 % american open voltage adjusting
1284 %
1285 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
1286 \ctikzset{open voltage position/.is choice}
1287 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
1288 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
1289 % bad names, kept for compatibility, don't use
1290 \ctikzset{american open voltage/.is choice}
1291 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
1292 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
1293 %
1294 % voltage and current styles
1295 %
1296 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
1297 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
1298 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
1299 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
1300 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
1301 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
1302 %%>>>
1303
1304 % vim: set fdm=marker fmr=%<<<,%>>>:
1305 %%%---------- close: tex/pgfcirc.defines
1306 %%%%%%%%%%% Springe nach tex/pgfcircutils
1307 %%%---------- open: tex/pgfcircutils.tex
1308 % Copyright 2018-2026 by Romano Giannetti
1309 % Copyright 2015-2026 by Stefan Lindner
1310 % Copyright 2013-2026 by Stefan Erhardt
1311 % Copyright 2007-2026 by Massimo Redaelli
1312 %
1313 % This file may be distributed and/or modified
1314 %
1315 % 1. under the LaTeX Project Public License and/or
1316 % 2. under the GNU Public License.
1317 %
1318 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1319
1320 \def\pgf@circ@handleSI#1{
1321 \noexpandarg
1322 \def\pgf@temp{}
1323 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
1324 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
1325
1326 \ifnum\pgf@circ@handleSI@unit@len=0
1327 \pgf@circ@siunitx@resfalse
1328 \else
1329 \IfEndWith{#1}{>}{
1330 \pgf@circ@siunitx@restrue
1331 \noexpandarg
1332 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
1333 %\typeout{si |#1|}
1334 }{
1335 \pgf@circ@siunitx@resfalse
1336 %\typeout{no si |#1|}
1337 }
1338 \fi
1339 }
1340
1341 \def\pgf@circ@ifkeyempty#1{
1342 \pgfextra{
1343 \ctikzset{#1/.get=\pgf@circ@temp}
1344 \edef\pgf@temp{}
1345 }
1346 \ifx\pgf@circ@temp\pgf@temp
1347 }
1348
1349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350 %% Math routines
1351
1352 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
1353
1354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1355 %% useful commands
1356
1357 \ifpgfutil@format@is@latex
1358 %% flipping text
1359 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
1360 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
1361 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
1362 % text mode overbar
1363 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1364 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
1365 \else\ifpgfutil@format@is@plain
1366 % text mode overbar
1367 % but really circuitikz will not work in plain...
1368 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1369 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1370 \else\ifpgfutil@format@is@context
1371 %% flipping text
1372 \def\ctikzflipx#1{\mirror{#1}}
1373 \def\ctikzflipy#1{\mirror{\rotate[rotation=180]{#1}}}
1374 \def\ctikzflipxy#1{\rotate[rotation=180]{#1}}
1375 % text mode overbar
1376 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1377 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1378 \fi\fi\fi
1379
1380 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1381 %% switch to use fpu in reciprocal scale transformations
1382 %%
1383 %% this code has been contributed by Schrödinger's cat
1384 %% https://tex.stackexchange.com/a/529159/38080
1385 %%
1386 %% Use the official key to use the fpu if installed, see
1387 %% https://github.com/pgf-tikz/pgf/issues/861
1388 %%
1389 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
1390 %% Thanks to Henri Menke for a faster approach https://github.com/circuitikz/circuitikz/commit/00966c45c42b464fab5429f89f2b7fb414e9b3f7#commitcomment-54592494
1391 %%
1392 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
1393 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
1394 }{%
1395 \pgfkeysifdefined{/pgf/use fpu reciprocal/.@cmd}{% use stock one
1396 }{
1397 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
1398 \def\pgfmathreciprocal@##1{%
1399 \begingroup
1400 \pgfmathfloatparsenumber{##1}%
1401 \pgfmathfloatreciprocal@{\pgfmathresult}%
1402 \pgfmathfloattofixed@{\pgfmathresult}%
1403 \pgfmath@smuggleone\pgfmathresult
1404 \endgroup
1405 }}}}%
1406 }
1407
1408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1409 %% subcircuits (experimental)
1410 %%
1411 %% introduced by Romano Giannetti around April 2021
1412 %% changes suggested by Jonathan P. Spratte
1413 %%
1414 \newbox\ctikz@scratchbox
1415 \pgfutil@protected\def\ctikzsubcircuitdef#1#2#3{%
1416 \expandafter\gdef\csname #1@Anchor\endcsname{}%
1417 \expandafter\gdef\csname #1@setanchors\endcsname{%
1418 \setbox\ctikz@scratchbox=\hbox{%
1419 \tikzpicture
1420 \draw (0,0) \csname#1\endcsname{T-#1}{};
1421 \foreach [count=\i] \anchor in {#2}
1422 % reference anchor is -center
1423 \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in
1424 node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}};
1425 \endtikzpicture
1426 }%
1427 }%
1428 \expandafter\gdef\csname#1\endcsname##1##2{%
1429 \csname #1@Anchor##2\endcsname coordinate(##1-subckt@reference)#3%
1430 }%
1431 }
1432 \long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
1433
1434
1435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1436 %% Basic utility macros
1437 %%
1438 %% Functions provided here are:
1439 %% \pgf@circ@ifempty{<argument>}{<true>}{<false>}
1440 %% Tests whether <argument> is completely empty.
1441 %% \pgf@circ@ifblank{<argument>}{<true>}{<false>}
1442 %% Tests whether <argument> is either empty or only contains spaces.
1443 %% \pgf@circ@trimspaces@do{<argument>}{<next>}
1444 %% Trims at most one space from either end of <argument> and forwards the
1445 %% result to <next> as <next>{<trimmed argument>}
1446
1447 % these two are pretty standard code
1448 \long\def\pgf@circ@ifempty#1%
1449 {%
1450 \if\relax\detokenize{#1}\relax
1451 \expandafter\pgfutil@firstoftwo
1452 \else
1453 \expandafter\pgfutil@secondoftwo
1454 \fi
1455 }
1456 \long\def\pgf@circ@ifblank#1%
1457 {%
1458 \if\relax\detokenize\expandafter{\pgfutil@gobble#1.}\relax
1459 \expandafter\pgfutil@firstoftwo
1460 \else
1461 \expandafter\pgfutil@secondoftwo
1462 \fi
1463 }
1464
1465 % \pgfutil@trimspaces needs two expansions. The first expansion we'll do during
1466 % the definition.
1467 \def\pgf@circ@trimspaces@do#1%
1468 {%
1469 \def\pgf@circ@trimspaces@do##1%
1470 {\expandafter\pgf@circ@trimspaces@do@\expandafter{#1}}%
1471 }
1472 \expandafter\pgf@circ@trimspaces@do\expandafter{\pgfutil@trimspaces{#1}}
1473 \def\pgf@circ@trimspaces@do@#1#2{#2{#1}}
1474
1475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1476 %% list handling
1477 %%
1478 %% Contribution by Jonathan P. Spratte (blame him!)
1479 %%
1480 %% The list implementation here has a few limitations. Those are:
1481 %% 1. not long, so no \par in the lists (but many used functions in pgfutil
1482 %% aren't long as well)
1483 %% 2. list elements can't contain a Q with category code 3 (but the used
1484 %% function \pgfutil@trimspaces doesn't support them as well, and this
1485 %% should be a very rare token anyway)
1486 %% 3. list elements can't contain the token \pgf@circ@set@list as that is used
1487 %% as the end marker
1488 %% 4. currently these lists are meant for numeric data (hence only
1489 %% \pgf@circ@if@num@in@list is provided as a test), as a result there is
1490 %% another limitation for the data here. If the list element contains no
1491 %% hyphen '-', the element will be stored without further processing
1492 %% 'as-is' (well, after trimming spaces). If there is a hyphen we assume
1493 %% well-behaved input data and will interpret this as a num-range without
1494 %% further tests.
1495 %%
1496 %% Functions provided here are:
1497 %% \pgf@circ@set@list<macro>{<csv-list>}
1498 %% Parses the <csv-list> and stores the result inside <macro> (local
1499 %% assignment). If a num-range given as <start - stop> (with or without
1500 %% spaces) is found it will be expanded to <start>,<start+1>,...,<stop>.
1501 %% \pgf@circ@if@num@in@list<macro>{<value>}{<true>}{<false>}
1502 %% Checks whether <value> (numeric value, evaluated once with \numexpr) is
1503 %% found inside the list stored in <macro>. There are two special cases: If
1504 %% <macro> is undefined <false> is executed. If the list contains only one
1505 %% element and that is `all' <true> is executed.
1506
1507 % set the catcode of our marker
1508 \chardef\pgf@circ@temp=\the\catcode`\Q
1509 \catcode`\Q=3
1510
1511 % lists will have the structure
1512 % <marker><element 1><marker>...<element n><marker>
1513 % As marker we use a Q with category 3. Under the assumption that no list
1514 % element does ever contain that token we can set the elements without braces,
1515 % allowing us to use \pgfutil@in@ to search for elements (see above). The other
1516 % token that isn't allowed to show up in the list is \pgf@circ@set@list, that we
1517 % use as another marker during parsing.
1518 % The other big restriction in this implementation is that lists can't contain a
1519 % \par (but \pgfutil@in@ doesn't support that anyway so there is not much
1520 % sense in supporting it here)
1521 \pgfutil@protected\def\pgf@circ@set@list#1#2%
1522 {%
1523 % clear the error flag
1524 \let\pgf@circ@error@marker\pgf@circ@undefined
1525 % set the list
1526 \edef#1%
1527 {Q\pgf@circ@set@list@sanitize#2,\pgf@circ@set@list,\pgf@circ@set@list}%
1528 % there was an error, throw the error message, recovery was already done by
1529 % ignoring the offending elements.
1530 \ifx\pgf@circ@error@marker\relax
1531 \begingroup
1532 \newlinechar`\^^J
1533 \pgfutil@packageerror{circuitikz}
1534 {%
1535 Unallowed marker found in list^^J%
1536 \pgfutil@unexpanded{#2}.^^J%
1537 Offending elements were ignored.%
1538 }
1539 {Lists can't contain a Q with category code 3}%
1540 \endgroup
1541 \fi
1542 }
1543 % just a utility for the <marker> test
1544 \def\pgf@circ@set@list@gobbletomarker#1Q{}
1545 % quick way to check whether list parsing is done by gobbling up to a marker, in
1546 % this case the marker is \pgf@circ@set@list
1547 \def\pgf@circ@set@list@sanitize@checkend#1\pgf@circ@set@list{}
1548 % will only be called after the last element is handled, will gobble the
1549 % remainder of the current sanitizing step
1550 \def\pgf@circ@set@list@sanitize@end\pgf@circ@set@list#1\pgf@circ@set@list{}
1551 % grabs the next list element, checks whether we're done, and if not sanitizes
1552 % it (meaning stripping spaces from either end and placing the <marker>).
1553 \def\pgf@circ@set@list@sanitize#1,%
1554 {%
1555 \pgf@circ@set@list@sanitize@checkend
1556 #1\pgf@circ@set@list@sanitize@end\pgf@circ@set@list
1557 \pgf@circ@set@list@sanitize@a{#1}%
1558 }
1559 % testing whether a list element contains the used <marker> expandably, if it
1560 % does set the flag, else continue sanitizing.
1561 \def\pgf@circ@set@list@sanitize@a#1%
1562 {%
1563 \expandafter\pgf@circ@ifempty\expandafter
1564 % if this is empty no marker was found
1565 {\pgf@circ@set@list@gobbletomarker#1Q}
1566 {%
1567 \pgf@circ@ifblank{#1}
1568 {}% ignore blank entries
1569 {\pgf@circ@trimspaces@do{#1}\pgf@circ@set@list@sanitize@b}%
1570 }
1571 {%
1572 % panic, there was a marker found in a list element. We'll recover by
1573 % ignoring the current element after setting a flag. When we do
1574 % \csname ...\endcsname on an undefined macro name TeX will let that
1575 % macro to relax and we exploit this to expandable set a flag and
1576 % gobbling the result.
1577 \expandafter\pgfutil@gobble\csname pgf@circ@error@marker\endcsname
1578 }%
1579 % get the next element
1580 \pgf@circ@set@list@sanitize
1581 }
1582 % we'll protect any element from further expanding using \unexpanded and place
1583 % the marker after the element, and ignore empty/blank elements
1584 \def\pgf@circ@set@list@sanitize@b#1%
1585 {%
1586 \expandafter\pgf@circ@ifempty\expandafter
1587 % if this is empty no hyphen is found
1588 {\pgf@circ@gobbletohyphen#1-}
1589 {\pgfutil@unexpanded{#1}Q}
1590 {\pgf@circ@set@list@parse@range{#1}}%
1591 }
1592 \def\pgf@circ@gobbletohyphen#1-{}
1593 \def\pgf@circ@set@list@parse@range#1{\pgf@circ@set@list@parse@range@a#1Q}
1594 \def\pgf@circ@set@list@parse@range@a#1-#2Q%
1595 {%
1596 \expandafter\pgf@circ@set@list@parse@range@b
1597 \the\numexpr#1\expandafter Q\the\numexpr#2Q%
1598 }
1599 \def\pgf@circ@set@list@parse@range@b#1Q#2Q%
1600 {%
1601 \ifnum#1<#2
1602 % expand to the range from #1 to #2 (inclusive)
1603 \pgf@circ@set@list@range{#1}{#2}%
1604 \else
1605 \ifnum#2<#1
1606 % if #2 is smaller than #1 just swap the order
1607 \pgf@circ@set@list@range{#2}{#1}%
1608 \else
1609 % last case, they are equal, so just put the result here
1610 #1Q%
1611 \fi
1612 \fi
1613 }
1614 \def\pgf@circ@set@list@parse@range@norange#1Q#2{\pgfutil@unexpanded{#2}Q}
1615 \def\pgf@circ@set@list@range#1#2%
1616 {%
1617 #1Q%
1618 \ifnum#1<#2
1619 \expandafter\pgfutil@secondoftwo
1620 \fi
1621 \pgfutil@gobble
1622 {\expandafter\pgf@circ@set@list@range\expandafter{\the\numexpr#1+1}{#2}}%
1623 }
1624
1625 % flag for special value
1626 \def\pgf@circ@all@flag{QallQ}
1627 \pgfutil@protected\def\pgf@circ@if@num@in@list#1#2%
1628 {%
1629 % test whether the list macro is defined, if it isn't result is false
1630 \pgfutil@ifx\pgf@circ@undefined#1%
1631 {\pgfutil@secondoftwo}
1632 {%
1633 % test whether the list macro is just the special value 'all', if so
1634 % true, else search (and start that by evaluating a numexpr)
1635 \pgfutil@ifx\pgf@circ@all@flag#1%
1636 {\pgfutil@firstoftwo}
1637 {%
1638 \expandafter\pgf@circ@if@num@in@list@a\expandafter
1639 {\the\numexpr#2}%
1640 #1%
1641 }%
1642 }%
1643 }
1644 % next step is expanding the list macro
1645 \pgfutil@protected\def\pgf@circ@if@num@in@list@a#1#2%
1646 {\expandafter\pgf@circ@if@num@in@list@b\expandafter{#2}{#1}}
1647 % now use \pgfutil@in@ to check whether there is the searched list element
1648 \pgfutil@protected\def\pgf@circ@if@num@in@list@b#1#2%
1649 {%
1650 \begingroup
1651 % put the <marker> around the number to make sure only full matches are
1652 % found. \pgfutil@in@ will set \ifpgfutil@in@ to true if it finds a match
1653 \pgfutil@in@{Q#2Q}{#1}%
1654 \expandafter
1655 \endgroup
1656 \ifpgfutil@in@
1657 \expandafter\pgfutil@firstoftwo
1658 \else
1659 \expandafter\pgfutil@secondoftwo
1660 \fi
1661 }
1662
1663 % reset the catcode of Q
1664 \catcode`\Q=\pgf@circ@temp
1665
1666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1667 %% temporary fix for old TikZ versions (remove me)
1668 %%
1669 %% All blame to Romano Giannetti for this code!
1670 %%
1671 %% This tries to be smart and provide \pgfutil@unexpanded and \pgfutil@ifx if
1672 %% PGF doesn't provide them.
1673
1674 \ifx\pgfutil@unexpanded\pgf@circ@undefined
1675 \ifpgfutil@format@is@context
1676 \let\pgfutil@unexpanded\normalunexpanded
1677 \else
1678 \let\pgfutil@unexpanded\unexpanded
1679 \fi
1680 \fi
1681
1682 \ifx\pgfutil@ifx\pgf@circ@undefined
1683 \long\def\pgfutil@ifx#1#2{%
1684 \ifx#1#2%
1685 \expandafter\pgfutil@firstoftwo
1686 \else
1687 \expandafter\pgfutil@secondoftwo
1688 \fi}
1689 \fi
1690
1691 %%
1692 %% generic tunable arrow for components that have no "variable" thing
1693 %%
1694 \def\ctikztunablearrow{\pgfutil@ifnextchar[{\ctikztunablearrow@full}{\ctikztunablearrow@simple}}%
1695 \def\ctikztunablearrow@simple{\ctikztunablearrow@full[]}%
1696 \def\ctikztunablearrow@full[#1]#2#3#4#5{%
1697 % add tunable arrow to a component
1698 % relative thickness, relative length, rotation from axis, name of the component
1699 \scope
1700 \draw
1701 \pgfextra{\pgfcirc@set@arrows{tunable}{}{latexslim}
1702 \pgfsetlinewidth{#2\pgflinewidth}} [#1]
1703 let \p1=($(#5.north east)-(#5.south west)$), \p2=($(#5.east)-(#5.west)$),
1704 \n1 = {veclen(\x1,\y1)},
1705 \n2 = {atan2(\y2,\x2)} in
1706 % node[above]{\n1, \n2}
1707 % notice that some node has the "center" on one side, so
1708 % midway from east to west is a safer bet for the center
1709 ($(#5.west)!0.5!(#5.east)$) ++({\n2+(#4)}:{-0.5*(\n1)*(#3)}) -- ++({\n2+(#4)}:{(\n1)*(#3)});
1710 \endscope
1711 }
1712 %%%---------- close: tex/pgfcircutils
1713 %%%%%%%%%%% Springe nach tex/pgfcircpath
1714 %%%---------- open: tex/pgfcircpath.tex
1715 % Copyright 2018-2026 by Romano Giannetti
1716 % Copyright 2015-2026 by Stefan Lindner
1717 % Copyright 2013-2026 by Stefan Erhardt
1718 % Copyright 2007-2026 by Massimo Redaelli
1719 %
1720 % This file may be distributed and/or modified
1721 %
1722 % 1. under the LaTeX Project Public License and/or
1723 % 2. under the GNU Public License.
1724 %
1725 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1726
1727
1728 \def\pgf@circ@direction{0.0}
1729
1730 % swap two coordinates
1731 \def\pgfcirc@swap@coordinates#1#2{%
1732 coordinate (pgfcirc@tmp@swap) at (#1)
1733 coordinate (#1) at (#2)
1734 coordinate (#2) at (pgfcirc@tmp@swap)
1735 }
1736
1737 % Names
1738 \ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
1739 \ctikzset{n/.code = {
1740 \pgfkeys{/tikz/circuitikz/bipole/name={#1}}
1741 }}
1742
1743 % Reflect the node along
1744 \ctikzset{mirrored/.is choice}
1745 \ctikzset{mirror value/.initial=1}
1746 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
1747 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
1748 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
1749
1750 % Invert node along path
1751 \ctikzset{inverted/.is choice}
1752 \ctikzset{invert value/.initial=1}
1753 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
1754 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
1755 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
1756 \newif\ifpgf@circuit@bipole@inverted
1757 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
1758
1759 \newif\ifpgf@circuit@bipole@voltage@backward
1760 \ctikzset{bipole/voltage/direction/.is choice}
1761 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1762 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1763
1764 % Initialize paths
1765 \def\pgfcircresetpath{
1766 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
1767 bipole/inverted=false, bipole/kind=,
1768 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
1769 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
1770 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
1771 bipole/current/y position=above, bipole/current/direction=forward,
1772 mirrored=false
1773 }
1774 }
1775
1776 %
1777 % expandable IF for the extra nodes (thanks to Henri Menke)
1778 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
1779 %
1780 \def\pgfcirc@if@has@i{%
1781 \ifpgfcirc@has@i
1782 \expandafter\pgfutil@firstoftwo
1783 \else
1784 \expandafter\pgfutil@secondoftwo
1785 \fi}
1786 \def\pgfcirc@if@has@v{%
1787 \ifpgfcirc@has@v
1788 \expandafter\pgfutil@firstoftwo
1789 \else
1790 \expandafter\pgfutil@secondoftwo
1791 \fi}
1792 \def\pgfcirc@if@has@f{%
1793 \ifpgfcirc@has@f
1794 \expandafter\pgfutil@firstoftwo
1795 \else
1796 \expandafter\pgfutil@secondoftwo
1797 \fi}
1798
1799
1800
1801 %% Generic bipole path
1802 \def\pgf@circ@bipole@path#1#2{
1803 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
1804 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
1805 % appended to the main (path-style) name
1806 % #1 path-style node name
1807 % #2 the argument passed from the to-path structure; don't touch
1808 %
1809 % Example:
1810 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
1811 %
1812 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
1813 }
1814 %%
1815 %% ultra-generic bipole path
1816 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
1817 %%
1818 \def\pgf@circ@bipole@path@base#1#2#3#4{%
1819 %
1820 % Create a path-style component based on a node-style shape
1821 % #1: postfix to be added to the name path to obtain the main shape name
1822 % #2: text to be passed as text to the node
1823 % #3: name of the bipole component
1824 % #4: this will be filled by the argument of the to-path
1825 %
1826 \pgfextra{
1827 \ctikzset{bipole/kind = #3}
1828 \edef\pgf@temp{\ctikzvalof{bipole/name}}
1829 \def\pgf@circ@temp{}
1830 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
1831 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
1832 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
1833 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
1834 \else
1835 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
1836 \fi
1837 }
1838 % save start and stop values
1839 % notice that we DO NOT MOVE the path position at all!
1840 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
1841 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
1842 \pgfextra{
1843 % find the direction (angle) of the path
1844 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
1845 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
1846 \edef\pgf@circ@direction{\pgfmathresult}
1847 % the global macro pgfcirc@whatever-direction is accessible as \ctikzgetdirection{whatever}
1848 % this gives access to the element path direction
1849 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
1850 }
1851 % position the component in the middle of the path. We DO NOT MOVE the current position!
1852 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
1853 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
1854 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
1855 % set start and end labels
1856 \ifpgf@circuit@bipole@inverted
1857 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1858 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
1859 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
1860 \else
1861 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
1862 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
1863 \fi
1864 \else
1865 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1866 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
1867 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
1868 \else
1869 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
1870 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
1871 \fi
1872 \fi
1873 % draw the leads unless it's an open circuit
1874 % stop at the component
1875 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1876 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1877 \else
1878 % it is important to start the path with -- to have correct line joins!
1879 -- (pgfcirc@anchorstartnode)
1880 \fi
1881 % Add all the "ornaments": labels, annotations, voltages, currents and flows
1882 \drawpoles
1883 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
1884 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
1885 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
1886 % it should be logically safe for older version too --- even if TikZ reverted the change
1887 % use explandable ifs too, thanks to Henri Menke
1888 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
1889 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
1890 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
1891 % finish the path from the component to the final target
1892 % you never know --- re-set \pgf@temp to detect open
1893 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1894 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1895 (\tikztotarget)
1896 \else
1897 (pgfcirc@anchorendnode) -- (\tikztotarget)
1898 \fi
1899 % reset internal circuit keys
1900 \pgfextra{\pgfcircresetpath}
1901 %draw pending nodes an path
1902 \tikztonodes
1903 }
1904
1905 %% Macros for path and style activation for bipoles or path-style
1906
1907 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
1908 \def\compattikzset#1{%
1909 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
1910 \tikzset{\comnpatname#1}}
1911 %
1912 % this is used for components that are mainly node-style but have a path-style form
1913 %
1914 \def\pgfcirc@node@to@path#1#2#3{%
1915 % add a path-style component based on a node-style one without mangling the name
1916 % of the shape.
1917 % #1: node-type shape name (existing)
1918 % #2: path-type name (to be created)
1919 % #3: additional options to add to the path style
1920 %
1921 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
1922 \compattikzset{#2/.style = {\circuitikzbasekey,
1923 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
1924 #3}}%
1925 \ctikzset{bipoles/#1/height/.initial=1}%
1926 }
1927 %
1928 % this one is for normal definition: path to style, directly
1929 % the first parameter (#1) here is l,v,i (l=..., v=..., i=...)
1930 % the last parameter are options to be inserted in the "to path" definition
1931 %
1932 \def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3
1933 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}%
1934 }
1935 % this one create a alias style from a node definition
1936 \def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3
1937 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}%
1938 }
1939 % this create an alias style
1940 \def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2
1941 \compattikzset{#2/.style={\comnpatname #1={##1}}}%
1942 }
1943 % this create an alias style, changing the labelling
1944 \def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2
1945 \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}%
1946 }
1947 % create a bipole
1948 \def\pgfcirc@activate@bipole#1#2#3#4{% type of label, path name, base node name, style name
1949 % \typeout{Activate bipole:\space #4,}
1950 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1951 \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see
1952 }
1953 \def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}}
1954 % create a bipole with options
1955 \def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% type of label, path name, base node name, style name, options
1956 % \typeout{Activate bipole:\space #4,}
1957 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1958 \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see
1959 }
1960 \def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}}
1961
1962
1963 %% New system, for simple object
1964 %% \pgfcirc@activate@bipole@simple{l}{mass}
1965 %% New system, different names
1966 %% The old system is the following
1967 %% 1 - define just the pgf@circ@path@whatever#1
1968 %% (see for example the variable one)
1969 %% 2 - set the style
1970 %% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}}
1971
1972 %% Path definition with the new mechanism have been moved to where the nodes
1973 %% are defined.
1974
1975 %% Handling of terminals%<<<
1976
1977 \ctikzset{bipole/nodes/.is family}
1978 \ctikzset{bipole/nodes/left/.initial=none}
1979 \ctikzset{bipole/nodes/right/.initial=none}
1980 \tikzset{bipole nodes/.style n args={2}{%
1981 \circuitikzbasekey/bipole/nodes/left=#1,
1982 \circuitikzbasekey/bipole/nodes/right=#2%
1983 }
1984 }
1985
1986 %% Easily usable styles
1987
1988 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1989 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1990 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
1991 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1992 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
1993 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1994 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1995 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
1996 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
1997 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
1998 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1999 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
2000 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
2001 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2002 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2003
2004 % rectjoinfill workarounds
2005
2006 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
2007 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
2008 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2009 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2010 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2011 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2012 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2013 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2014 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2015
2016 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
2017
2018 \def\drawpoles{
2019 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
2020 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
2021 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
2022 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
2023 }
2024 % %>>>
2025
2026 %%
2027 %% Definition of path for transistors
2028 %%
2029 % Transistor like bipoles
2030
2031 \def\pgf@circ@trans@path#1#2{
2032 \pgfextra{
2033 \edef\pgf@temp{\ctikzvalof{bipole/name}}
2034 \def\pgf@circ@temp{#2}
2035 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
2036 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
2037 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
2038 \fi
2039 }
2040 \ifpgf@circuit@bipole@inverted
2041 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
2042 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
2043 \else
2044 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
2045 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
2046 \fi
2047 \pgfextra{
2048 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
2049 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
2050 \pgfmathadd{\pgfmathresult}{-90}
2051 \pgfmathround{\pgfmathresult}
2052 \edef\pgf@circ@direction{\pgfmathresult}
2053 }
2054 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
2055 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
2056 (\ctikzvalof{bipole/name}) {}
2057 node {\ctikzvalof{bipole/label/name}}
2058 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
2059 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
2060 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
2061 \else
2062 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
2063 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
2064 \fi
2065 \drawpoles
2066 \pgfextra{
2067 \pgfcircresetpath
2068 }
2069 (\tikztotarget) \tikztonodes % and go on!
2070 }
2071
2072 \def\pgf@circ@definetranspath#1{
2073 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
2074 }
2075
2076 %
2077 % vim: set fdm=marker fmr=%<<<,%>>>:
2078 %%%---------- close: tex/pgfcircpath
2079
2080 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2081 %%%---------- open: tex/pgfcircshapes.tex
2082 % Copyright 2018-2026 by Romano Giannetti
2083 % Copyright 2015-2026 by Stefan Lindner
2084 % Copyright 2013-2026 by Stefan Erhardt
2085 % Copyright 2007-2026 by Massimo Redaelli
2086 %
2087 % This file may be distributed and/or modified
2088 %
2089 % 1. under the LaTeX Project Public License and/or
2090 % 2. under the GNU Public License.
2091 %
2092 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2093 %
2094 % This file has folding marks for vim (See last line).
2095 %
2096
2097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2098 %% Other shapes
2099
2100 %% Nothing: empty shape%<<<
2101
2102 \pgfdeclareshape{emptyshape}{
2103 \savedanchor{\northeast}{%
2104 \pgf@x=.5\wd\pgfnodeparttextbox%
2105 \pgf@y=.5\ht\pgfnodeparttextbox%
2106 }
2107 % geo anchors based on north-east
2108 \pgfcirc@northeast@symmetric@geoanchors
2109 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2110 \anchor{center}{
2111 \pgfpointorigin
2112 }
2113 }%
2114 %>>>
2115
2116 %% Poles%<<<
2117 %
2118 % Provision for changing opacity. Only expert use, see the manual.
2119 %
2120 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2121 \tikzset{open poles opacity/.code={%
2122 \ctikzset{poles/open fill opacity=#1}%
2123 }}
2124 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2125 \tikzset{full poles opacity/.code={%
2126 \ctikzset{poles/full fill opacity=#1}%
2127
2128 }}
2129
2130 %
2131 % Provision for changing default background
2132 %
2133
2134 \ctikzset{open poles fill/.initial={white}}
2135
2136 %% Full terminal
2137
2138 \pgfdeclareshape{circ}{
2139 \anchor{center}{
2140 \pgfpointorigin
2141 }
2142 \savedanchor\northwest{%
2143 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2144 \pgf@x=-\pgf@y
2145 }
2146 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2147 % geo anchors based on north-west
2148 \pgfcirc@northwest@symmetric@geoanchors
2149 \anchorborder{
2150 \pgf@circ@res@left=\pgf@x
2151 \pgf@circ@res@up=\pgf@y
2152 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2153 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2154 }
2155 \pgf@circ@draw@component{
2156 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2157 \pgf@circ@setcolor
2158 \pgf@circ@fill@strokecolor
2159 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2160 \pgfusepath{draw,fill}
2161 }
2162 }
2163
2164 %% Empty round terminal
2165
2166 \pgfdeclareshape{ocirc}{
2167 \anchor{center}{
2168 \pgfpointorigin
2169 }
2170 \savedanchor\northwest{%
2171 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2172 \pgf@x=-\pgf@y
2173 }
2174 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2175 % geo anchors based on north-west
2176 \pgfcirc@northwest@symmetric@geoanchors
2177 \anchorborder{
2178 \pgf@circ@res@left=\pgf@x
2179 \pgf@circ@res@up=\pgf@y
2180 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2181 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2182 }
2183 \pgf@circ@draw@component{
2184 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2185 \pgf@circ@setcolor
2186 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2187 \ifx\tikz@fillcolor\pgfutil@empty
2188 % set the default fill color to white
2189 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2190 % ...but override it if the class is defined!
2191 % note that this element has no class, but will inherit it when used
2192 % into another component
2193 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2194 \else
2195 \pgfsetfillcolor{\tikz@fillcolor}
2196 \fi
2197 \pgfusepath{draw,fill}
2198 }
2199 }
2200
2201 %% Diamond terminal
2202
2203 \pgfdeclareshape{diamondpole}{
2204 \anchor{center}{
2205 \pgfpointorigin
2206 }
2207 \savedanchor\northwest{%
2208 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2209 \pgf@x=-\pgf@y
2210 }
2211 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2212 % geo anchors based on north-west
2213 \pgfcirc@northwest@symmetric@geoanchors
2214 \anchorborder{
2215 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2216 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2217 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2218 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2219 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2220 \pgfextracty{\pgf@circ@res@up}{\northwest}
2221 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2222 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2223 \pgfpointintersectionoflines
2224 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2225 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2226 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2227 \pgf@x=\@@switchx\pgf@x
2228 \pgf@y=\@@switchy\pgf@y
2229 }
2230 \pgf@circ@draw@component{
2231 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2232 \pgftransformrotate{45}
2233 \pgfpathrectanglecorners
2234 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2235 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2236 \pgf@circ@setcolor
2237 \pgf@circ@fill@strokecolor
2238 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2239 \pgfusepath{draw,fill}
2240 }
2241 }
2242
2243 %% Diamond terminal, unfilled
2244
2245 \pgfdeclareshape{odiamondpole}{
2246 \anchor{center}{
2247 \pgfpointorigin
2248 }
2249 \savedanchor\northwest{%
2250 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2251 \pgf@x=-\pgf@y
2252 }
2253 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2254 % geo anchors based on north-west
2255 \pgfcirc@northwest@symmetric@geoanchors
2256 \anchorborder{
2257 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2258 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2259 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2260 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2261 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2262 \pgfextracty{\pgf@circ@res@up}{\northwest}
2263 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2264 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2265 \pgfpointintersectionoflines
2266 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2267 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2268 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2269 \pgf@x=\@@switchx\pgf@x
2270 \pgf@y=\@@switchy\pgf@y
2271 }
2272 \pgf@circ@draw@component{
2273 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2274 \pgftransformrotate{45}
2275 \pgfpathrectanglecorners
2276 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2277 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2278 \pgf@circ@setcolor
2279 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2280 \ifx\tikz@fillcolor\pgfutil@empty
2281 % set the default fill color to white
2282 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2283 % ...but override it if the class is defined!
2284 % note that this element has no class, but will inherit it when used
2285 % into another component
2286 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2287 \else
2288 \pgfsetfillcolor{\tikz@fillcolor}
2289 \fi
2290 \pgfusepath{draw,fill}
2291 }
2292 }
2293
2294 %% square terminal, filled
2295
2296 \pgfdeclareshape{squarepole}{
2297 \anchor{center}{
2298 \pgfpointorigin
2299 }
2300 \savedanchor\northwest{%
2301 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2302 \pgf@x=-\pgf@y
2303 }
2304 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2305 % geo anchors based on north-west
2306 \pgfcirc@northwest@symmetric@geoanchors
2307 \anchorborder{
2308 \pgf@xa=\pgf@x
2309 \pgf@ya=\pgf@y
2310 \pgfextracty{\pgf@circ@res@up}{\northwest}
2311 \pgfpointborderrectangle
2312 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2313 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2314 }
2315 \pgf@circ@draw@component{
2316 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2317 \pgfpathrectanglecorners
2318 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2319 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2320 \pgf@circ@setcolor
2321 \pgf@circ@fill@strokecolor
2322 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2323 \pgfusepath{draw,fill}
2324 }
2325 }
2326 %% square terminal, unfilled
2327
2328 \pgfdeclareshape{osquarepole}{
2329 \anchor{center}{
2330 \pgfpointorigin
2331 }
2332 \savedanchor\northwest{%
2333 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2334 \pgf@x=-\pgf@y
2335 }
2336 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2337 % geo anchors based on north-west
2338 \pgfcirc@northwest@symmetric@geoanchors
2339 \anchorborder{
2340 \pgf@xa=\pgf@x
2341 \pgf@ya=\pgf@y
2342 \pgfextracty{\pgf@circ@res@up}{\northwest}
2343 \pgfpointborderrectangle
2344 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2345 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2346 }
2347 \pgf@circ@draw@component{
2348 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2349 \pgfpathrectanglecorners
2350 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2351 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2352 \pgf@circ@setcolor
2353 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2354 \ifx\tikz@fillcolor\pgfutil@empty
2355 % set the default fill color to white
2356 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2357 % ...but override it if the class is defined!
2358 % note that this element has no class, but will inherit it when used
2359 % into another component
2360 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2361 \else
2362 \pgfsetfillcolor{\tikz@fillcolor}
2363 \fi
2364 \pgfusepath{draw,fill}
2365 }
2366 }
2367
2368 %% Fill for correct rectangular joins
2369
2370 \pgfdeclareshape{rectjoinfill}{
2371 \savedanchor{\northeast}{%
2372 \pgf@x=.5\pgflinewidth%
2373 \pgf@y=.5\pgflinewidth%
2374 }
2375 % geo anchors based on north-east
2376 \pgfcirc@northeast@symmetric@geoanchors
2377 \anchor{center}{
2378 \pgfpointorigin
2379 }
2380 \anchorborder{
2381 \pgf@circ@res@left=\pgf@x
2382 \pgf@circ@res@up=\pgf@y
2383 }
2384 \pgf@circ@draw@component{
2385 \pgfpathrectanglecorners
2386 {\pgfpoint{0}{.5\pgflinewidth}}
2387 {\pgfpoint{0}{-.5\pgflinewidth}}
2388 \pgf@circ@setcolor
2389 \pgf@circ@fill@strokecolor
2390 \pgfusepath{draw,fill}
2391 }
2392 }
2393 % %>>>
2394
2395 %% Arrows%<<<
2396 %% transistor arrow
2397
2398 \def\pgf@circ@find@linescale{
2399 % find the scale inverse of the scale factor: line width do not scale
2400 % with scale=..., transform shape so we have to counteract it.
2401 \iftikz@fullytransformed % this is true if `transform shape` is active
2402 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2403 % Note that this trick is not working inside a `spy` environment...
2404 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2405 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2406 \else
2407 \pgfmathsetmacro{\@@factor}{1.0}
2408 \fi
2409 }
2410
2411 \pgfdeclareshape{trarrow}{%
2412 % this arrow is only filled but grows with the linewidth, more or less
2413 % like currarrow do
2414 \savedanchor{\northeast}{%
2415 \pgf@circ@res@step = \pgf@circ@Rlen
2416 \pgf@circ@find@linescale
2417 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2418 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2419 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2420 }
2421 % The arrow size should be more or less the same of a currarrow, which is
2422 % both filled and stroke, for backward output compatibility (more or less)
2423 %
2424 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2425 % |-\__ currarrow as the tip at (W,0)
2426 % | | and the upper tail at (-0.7*W, 0.8*W)
2427 % | \__ it then "overshoot" do to the linew width L
2428 % | \__ xangle \alpha
2429 % ---0------->
2430 %
2431 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2432 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2433 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2434 %
2435 \savedanchor{\northwest}{%
2436 \pgf@circ@res@step = \pgf@circ@Rlen
2437 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2438 \pgf@circ@find@linescale
2439 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2440 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2441 }
2442 \savedanchor{\tip}{%
2443 \pgf@circ@res@step = \pgf@circ@Rlen
2444 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2445 \pgf@circ@find@linescale
2446 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2447 }
2448 \anchor{north}{\northeast\pgf@x=0cm\relax}
2449 \anchor{east}{\northeast\pgf@y=0cm\relax}
2450 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2451 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2452 \anchor{north east}{\northeast}
2453 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2454 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2455 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2456 \anchor{center}{
2457 \pgfpointorigin
2458 }
2459 \anchor{tip}{
2460 \tip
2461 }
2462 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2463 \tip
2464 \pgf@circ@find@linescale
2465 \pgf@circ@res@temp=\@@factor\pgflinewidth
2466 \advance\pgf@x by -.5\pgf@circ@res@temp
2467 }
2468 \pgf@circ@draw@component{
2469 \northwest
2470 \pgf@circ@res@up=\pgf@y
2471 \pgf@circ@res@left=\pgf@x
2472 \tip
2473 \pgf@circ@res@step = \pgf@x
2474 %
2475 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2476 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2477 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2478 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2479 \pgfpathclose
2480 \pgf@circ@fill@strokecolor
2481 \pgfusepath{fill} % just fill
2482 }
2483 }
2484
2485 %% Current arrow
2486
2487 %% we need a phantom version of this shape for advanced v-i-f
2488 %% use strange names to keep ot private
2489 \newif\ifpgfcirc@really@draw@currarrow\pgfcirc@really@draw@currarrowtrue
2490 \ctikzset{phantom@currarrow/.code=\pgfcirc@really@draw@currarrowfalse}
2491 \ctikzset{normal@currarrow/.code=\pgfcirc@really@draw@currarrowtrue}
2492
2493 \pgfdeclareshape{currarrow}{
2494 \savedanchor{\northeast}{%
2495 \pgf@circ@res@step = \pgf@circ@Rlen
2496 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2497 \pgf@x=.5\pgf@circ@res@step
2498 \pgf@y=\pgf@x%
2499 }
2500 \anchor{north}{\northeast\pgf@x=0cm\relax}
2501 \anchor{east}{\northeast\pgf@y=0cm\relax}
2502 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2503 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2504 \anchor{north east}{\northeast}
2505 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2506 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2507 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2508 \anchor{center}{
2509 \pgfpointorigin
2510 }
2511 \anchor{tip}{
2512 \pgfpointorigin
2513 \pgf@circ@res@step = \pgf@circ@Rlen
2514 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2515 \pgf@x =\pgf@circ@res@step
2516 }
2517 \pgf@circ@draw@component{
2518 \ifpgfcirc@really@draw@currarrow
2519 \pgf@circ@reset@arrows@rounded
2520 \pgf@circ@res@step = \pgf@circ@Rlen
2521 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2522
2523 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2524 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2525 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2526 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2527 \pgfpathclose
2528 \pgf@circ@setcolor
2529 \pgf@circ@fill@strokecolor
2530 \pgfusepath{draw,fill}
2531 \fi
2532 }
2533 }
2534
2535 %% Flow arrow
2536 %% we need a phantom version of this shape for advanced v-i-f
2537 %% use strange names to keep ot private
2538 \newif\ifpgfcirc@really@draw@flowarrow\pgfcirc@really@draw@flowarrowtrue
2539 \ctikzset{phantom@flowarrow/.code=\pgfcirc@really@draw@flowarrowfalse}
2540 \ctikzset{normal@flowarrow/.code=\pgfcirc@really@draw@flowarrowtrue}
2541
2542 \pgfdeclareshape{flowarrow}{
2543 \savedanchor{\northeast}{%
2544 \pgf@circ@res@step = \pgf@circ@Rlen
2545 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2546 \pgf@y=.5\pgf@circ@res@step
2547 \pgf@circ@res@step = \pgf@circ@Rlen
2548 \divide \pgf@circ@res@step by 4
2549 \pgf@x=\pgf@circ@res@step%
2550 }
2551 \anchor{north}{\northeast\pgf@x=0cm\relax}
2552 \anchor{east}{\northeast\pgf@y=0cm\relax}
2553 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2554 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2555 \anchor{north east}{\northeast}
2556 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2557 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2558 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2559 \anchor{text}{% text centered above
2560 \pgfpointorigin
2561 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2562 }
2563 \anchor{center}{
2564 \pgfpointorigin
2565 }
2566 \anchor{tip}{
2567 \pgfpointorigin
2568 \pgf@circ@res@step = \pgf@circ@Rlen
2569 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2570 \pgf@x =\pgf@circ@res@step
2571 }
2572 \pgf@circ@draw@component{
2573 \ifpgfcirc@really@draw@flowarrow
2574 \pgf@circ@reset@arrows@rounded
2575 \pgf@circ@res@step = \pgf@circ@Rlen
2576 \divide \pgf@circ@res@step by 4
2577 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2578 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2579 \pgf@circ@setcolor
2580 \pgfusepath{draw}
2581 \pgf@circ@fill@strokecolor
2582 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2583 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2584 \fi
2585 }
2586 }
2587
2588 %% Input arrow
2589
2590 \pgfdeclareshape{inputarrow}{
2591 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2592 \pgf@circ@res@step = \pgf@circ@Rlen
2593 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2594 \pgf@y=.5\pgf@circ@res@step
2595 \pgf@x=1.7\pgf@circ@res@step
2596 }
2597 \anchor{north}{\northeast\pgf@x=0cm\relax}
2598 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2599 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2600 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2601 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2602 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2603 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2604 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2605 \savedanchor{\tip}{
2606 \pgfpointorigin
2607 }
2608 \anchor{center}{
2609 \tip
2610 }
2611 \anchor{tip}{
2612 \tip
2613 }
2614 \pgf@circ@draw@component{
2615 \pgf@circ@reset@arrows@rounded
2616 \pgf@circ@res@step = \pgf@circ@Rlen
2617 \divide \pgf@circ@res@step by 16
2618 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2619 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2620 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2621 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2622 \pgfpathclose
2623 \pgf@circ@setcolor
2624 \pgf@circ@fill@strokecolor
2625 \pgfusepath{fill}
2626 }
2627 }
2628 % %>>>
2629
2630 %% boxes%<<<
2631 %% box
2632
2633 \pgfdeclareshape{box}{
2634 \anchor{center}{
2635 \pgfpointorigin
2636 }
2637 \pgf@circ@draw@component{
2638 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2639 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2640 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2641 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2642 \pgf@circ@draworfill
2643 }
2644 }
2645
2646 %% box scaled with blocks
2647
2648 \pgfdeclareshape{blockbox}{
2649 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2650 \anchor{center}{
2651 \pgfpointorigin
2652 }
2653 \pgf@circ@draw@component{
2654 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2655 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2656 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2658 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2659 \pgf@circ@draworfill
2660 }
2661 }
2662 % %>>>
2663
2664 %% crossings%<<<
2665 % full nodes for wire crossing
2666 % styling for the vertical wire (default: do none)
2667 \ctikzset{crossing vertical/relative thickness/.initial=1}
2668 \ctikzset{crossing vertical/color/.initial=default}
2669 \ctikzset{crossing vertical/dash/.initial=default}
2670
2671 \pgfdeclareshape{jump crossing}
2672 {
2673 \savedanchor\northwest{%
2674 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2675 \pgf@y=.5\pgf@y
2676 \pgf@x=-\pgf@y
2677 }
2678 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2679 \pgfcirc@northwest@symmetric@geoanchors
2680 \pgf@circ@draw@component{
2681 \northwest
2682 \pgf@circ@res@up = \pgf@y
2683 \pgf@circ@res@down = -\pgf@y
2684 \pgf@circ@res@right = -\pgf@x
2685 \pgf@circ@res@left = \pgf@x
2686 % horizontal jumper
2687 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2688 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2689 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2690 \pgfsetbeveljoin
2691 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2692 \pgfusepath{draw}
2693 % vertical, broken path
2694 % styling of vertical line
2695 \pgfsetlinewidth{\ctikzvalof{crossing vertical/relative thickness}\pgflinewidth}
2696 \pgf@circ@subset@color@dash{crossing vertical}
2697 %
2698 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2699 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2700 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2701 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2702 \pgfusepath{draw}
2703 }
2704 }
2705 \pgfdeclareshape{plain crossing}
2706 {
2707 \savedanchor\northwest{%
2708 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2709 \pgf@y=.5\pgf@y
2710 \pgf@x=-\pgf@y
2711 }
2712 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2713 \pgfcirc@northwest@symmetric@geoanchors
2714 \pgf@circ@draw@component{
2715 \northwest
2716 \pgf@circ@res@up = \pgf@y
2717 \pgf@circ@res@down = -\pgf@y
2718 \pgf@circ@res@right = -\pgf@x
2719 \pgf@circ@res@left = \pgf@x
2720 % horizontal jumper
2721 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2722 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2723 \pgfusepath{draw}
2724 % vertical, broken path
2725 % styling of vertical line
2726 \pgfsetlinewidth{\ctikzvalof{crossing vertical/relative thickness}\pgflinewidth}
2727 \pgf@circ@subset@color@dash{crossing vertical}
2728 %
2729 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2730 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
2731 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
2732 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2733 \pgfusepath{draw}
2734 }
2735 }
2736 % %>>>
2737
2738 %% Connectors (BNC and IEC connectors; see https://github.com/circuitikz/circuitikz/issues/611)%<<<
2739
2740 % define new class
2741 \ctikzset{connectors/scale/.initial=1.0}
2742 \ctikzset{connectors/fill/.initial=none}
2743 \ctikzset{connectors/thickness/.initial=none}
2744 % parameters. To have round sockets, 3*height==2*width
2745 \ctikzset{bipoles/iecconn/height/.initial=.2}
2746 \ctikzset{bipoles/iecconn/width/.initial=.3}
2747 % objects
2748 \pgfcircdeclarebipolescaled{connectors}
2749 {
2750 \anchor{plug center}{\northeast\pgf@y=0pt\divide\pgf@x by 3 }
2751 \anchor{socket center}{\northeast\pgf@y=0pt\pgf@x=-0.333333\pgf@x}
2752 % put the node text above and centered
2753 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
2754 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2755 \dimexpr.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2756 }
2757 }
2758 }
2759 {\ctikzvalof{bipoles/iecconn/height}}%symmetrical
2760 {iecconn}
2761 {\ctikzvalof{bipoles/iecconn/height}}
2762 {\ctikzvalof{bipoles/iecconn/width}}
2763 {
2764 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2765 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
2766 \pgfpatharc{90}{-90}{0.66666\pgf@circ@res@left and \pgf@circ@res@up}
2767 \pgfusepath{draw}
2768 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up/2}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down/2}}
2769 \pgf@circ@fill@strokecolor
2770 \pgfusepath{draw, fill}
2771 }
2772 \pgfcirc@activate@bipole@simple{l}{iecconn}
2773 \pgfcirc@style@to@style{iecconn}{iec connector}
2774
2775 \long\def\pgfcirc@declare@iecsocket#1#2#3{% #1 name, #2 anchors, #3 drawing code
2776 \pgfdeclareshape{#1}{%
2777 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
2778 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2779 \savedanchor\northwest{%
2780 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2781 \pgf@y=\ctikzvalof{bipoles/iecconn/height}\pgf@circ@scaled@Rlen
2782 \pgf@y=.5\pgf@y
2783 \pgf@x=-\ctikzvalof{bipoles/iecconn/width}\pgf@circ@scaled@Rlen
2784 \divide\pgf@x by 6
2785 }
2786 \pgfcirc@northwest@symmetric@geoanchors
2787 #2%
2788 \pgf@circ@draw@component{%
2789 \pgf@circ@scaled@Rlen=\scaledRlen
2790 \pgfstartlinewidth=\pgflinewidth
2791 \northwest
2792 \pgf@circ@res@up=\pgf@y
2793 \pgf@circ@res@left=\pgf@x
2794 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2795 #3%
2796 \pgfusepath{draw}
2797 }
2798 }
2799 }
2800
2801 \long\def\pgfcirc@declare@iecplug#1#2{% #1 name, #2 anchors (drawing code is the same)
2802 \pgfdeclareshape{#1}{%
2803 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
2804 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2805 \savedanchor\northwest{%
2806 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2807 \pgf@y=\ctikzvalof{bipoles/iecconn/height}\pgf@circ@scaled@Rlen
2808 \pgf@y=.25\pgf@y
2809 \pgf@x=-\ctikzvalof{bipoles/iecconn/width}\pgf@circ@scaled@Rlen
2810 \divide\pgf@x by 3
2811 }
2812 \pgfcirc@northwest@symmetric@geoanchors
2813 \anchor{plug center}{\pgfpointorigin}
2814 #2%
2815 \pgf@circ@draw@component{%
2816 \pgf@circ@scaled@Rlen=\scaledRlen
2817 \pgfstartlinewidth=\pgflinewidth
2818 \northwest
2819 \pgf@circ@res@up=\pgf@y
2820 \pgf@circ@res@left=\pgf@x
2821 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2822 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@up}}
2823 \pgf@circ@setcolor
2824 \pgf@circ@fill@strokecolor
2825 \pgfusepath{draw, fill}
2826 }
2827 }
2828 }
2829
2830 \pgfcirc@declare@iecsocket{iecsocketR}{%
2831 % notice: center is on the left side
2832 \anchor{center}{\northwest\pgf@y=0pt}
2833 \anchor{socket center}{\northwest\pgf@y=0pt}
2834 % put the node text above and to the left, ignore depth
2835 \anchor{text}{%
2836 \pgfextractx{\pgf@circ@res@left}{\northwest}
2837 \pgfextracty{\pgf@circ@res@up}{\northwest}
2838 \pgfpoint{-\pgf@circ@res@left}{%
2839 .5\ht\pgfnodeparttextbox+\pgf@circ@res@up
2840 }%
2841 }%
2842 }{% drawing
2843 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2844 \pgfpatharc{90}{270}{2\pgf@circ@res@left and \pgf@circ@res@up}
2845 }
2846 \pgfcirc@declare@iecsocket{iecsocketL}{%
2847 % notice: center is on the left side
2848 \anchor{center}{\northwest\pgf@y=0pt}
2849 \anchor{socket center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2850 % put the node text above and to the left, ignore depth
2851 \anchor{text}{%
2852 \pgfextractx{\pgf@circ@res@left}{\northwest}
2853 \pgfextracty{\pgf@circ@res@up}{\northwest}
2854 \pgfpoint{-\wd\pgfnodeparttextbox+\pgf@circ@res@left}{%
2855 .5\ht\pgfnodeparttextbox+\pgf@circ@res@up
2856 }%
2857 }%
2858 }{% drawing
2859 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
2860 \pgfpatharc{90}{-90}{2\pgf@circ@res@left and \pgf@circ@res@up}
2861 }
2862
2863 \pgfcirc@declare@iecplug{iecplugL}{%
2864 % notice: center is on the left side
2865 \anchor{center}{\northwest\pgf@y=0pt}
2866 % put the node text above and to the right, ignore depth
2867 % the text is higher to match the iec socket position
2868 \anchor{text}{%
2869 \pgfextractx{\pgf@circ@res@left}{\northwest}
2870 \pgfextracty{\pgf@circ@res@up}{\northwest}
2871 \pgfpoint{-\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
2872 .5\ht\pgfnodeparttextbox+2\pgf@circ@res@up
2873 }
2874 }
2875 }
2876 \pgfcirc@declare@iecplug{iecplugR}{%
2877 % notice: center is on the left side
2878 \anchor{center}{\northwest\pgf@y=0pt}
2879 % put the node text above and to the right, ignore depth
2880 % the text is higher to match the iec socket position
2881 \anchor{text}{%
2882 \pgfextractx{\pgf@circ@res@left}{\northwest}
2883 \pgfextracty{\pgf@circ@res@up}{\northwest}
2884 \pgfpoint{-\pgf@circ@res@left}{
2885 .5\ht\pgfnodeparttextbox+2\pgf@circ@res@up
2886 }
2887 }
2888 }
2889 % BNC connector
2890
2891 \pgfdeclareshape{bnc}{
2892 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
2893 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2894 \anchor{center}{
2895 \pgfpointorigin
2896 }
2897 % BNC size is 2.5 times the size of the internal "ocirc", when class scale is=1
2898 \savedanchor\northwest{%
2899 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2900 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
2901 \pgf@y=2.5\pgf@y
2902 \pgf@x=-\pgf@y
2903 }
2904 % center is on the opening
2905 \anchor{center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2906 \anchor{zero}{\pgfpointorigin}
2907 \anchor{hot}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
2908 \anchor{shield}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
2909 % geo-anchors
2910 \pgfcirc@northwest@symmetric@geoanchors
2911 % put the node text above and centered
2912 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2913 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2914 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2915 }
2916 }
2917 \anchorborder{
2918 \pgf@circ@res@left=\pgf@x
2919 \pgf@circ@res@up=\pgf@y
2920 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2921 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2922 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}}
2923 }
2924 \pgf@circ@draw@component{
2925 \pgfextracty{\pgf@circ@res@other}{\northwest}
2926 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{nodes width}*\scaledRlen}
2927 \pgfstartlinewidth=\pgflinewidth
2928 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2929 \pgf@circ@setcolor
2930 % external circle
2931 \pgfscope
2932 % clipping path: first a rectangle bigger then the shape
2933 % to avoid problems with the line thickness
2934 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2935 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2936 % next the opening to the right
2937 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2938 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2939 % do the difference and clip before drawing
2940 \pgfseteorule
2941 \pgfusepath{clip}
2942 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2943 \pgfusepath{draw}
2944 \endpgfscope
2945 % internal circle
2946 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2947 \pgf@circ@draworfill
2948 % and the contact line to the right
2949 \pgfsetlinewidth{\pgfstartlinewidth}
2950 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2951 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2952 \pgfusepath{draw}
2953 }
2954 }
2955 % %>>>
2956
2957 % vim: set fdm=marker fmr=%<<<,%>>>:
2958 %%%---------- close: tex/pgfcircshapes
2959 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
2960 %%%---------- open: tex/pgfcircmonopoles.tex
2961 % Copyright 2018-2026 by Romano Giannetti
2962 % Copyright 2015-2026 by Stefan Lindner
2963 % Copyright 2013-2026 by Stefan Erhardt
2964 % Copyright 2007-2026 by Massimo Redaelli
2965 %
2966 % This file may be distributed and/or modified
2967 %
2968 % 1. under the LaTeX Project Public License and/or
2969 % 2. under the GNU Public License.
2970 %
2971 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2972
2973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2974 %% Monopoles
2975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2976
2977 %%%%%%%%%%%%%
2978 %% Grounds
2979 %%%%%%%%%%%%%
2980
2981
2982 % grounds and power supplies%<<<1
2983
2984 \ctikzset{monopoles/.is family}
2985 \ctikzset{monopoles/ground/width/.initial=.25}
2986 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
2987 \ctikzset{monopoles/ground/thickness/.initial=2}
2988 \ctikzset{monopoles/rground/thickness/.initial=2}
2989 \ctikzset{monopoles/tground/thickness/.initial=3}
2990 \ctikzset{monopoles/vcc/width/.initial=.2}
2991 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
2992 \ctikzset{monopoles/vee/arrow/.initial=legacy}
2993 \ctikzset{monopoles/match/width/.initial=.4}
2994 \ctikzset{monopoles/chassis/width/.initial=.25}
2995 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
2996 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
2997 \ctikzset{monopoles/antenna/width/.initial=.25}
2998 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
2999 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
3000 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
3001 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
3002 \ctikzset{monopoles/txantenna/width/.initial=.25}
3003 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
3004 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
3005 \ctikzset{monopoles/rxantenna/width/.initial=.25}
3006 \ctikzset{monopoles/bareantenna/width/.initial=.25}
3007 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
3008 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
3009 \ctikzset{monopoles/dinantenna/width/.initial=.2}
3010 \ctikzset{monopoles/dinantenna/height/.initial=.6}
3011 \ctikzset{monopoles/waves/width/.initial=0.5}%
3012 \ctikzset{monopoles/harmonics/width/.initial=0.5}%
3013 %>>>
3014
3015 %% Node shapes for grounds and power supply%<<<
3016
3017 %% Ground symbol
3018 % #1 -> name
3019 % #2 -> width
3020 % #3 -> depth
3021 % #4 -> code
3022 \long\def\pgf@circ@declareground#1#2#3#4{
3023 \pgfdeclareshape{#1}{
3024 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3025 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3026 \savedanchor{\southeast}{
3027 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3028 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3029 \pgf@x=#2\pgf@x
3030 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3031 \pgf@y=-#3\pgf@y
3032 }
3033 \anchor{north}{\pgfpointorigin}
3034 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3035 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3036 \anchor{south east}{\southeast}
3037 \anchor{south}{\southeast\pgf@x=0pt\relax}
3038 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3039 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3040 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3041 \anchor{left}{\pgfpointorigin}
3042 \anchor{right}{\pgfpointorigin}
3043 \anchor{center}{\pgfpointorigin}
3044 \pgf@circ@draw@component{
3045 \pgf@circ@scaled@Rlen=\scaledRlen
3046 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3047 \pgfscope
3048 \pgfstartlinewidth=\pgflinewidth
3049 #4
3050 \endpgfscope
3051 }
3052 }
3053 }
3054
3055
3056 \pgf@circ@declareground{ground}{0.6}{1.6}{
3057 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3058 \pgfpathmoveto{\pgfpointorigin}
3059 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3060 \pgfusepath{draw}
3061 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3062 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3063 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3064 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3065 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3066 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3067 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3068 \pgfusepath{draw}
3069 }
3070
3071 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3072 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3073 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3074 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3075 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3076 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3077 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3078 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3079 \pgfusepath{draw}
3080 }
3081
3082
3083 \pgf@circ@declareground{rground}{0.6}{1}{
3084 \pgfpathmoveto{\pgfpointorigin}
3085 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3086 \pgfusepath{draw}
3087
3088 \pgfstartlinewidth=\pgflinewidth
3089 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3090
3091 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3092 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3093 \pgfsetroundcap\pgfusepath{draw}
3094 }
3095
3096 \pgf@circ@declareground{tground}{0.6}{0}{
3097 \pgfpathmoveto{\pgfpointorigin}
3098 \pgfusepath{draw}
3099
3100 \pgfstartlinewidth=\pgflinewidth
3101 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3102
3103 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3104 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3105 \pgfusepath{draw}
3106 }
3107
3108 \pgf@circ@declareground{sground}{0.6}{1.8}{
3109 \pgfpathmoveto{\pgfpointorigin}
3110 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3111 \pgfusepath{draw}
3112
3113 \pgfstartlinewidth=\pgflinewidth
3114 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3115
3116 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3117 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3118 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3119 \pgfpathclose
3120 \pgf@circ@draworfill
3121 }
3122
3123 % noiseless ground
3124 \pgf@circ@declareground{nground}{0.9}{1.6}{
3125 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3126 \pgfpathmoveto{\pgfpointorigin}
3127 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3128 \pgfusepath{draw}
3129 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3130 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3131 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3132 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3133 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3134 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3135 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3136 \pgfusepath{draw}
3137 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3138 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3139 \pgfusepath{draw}
3140 }
3141
3142 % protective ground
3143 \pgf@circ@declareground{pground}{0.9}{1.8}{
3144 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3145 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3146 \pgf@circ@draworfill
3147 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3148 \pgfpathmoveto{\pgfpointorigin}
3149 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3150 \pgfusepath{draw}
3151 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3152 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3153 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3154 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3155 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3156 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3157 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3158 \pgfusepath{draw}
3159 }
3160
3161 % chassis ground
3162 \pgf@circ@declareground{cground}{1}{2}{
3163 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3164 \pgfpathmoveto{\pgfpointorigin}
3165 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3166 \pgfusepath{draw}
3167 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3168 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3169 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3170 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3171 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3172 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3173 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3174 \pgfusepath{draw}
3175 }
3176
3177 % Contributed by @fotesan https://github.com/fotesan
3178 % european ground
3179 \pgf@circ@declareground{eground}{1.1}{1.7}{
3180 \pgfpathmoveto{\pgfpointorigin}
3181 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3182 \pgfusepath{draw}
3183
3184 \pgfstartlinewidth=\pgflinewidth
3185 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3186
3187 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3188 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3189 \pgfusepath{draw}
3190
3191 \pgfsetlinewidth{\pgfstartlinewidth}
3192 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3193 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3194 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3195 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3196 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3197 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3198 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3199 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3200 \pgfusepath{draw}
3201 }
3202
3203 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3204 \pgfpathmoveto{\pgfpointorigin}
3205 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3206 \pgfusepath{draw}
3207
3208 \pgfstartlinewidth=\pgflinewidth
3209 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3210
3211 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3212 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3213 \pgfusepath{draw}
3214
3215 \pgfsetlinewidth{\pgfstartlinewidth}
3216 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3217 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3218 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3219 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3220 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3221 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3222 \pgfusepath{draw}
3223 }
3224
3225 %%%%%%%%%%%%%%%%%%
3226 %% Power supplies
3227 %%%%%%%%%%%%%%%%%%
3228
3229 % Vcc
3230 \pgfdeclareshape{vcc}{
3231 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3232 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3233 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3234 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3235 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3236 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3237 }
3238 \savedanchor{\northeast}{%
3239 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3240 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3241 \pgf@x=.5\pgf@circ@res@step
3242 \pgf@y=3\pgf@x%
3243 }
3244 \anchor{north}{\northeast\pgf@x=0cm\relax}
3245 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3246 \anchor{south}{\pgfpointorigin}
3247 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3248 \anchor{north east}{\northeast}
3249 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3250 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3251 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3252 \anchor{center}{\pgfpointorigin}
3253 \anchor{left}{\pgfpointorigin}
3254 \anchor{right}{\pgfpointorigin}
3255 \anchor{text}{
3256 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3257 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3258 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3259 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3260 \pgf@x=0pt
3261 \pgf@y=2\pgf@circ@res@step
3262 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3263 \pgf@x=-.5\wd\pgfnodeparttextbox
3264 }
3265 \pgf@circ@draw@component{
3266 \pgf@circ@scaled@Rlen=\scaledRlen
3267 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3268 \pgfscope
3269 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3270 \ifx\pgf@temp\pgf@circ@temp
3271 \pgfstartlinewidth=\pgflinewidth
3272 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3273
3274 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3275 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3276 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3277 \pgfusepath{draw}
3278
3279 \pgfsetlinewidth{\pgfstartlinewidth}
3280 \else
3281 \pgfsetarrowsend{\pgf@circ@temp}
3282 \fi
3283 \pgfpathmoveto{\pgfpointorigin}
3284 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3285 \pgfusepath{draw}
3286 \endpgfscope
3287 }
3288 }
3289
3290 % Vee
3291 \pgfdeclareshape{vee}{
3292 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3293 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3294 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3295 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3296 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3297 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3298 }
3299 \savedanchor{\northeast}{%
3300 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3301 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3302 \pgf@x=.5\pgf@circ@res@step
3303 \pgf@y=-3\pgf@x%
3304 }
3305 \anchor{south}{\northeast\pgf@x=0cm\relax}
3306 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3307 \anchor{north}{\pgfpointorigin}
3308 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3309 \anchor{south east}{\northeast}
3310 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3311 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3312 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3313 \anchor{center}{\pgfpointorigin}
3314 \anchor{left}{\pgfpointorigin}
3315 \anchor{right}{\pgfpointorigin}
3316 \anchor{text}{
3317 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3318 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3319 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3320 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3321 \pgf@x=0pt
3322 \pgf@y=-2\pgf@circ@res@step
3323 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3324 \pgf@x=-.5\wd\pgfnodeparttextbox
3325 }
3326
3327 \pgf@circ@draw@component{
3328 \pgf@circ@scaled@Rlen=\scaledRlen
3329 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3330 \pgfscope
3331 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3332 \ifx\pgf@temp\pgf@circ@temp
3333
3334 \pgfstartlinewidth=\pgflinewidth
3335 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3336
3337 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3338 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3339 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3340 \pgfusepath{draw}
3341 \pgfsetlinewidth{\pgfstartlinewidth}
3342 \else
3343 \pgfsetarrowsend{\pgf@circ@temp}
3344 \fi
3345 \pgfpathmoveto{\pgfpointorigin}
3346 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3347 \pgfusepath{draw}
3348 \endpgfscope
3349 }
3350 }% %>>>
3351
3352
3353 %% This are strange, and probably wrong FIXME
3354 % \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
3355 % \compattikzset{vss/.style = {\comnpatname vee = #1}}
3356 \pgfcirc@style@to@style{vcc}{vdd}
3357 \pgfcirc@style@to@style{vee}{vss}
3358
3359
3360 %%%%%%%%%%%%%%
3361 %% RF bipoles and monopoles
3362 %%%%%%%%%%%%%%
3363
3364 %% RF bipoles and monopoles settings %<<<1
3365 \ctikzset{bipoles/mstline/height/.initial=0.3}
3366 \ctikzset{bipoles/mstline/width/.initial=1.2}
3367 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
3368 \ctikzset{monopoles/msport/width/.initial=.5}
3369 \ctikzset{monopoles/msrstub/height/.initial=1.0}
3370 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
3371 %>>>
3372
3373 %% Node shapes for RF bipoles%<<<
3374 \ctikzset{bipoles/tline/height/.initial=.3}
3375 \ctikzset{bipoles/tline/width/.initial=.6}
3376 \newif\ifpgf@circ@bare@tline
3377 \ctikzset{bipoles/tline/bare/.is if=pgf@circ@bare@tline}
3378 \pgfcircdeclarebipolescaled{RF}
3379 {
3380 \savedmacro{\recessright}{\edef\recessright{\ifpgf@circ@bare@tline -0.4\else 0.0\fi}}
3381 \anchor{center right}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@y=0pt}
3382 \anchor{top right}{\northeast \advance\pgf@x by -0.4\pgf@y}
3383 \anchor{bottom right}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@y=-\pgf@y}
3384 \anchor{center left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x\pgf@y=0pt}
3385 \anchor{top left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x}
3386 \anchor{bottom left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
3387 \anchor{right}{\northeast \advance\pgf@x by \recessright\pgf@y\pgf@y=0pt}
3388 }
3389 {\ctikzvalof{bipoles/tline/height}}
3390 {tline}
3391 {\ctikzvalof{bipoles/tline/height}}
3392 {\ctikzvalof{bipoles/tline/width}}
3393 {
3394 \pgf@circ@res@step=.4\pgf@circ@res@up % the size of the ellipsis is proportional to the height
3395 \pgfscope
3396 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3397 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3399 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3400 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
3401 \pgfpatharc{-90}{90}{\pgf@circ@res@step and \pgf@circ@res@up}
3402 \pgf@circ@draworfill
3403 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3404 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3405 \pgfusepath{stroke}
3406 \endpgfscope
3407 \ifpgf@circ@bare@tline\else
3408 \pgfsetlinewidth{\pgfstartlinewidth}
3409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
3410 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3411 \pgfusepath{stroke}
3412 \fi
3413 }
3414
3415 % microstrip transmission line
3416 \pgfcircdeclarebipolescaled{RF}
3417 {}
3418 {\ctikzvalof{bipoles/mstline/height}}
3419 {mstline}
3420 {\ctikzvalof{bipoles/mstline/height}}
3421 {\ctikzvalof{bipoles/mstline/width}}
3422 {
3423 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3424 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3425 \pgf@circ@draworfill
3426 }% %>>>
3427
3428 %% Path definitions for RF path objects%<<<
3429 \pgfcirc@activate@bipole@simple{l}{mstline}
3430 \pgfcirc@activate@bipole@simple{l}{tline}
3431 \pgfcirc@style@to@style{tline}{transmission line}
3432 \pgfcirc@style@to@style{tline}{TL}
3433 % %>>>
3434
3435 %% Node shapes for RF monopoles%<<<
3436
3437 % Legacy tlinestub
3438 % Contributed by Leonardo Azzinnari
3439 \pgfdeclareshape{tlinestub}{
3440 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3441 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3442 \savedanchor{\northeast}{%
3443 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3444 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3445 \pgf@x=1.2\pgf@circ@res@step
3446 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3447 \pgf@y=.2\pgf@circ@res@step%
3448 }
3449 % the center is on the left side of the shape for facility of usage
3450 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3451 \anchor{east}{\northeast\pgf@y=0cm\relax}
3452 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3453 \anchor{west}{\pgfpointorigin}
3454 \anchor{north east}{\northeast}
3455 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3456 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3457 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3458 \anchor{center}{\pgfpointorigin}
3459 % this is not exact, but it's better than nothing
3460 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3461 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3462 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3463 \pgf@circ@draw@component{
3464 \pgfstartlinewidth=\pgflinewidth
3465
3466 \pgf@circ@scaled@Rlen=\scaledRlen
3467 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3468
3469 \pgfscope
3470 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3471 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3472 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3473 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3474 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3475 \pgfpatharc{90}{-90}{-0.125\pgf@circ@res@step and -0.25\pgf@circ@res@step}
3476 \pgf@circ@draworfill
3477 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3478 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3479 \pgfusepath{stroke}
3480 \endpgfscope
3481 \pgfpathmoveto{\pgfpointorigin}
3482 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3483 \pgfusepath{draw}
3484 }
3485 }
3486
3487 %% New antennas without tails
3488
3489 % main body of antennas
3490 \def\pgf@circ@antennabody{%
3491 \pgfstartlinewidth=\pgflinewidth
3492 \pgf@circ@scaled@Rlen=\scaledRlen
3493 \pgf@circ@setcolor
3494 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3495 \pgfscope
3496 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3497 \pgfpathmoveto{\pgfpointorigin}
3498 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3500 \pgfsetbeveljoin
3501 \pgfpathclose
3502 \pgf@circ@draworfill
3503 \endpgfscope
3504 \pgfsetlinewidth{\pgfstartlinewidth}
3505 \pgfpathmoveto{\pgfpointorigin}
3506 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3507 \pgfusepath{draw}
3508 }
3509
3510 % Waves for the antennas.
3511 \def\pgf@circ@antennawaves{%
3512 \pgfscope
3513 % define a triangle for clipping the waves
3514 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3515 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3516 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3517 \pgfpathclose
3518 \pgfusepath{clip}
3519 % ...and build the waves as clipped circles
3520 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3521 \pgfmathloop%
3522 \ifnum\pgf@circ@count@a>2
3523 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3524 \advance\pgf@circ@count@a-1\relax%
3525 \repeatpgfmathloop
3526 \pgfusepath{draw}
3527 \endpgfscope
3528 }
3529
3530 % additional shape with the waves
3531 \pgfdeclareshape{waves}{
3532 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3533 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3534 \anchor{center}{\pgfpointorigin}
3535 \savedanchor{\northeast}{
3536 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3537 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3538 \pgf@x=\pgf@circ@res@step
3539 \pgf@y=\pgf@circ@res@step
3540 }
3541 \anchor{text}{
3542 \northeast
3543 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3544 }
3545 \anchor{top}{\northeast\pgf@x=0pt}
3546 \anchor{right}{\northeast\pgf@y=0pt}
3547 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3548 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3549 \anchor{north}{\northeast\pgf@x=0pt}
3550 \anchor{north east}{\northeast}
3551 \anchor{east}{\northeast\pgf@y=0pt}
3552 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3553 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3554 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3555 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3556 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3557 \pgf@circ@draw@component{
3558 \pgf@circ@scaled@Rlen=\scaledRlen
3559 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3560 \pgf@circ@res@step=0.5\pgf@circ@res@step
3561 \pgf@circ@setcolor
3562 \pgfscope
3563 % define a triangle for clipping the waves
3564 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3565 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3566 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3567 \pgfpathclose
3568 \pgfusepath{clip}
3569 % ...and build the waves as clipped circles
3570 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3571 \pgfmathloop%
3572 \ifnum\c@pgf@counta>1
3573 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3574 \advance\c@pgf@counta-1\relax%
3575 \repeatpgfmathloop
3576 \pgfusepath{draw}
3577 \endpgfscope
3578 }
3579 }
3580
3581 \pgfdeclareshape{harmonics}{
3582 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3583 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3584 \anchor{center}{\pgfpointorigin}
3585 \savedanchor{\northeast}{
3586 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3587 \pgf@circ@res@step=\ctikzvalof{monopoles/harmonics/width}\pgf@circ@scaled@Rlen
3588 \pgf@x=\pgf@circ@res@step
3589 \pgf@y=\pgf@circ@res@step
3590 }
3591 \anchor{text}{
3592 \northeast
3593 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3594 }
3595 \anchor{top}{\northeast\pgf@x=0pt}
3596 \anchor{right}{\northeast\pgf@y=0pt}
3597 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3598 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3599 \anchor{north}{\northeast\pgf@x=0pt}
3600 \anchor{north east}{\northeast}
3601 \anchor{east}{\northeast\pgf@y=0pt}
3602 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3603 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3604 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3605 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3606 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3607 \pgf@circ@draw@component{
3608 \pgf@circ@scaled@Rlen=\scaledRlen
3609 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3610 \pgf@circ@res@step=0.5\pgf@circ@res@step
3611 \pgf@circ@setcolor
3612 \pgfscope
3613 % define a triangle for clipping the waves
3614 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3615 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{1\pgf@circ@res@step}}
3616 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3617 \pgfpathclose
3618 \pgfusepath{clip}
3619 % ...and build the waves as clipped circles
3620 \c@pgf@counta=32\pgf@circ@res@other=0.125\pgf@circ@res@step
3621 \pgfmathloop%
3622 \ifnum\c@pgf@counta>1
3623 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3624 \advance\c@pgf@counta-1\relax%
3625 \repeatpgfmathloop
3626 \pgfusepath{draw}
3627 \endpgfscope
3628 }
3629 }
3630
3631 % the four types of antennas: simple, din, TX, RX. Notice that you can flip them...
3632 %
3633 \pgfdeclareshape{bareantenna}{
3634 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3635 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3636 \anchor{center}{\pgfpointorigin}
3637 \savedanchor{\northeast}{
3638 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3639 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3640 \pgf@x=\pgf@circ@res@step
3641 \pgf@y=2\pgf@circ@res@step
3642 }
3643 \anchor{text}{
3644 \northeast
3645 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3646 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3647 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3648 }
3649 \anchor{top}{\northeast\pgf@x=0pt}
3650 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3651 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3652 \anchor{bottom}{\pgfpointorigin}
3653 \anchor{north}{\northeast\pgf@x=0pt}
3654 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3655 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3656 \anchor{south}{\pgfpointorigin}
3657 \anchor{north east}{\northeast}
3658 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3659 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3660 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3661 \pgf@circ@draw@component{
3662 \pgf@circ@antennabody
3663 }
3664 }
3665 %
3666 \pgfdeclareshape{dinantenna}{
3667 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3668 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3669 \anchor{center}{\pgfpointorigin}
3670 \savedanchor{\northeast}{
3671 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3672 \pgf@circ@res@step=\ctikzvalof{monopoles/dinantenna/width}\pgf@circ@scaled@Rlen
3673 \pgf@circ@res@other=\ctikzvalof{monopoles/dinantenna/height}\pgf@circ@scaled@Rlen
3674 \pgf@x=\pgf@circ@res@step
3675 \pgf@y=\pgf@circ@res@other
3676 }
3677 \anchor{text}{
3678 \northeast
3679 \pgf@y=\dimexpr.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3680 }
3681 \anchor{top}{\northeast\pgf@x=0pt}
3682 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3683 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3684 \anchor{bottom}{\pgfpointorigin}
3685 \anchor{north}{\northeast\pgf@x=0pt}
3686 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3687 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3688 \anchor{south}{\pgfpointorigin}
3689 \anchor{north east}{\northeast}
3690 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3691 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3692 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3693 \pgf@circ@draw@component{
3694 \pgfstartlinewidth=\pgflinewidth
3695 \pgf@circ@scaled@Rlen=\scaledRlen
3696 \pgf@circ@setcolor
3697 \pgf@circ@res@right=\ctikzvalof{monopoles/dinantenna/width}\pgf@circ@scaled@Rlen
3698 \pgf@circ@res@up=\ctikzvalof{monopoles/dinantenna/height}\pgf@circ@scaled@Rlen
3699 \pgfscope
3700 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3701 \pgfpathmoveto{\pgfpointorigin}
3702 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3703 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3704 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
3705 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3706 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3707 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3708 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3709 \pgfusepath{draw}
3710 \endpgfscope
3711 }
3712 }
3713
3714 \pgfdeclareshape{bareTXantenna}{
3715 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3716 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3717 \anchor{center}{\pgfpointorigin}
3718 \savedanchor{\northeast}{
3719 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3720 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3721 \pgf@x=\pgf@circ@res@step
3722 \pgf@y=2\pgf@circ@res@step
3723 }
3724 \savedanchor{\savedwaves}{
3725 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3726 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3727 \pgf@x=4.2\pgf@circ@res@step
3728 \pgf@y=\pgf@circ@res@step
3729 }
3730 \anchor{text}{
3731 \northeast
3732 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3733 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3734 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3735 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3736 }
3737 \anchor{waves}{\savedwaves}
3738 \anchor{top}{\northeast\pgf@x=0pt}
3739 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3740 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3741 \anchor{bottom}{\pgfpointorigin}
3742 \anchor{north}{\northeast\pgf@x=0pt}
3743 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3744 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3745 \anchor{south}{\pgfpointorigin}
3746 \anchor{north east}{\northeast}
3747 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3748 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3749 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3750 \pgf@circ@draw@component{
3751 \pgf@circ@antennabody
3752 \pgf@circ@antennawaves
3753 }
3754 }
3755
3756 \pgfdeclareshape{bareRXantenna}{
3757 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3758 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3759 \anchor{center}{\pgfpointorigin}
3760 \savedanchor{\northeast}{
3761 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3762 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3763 \pgf@x=\pgf@circ@res@step
3764 \pgf@y=2\pgf@circ@res@step
3765 }
3766 \savedanchor{\savedwaves}{
3767 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3768 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3769 \pgf@x=-4.2\pgf@circ@res@step
3770 \pgf@y=\pgf@circ@res@step
3771 }
3772 \anchor{text}{
3773 \northeast
3774 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3775 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3776 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3777 }
3778 \anchor{waves}{\savedwaves}
3779 \anchor{top}{\northeast\pgf@x=0pt}
3780 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3781 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3782 \anchor{bottom}{\pgfpointorigin}
3783 \anchor{north}{\northeast\pgf@x=0pt}
3784 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3785 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3786 \anchor{south}{\pgfpointorigin}
3787 \anchor{north east}{\northeast}
3788 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3789 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3790 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3791 \pgf@circ@draw@component{
3792 \pgf@circ@antennabody
3793 \pgftransformxshift{-5.2\pgf@circ@res@step}
3794 \pgf@circ@antennawaves
3795 }
3796 }
3797
3798 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
3799 \ctikzset{monopoles/dynode/width/.initial=0.4}
3800 \ctikzset{monopoles/dynode/height/.initial=0.8}
3801 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
3802 \ctikzset{monopoles/dynode/arc angle/.initial=30}
3803 \ctikzset{monopoles/dynode/top width/.initial=1.0}
3804
3805 \pgfdeclareshape{dynode}{
3806 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
3807 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3808 \anchor{center}{\pgfpointorigin}
3809 \savedanchor{\northeast}{
3810 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3811 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3812 \pgf@x=0.5\pgf@x
3813 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3814 }
3815 \savedanchor{\arcpos}{% bottom part of the arc pos
3816 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3817 \pgf@x=0pt
3818 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3819 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
3820 }
3821 \savedanchor{\topright}{%
3822 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3823 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3824 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
3825 \pgf@x=0.5\pgf@x
3826 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3827 }
3828 \anchor{arc}{\arcpos}
3829 \anchor{top right}{\topright}
3830 \anchor{top left}{\topright\pgf@x=-\pgf@x}
3831 \anchor{text}{
3832 \northeast
3833 \advance\pgf@x by 4pt\relax
3834 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3835 }
3836 \anchor{top}{\northeast\pgf@x=0pt}
3837 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3838 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3839 \anchor{bottom}{\pgfpointorigin}
3840 \anchor{north}{\northeast\pgf@x=0pt}
3841 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3842 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3843 \anchor{south}{\pgfpointorigin}
3844 \anchor{north east}{\northeast}
3845 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3846 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3847 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3848 \pgf@circ@draw@component{
3849 \pgfstartlinewidth=\pgflinewidth
3850 \pgf@circ@scaled@Rlen=\scaledRlen
3851 \pgf@circ@setcolor
3852 \northeast
3853 \pgf@circ@res@right=\pgf@x
3854 \pgf@circ@res@up=\pgf@y
3855 \arcpos
3856 \pgf@circ@res@step=\pgf@y
3857 % top
3858 \pgfscope
3859 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3860 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3861 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3862 \pgfusepath{draw}
3863 \endpgfscope
3864 % arc
3865 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
3866 \ifnum90=\@@angle\else % avoid divisions by zero
3867 % radius
3868 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
3869 % start angle y position
3870 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
3871 \pgfsetlinewidth{\pgfstartlinewidth}
3872 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
3873 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
3874 \fi
3875 % tail
3876 \pgfpathmoveto{\pgfpointorigin}
3877 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3878 \pgfusepath{draw}
3879 }
3880 }
3881 % Microstrip monopoles
3882
3883 \pgfdeclareshape{mslstub}{
3884 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3885 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3886 \savedanchor{\southeast}{
3887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3888 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3889 \pgf@x=.5\pgf@x
3890 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3891 \pgf@y=-.5\pgf@y
3892 }
3893 \savedanchor{\northwest}{
3894 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3895 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3896 \pgf@x=-.5\pgf@x
3897 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3898 \pgf@y=.5\pgf@y
3899 }
3900 \anchor{north}{\northwest\pgf@x=0pt\relax}
3901 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3902 \anchor{east}{\southeast\pgf@y=0pt\relax}
3903 \anchor{south east}{\southeast}
3904 \anchor{south}{\southeast\pgf@x=0pt\relax}
3905 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3906 \anchor{west}{\northwest\pgf@y=0pt\relax}
3907 \anchor{north west}{\northwest}
3908 %
3909 \anchor{center}{\northwest\pgf@y=0pt\relax}
3910 \anchor{left}{\northwest\pgf@y=0pt\relax}
3911 \anchor{right}{\southeast\pgf@y=0pt\relax}
3912 % put the node text above and centered
3913 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3914 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3915 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3916 }
3917 }
3918 \pgf@circ@draw@component{
3919 \pgfextracty{\pgf@circ@res@up}{\northwest}
3920 \pgfextractx{\pgf@circ@res@right}{\southeast}
3921 \pgfextractx{\pgf@circ@res@left}{\northwest}
3922 \pgfextracty{\pgf@circ@res@down}{\southeast}
3923 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3924 \pgfstartlinewidth=\pgflinewidth
3925 \pgfscope
3926 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3927 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3928 \pgf@circ@draworfill
3929 \endpgfscope
3930 }
3931 }
3932
3933 \pgfdeclareshape{msrstub}{
3934 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3935 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3936 \savedanchor{\southeast}{
3937 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3938 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3939 \pgf@x=.5\pgf@x
3940 \pgf@y=0pt\relax
3941 }
3942 \savedanchor{\northwest}{
3943 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3944 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3945 \pgf@x=-.5\pgf@x
3946 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
3947 \pgf@y=.5\pgf@y
3948 }
3949 \anchor{north}{\northwest\pgf@x=0pt\relax}
3950 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3951 \anchor{east}{\southeast\pgf@y=0pt\relax}
3952 \anchor{south east}{\southeast}
3953 \anchor{south}{\southeast\pgf@x=0pt\relax}
3954 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3955 \anchor{west}{\northwest\pgf@y=0pt\relax}
3956 \anchor{north west}{\northwest}
3957 %
3958 \anchor{center}{\pgfpointorigin}
3959 \anchor{left}{\pgfpointorigin}
3960 \anchor{right}{\pgfpointorigin}
3961 % put the node text above and centered
3962 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3963 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3964 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3965 }
3966 }
3967 \pgf@circ@draw@component{
3968 \pgfextracty{\pgf@circ@res@up}{\northwest}
3969 \pgfextractx{\pgf@circ@res@right}{\southeast}
3970 \pgfextractx{\pgf@circ@res@left}{\northwest}
3971 \pgfextracty{\pgf@circ@res@down}{\southeast}
3972 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3973 \pgfstartlinewidth=\pgflinewidth
3974 \pgfscope
3975 \pgfpathmoveto{\pgfpointorigin}
3976 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3977 \pgfusepath{draw}
3978 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3979 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
3980 \pgfpatharc{135}{45}{\pgf@circ@res@step}
3981 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
3982 \pgfpatharc{45}{135}{\pgf@circ@res@up}
3983 \pgfpathclose
3984 \pgf@circ@draworfill
3985 \endpgfscope
3986 }
3987 }
3988
3989 \pgfdeclareshape{msport}{
3990 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3991 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3992 \savedanchor{\southeast}{
3993 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3994 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3995 \pgf@x=.5\pgf@x
3996 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3997 \pgf@y=-.5\pgf@y
3998 }
3999 \savedanchor{\northwest}{
4000 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4001 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4002 \pgf@x=-.5\pgf@x
4003 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4004 \pgf@y=.5\pgf@y
4005 }
4006 \anchor{north}{\northwest\pgf@x=0pt\relax}
4007 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4008 \anchor{east}{\southeast\pgf@y=0pt\relax}
4009 \anchor{south east}{\southeast}
4010 \anchor{south}{\southeast\pgf@x=0pt\relax}
4011 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4012 \anchor{west}{\northwest\pgf@y=0pt\relax}
4013 \anchor{north west}{\northwest}
4014 %
4015 \anchor{center}{\northwest\pgf@y=0pt\relax}
4016 \anchor{left}{\northwest\pgf@y=0pt\relax}
4017 \anchor{right}{\southeast\pgf@y=0pt\relax}
4018 % put the node text above and centered
4019 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4020 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4021 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4022 }
4023 }
4024 \pgf@circ@draw@component{
4025 \pgfextracty{\pgf@circ@res@up}{\northwest}
4026 \pgfextractx{\pgf@circ@res@right}{\southeast}
4027 \pgfextractx{\pgf@circ@res@left}{\northwest}
4028 \pgfextracty{\pgf@circ@res@down}{\southeast}
4029 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
4030 \pgfstartlinewidth=\pgflinewidth
4031 \pgfscope
4032 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4033 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
4035 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4036 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4037 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
4038 \pgfpathclose
4039 \pgf@circ@draworfill
4040 \endpgfscope
4041 }
4042 }
4043
4044 % Legacy antennas (with tails)
4045 \def\pgf@circ@shift@antenna@xy#1#2{%
4046 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
4047 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
4048 \relax}
4049
4050 % Legacy antenna
4051 \pgfdeclareshape{antenna}{
4052 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4053 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4054 \anchor{center}{\pgfpointorigin}
4055 \savedanchor{\northeast}{
4056 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4057 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4058 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4059 \pgf@y=4\pgf@circ@res@step
4060 }
4061 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
4062 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
4063 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
4064 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
4065 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4066 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4067 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
4068 \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}}
4069 \anchor{text}{
4070 \northeast
4071 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
4072 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
4073 }
4074 \pgf@circ@draw@component{
4075 \pgfstartlinewidth=\pgflinewidth
4076 \pgf@circ@scaled@Rlen=\scaledRlen
4077 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4078
4079 \pgftransformxshift{ -4\pgf@circ@res@step }
4080
4081 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4082 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4083
4084 \pgfusepath{draw}
4085
4086 \pgfscope
4087 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4088 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4089 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4090 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4091 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4092 \pgf@circ@setcolor
4093 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4094 \pgfusepath{draw}
4095 \endpgfscope
4096 \pgfsetlinewidth{\pgfstartlinewidth}
4097
4098 }
4099 }
4100
4101 % Legacy TX antenna
4102 \pgfdeclareshape{txantenna}{
4103 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4104 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4105 \anchor{center}{\pgfpointorigin}
4106 \savedanchor{\northeast}{
4107 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4108 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4109 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4110 \pgf@y=4\pgf@circ@res@step
4111 }
4112 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4113 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4114 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4115 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4116 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4117 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4118 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4119 \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}}
4120 \anchor{text}{
4121 \northeast
4122 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
4123 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
4124 }
4125 \pgf@circ@draw@component{
4126 \pgfstartlinewidth=\pgflinewidth
4127 \pgf@circ@scaled@Rlen=\scaledRlen
4128 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
4129
4130 \pgfpathmoveto{\pgfpointorigin}
4131 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4132 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4133 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4134
4135 \pgfusepath{draw}
4136
4137 \pgfscope
4138 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4139 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4140 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4141 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4142 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4143 \pgf@circ@setcolor
4144 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4145 \pgfusepath{draw}
4146 \endpgfscope
4147 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
4148 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4149 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4150 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
4151 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4152 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
4153 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4154 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
4155 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
4156 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
4157 \pgfusepath{draw}
4158 \pgfsetlinewidth{\pgfstartlinewidth}
4159
4160 }
4161 }
4162
4163 % Legacy RX antenna
4164 \pgfdeclareshape{rxantenna}{
4165 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4166 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4167 \anchor{center}{\pgfpointorigin}
4168 \savedanchor{\northeast}{
4169 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4170 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4171 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4172 \pgf@y=4\pgf@circ@res@step
4173 }
4174 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4175 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4176 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4177 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4178 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4179 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4180 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4181 \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}}
4182 \anchor{text}{
4183 \northeast
4184 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
4185 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
4186 }
4187 \pgf@circ@draw@component{
4188 \pgfstartlinewidth=\pgflinewidth
4189 \pgf@circ@scaled@Rlen=\scaledRlen
4190 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
4191
4192 \pgfpathmoveto{\pgfpointorigin}
4193 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4194 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4195 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4196
4197 \pgfusepath{draw}
4198
4199 \pgfscope
4200 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4201 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4202 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4203 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4204 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4205 \pgf@circ@setcolor
4206 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4207 \pgfusepath{draw}
4208 \endpgfscope
4209
4210 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
4211 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4212 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4213 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
4214 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4215 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
4216 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4217 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
4218 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
4219 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
4220 \pgfusepath{draw}
4221 \pgfsetlinewidth{\pgfstartlinewidth}
4222 }
4223 }
4224
4225 % Legacy match
4226 \pgfdeclareshape{match}{
4227 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4228 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4229 \savedanchor{\northeast}{%
4230 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4231 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4232 \pgf@x=2\pgf@circ@res@step
4233 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4234 \pgf@y=.5\pgf@circ@res@step%
4235 }
4236 % the center is on the left side of the shape for facility of usage
4237 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4238 \anchor{east}{\northeast\pgf@y=0cm\relax}
4239 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4240 \anchor{west}{\pgfpointorigin}
4241 \anchor{north east}{\northeast}
4242 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4243 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4244 \anchor{south west}{\pgfpointorigin}
4245 \anchor{center}{\pgfpointorigin}
4246 \anchor{text}{
4247 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4248 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4249 \pgf@x=1.5\pgf@x
4250 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4251 \pgf@y=-1.5\ht\pgfnodeparttextbox
4252 }
4253 \pgf@circ@draw@component{
4254 \pgf@circ@scaled@Rlen=\scaledRlen
4255 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4256
4257 \pgfscope
4258 \pgfpathmoveto{\pgfpointorigin}
4259 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4260 \pgfusepath{draw}
4261
4262 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4263 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4264 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4265 \pgf@circ@fill@strokecolor
4266 \pgfusepath{fill}
4267
4268 \pgfsetlinewidth{\pgfstartlinewidth}
4269 \endpgfscope
4270 }
4271 }
4272 % %>>>
4273
4274 % vim: set fdm=marker fmr=%<<<,%>>>:
4275 %%%---------- close: tex/pgfcircmonopoles
4276 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4277 %%%---------- open: tex/pgfcircbipoles.tex
4278 % Copyright 2018-2026 by Romano Giannetti
4279 % Copyright 2015-2026 by Stefan Lindner
4280 % Copyright 2013-2026 by Stefan Erhardt
4281 % Copyright 2007-2026 by Massimo Redaelli
4282 %
4283 % This file may be distributed and/or modified
4284 %
4285 % 1. under the LaTeX Project Public License and/or
4286 % 2. under the GNU Public License.
4287 %
4288 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4290 %% Standard bipole shapes declarations
4291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4292
4293 %% Generic macro and flags for bipoles %<<<
4294 % Fixing tunable directions
4295 \newif\ifpgf@circ@fixtunable@dir
4296 \ctikzset{bipoles/fix tunable direction/.is if=pgf@circ@fixtunable@dir}
4297 \ctikzset{bipoles/fix tunable direction=true}
4298 % choosing several arrows
4299 \pgf@circ@declare@family@arrows{tunable}
4300 \pgf@circ@declare@family@arrows{wiper}
4301 \pgf@circ@declare@family@arrows{switch}
4302 \pgf@circ@declare@family@arrows{gto gate}
4303 \pgf@circ@declare@family@arrows{opto}
4304
4305 %>>>
4306
4307
4308 %%%%%%%%%%%%%%%%%%%%%%%%
4309 % Resistive components: generics, resistors, wires
4310 %%%%%%%%%%%%%%%%%%%%%%%%
4311
4312 %% Definitions for resistive components %<<<
4313
4314 % Zig Zag resistors
4315 \ctikzset{resistors/zigs/.initial=3}
4316 \ctikzset{resistors/width/.code={%
4317 \ctikzset{bipoles/resistor/width=#1}%
4318 \ctikzset{bipoles/vresistor/width=#1}%
4319 \ctikzset{bipoles/potentiometer/width=#1}%
4320 \ctikzset{bipoles/resistivesens/width=#1}%
4321 \ctikzset{bipoles/photoresistor/width=#1}%
4322 \ctikzset{bipoles/thermistor/width=#1}%
4323 \ctikzset{bipoles/thermistorntc/width=#1}%
4324 \ctikzset{bipoles/thermistorptc/width=#1}%
4325 \ctikzset{bipoles/varistor/width=#1}%
4326 \ctikzset{bipoles/generic/width=#1}%
4327 \ctikzset{bipoles/generic potentiometer/width=#1}%
4328 \ctikzset{bipoles/ageneric/width=#1}%
4329 \ctikzset{bipoles/tgeneric/width=#1}%
4330 \ctikzset{bipoles/ldresistor/width=#1}%
4331 \ctikzset{bipoles/ldgeneric/width=#1}%
4332 }}
4333 \ctikzset{wiper pos/.code={%
4334 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
4335 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
4336 }}
4337 % zigzag resistor
4338 \ctikzset{bipoles/resistor/height/.initial=.3}
4339 \ctikzset{bipoles/resistor/width/.initial=.8}
4340 \ctikzset{bipoles/potentiometer/height/.initial=.8}
4341 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
4342 \ctikzset{bipoles/potentiometer/width/.initial=.8}
4343 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
4344 \ctikzset{bipoles/vresistor/height/.initial=.6}
4345 \ctikzset{bipoles/vresistor/width/.initial=.8}
4346 \ctikzset{bipoles/resistivesens/height/.initial=.6}
4347 \ctikzset{bipoles/resistivesens/width/.initial=.8}
4348 \ctikzset{bipoles/ldresistor/height/.initial=.8}
4349 \ctikzset{bipoles/ldresistor/width/.initial=.8}
4350 \ctikzset{bipoles/ldresistor/internal scale/.initial=.8}
4351 % square resistors
4352 \ctikzset{bipoles/photoresistor/height/.initial=.6}
4353 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
4354 \ctikzset{bipoles/photoresistor/width/.initial=.8}
4355 \ctikzset{bipoles/thermistor/main/.initial=.7}
4356 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
4357 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
4358 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
4359 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
4360 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
4361 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
4362 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
4363 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
4364 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
4365 \ctikzset{bipoles/thermistor/width/.initial=.8}
4366 \ctikzset{bipoles/varistor/main/.initial=.7}
4367 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
4368 \ctikzset{bipoles/varistor/width/.initial=.8}
4369 \ctikzset{bipoles/generic/height/.initial=.30}
4370 \ctikzset{bipoles/generic/width/.initial=.80}
4371 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
4372 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
4373 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
4374 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
4375 \ctikzset{bipoles/ageneric/height/.initial=.30}
4376 \ctikzset{bipoles/tgeneric/height/.initial=.70}
4377 \ctikzset{bipoles/tgeneric/width/.initial=.80}
4378 \ctikzset{bipoles/ageneric/width/.initial=.80}
4379 \ctikzset{bipoles/memristor/height/.initial=.30}
4380 \ctikzset{bipoles/memristor/wave height/.initial=.5}
4381 \ctikzset{bipoles/memristor/width/.initial=.80}
4382 \ctikzset{bipoles/ldgeneric/height/.initial=.8}
4383 \ctikzset{bipoles/ldgeneric/width/.initial=.8}
4384 \ctikzset{bipoles/ldgeneric/internal scale/.initial=.8}
4385
4386 \newif\ifpgf@circuit@europeanresistor
4387 \ctikzset{resistor/.is choice}
4388 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
4389 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
4390 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
4391 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%
4392
4393 % wires (open, shorts, ...)
4394
4395 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
4396 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
4397 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
4398 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
4399 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
4400 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
4401 % multiwire
4402 \ctikzset{bipoles/multiwire/height/.initial=0.4}
4403 \ctikzset{bipoles/multiwire/width/.initial=0.2}
4404 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
4405 % crossing wires
4406 \ctikzset{bipoles/crossing/size/.initial=.2}
4407
4408 %%>>>
4409
4410 %% Shapes for generic, resistives and wires components %<<<
4411 %% Short circuit
4412
4413 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4414 %%% natural length is zero.
4415 \pgfcircdeclarebipole
4416 {% fix the anchor border to add a bit of space for voltage and labels
4417 % it uses the dummy width and height
4418 \anchorborder{%
4419 \ifpgf@circuit@bipole@inverted
4420 \pgf@circ@res@left=-\pgf@x
4421 \pgf@circ@res@up=-\pgf@y
4422 \else
4423 \pgf@circ@res@left=\pgf@x
4424 \pgf@circ@res@up=\pgf@y
4425 \fi
4426 \ifdim\pgf@circ@res@up>0cm
4427 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4428 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4429 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4430 {\pgfpoint{\pgf@x}{\pgf@y}}
4431 \else
4432 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4433 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4434 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4435 {\pgfpoint{-\pgf@x}{-\pgf@y}}
4436 \fi
4437 }
4438 }
4439 {0}
4440 {short}
4441 {0}
4442 {0}
4443 {}
4444
4445 %% Open circuit
4446 \pgfcircdeclarebipole
4447 {}
4448 {\ctikzvalof{bipoles/open/height}}
4449 {open}
4450 {\ctikzvalof{bipoles/open/height}}
4451 {\ctikzvalof{bipoles/open/width}}
4452 {}
4453
4454 % multiwire(s)
4455 \pgfcircdeclarebipole
4456 {}
4457 {\ctikzvalof{bipoles/multiwire/height}}
4458 {multiwire}
4459 {\ctikzvalof{bipoles/multiwire/height}}
4460 {\ctikzvalof{bipoles/multiwire/width}}
4461 {
4462 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4463 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4464 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4465 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4466 \pgfusepath{draw}
4467 }
4468
4469 \pgfcircdeclarebipole
4470 {}
4471 {\ctikzvalof{bipoles/multiwire/height}}
4472 {bmultiwire}
4473 {\ctikzvalof{bipoles/multiwire/height}}
4474 {\ctikzvalof{bipoles/multiwire/width}}
4475 {
4476 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4477 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4478 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4479 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4480 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4481 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4482 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4483 \pgfusepath{draw}
4484 }
4485
4486 \pgfcircdeclarebipole
4487 {}
4488 {\ctikzvalof{bipoles/multiwire/height}}
4489 {tmultiwire}
4490 {\ctikzvalof{bipoles/multiwire/height}}
4491 {\ctikzvalof{bipoles/multiwire/width}}
4492 {
4493 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4494 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4495 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4496 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4497 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4498 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4499 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4501 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4502 \pgfusepath{draw}
4503 }
4504
4505 %%%%%%%%%%%%%%%%
4506 %% Crossing
4507 %%%%%%%%%%%%%%%%
4508
4509 %% crossing bipole (but see also nodes)
4510 \pgfcircdeclarebipole
4511 {}
4512 {\ctikzvalof{bipoles/crossing/size}}
4513 {crossing}
4514 {\ctikzvalof{bipoles/crossing/size}}
4515 {\ctikzvalof{bipoles/crossing/size}}{
4516 \pgfscope
4517 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
4518 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
4519 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
4520 \pgfsetbeveljoin
4521 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
4522 \pgfusepath{draw}
4523 \endpgfscope
4524 }
4525 %
4526 %
4527 %% Generic bipole - used as resistor by some
4528 \pgfcircdeclarebipolescaled{resistors}
4529 {}
4530 {\ctikzvalof{bipoles/generic/height}}
4531 {generic}
4532 {\ctikzvalof{bipoles/generic/height}}
4533 {\ctikzvalof{bipoles/generic/width}}
4534 {
4535 % \pgf@circ@debug@colors
4536 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4537 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4538 \pgf@circ@draworfill
4539 }
4540
4541 %
4542 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4543 % inherit "generic" properties
4544 %
4545 \pgfcircdeclarebipolescaled{resistors}
4546 {}
4547 {\ctikzvalof{bipoles/generic/height}}
4548 {xgeneric}
4549 {\ctikzvalof{bipoles/generic/height}}
4550 {\ctikzvalof{bipoles/generic/width}}
4551 {
4552 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4553 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4554 \pgf@circ@draworfill
4555 % cross it
4556 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4558 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4559 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4560 \pgfusepath{draw}
4561 }
4562 %
4563 % generic slashed, suggested by Jana on TeX.stackexchange.com
4564 % https://tex.stackexchange.com/questions/711702/european-relay-with-circuitikz
4565 % inherit "generic" properties
4566 %
4567 \pgfcircdeclarebipolescaled{resistors}
4568 {}
4569 {\ctikzvalof{bipoles/generic/height}}
4570 {sgeneric}
4571 {\ctikzvalof{bipoles/generic/height}}
4572 {\ctikzvalof{bipoles/generic/width}}
4573 {
4574 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4575 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4576 \pgf@circ@draworfill
4577 % slash it
4578 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4579 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4580 \pgfusepath{draw}
4581 }
4582 %% Generic empty tunable
4583 \pgfcircdeclarebipolescaled{resistors}
4584 {
4585 \anchor{wiper}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
4586 \anchor{W}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
4587 \anchor{tip}{\northeast\pgf@x=0.5\pgf@x}
4588 }
4589 {\ctikzvalof{bipoles/tgeneric/height}}
4590 {tgeneric}
4591 {\ctikzvalof{bipoles/tgeneric/height}}
4592 {\ctikzvalof{bipoles/tgeneric/width}}
4593 {
4594 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4595 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4596 \pgf@circ@draworfill
4597 \pgfscope
4598 \pgf@circ@set@relative@thickness{modifier thickness}
4599 \pgfcirc@set@arrows{tunable}{}{latexslim}
4600 \ifpgf@circ@fixtunable@dir
4601 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4602 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4603 \else
4604 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4605 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4606 \fi
4607 \pgfusepath{draw}
4608 \endpgfscope
4609 }
4610
4611 %% Generic asymmetric bipole
4612 \pgfcircdeclarebipolescaled{resistors}
4613 {}
4614 {\ctikzvalof{bipoles/ageneric/height}}
4615 {ageneric}
4616 {\ctikzvalof{bipoles/ageneric/height}}
4617 {\ctikzvalof{bipoles/ageneric/width}}
4618 {
4619 \pgfscope
4620 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4621 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4622 \pgf@circ@draworfill
4623 \endpgfscope
4624
4625 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4626 \pgfusepath{stroke,fill}
4627 }
4628
4629 %% Memristor
4630 \pgfcircdeclarebipolescaled{resistors}
4631 {}
4632 {\ctikzvalof{bipoles/memristor/height}}
4633 {memristor}
4634 {\ctikzvalof{bipoles/memristor/height}}
4635 {\ctikzvalof{bipoles/memristor/width}}
4636 {
4637 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4638 \divide \pgf@circ@res@step by 14
4639
4640 \pgfscope
4641 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4642 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4643 \pgf@circ@draworfill
4644 \endpgfscope
4645 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4646 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4647 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4648 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4649 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4650 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4651 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4652 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4653 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4654 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4655
4656 \pgfusepath{draw}
4657
4658 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4659 \pgfusepath{stroke,fill}
4660 }
4661
4662 %% Photoresistor
4663 \pgfcircdeclarebipolescaled{resistors}
4664 {% anchor for light arrows
4665 \anchor{arrows}{\northeast\pgf@x=0.575\pgf@x\pgf@y=1.1\pgf@y}%
4666 }
4667 {\ctikzvalof{bipoles/photoresistor/height 2}}
4668 {photoresistor}
4669 {\ctikzvalof{bipoles/photoresistor/height}}
4670 {\ctikzvalof{bipoles/photoresistor/width}}
4671 {
4672 \pgfscope
4673 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4674 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4675 \pgf@circ@draworfill
4676 \endpgfscope
4677
4678 \pgfscope
4679 \pgf@circ@set@optoarrow@style
4680 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4681 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4682 \pgfusepath{draw}
4683 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4684 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4685 \pgfusepath{draw}
4686 \endpgfscope
4687 }
4688
4689
4690
4691 %% Thermistor
4692 \pgfcircdeclarebipolescaled{resistors}
4693 {% anchor for labelling the type of dependency
4694 \anchor{label}{%
4695 \southwest
4696 \pgf@x=0.4\pgf@x
4697 \pgf@y=1.2\pgf@y
4698 }%
4699 \pgfcirc@border@extend@updown{1}{1.2}
4700 \anchor{wiper}{\northeast\pgf@x=-\pgf@x\pgf@y=-1.2\pgf@y}
4701 \anchor{W}{\northeast\pgf@x=-\pgf@x\pgf@y=-1.2\pgf@y}
4702 \anchor{tip}{\northeast}
4703 }
4704 {\ctikzvalof{bipoles/thermistor/height}}
4705 {thermistor}
4706 {\ctikzvalof{bipoles/thermistor/height}}
4707 {\ctikzvalof{bipoles/thermistor/width}}
4708 {
4709 \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}}
4710 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4711 \pgf@circ@draworfill
4712 \pgf@circ@set@relative@thickness{modifier thickness}
4713 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4714 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4715 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4716 \pgfusepath{draw}
4717 }
4718
4719 %% Thermistor PTC
4720 \pgfcircdeclarebipolescaled{resistors}
4721 {}
4722 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4723 {thermistorptc}
4724 {\ctikzvalof{bipoles/thermistorptc/height}}
4725 {\ctikzvalof{bipoles/thermistorptc/width}}
4726 {
4727 \pgfscope
4728 \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}}
4729 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4730 \pgf@circ@draworfill
4731 \pgf@circ@set@relative@thickness{modifier thickness}
4732 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4733 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4735 \pgfusepath{draw}
4736 \endpgfscope
4737
4738 \pgfsetlinewidth{\pgfstartlinewidth}
4739 \pgfsetarrowsend{latexslim}
4740 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4741 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4742 \pgfusepath{draw}
4743 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4744 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4745 \pgfusepath{draw}
4746 \pgf@circ@text@strokecolor
4747 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4748 }
4749
4750 %% Thermistor NTC
4751 \pgfcircdeclarebipolescaled{resistors}
4752 {}
4753 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4754 {thermistorntc}
4755 {\ctikzvalof{bipoles/thermistorntc/height}}
4756 {\ctikzvalof{bipoles/thermistorntc/width}}
4757 {
4758 \pgfscope
4759 \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}}
4760 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4761 \pgf@circ@draworfill
4762 \pgf@circ@set@relative@thickness{modifier thickness}
4763 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4764 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4766 \pgfusepath{draw}
4767 \endpgfscope
4768
4769 \pgfsetlinewidth{\pgfstartlinewidth}
4770 \pgfsetarrowsend{latexslim}
4771 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4772 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4773 \pgfusepath{draw}
4774 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4775 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4776 \pgfusepath{draw}
4777 \pgf@circ@text@strokecolor
4778 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4779 }
4780
4781 %% Varistor
4782 \pgfcircdeclarebipolescaled{resistors}
4783 {
4784 \pgfcirc@border@extend@updown{1}{1.4}
4785 }
4786 {\ctikzvalof{bipoles/varistor/height}}
4787 {varistor}
4788 {\ctikzvalof{bipoles/varistor/height}}
4789 {\ctikzvalof{bipoles/varistor/width}}
4790 {
4791 \pgfscope
4792 \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}}
4793 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4794 \pgf@circ@draworfill
4795 \pgf@circ@set@relative@thickness{modifier thickness}
4796 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4797 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4798 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4799 \pgfusepath{draw}
4800 \endpgfscope
4801 \pgf@circ@text@strokecolor
4802 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
4803 }
4804 %% MOV
4805 \pgfcircdeclarebipolescaled{resistors}
4806 {
4807 \pgfcirc@border@extend@updown{1.2}{1.2}
4808 }
4809 {\ctikzvalof{bipoles/varistor/height}}
4810 {mov}
4811 {\ctikzvalof{bipoles/varistor/height}}
4812 {\ctikzvalof{bipoles/varistor/width}}
4813 {
4814 \pgfscope
4815 \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}}
4816 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4817 \pgf@circ@draworfill
4818 \pgf@circ@set@relative@thickness{modifier thickness}
4819 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-1.1\pgf@circ@res@down}}
4820 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@left}{-1.1\pgf@circ@res@down}}
4821 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@left}{1.1\pgf@circ@res@down}}
4822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.1\pgf@circ@res@down}}
4823 \pgfusepath{draw}
4824 \endpgfscope
4825 }
4826 %% Generic tunable
4827 \pgfcircdeclarebipolescaled{resistors}
4828 {
4829 \savedanchor{\wiper}{
4830 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4831 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4832 \pgf@y=.5\pgf@ya
4833 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4834 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4835 }
4836 \anchor{wiper}{\wiper}
4837 \anchor{W}{\wiper}
4838 \anchor{tip}{\wiper\pgf@xa=\pgf@x\southwest\pgf@x=\pgf@xa\pgf@y=-\pgf@y}
4839 }
4840 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4841 {genericpotentiometer}
4842 {\ctikzvalof{bipoles/generic potentiometer/height}}
4843 {\ctikzvalof{bipoles/generic potentiometer/width}}
4844 {
4845
4846 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4847 \divide \pgf@circ@res@step by 14
4848
4849 \pgfscope
4850 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4851 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4852 \pgf@circ@draworfill
4853 \endpgfscope
4854 \pgfscope
4855 %\pgfsetlinewidth{\pgfstartlinewidth}
4856 \pgfcirc@set@arrows{wiper}{}{latexslim}
4857 \pgfextractx{\pgf@circ@res@other}{\wiper}
4858 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4859 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4860 \pgfusepath{draw}
4861 \endpgfscope
4862 }
4863
4864 %% european style LDR
4865 \pgfcircdeclarebipolescaled{resistors}
4866 {% anchor for light arrows
4867 \anchor{arrows}{\northeast\pgf@x=1.6\pgf@x\pgf@y=1.4\pgf@y}%
4868 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4869 }
4870 {\ctikzvalof{bipoles/ldgeneric/height}}
4871 {ldgeneric}
4872 {\ctikzvalof{bipoles/ldgeneric/height}}
4873 {\ctikzvalof{bipoles/ldgeneric/width}}
4874 {%
4875 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4876 \pgfscope
4877 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
4878 \pgf@circ@draworfill
4879 \endpgfscope
4880 \pgfscope
4881 % arrows
4882 \pgf@circ@set@optoarrow@style
4883 \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{1.4\pgf@circ@res@up}}
4884 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
4885 \pgfusepath{draw}
4886 \pgfpathmoveto{\pgfpoint{1.6\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
4887 \pgfpathlineto{\pgfpoint{1.0\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
4888 \pgfusepath{draw}
4889 \endpgfscope
4890 \edef\@@intscale{\ctikzvalof{bipoles/ldgeneric/internal scale}}%
4891 \pgfmathsetmacro{\@@hscale}{0.5*\@@intscale}%
4892 \pgftransformscale{\@@intscale}% the end of the bipole will deactivate it
4893 % the generic will be reduced by @@intscale; let's undo the scaling to
4894 % connect the leads to the end of the component.
4895 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/\@@intscale-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
4896 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
4897 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right/\@@intscale+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
4898 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
4899 \pgftransformationadjustments
4900 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldgeneric/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4901 \pgfusepath{draw}
4902 \pgfscope
4903 % reset the up at the "generic" thing
4904 \pgf@circ@res@up=\ctikzvalof{bipoles/generic/height}\pgf@circ@scaled@Rlen
4905 \pgf@circ@res@up=0.5\pgf@circ@res@up
4906 \pgf@circ@res@down=-\pgf@circ@res@up
4907 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4908 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4909 \pgfusepath{draw}
4910 \endpgfscope
4911 }%
4912 %% Zig-zag resistors
4913 % see https://github.com/circuitikz/circuitikz/discussions/814
4914 \ctikzset{resistors/zigzag stub/.initial=0}
4915 \ctikzset{resistors/zigzag hook/.code={}}
4916 \def\pgf@circ@zigzag#1{%
4917 \pgf@circ@res@temp=\ctikzvalof{resistors/zigzag stub}\pgf@circ@res@step
4918 \advance \pgf@circ@res@step by -2\pgf@circ@res@temp
4919 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4920
4921 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4922 \ifdim\pgf@circ@res@temp>0pt
4923 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp -\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4924 \fi
4925 \pgf@circ@res@other = \pgf@circ@res@left
4926 \advance\pgf@circ@res@other by \pgf@circ@res@temp
4927 \pgf@circ@count@a=\zigs\relax
4928 % first half zig
4929 \advance\pgf@circ@res@other by \pgf@circ@res@step
4930 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4931 \pgfmathloop%
4932 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4933 \ifnum\pgf@circ@count@a>0
4934 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4935 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4936 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4937 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4938 \repeatpgfmathloop%
4939 % last zig and a half
4940 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4941 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4942 \advance\pgf@circ@res@other by \pgf@circ@res@step
4943 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4944 \ifdim\pgf@circ@res@temp>0pt
4945 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4946 \fi
4947 \pgfsetbeveljoin
4948 \pgfkeys{/tikz/circuitikz/resistors/zigzag hook}
4949 \pgfusepath{draw}
4950 }
4951 %% Resistor
4952 \pgfcircdeclarebipolescaled{resistors}
4953 {
4954 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4955 }
4956 {\ctikzvalof{bipoles/resistor/height}}
4957 {resistor}
4958 {\ctikzvalof{bipoles/resistor/height}}
4959 {\ctikzvalof{bipoles/resistor/width}}
4960 {
4961 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4962 \pgftransformationadjustments
4963 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen}
4964 \pgf@circ@zigzag{1}
4965 }
4966
4967
4968 %% Variable resistor
4969 \pgfcircdeclarebipolescaled{resistors}
4970 {
4971 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4972 \anchor{wiper}{\northeast\pgf@x=-0.4\pgf@x\pgf@y=-\pgf@y}
4973 \anchor{W}{\northeast\pgf@x=-0.4\pgf@x\pgf@y=-\pgf@y}
4974 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
4975 }
4976 {\ctikzvalof{bipoles/vresistor/height}}
4977 {vresistor}
4978 {\ctikzvalof{bipoles/vresistor/height}}
4979 {\ctikzvalof{bipoles/vresistor/width}}
4980 {
4981 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4982 \pgftransformationadjustments
4983 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen}
4984 \pgf@circ@zigzag{.5}
4985
4986 \pgfscope
4987 \pgf@circ@set@relative@thickness{modifier thickness}
4988 \pgfcirc@set@arrows{tunable}{}{latexslim}
4989 \ifpgf@circ@fixtunable@dir
4990 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4991 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4992 \else
4993 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4994 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4995 \fi
4996 \pgfusepath{draw}
4997 \endpgfscope
4998 }
4999
5000 %% Potentiometer
5001 \pgfcircdeclarebipolescaled{resistors}
5002 {
5003 \savedanchor{\wiper}{
5004 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5005 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
5006 \pgf@y=.5\pgf@ya
5007 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
5008 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
5009 }
5010 \anchor{wiper}{\wiper}
5011 \anchor{W}{\wiper}
5012 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5013 \anchor{tip}{\wiper\pgf@xa=\pgf@x\southwest\pgf@x=\pgf@xa\pgf@y=-\pgf@y}
5014 }
5015 {\ctikzvalof{bipoles/potentiometer/height 2}}
5016 {potentiometer}
5017 {\ctikzvalof{bipoles/potentiometer/height}}
5018 {\ctikzvalof{bipoles/potentiometer/width}}
5019 {
5020 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5021 \pgftransformationadjustments
5022 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen}
5023 \pgf@circ@zigzag{1}
5024
5025 \pgfscope
5026 %\pgfsetlinewidth{\pgfstartlinewidth}
5027 \pgf@circ@set@relative@thickness{modifier thickness}
5028 \pgfcirc@set@arrows{wiper}{}{latexslim}
5029 \pgfextractx{\pgf@circ@res@other}{\wiper}
5030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5032 \pgfusepath{draw}
5033 \endpgfscope
5034 }
5035
5036 %% Resistive sensor
5037 \pgfcircdeclarebipolescaled{resistors}
5038 {% anchor for labelling the type of dependency
5039 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
5040 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5041 \anchor{wiper}{\northeast\pgf@x=-0.9\pgf@x\pgf@y=-\pgf@y}
5042 \anchor{W}{\northeast\pgf@x=-0.9\pgf@x\pgf@y=-\pgf@y}
5043 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
5044 }
5045 {\ctikzvalof{bipoles/resistivesens/height}}
5046 {resistivesens}
5047 {\ctikzvalof{bipoles/resistivesens/height}}
5048 {\ctikzvalof{bipoles/resistivesens/width}}
5049 {%
5050 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5051 \pgftransformationadjustments
5052 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen}
5053 \pgf@circ@zigzag{.5}
5054
5055 \pgfscope
5056 \pgf@circ@set@relative@thickness{modifier thickness}
5057 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5058 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5059 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@right}{\pgf@circ@res@down}}
5060 \pgfusepath{draw}
5061 \endpgfscope
5062 }%
5063
5064 %% american style LDR
5065 \pgfcircdeclarebipolescaled{resistors}
5066 {% anchor for light arrows
5067 \anchor{arrows}{\northeast\pgf@x=1.6\pgf@x\pgf@y=1.4\pgf@y}%
5068 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5069 % \pgfcirc@border@extend@full{1.2}{1.2}{1.2}{1.2}
5070 }
5071 {\ctikzvalof{bipoles/ldresistor/height}}
5072 {ldresistor}
5073 {\ctikzvalof{bipoles/ldresistor/height}}
5074 {\ctikzvalof{bipoles/ldresistor/width}}
5075 {%
5076 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5077 \pgfscope
5078 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5079 \pgf@circ@draworfill
5080 \endpgfscope
5081 \pgfscope
5082 % arrows
5083 \pgf@circ@set@optoarrow@style
5084 \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{1.4\pgf@circ@res@up}}
5085 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
5086 \pgfusepath{draw}
5087 \pgfpathmoveto{\pgfpoint{1.6\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
5088 \pgfpathlineto{\pgfpoint{1.0\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
5089 \pgfusepath{draw}
5090 \endpgfscope
5091 \edef\@@intscale{\ctikzvalof{bipoles/ldresistor/internal scale}}%
5092 \pgfmathsetmacro{\@@hscale}{0.5*\@@intscale}%
5093 \pgftransformscale{\@@intscale}% the end of the bipole will deactivate it
5094 % the zigzag will be reduced by @@intscale; let's undo the scaling to
5095 % connect the leads to the end of the component.
5096 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/\@@intscale-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5097 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5098 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right/\@@intscale+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5099 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5100 \pgftransformationadjustments
5101 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldresistor/width}*\scaledRlen}
5102 \pgf@circ@zigzag{\@@hscale}
5103 }%
5104
5105
5106 %>>>
5107
5108 %% Paths for resistive components: generic, resistors and wires% %<<<
5109
5110 %% GENERICS
5111 \def\pgf@circ@empty@path#1{}
5112 \pgfcirc@activate@bipole@simple{l}{generic}
5113 \pgfcirc@activate@bipole@simple{l}{ageneric}
5114 \pgfcirc@activate@bipole@simple{l}{tgeneric}
5115 \pgfcirc@activate@bipole@simple{l}{xgeneric}
5116 \pgfcirc@activate@bipole@simple{l}{sgeneric}
5117 \pgfcirc@activate@bipole@simple{l}{fullgeneric}
5118 \pgfcirc@activate@bipole@simple{l}{tfullgeneric}
5119 \pgfcirc@activate@bipole@simple{l}{short}
5120 \pgfcirc@activate@bipole@simple{l}{open}
5121
5122 %% wires and crossings
5123
5124 \pgfcirc@activate@bipole@simple{l}{crossing}
5125 \pgfcirc@style@to@style{crossing}{xing}
5126 \pgfcirc@activate@bipole@simple{l}{multiwire}
5127 \pgfcirc@activate@bipole@simple{l}{bmultiwire}
5128 \pgfcirc@activate@bipole@simple{l}{tmultiwire}
5129
5130 % automatically switching path --- to be defined manually
5131 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
5132 \pgfcirc@path@to@style{l}{resistor}{resistor}{}
5133 \pgfcirc@node@to@style{l}{resistor}{american resistor}{}
5134 \pgfcirc@node@to@style{l}{generic}{european resistor}{}
5135 \pgfcirc@style@to@style{resistor}{R}
5136
5137 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
5138 \pgfcirc@path@to@style{l}{vresistor}{variable resistor}{}
5139 \pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{}
5140 \pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{}
5141 \pgfcirc@style@to@style{variable resistor}{vR}
5142
5143 \def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
5144 \pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{}
5145 \pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{}
5146 \pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{}
5147 \pgfcirc@style@to@style{resistive sensor}{sR}
5148
5149 \def\pgf@circ@ldresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{ldgeneric}{#1}\else\pgf@circ@bipole@path{ldresistor}{#1}\fi}
5150 \pgfcirc@path@to@style{l}{ldresistor}{light dependent resistor}{}
5151 \pgfcirc@node@to@style{l}{ldresistor}{american light dependent resistor}{}
5152 \pgfcirc@node@to@style{l}{ldgeneric}{european light dependent resistor}{}
5153 \pgfcirc@style@to@style{light dependent resistor}{ldR}
5154
5155 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
5156 \pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{}
5157 \pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{}
5158 \pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{}
5159 \pgfcirc@style@to@style{potentiometer}{pR}
5160
5161 \pgfcirc@activate@bipole@simple{l}{thermistor}
5162 \pgfcirc@style@to@style{thermistor}{thR}
5163 \pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc}
5164 \pgfcirc@style@to@style{thermistor ptc}{thRp}
5165 \pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc}
5166 \pgfcirc@style@to@style{thermistor ntc}{thRn}
5167 \pgfcirc@activate@bipole@simple{l}{photoresistor}
5168 \pgfcirc@style@to@style{photoresistor}{phR}
5169 \pgfcirc@activate@bipole@simple{l}{varistor}
5170 \pgfcirc@activate@bipole@simple{l}{mov}
5171 \pgfcirc@activate@bipole@simple{l}{memristor}
5172 \pgfcirc@style@to@style{memristor}{Mr}%
5173 % %>>>
5174
5175 %%%%%%%%%%%%%%
5176 %% Capacitors
5177 %%%%%%%%%%%%%
5178
5179 %% Definitions for Capacitors%<<<1
5180 \ctikzset{bipoles/capacitor/height/.initial=.6}
5181 \ctikzset{bipoles/capacitor/width/.initial=.2}
5182 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
5183 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
5184 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
5185 %%% pcapacitor is deprecated
5186 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
5187 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
5188 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
5189 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
5190 \ctikzset{bipoles/ccapacitor/width/.initial=.2}
5191 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
5192 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
5193 \ctikzset{bipoles/vcapacitor/width/.initial=.2}
5194 \ctikzset{bipoles/vcapacitor/tunable width/.initial=3}
5195 \ctikzset{bipoles/vcapacitor/capacitor width/.code={%
5196 \pgfutil@packagewarning{circuitikz}{vcapacitor/capacitor width deprecated; ignored}%
5197 }}% deprecated
5198 % piezoelectric (double size by default)
5199 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
5200 \ctikzset{bipoles/piezoelectric/width/.initial=.4}%
5201 % constant phase element (double size by default)
5202 \ctikzset{bipoles/cpe/height/.initial=.6}
5203 \ctikzset{bipoles/cpe/width/.initial=.4}
5204 %
5205 % style settings
5206 %
5207 \ctikzset{capacitors/width/.code={%
5208 \pgfmathsetmacro{\pgfcirc@@double}{2*#1}%
5209 \ctikzset{bipoles/.cd,
5210 capacitor/width=#1, ecapacitor/width=#1, ccapacitor/width=#1,
5211 vcapacitor/width=#1,
5212 piezoelectric/width=\pgfcirc@@double,
5213 cpe/width=\pgfcirc@@double,
5214 }}}
5215 \ctikzset{capacitors/height/.code={%
5216 \ctikzset{bipoles/.cd,
5217 capacitor/height=#1, ecapacitor/height=#1, ccapacitor/height=#1,
5218 vcapacitor/height=#1,
5219 piezoelectric/height=#1,
5220 cpe/height=#1,
5221 }}}
5222 \def\pgfcirc@maybe@fill@straight@capacitor{%
5223 \pgfscope
5224 \pgfpathrectanglecorners
5225 {\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5226 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5227 \pgf@circ@maybefill
5228 \endpgfscope
5229 }
5230 %>>>
5231
5232 %% Shapes for capacitors%<<<
5233 %% Plain Capacitor
5234 \pgfcircdeclarebipolescaled{capacitors}
5235 {}
5236 {\ctikzvalof{bipoles/capacitor/height}}
5237 {capacitor}
5238 {\ctikzvalof{bipoles/capacitor/height}}
5239 {\ctikzvalof{bipoles/capacitor/width}}
5240 {
5241 \pgfcirc@maybe@fill@straight@capacitor
5242
5243 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5244 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5245 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5246
5247 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5248 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5249 \pgfusepath{draw}
5250
5251 }
5252
5253 %% Capacitive sensor
5254 \pgfcircdeclarebipolescaled{capacitors}
5255 {
5256 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
5257 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
5258 \anchor{wiper}{\northeast\pgf@x=-4.4\pgf@x\pgf@y=-1.2\pgf@y}
5259 \anchor{W}{\northeast\pgf@x=-4.4\pgf@x\pgf@y=-1.2\pgf@y}
5260 \anchor{tip}{\northeast\pgf@x=2.6\pgf@x}
5261 }
5262 {\ctikzvalof{bipoles/capacitor/height}}
5263 {capacitivesens}
5264 {\ctikzvalof{bipoles/capacitor/height}}
5265 {\ctikzvalof{bipoles/capacitor/width}}
5266 {
5267 \pgfcirc@maybe@fill@straight@capacitor
5268 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5269 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5270 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5271
5272 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5273 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5274 \pgfusepath{draw}
5275 \pgfscope
5276 \pgf@circ@set@relative@thickness{modifier thickness}
5277 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
5278 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5279 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5280 \pgfusepath{draw}
5281 \endpgfscope
5282 }
5283
5284 %% Polar Capacitor (DEPRECATED)
5285 \pgfcircdeclarebipolescaled{capacitors}
5286 {}
5287 {\ctikzvalof{bipoles/pcapacitor/height}}
5288 {polarcapacitor}
5289 {\ctikzvalof{bipoles/pcapacitor/height}}
5290 {\ctikzvalof{bipoles/pcapacitor/width}}
5291 {
5292
5293 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5294
5295 \pgfutil@packagewarning{circuitikz}{polar capacitor has been deprecated; change to curved capacitor (see manual)}%
5296
5297 \pgfscope
5298 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
5299 \pgftransformrotate{-90}
5300 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5301 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5302 \pgfusepath{draw}
5303 \endpgfscope
5304
5305 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5306 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5307 \pgfusepath{draw}
5308 }
5309
5310
5311 %% Curved capacitor
5312 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
5313 % for a rationale
5314 %
5315 \pgfcircdeclarebipolescaled{capacitors}
5316 {}
5317 {\ctikzvalof{bipoles/ccapacitor/height}}
5318 {ccapacitor}
5319 {\ctikzvalof{bipoles/ccapacitor/height}}
5320 {\ctikzvalof{bipoles/ccapacitor/width}}
5321 {
5322 \pgfscope
5323 \pgfscope
5324 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5325 \pgftransformrotate{-90}
5326 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5327 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
5328 \pgftransformrotate{90}
5329 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5331 \pgfpathclose{}
5332 \pgf@circ@maybefill
5333 \endpgfscope
5334 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5335 \pgfscope
5336 % \pgfsetcolor{red}
5337 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5338 \pgftransformrotate{-90}
5339 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5340 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
5341 \pgfusepath{draw}
5342 \endpgfscope
5343 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5344 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5345 \pgfusepath{draw}
5346 \endpgfscope
5347 % extend wire to the curved capacitor
5348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}{0pt}}
5349 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5350 \pgfusepath{draw}
5351 }
5352
5353 %% Electrolytic Capacitor
5354 \pgfcircdeclarebipolescaled{capacitors}
5355 {}
5356 {\ctikzvalof{bipoles/ecapacitor/height}}
5357 {ecapacitor}
5358 {\ctikzvalof{bipoles/ecapacitor/height}}
5359 {\ctikzvalof{bipoles/ecapacitor/width}}
5360 {
5361 \pgfscope
5362 \pgfsetrectcap
5363 % % % Draw plus pole
5364 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5365 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5366 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5367 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5368 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5369 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5370 \pgf@circ@draworfill
5371 % % Draw minus pole
5372 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5373 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5374 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5377 \pgf@circ@setcolor
5378 \pgf@circ@fill@strokecolor
5379 \pgfusepath{draw,fill}
5380 \endpgfscope
5381 % % plus pole annotation
5382 \pgf@circ@text@strokecolor
5383 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
5384 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
5385 }
5386
5387 %% Variable Capacitor
5388 \pgfcircdeclarebipolescaled{capacitors}
5389 {
5390 \saveddimen{\tunablewidth}{%
5391 \pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/vcapacitor/tunable width}*
5392 \ctikzvalof{bipoles/vcapacitor/width}*0.5*
5393 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
5394 }
5395 \anchor{wiper}{\northeast\pgf@x=-\tunablewidth\pgf@y=-\pgf@y}
5396 \anchor{W}{\northeast\pgf@x=-\tunablewidth\pgf@y=-\pgf@y}
5397 \anchor{tip}{\northeast\pgf@x=\tunablewidth}
5398 }
5399 {\ctikzvalof{bipoles/vcapacitor/height}}
5400 {vcapacitor}
5401 {\ctikzvalof{bipoles/vcapacitor/height}}
5402 {\ctikzvalof{bipoles/vcapacitor/width}}
5403 {
5404 \pgfcirc@maybe@fill@straight@capacitor
5405 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/tunable width} \pgf@circ@res@right
5406
5407 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5408 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
5409 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@down}}
5410
5411 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5412 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5413 \pgfusepath{draw}
5414
5415 \pgfscope
5416 \pgf@circ@set@relative@thickness{modifier thickness}
5417 \pgfcirc@set@arrows{tunable}{}{latexslim}
5418 \ifpgf@circ@fixtunable@dir
5419 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5421 \else
5422 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5424 \fi
5425 \pgfusepath{draw}
5426 \endpgfscope
5427
5428 \pgfsetlinewidth{\pgfstartlinewidth}
5429 \pgfusepath{draw}
5430 }
5431
5432
5433 %% Piezoelectric Element
5434
5435 \pgfcircdeclarebipolescaled{capacitors}
5436 {}
5437 {\ctikzvalof{bipoles/piezoelectric/height}}
5438 {piezoelectric}
5439 {\ctikzvalof{bipoles/piezoelectric/height}}
5440 {\ctikzvalof{bipoles/piezoelectric/width}}
5441 {
5442 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
5443 % \divide \pgf@circ@res@step by 5
5444
5445 %% Outer markings
5446 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5447 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5448 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5449
5450 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5451 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5452 \pgfusepath{draw}
5453
5454 %% Inner Box
5455 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5456 \pgfscope
5457 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5458 \pgfpathrectanglecorners
5459 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5460 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5461 \pgf@circ@draworfill
5462 \endpgfscope
5463 }
5464
5465 % Ferroelectric capacitor, suggested by Mayeul Cantan
5466 % (see https://github.com/circuitikz/circuitikz/issues/515)
5467 \pgfcircdeclarebipolescaled{capacitors}
5468 {
5469 \anchor{curve right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=\pgf@y}%
5470 \anchor{curve left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-\pgf@y}%
5471 \anchor{kink right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=0.5\pgf@y}%
5472 \anchor{kink left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-0.5\pgf@y}%
5473 \pgfcirc@border@extend@full{1.8}{1}{1.8}{1}
5474 }
5475 {\ctikzvalof{bipoles/capacitor/height}}
5476 {ferrocap}
5477 {\ctikzvalof{bipoles/capacitor/height}}
5478 {\ctikzvalof{bipoles/capacitor/width}}
5479 {
5480 \pgfcirc@maybe@fill@straight@capacitor
5481
5482 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5483 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5484 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5485
5486 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5488 \pgfusepath{draw}
5489 \pgfscope
5490 \pgf@circ@set@relative@thickness{modifier thickness}
5491 \pgfsetcornersarced{\pgfpoint{0.2\pgf@circ@res@right}{0.2\pgf@circ@res@up}}
5492 \pgfpathmoveto{\pgfpoint{-1.8\pgf@circ@res@right}{\pgf@circ@res@up}}
5493 \pgfpathlineto{\pgfpoint{-1.8\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
5494 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
5495 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{\pgf@circ@res@down}}
5496 \pgfusepath{draw}
5497 \endpgfscope
5498 }
5499
5500 %% Constant phase element
5501 \pgfcircdeclarebipolescaled{capacitors}
5502 {}
5503 {\ctikzvalof{bipoles/cpe/height}}
5504 {cpe}
5505 {\ctikzvalof{bipoles/cpe/height}}
5506 {\ctikzvalof{bipoles/cpe/width}}
5507 {
5508 \pgfscope
5509 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5510 \pgfpathlineto{\pgfpointorigin}
5511 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5512 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5513 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5514 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5515 \pgfpathclose
5516 \pgf@circ@maybefill
5517 \endpgfscope
5518
5519 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5520 \pgfpathlineto{\pgfpointorigin}
5521 \pgfusepath{draw}
5522 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5523 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5524 \pgfpathlineto{\pgfpointorigin}
5525 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5526
5527 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5528 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5529 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5530 \pgfusepath{draw}
5531 }
5532
5533 % %>>>
5534
5535 %% Paths for capacitors%<<<
5536 \pgfcirc@activate@bipole@simple{l}{capacitor}
5537 \pgfcirc@style@to@style{capacitor}{C}
5538 \pgfcirc@activate@bipole@simple{l}{ecapacitor}
5539 \pgfcirc@style@to@style{ecapacitor}{eC}
5540 \pgfcirc@style@to@style{ecapacitor}{elko}
5541 \pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor}
5542 %% polar capacitor is deprecated, use curved capacitor instead
5543 \pgfcirc@style@to@style{polar capacitor}{pC}
5544 \pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor}
5545 \pgfcirc@style@to@style{curved capacitor}{cC}
5546 \pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor}
5547 \pgfcirc@style@to@style{variable capacitor}{vC}
5548 \pgfcirc@activate@bipole@simple{l}{piezoelectric}
5549 \pgfcirc@style@to@style{piezoelectric}{PZ}
5550 \pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor}
5551 \pgfcirc@style@to@style{capacitive sensor}{sC}
5552 \pgfcirc@activate@bipole@simple{l}{ferrocap}
5553 \pgfcirc@style@to@style{ferrocap}{feC}
5554 \pgfcirc@activate@bipole@simple{l}{cpe}
5555 % %>>>
5556
5557 %%%%%%%%%%%%%%%
5558 %% Inductors
5559 %%%%%%%%%%%%%%%
5560
5561 % Definitions of Inductors%<<<1
5562
5563 \ctikzset{inductors/coils/.code={%
5564 \ctikzset{bipoles/cuteinductor/coils=#1}%
5565 \ctikzset{bipoles/cutechoke/coils=#1}%
5566 \ctikzset{bipoles/americaninductor/coils=#1}%
5567 \ctikzset{bipoles/vcuteinductor/coils=#1}%
5568 \ctikzset{bipoles/vamericaninductor/coils=#1}%
5569 }}
5570 \ctikzset{inductors/width/.code={%
5571 \ctikzset{bipoles/cuteinductor/width=#1}%
5572 \ctikzset{bipoles/cutechoke/width=#1}%
5573 \ctikzset{bipoles/americaninductor/width=#1}%
5574 \ctikzset{bipoles/vcuteinductor/width=#1}%
5575 \ctikzset{bipoles/vamericaninductor/width=#1}%
5576 \ctikzset{bipoles/fullgeneric/width=#1}%
5577 \ctikzset{bipoles/tfullgeneric/width=#1}%
5578 }}
5579 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
5580 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
5581 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
5582 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
5583 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5584 %% Cute choke settings
5585 \ctikzset{bipoles/cutechoke/height/.initial=.3}
5586 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
5587 \ctikzset{bipoles/cutechoke/width/.initial=.6}
5588 \ctikzset{bipoles/cutechoke/coils/.initial=5}
5589 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
5590 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
5591 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
5592 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
5593 \newif\ifpgf@circuit@bipole@twolineschoke
5594 \pgf@circuit@bipole@twolineschokefalse
5595 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5596 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5597 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5598 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5599 %
5600 % generic core anchor settings
5601 \ctikzset{bipoles/inductors/core distance/.initial={2pt}}
5602 \ctikzset{bipoles/inductors/dot x distance/.initial={4pt}}
5603 \ctikzset{bipoles/inductors/dot y distance/.initial={1pt}}
5604 \def\pgfcir@basic@core@anchors{%
5605 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5606 \saveddimen{\dotXdistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/dot x distance}}}
5607 \saveddimen{\dotYdistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/dot y distance}}}
5608 \anchor{core east}{%
5609 \northeast\advance\pgf@y by\coredistance
5610 }
5611 \anchor{core west}{%
5612 \northeast\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5613 }
5614 \anchor{ll dot}{%
5615 \southwestborder
5616 \advance\pgf@x by -\dotXdistance
5617 \advance\pgf@y by -\dotYdistance
5618 }
5619 \anchor{ul dot}{%
5620 \northeastborder
5621 \advance\pgf@x by \dotXdistance\pgf@x=-\pgf@x
5622 \advance\pgf@y by \dotYdistance
5623 }
5624 \anchor{lr dot}{%
5625 \southwestborder
5626 \advance\pgf@x by -\dotXdistance\pgf@x=-\pgf@x
5627 \advance\pgf@y by -\dotYdistance
5628 }
5629 \anchor{ur dot}{%
5630 \northeastborder
5631 \advance\pgf@x by \dotXdistance
5632 \advance\pgf@y by \dotYdistance
5633 }
5634 }
5635 %
5636 \ctikzset{bipoles/americaninductor/height/.initial=.3}
5637 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
5638 \ctikzset{bipoles/americaninductor/width/.initial=.8}
5639 \ctikzset{bipoles/americaninductor/coils/.initial=4}
5640 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
5641 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
5642 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
5643 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
5644 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
5645 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5646 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
5647 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
5648 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
5649 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
5650 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
5651 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
5652 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
5653 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
5654 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
5655 \ctikzset{inductor/.is choice}
5656 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
5657 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
5658 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
5659
5660 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
5661 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
5662 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
5663 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
5664 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
5665
5666 %%>>>
5667
5668 %% Shapes for inductors%<<<
5669 %% cute inductor
5670 \pgfcircdeclarebipolescaled{inductors}
5671 {
5672 \savedanchor{\midtap}{%
5673 \pgf@x=0pt\relax
5674 \pgfmathsetlength{\pgf@y}{%
5675 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5676 \ctikzvalof{bipoles/cuteinductor/height} :% even
5677 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5678 *\pgf@circ@scaled@Rlen/2
5679 }
5680 }
5681 \anchor{midtap}{\midtap}
5682 \pgfcir@basic@core@anchors
5683 }
5684 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5685 {cuteinductor}
5686 {\ctikzvalof{bipoles/cuteinductor/height}}
5687 {\ctikzvalof{bipoles/cuteinductor/width}}
5688 {
5689 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5690 \pgftransformationadjustments
5691
5692 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5693 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5694
5695
5696 \pgfmathsetlength{\pgf@circ@res@step}
5697 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5698
5699 \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
5700 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5701 {
5702 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5703 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5704 }
5705 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5706 \pgfsetbuttcap
5707 \pgfsetbeveljoin
5708 \pgfusepath{stroke}
5709 }
5710
5711 %% cute inductive sensor
5712 \pgfcircdeclarebipolescaled{inductors}
5713 {% anchor for labelling the type of dependency
5714 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5715 \savedanchor{\midtap}{%
5716 \pgf@x=0pt\relax
5717 \pgfmathsetlength{\pgf@y}{%
5718 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5719 \ctikzvalof{bipoles/cuteinductor/height} :% even
5720 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5721 *\pgf@circ@scaled@Rlen/2
5722 }
5723 }
5724 \anchor{midtap}{\midtap}
5725 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5726 \pgfcir@basic@core@anchors
5727 \anchor{wiper}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
5728 \anchor{W}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
5729 \anchor{tip}{\northeast\pgf@x=0.8\pgf@x\pgf@y=2\pgf@y}
5730 }
5731 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5732 {scuteinductor}
5733 {\ctikzvalof{bipoles/cuteinductor/height}}
5734 {\ctikzvalof{bipoles/cuteinductor/width}}
5735 {
5736 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5737 \pgftransformationadjustments
5738
5739 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5740 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5741
5742
5743 \pgfmathsetlength{\pgf@circ@res@step}
5744 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5745
5746 \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
5747 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5748 {
5749 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5750 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5751 }
5752 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5753 \pgfsetbuttcap
5754 \pgfsetbeveljoin
5755 \pgfusepath{stroke}
5756 \pgfscope
5757 \pgf@circ@set@relative@thickness{modifier thickness}
5758 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5759 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5760 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5761 \pgfusepath{draw}
5762 \endpgfscope
5763 }
5764
5765 %% cute choke
5766 \pgfcircdeclarebipolescaled{inductors}
5767 {
5768 \savedanchor{\midtap}{%
5769 \pgf@x=0pt\relax
5770 \pgfmathsetlength{\pgf@y}{%
5771 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5772 \ctikzvalof{bipoles/cuteinductor/height} :% even
5773 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5774 *\pgf@circ@scaled@Rlen/2
5775 }
5776 }
5777 \anchor{midtap}{\midtap}
5778 }
5779 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5780 {cutechoke}
5781 {\ctikzvalof{bipoles/cutechoke/height}}
5782 {\ctikzvalof{bipoles/cutechoke/width}}
5783 {
5784 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5785 \pgftransformationadjustments
5786
5787 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5788 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5789
5790
5791 \pgfmathsetlength{\pgf@circ@res@step}
5792 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5793
5794 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5795 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5796 {
5797 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5798 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5799 }
5800 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5801 \pgfsetbuttcap
5802 \pgfsetbeveljoin
5803 \pgfusepath{stroke}
5804
5805 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5807 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5808 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5809 \pgfusepath{stroke}
5810
5811 \ifpgf@circuit@bipole@twolineschoke
5812 \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}}
5813 \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}}
5814 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5815 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5816 \pgfusepath{stroke}
5817 \fi
5818 }
5819
5820 %% variable cute inductor
5821 \pgfcircdeclarebipolescaled{inductors}
5822 {
5823 \savedanchor{\midtap}{%
5824 \pgf@x=0pt\relax
5825 \pgfmathsetlength{\pgf@y}{%
5826 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5827 \ctikzvalof{bipoles/cuteinductor/height} :% even
5828 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5829 *\pgf@circ@scaled@Rlen/2
5830 }
5831 }
5832 \anchor{midtap}{\midtap}
5833 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5834 \anchor{core east}{%
5835 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5836 }
5837 \anchor{core west}{%
5838 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5839 }
5840 \anchor{wiper}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
5841 \anchor{W}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
5842 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
5843 }
5844 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5845 {vcuteinductor}
5846 {\ctikzvalof{bipoles/vcuteinductor/height}}
5847 {\ctikzvalof{bipoles/vcuteinductor/width}}
5848 {
5849 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5850 \pgftransformationadjustments
5851
5852 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5853 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5854
5855
5856 \pgfmathsetlength{\pgf@circ@res@step}
5857 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5858
5859 \pgfscope
5860 \pgf@circ@set@relative@thickness{modifier thickness}
5861 \pgfcirc@set@arrows{tunable}{}{latexslim}
5862 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5863 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5864 \pgfusepath{draw}
5865 \endpgfscope
5866
5867 \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
5868 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5869 {
5870 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5871 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5872 }
5873 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5874 \pgfsetbuttcap
5875 \pgfsetbeveljoin
5876 \pgfusepath{stroke}
5877 }
5878
5879 %% american inductor
5880 \pgfcircdeclarebipolescaled{inductors}
5881 {
5882 \savedanchor{\midtap}{%
5883 \pgf@x=0pt\relax
5884 \pgfmathsetlength{\pgf@y}{%
5885 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5886 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5887 0) %odd
5888 *\pgf@circ@scaled@Rlen/2
5889 }
5890 }
5891 \anchor{midtap}{\midtap}
5892 \pgfcir@basic@core@anchors
5893 }
5894 {\ctikzvalof{bipoles/americaninductor/height 2}}
5895 {americaninductor}
5896 {\ctikzvalof{bipoles/americaninductor/height}}
5897 {\ctikzvalof{bipoles/americaninductor/width}}
5898 {
5899 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5900 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5901 \pgftransformationadjustments
5902 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5903 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5904 \divide \pgf@circ@res@step by 2
5905 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5906
5907 \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
5908 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5909 {
5910 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5911 }
5912 \pgfsetbuttcap
5913 \pgfsetbeveljoin
5914 \pgfusepath{stroke}
5915 }
5916
5917
5918 %% american inductive sensor
5919 \pgfcircdeclarebipolescaled{inductors}
5920 {% anchor for labelling the type of dependency
5921 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5922 \savedanchor{\midtap}{%
5923 \pgf@x=0pt\relax
5924 \pgfmathsetlength{\pgf@y}{%
5925 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5926 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5927 0) %odd
5928 *\pgf@circ@scaled@Rlen/2
5929 }
5930 }
5931 \anchor{midtap}{\midtap}
5932 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5933 \pgfcir@basic@core@anchors
5934 \anchor{wiper}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
5935 \anchor{W}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
5936 \anchor{tip}{\northeast\pgf@x=0.8\pgf@x\pgf@y=2\pgf@y}
5937 }
5938 {\ctikzvalof{bipoles/americaninductor/height 2}}
5939 {samericaninductor}
5940 {\ctikzvalof{bipoles/americaninductor/height}}
5941 {\ctikzvalof{bipoles/americaninductor/width}}
5942 {
5943 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5944 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5945 \pgftransformationadjustments
5946 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5947 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5948 \divide \pgf@circ@res@step by 2
5949 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5950
5951 \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
5952 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5953 {
5954 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5955 }
5956 \pgfsetbuttcap
5957 \pgfsetbeveljoin
5958 \pgfusepath{stroke}
5959 \pgfscope
5960 \pgf@circ@set@relative@thickness{modifier thickness}
5961 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5962 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5963 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5964 \pgfusepath{draw}
5965 \endpgfscope
5966 }
5967
5968 %% variable american inductor
5969 \pgfcircdeclarebipolescaled{inductors}
5970 {
5971 \savedanchor{\midtap}{%
5972 \pgf@x=0pt\relax
5973 \pgfmathsetlength{\pgf@y}{%
5974 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5975 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5976 0) %odd
5977 *\pgf@circ@scaled@Rlen/2
5978 }
5979 }
5980 \anchor{midtap}{\midtap}
5981 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5982 \anchor{core east}{%
5983 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5984 }
5985 \anchor{core west}{%
5986 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5987 }
5988 \anchor{wiper}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
5989 \anchor{W}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
5990 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
5991 }
5992 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5993 {vamericaninductor}
5994 {\ctikzvalof{bipoles/vamericaninductor/height}}
5995 {\ctikzvalof{bipoles/vamericaninductor/width}}
5996 {
5997 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5998 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5999 \pgftransformationadjustments
6000 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
6001 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
6002 \divide \pgf@circ@res@step by 2
6003 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
6004
6005 \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
6006 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
6007 {
6008 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
6009 }
6010 \pgfsetbuttcap
6011 \pgfsetbeveljoin
6012 \pgfusepath{stroke}
6013
6014 \pgfscope
6015 \pgf@circ@set@relative@thickness{modifier thickness}
6016 \pgfcirc@set@arrows{tunable}{}{latexslim}
6017 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
6018 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
6019 \pgfusepath{draw}
6020 \endpgfscope
6021 }
6022
6023 %% Generic bipole, filled - used as inductor by some
6024 \pgfcircdeclarebipolescaled{inductors}
6025 {
6026 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6027 \pgfcir@basic@core@anchors
6028 }
6029 {\ctikzvalof{bipoles/fullgeneric/height}}
6030 {fullgeneric}
6031 {\ctikzvalof{bipoles/fullgeneric/height}}
6032 {\ctikzvalof{bipoles/fullgeneric/width}}
6033 {
6034 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6035 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6036
6037 \pgf@circ@fill@strokecolor
6038 \pgfusepath{draw,fill}
6039 }
6040
6041 %% Generic sensor, filled - used as inductive sensor by some
6042 \pgfcircdeclarebipolescaled{inductors}
6043 {% anchor for labelling the type of dependency
6044 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
6045 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6046 \pgfcirc@border@extend@full{1}{2}{1}{2}
6047 \pgfcir@basic@core@anchors
6048 \anchor{wiper}{\northeast\pgf@x=-\pgf@x\pgf@y=-2\pgf@y}
6049 \anchor{W}{\northeast\pgf@x=-\pgf@x\pgf@y=-2\pgf@y}
6050 \anchor{tip}{\northeast\pgf@y=2\pgf@y}
6051 }
6052 {\ctikzvalof{bipoles/fullgeneric/height}}
6053 {sfullgeneric}
6054 {\ctikzvalof{bipoles/fullgeneric/height}}
6055 {\ctikzvalof{bipoles/fullgeneric/width}}
6056 {
6057
6058 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6059 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6060 \pgf@circ@fill@strokecolor
6061 \pgfusepath{draw,fill}
6062 \pgfscope
6063 \pgf@circ@set@relative@thickness{modifier thickness}
6064 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
6065 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
6066 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
6067 \pgfusepath{draw}
6068 \endpgfscope
6069 }
6070
6071 %% Generic full tunable
6072 \pgfcircdeclarebipolescaled{inductors}
6073 {
6074 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6075 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
6076 \anchor{core east}{%
6077 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance
6078 }
6079 \anchor{core west}{%
6080 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance\pgf@x=-\pgf@x
6081 }
6082 \anchor{wiper}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
6083 \anchor{W}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
6084 \anchor{tip}{\northeast\pgf@x=0.5\pgf@x}
6085 }
6086 {\ctikzvalof{bipoles/tfullgeneric/height}}
6087 {tfullgeneric}
6088 {\ctikzvalof{bipoles/tfullgeneric/height}}
6089 {\ctikzvalof{bipoles/tfullgeneric/width}}
6090 {
6091 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
6092 \divide \pgf@circ@res@step by 14
6093
6094 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
6095 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6096 \pgf@circ@fill@strokecolor
6097 \pgfusepath{draw,fill}
6098
6099 \pgfscope
6100 \pgf@circ@set@relative@thickness{modifier thickness}
6101 \pgfcirc@set@arrows{tunable}{}{latexslim}
6102 \ifpgf@circ@fixtunable@dir
6103 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
6104 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
6105 \else
6106 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
6107 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
6108 \fi
6109 \pgfusepath{draw}
6110 \endpgfscope
6111 }
6112 % %>>>
6113
6114 %% Paths for Inductors%<<<
6115 %% these are complex because of the three-way set
6116 %% should be simplified
6117 \def\pgf@circ@inductor@path#1{%
6118 \pgfextra{
6119 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6120 \def\pgf@temp{european}%
6121 }
6122 \ifx\pgf@temp\pgf@circ@temp%
6123 \pgf@circ@europeaninductor@path{#1}%
6124 \else%
6125 \pgfextra{ \def\pgf@temp{cute} }%
6126 \ifx\pgf@temp\pgf@circ@temp%
6127 \pgf@circ@cuteinductor@path{#1}%
6128 \else%
6129 \pgf@circ@americaninductor@path{#1}%
6130 \fi%
6131 \fi%
6132 }
6133 \pgfcirc@path@to@style{l}{inductor}{inductor}{}
6134 \pgfcirc@style@to@style{inductor}{L}
6135 \pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor}
6136 \pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor}
6137 \pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor}
6138
6139 \def\pgf@circ@vinductor@path#1{
6140 \pgfextra{
6141 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6142 \def\pgf@temp{european}%
6143 }
6144 \ifx\pgf@temp\pgf@circ@temp%
6145 \pgf@circ@veuropeaninductor@path{#1}%
6146 \else%
6147 \pgfextra{ \def\pgf@temp{cute} }%
6148 \ifx\pgf@temp\pgf@circ@temp%
6149 \pgf@circ@vcuteinductor@path{#1}%
6150 \else%
6151 \pgf@circ@vamericaninductor@path{#1}%
6152 \fi%
6153 \fi%
6154 }
6155 \pgfcirc@path@to@style{l}{vinductor}{variable inductor}{}
6156 \pgfcirc@style@to@style{variable inductor}{vL}
6157 \pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor}
6158 \pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor}
6159 \pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor}
6160
6161 \def\pgf@circ@inductivesens@path#1{%
6162 \pgfextra{
6163 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6164 \def\pgf@temp{european}%
6165 }
6166 \ifx\pgf@temp\pgf@circ@temp%
6167 \pgf@circ@europeaninductivesens@path{#1}%
6168 \else%
6169 \pgfextra{ \def\pgf@temp{cute} }%
6170 \ifx\pgf@temp\pgf@circ@temp%
6171 \pgf@circ@cuteinductivesens@path{#1}%
6172 \else%
6173 \pgf@circ@americaninductivesens@path{#1}%
6174 \fi%
6175 \fi%
6176 }
6177 \pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{}
6178 \pgfcirc@style@to@style{inductive sensor}{sL}
6179 \pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor}
6180 \pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor}
6181 \pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor}
6182
6183 \pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke}
6184 % %>>>
6185
6186 %%%%%%%%%%%
6187 %% Sources (batteries, independent, dependents and so on
6188 %%%%%%%%%%%
6189
6190 % Definitions for Sources%<<<1
6191
6192 \ctikzset{bipoles/esource/height/.initial=.60}
6193 \ctikzset{bipoles/esource/width/.initial=.60}
6194 \ctikzset{bipoles/pvsource/height/.initial=.60}
6195 \ctikzset{bipoles/pvsource/width/.initial=.60}
6196 \ctikzset{bipoles/pvmodule/height/.initial=.60}
6197 \ctikzset{bipoles/pvmodule/width/.initial=1.20}
6198 \ctikzset{bipoles/isource/height/.initial=.60}
6199 \ctikzset{bipoles/isource/width/.initial=.60}
6200 \ctikzset{bipoles/oosource/height/.initial=.60}
6201 \ctikzset{bipoles/oosource/width/.initial=.60}
6202 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
6203 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
6204 \ctikzset{bipoles/dcisource/angle/.initial=80}
6205 \ctikzset{bipoles/dcisource/height/.initial=.60}
6206 \ctikzset{bipoles/dcisource/width/.initial=.60}
6207 \ctikzset{bipoles/dcvsource/height/.initial=.60}
6208 \ctikzset{bipoles/dcvsource/width/.initial=.60}
6209 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
6210 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
6211 \ctikzset{bipoles/isourceam/height/.initial=.60}
6212 \ctikzset{bipoles/isourceam/width/.initial=.60}
6213 \ctikzset{bipoles/vsource/height/.initial=.60}
6214 \ctikzset{bipoles/vsource/width/.initial=.60}
6215 \ctikzset{bipoles/vsourceam/height/.initial=.60}
6216 \ctikzset{bipoles/vsourceam/width/.initial=.60}
6217 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
6218 \ctikzset{bipoles/isourcesin/angle/.initial=90}
6219 \ctikzset{bipoles/isourcesin/height/.initial=.60}
6220 \ctikzset{bipoles/isourcesin/width/.initial=.60}
6221 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
6222 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
6223 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
6224 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
6225 \ctikzset{bipoles/cisource/height/.initial=.7}
6226 \ctikzset{bipoles/cisource/width/.initial=.7}
6227 \ctikzset{bipoles/cisourceam/height/.initial=.7}
6228 \ctikzset{bipoles/cisourceam/width/.initial=.7}
6229 \ctikzset{bipoles/ecsource/height/.initial=.7}
6230 \ctikzset{bipoles/ecsource/width/.initial=.7}
6231 \ctikzset{bipoles/cvsource/height/.initial=.7}
6232 \ctikzset{bipoles/cvsource/width/.initial=.7}
6233 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
6234 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
6235 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
6236 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
6237 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
6238 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
6239 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
6240 \ctikzset{bipoles/battery/height/.initial=.6}
6241 \ctikzset{bipoles/battery/width/.initial=.3}
6242 \ctikzset{bipoles/battery1/height/.initial=.6}
6243 \ctikzset{bipoles/battery1/width/.initial=.3}
6244 \ctikzset{bipoles/battery2/height/.initial=.6}
6245 \ctikzset{bipoles/battery2/width/.initial=.3}
6246 \ctikzset{bipoles/solar/height/.initial=.6}
6247 \ctikzset{bipoles/solar/width/.initial=.3}
6248
6249 % noise sources
6250 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
6251
6252 % for special symbols in the sources: sin, square, triangle, delta, wye, eyw, zig, etc.
6253 \ctikzset{sources/symbol/thickness/.initial={1}}
6254 \ctikzset{csources/symbol/thickness/.initial={1}}
6255 \ctikzset{sources/symbol/rotate/.initial={90}}
6256 \ctikzset{csources/symbol/rotate/.initial={90}}
6257
6258 % % % oo autotransformer
6259 \ctikzset{bipoles/oosourceatrans/height/.initial=.6}
6260 \ctikzset{bipoles/oosourceatrans/width/.initial=.5}
6261 \ctikzset{bipoles/oosourceatrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
6262 % we do not use the offset here; the circle is "seated" to the right side
6263 % \ctikzset{bipoles/oosourceatrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
6264 \ctikzset{bipoles/oosourceatrans/vectorgroupscale/.initial=1.2}% better if it's a bit bigger
6265
6266 % % % ootransformer
6267 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
6268 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
6269 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
6270 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
6271 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
6272
6273 % % % oootransformer
6274 \ctikzset{bipoles/ooosource/height/.initial=.6}
6275 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
6276 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
6277 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
6278
6279 % % % primary windings
6280 \newif\ifpgf@circ@prim@delta
6281 \newif\ifpgf@circ@prim@wye
6282 \newif\ifpgf@circ@prim@eyw
6283 \newif\ifpgf@circ@prim@zig
6284 \pgfkeys{tikz/prim/.is choice}
6285 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
6286 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
6287 \pgfkeys{tikz/prim/eyw/.add code={}{\pgf@circ@prim@eywtrue}}
6288 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
6289
6290 % % % secondary windings
6291 \newif\ifpgf@circ@sec@delta
6292 \newif\ifpgf@circ@sec@wye
6293 \newif\ifpgf@circ@sec@eyw
6294 \newif\ifpgf@circ@sec@zig
6295 \pgfkeys{tikz/sec/.is choice}
6296 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
6297 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
6298 \pgfkeys{tikz/sec/eyw/.add code={}{\pgf@circ@sec@eywtrue}}
6299 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
6300
6301 % % % tertiary windings (ooosource)
6302 \newif\ifpgf@circ@tert@delta
6303 \newif\ifpgf@circ@tert@wye
6304 \newif\ifpgf@circ@tert@eyw
6305 \newif\ifpgf@circ@tert@zig
6306 \pgfkeys{tikz/tert/.is choice}
6307 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
6308 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
6309 \pgfkeys{tikz/tert/eyw/.add code={}{\pgf@circ@tert@eywtrue}}
6310 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
6311
6312 % nullator and norator
6313 \ctikzset{bipoles/nullator/height/.initial=.30}
6314 \ctikzset{bipoles/nullator/width/.initial=.60}
6315 \ctikzset{bipoles/norator/height/.initial=.25}
6316 \ctikzset{bipoles/norator/width/.initial=.60}%must be greater than 2*height
6317
6318 %%>>>
6319
6320 %% Nodes definitions for sources%<<<
6321
6322 %% Battery
6323 \pgfcircdeclarebipolescaled{batteries}
6324 {}
6325 {\ctikzvalof{bipoles/battery/height}}
6326 {battery}
6327 {\ctikzvalof{bipoles/battery/height}}
6328 {\ctikzvalof{bipoles/battery/width}}
6329 {
6330 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
6331 \divide \pgf@circ@res@step by 6
6332
6333 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6334
6335 \ifpgf@circ@fixbatteries
6336 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6338
6339 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
6340 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
6341
6342 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6343 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6344
6345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6346 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6347 \else
6348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6349 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6350
6351 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6352 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6353
6354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6356
6357 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6358 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6359 \fi
6360 \pgfusepath{draw}
6361 }
6362
6363
6364 %% Battery 1 % poles with equl thickness
6365
6366 \pgfcircdeclarebipolescaled{batteries}
6367 {}
6368 {\ctikzvalof{bipoles/battery1/height}}
6369 {battery1}
6370 {\ctikzvalof{bipoles/battery1/height}}
6371 {\ctikzvalof{bipoles/battery1/width}}
6372 {
6373 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6374 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6375 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6377 \pgfusepath{draw}
6378
6379 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6380 \ifpgf@circ@fixbatteries
6381 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6382 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6383
6384 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6385 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6386 \else
6387 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6388 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6389
6390 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6391 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6392 \fi
6393 \pgfusepath{draw}
6394 }
6395
6396 %% Battery 2 % negative pole thicker
6397
6398 \pgfcircdeclarebipolescaled{batteries}
6399 {}
6400 {\ctikzvalof{bipoles/battery2/height}}
6401 {battery2}
6402 {\ctikzvalof{bipoles/battery2/height}}
6403 {\ctikzvalof{bipoles/battery2/width}}
6404 {
6405 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6406 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6407 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6408 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6409 \pgfusepath{draw}
6410
6411 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6412 \ifpgf@circ@fixbatteries
6413 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6414 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6415 \pgfusepath{draw}
6416 \pgfsetlinewidth{3\pgflinewidth}
6417 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6418 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6419 \else
6420 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6421 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6422 \pgfusepath{draw}
6423 \pgfsetlinewidth{3\pgflinewidth}
6424 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6425 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6426 \fi
6427 \pgfusepath{draw}
6428 }
6429
6430 % Solar cell
6431 \pgfcircdeclarebipolescaled{batteries}
6432 {}
6433 {\ctikzvalof{bipoles/solar/height}}
6434 {solar}
6435 {\ctikzvalof{bipoles/solar/height}}
6436 {\ctikzvalof{bipoles/solar/width}}
6437 {
6438 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6439 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6440 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6441 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6442 \pgfusepath{draw}
6443
6444 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6445 \ifpgf@circ@fixbatteries
6446 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6447 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6448 \pgfusepath{draw}
6449 \pgfsetlinewidth{3\pgflinewidth}
6450 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6451 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6452 \else
6453 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6454 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6455 \pgfusepath{draw}
6456 \pgfsetlinewidth{3\pgflinewidth}
6457 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6458 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6459 \fi
6460
6461 \pgfusepath{draw}
6462 \pgf@circ@draw@pdarrows
6463 }
6464
6465 %%%
6466 %%% https://xkcd.com/2818/
6467 %%% Also https://chat.stackexchange.com/transcript/message/64238058#64238058
6468 %%%
6469 \pgfcircdeclarebipolescaled{batteries}
6470 {}
6471 {\ctikzvalof{bipoles/battery/height}}
6472 {baertty}
6473 {\ctikzvalof{bipoles/battery/height}}
6474 {\ctikzvalof{bipoles/battery/width}}
6475 {
6476 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
6477 \divide \pgf@circ@res@step by 6
6478 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6479 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6480 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6481 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6482 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6483 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6484 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6485 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6486 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6487 \pgfusepath{draw}
6488 }
6489 \pgfcirc@activate@bipole@simple@opt{v}{baertty}{\circuitikzbasekey/bipole/is voltage=true,
6490 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6491
6492 %%%%%%%%%%%
6493 %% Round and diamond sources
6494 %%%%%%%%%%%
6495
6496 % % % symbol drawing macros (NOT for delta, wye, eyw, zig)
6497 \def\pgf@circ@sources@symbol@setup{% called in a pgfscope
6498 \edef\@@@auto{auto}\edef\@@@rotate{\ctikzvalof{\ctikzclass/symbol/rotate}}
6499 \ifx\@@@auto\@@@rotate
6500 \pgfgettransformentries\a\b\temp\temp\temp\temp
6501 \pgfmathsetmacro{\@@@rotate}{-atan2(\b,\a)}
6502 \fi
6503 \pgftransformrotate{\@@@rotate}%
6504 \pgf@circ@set@relative@thickness{symbol/thickness}%
6505 }
6506
6507 %% Independent voltage source
6508 \pgfcircdeclarebipolescaled{sources}
6509 {}
6510 {\ctikzvalof{bipoles/vsource/height}}
6511 {vsource}
6512 {\ctikzvalof{bipoles/vsource/height}}
6513 {\ctikzvalof{bipoles/vsource/width}}
6514 {
6515
6516 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6517
6518 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6519 \pgf@circ@draworfill
6520 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6521 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6522 \pgfusepath{draw}
6523 }
6524
6525
6526 %% macros for the sources with plus and minus internally
6527 %% To change the internal symbols of the voltage source american style
6528 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
6529 % In the mayority of fonts, the size of - is smaller than +, so we have
6530 % unaligned signs when positioned independently.
6531 % See https://github.com/circuitikz/circuitikz/issues/721
6532 \ctikzset{bipoles/vsourceam/inner minus/.initial={$\vphantom{+}-$}}
6533 %%
6534 %% add the possibility to change the orientation of signs
6535 \ctikzset{sources/symbol/sign rotation/.initial=default}% default, auto, or value
6536 %% this should be more or less equivalent to \ctikzset{sources/symbol/sign rotation=90}, but it's font-dependent,
6537 %% so you never know. Let's keep the traditional one here.
6538 \def\pgf@circ@vsources@signs@default{%
6539 \ifpgf@circ@oldvoltagedirection
6540 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}%
6541 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}%
6542 \else
6543 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}%
6544 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}%
6545 \fi
6546 }
6547 \def\pgf@circ@vsources@sign@auto@or@fix{%
6548 \pgfgettransformentries\a\b\temp\temp\temp\temp
6549 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
6550 % the distance here is choosen so that it seems ok with standard fonts... probably, it must be changed.
6551 \pgfmathsetlength{\pgf@circ@res@temp}{%
6552 \ctikzvalof{bipoles/vsourceam/margin}*\pgf@circ@res@up
6553 -0.5*height("\ctikzvalof{bipoles/vsourceam/inner plus}")}
6554 \ifx\@@rotmode\@@auto
6555 \pgfmathsetmacro{\innerrot}{abs(\rot)<46?0:(abs(\rot)>134?0:90)}
6556 \else
6557 \ifx\@@rotmode\@@straight
6558 \pgfmathsetmacro{\innerrot}{\rot}
6559 \else
6560 \pgfmathsetmacro{\innerrot}{\@@rotmode}
6561 \fi
6562 \fi
6563 \ifpgf@circ@oldvoltagedirection
6564 \pgfscope
6565 \pgftransformxshift{\pgf@circ@res@temp}
6566 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6567 \endpgfscope
6568 \pgfscope
6569 \pgftransformxshift{-\pgf@circ@res@temp}
6570 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6571 \endpgfscope
6572 \else
6573 \pgfscope
6574 \pgftransformxshift{\pgf@circ@res@temp}
6575 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6576 \endpgfscope
6577 \pgfscope
6578 \pgftransformxshift{-\pgf@circ@res@temp}
6579 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6580 \endpgfscope
6581 \fi
6582 }
6583 \def\pgf@circ@vsources@draw@signs{%
6584 \edef\@@auto{auto}\edef\@@default{default}\edef\@@straight{straight}%
6585 \edef\@@rotmode{\ctikzvalof{sources/symbol/sign rotation}}%
6586 \ifx\@@rotmode\@@default
6587 \pgf@circ@vsources@signs@default
6588 \else
6589 \pgf@circ@vsources@sign@auto@or@fix
6590 \fi
6591 }
6592
6593 %% Independent voltage source - American style
6594 \pgfcircdeclarebipolescaled{sources}
6595 {}
6596 {\ctikzvalof{bipoles/vsourceam/height}}
6597 {vsourceAM}
6598 {\ctikzvalof{bipoles/vsourceam/height}}
6599 {\ctikzvalof{bipoles/vsourceam/width}}
6600 {
6601
6602 \pgfscope
6603 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6604 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6605 \pgf@circ@draworfill
6606 \endpgfscope
6607 \pgf@circ@text@strokecolor
6608 \pgf@circ@vsources@draw@signs
6609 }
6610
6611 %% Independent sinusoidal voltage source
6612 \pgfcircdeclarebipolescaled{sources}
6613 {}
6614 {\ctikzvalof{bipoles/vsourcesin/height}}
6615 {vsourcesin}
6616 {\ctikzvalof{bipoles/vsourcesin/height}}
6617 {\ctikzvalof{bipoles/vsourcesin/width}}
6618 {
6619
6620 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6621 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6622 \pgf@circ@draworfill
6623
6624 \pgf@circ@res@up = .5\pgf@circ@res@up
6625 \pgfscope
6626 \pgf@circ@sources@symbol@setup
6627 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6628 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6629 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6630 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6631 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6632 \pgfusepath{draw}
6633 \endpgfscope
6634 }
6635
6636 % Square Voltage source - contributed by Alistair Kwan
6637 \pgfcircdeclarebipolescaled{sources}
6638 {}
6639 {\ctikzvalof{bipoles/vsourcesquare/height}}
6640 {vsourcesquare}
6641 {\ctikzvalof{bipoles/vsourcesquare/height}}
6642 {\ctikzvalof{bipoles/vsourcesquare/width}}
6643 {
6644 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6645 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6646 \pgf@circ@draworfill
6647 \pgf@circ@res@up = .5\pgf@circ@res@up
6648 \pgfscope
6649 \pgf@circ@sources@symbol@setup
6650 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6651 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
6652 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
6653 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6654 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6655 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6656 \pgfusepath{draw}
6657 \endpgfscope
6658 }
6659
6660 % Triangle Voltage source - contributed by Ralf Farkas
6661 \pgfcircdeclarebipolescaled{sources}
6662 {}
6663 {\ctikzvalof{bipoles/vsourcetri/height}}
6664 {vsourcetri}
6665 {\ctikzvalof{bipoles/vsourcetri/height}}
6666 {\ctikzvalof{bipoles/vsourcetri/width}}
6667 {
6668
6669 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6670 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6671 \pgf@circ@draworfill
6672
6673 \pgf@circ@res@up = .5\pgf@circ@res@up
6674 \pgfscope
6675 \pgf@circ@sources@symbol@setup
6676 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6677 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
6678 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
6679 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6680 \pgfusepath{draw}
6681 \endpgfscope
6682 }
6683
6684 %% PV Source
6685 \pgfcircdeclarebipolescaled{sources}
6686 {}
6687 {\ctikzvalof{bipoles/pvsource/height}}
6688 {pvsource}
6689 {\ctikzvalof{bipoles/pvsource/height}}
6690 {\ctikzvalof{bipoles/pvsource/width}}
6691 {
6692 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6693 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6694 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6695 \pgf@circ@draworfill
6696
6697 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
6698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6699 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
6700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6701 \pgfusepath{draw}
6702
6703 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6704 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
6705 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
6706
6707 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
6708 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
6709 \pgfusepath{draw}
6710
6711 %Arrow Part
6712 \pgfscope
6713 \pgfsetarrowsend{latex}
6714 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6715 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6716 \pgfusepath{draw}
6717 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6718 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6719 \pgfusepath{draw}
6720 \endpgfscope
6721
6722 }
6723
6724 %% PV Module - contributed by Andre Alves
6725 \pgfcircdeclarebipolescaled{sources}
6726 {}
6727 {\ctikzvalof{bipoles/pvmodule/height}}
6728 {pvmodule}
6729 {\ctikzvalof{bipoles/pvmodule/height}}
6730 {\ctikzvalof{bipoles/pvmodule/width}}
6731 {
6732
6733 % Draw rectangle
6734 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6738 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6739 \pgfpathclose
6740 \pgf@circ@draworfill
6741
6742 % Draw triangle
6743 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6744 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}}
6745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6746 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6747 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6748 \pgf@circ@draworfill
6749 \pgfusepath{draw}
6750 }
6751
6752 %% Empty Source
6753 \pgfcircdeclarebipolescaled{sources}
6754 {}
6755 {\ctikzvalof{bipoles/esource/height}}
6756 {esource}
6757 {\ctikzvalof{bipoles/esource/height}}
6758 {\ctikzvalof{bipoles/esource/width}}
6759 {
6760 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6761 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6762 \pgf@circ@draworfill
6763 }
6764
6765 %% DC Current Source with open shape
6766 \pgfcircdeclarebipolescaled{sources}
6767 {}
6768 {\ctikzvalof{bipoles/dcisource/height}}
6769 {dcisource}
6770 {\ctikzvalof{bipoles/dcisource/height}}
6771 {\ctikzvalof{bipoles/dcisource/width}}
6772 {
6773 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6774 \pgfpathmoveto{\pgfpointorigin}
6775 \pgfscope
6776 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6777 \pgf@circ@maybefill
6778 \endpgfscope
6779 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
6780 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
6781 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
6782 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
6783 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
6784 \pgfusepath{draw}
6785
6786 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6787 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6788 \pgfusepath{draw}
6789 \pgfscope
6790 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6791 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6792 \endpgfscope
6793 }
6794
6795 %% DC-Voltage source
6796 \pgfcircdeclarebipolescaled{sources}
6797 {}
6798 {\ctikzvalof{bipoles/dcvsource/height}}
6799 {dcvsource}
6800 {\ctikzvalof{bipoles/dcvsource/height}}
6801 {\ctikzvalof{bipoles/dcvsource/width}}
6802 {
6803 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6804 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6805 \pgf@circ@draworfill
6806 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
6807 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
6808 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
6809 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
6810 \pgfusepath{draw}
6811 }
6812
6813 %% Independent current source
6814 \pgfcircdeclarebipolescaled{sources}
6815 {}
6816 {\ctikzvalof{bipoles/isource/height}}
6817 {isource}
6818 {\ctikzvalof{bipoles/isource/height}}
6819 {\ctikzvalof{bipoles/isource/width}}
6820 {
6821 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6822 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6824 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6825 \pgf@circ@draworfill
6826 }
6827
6828 %% Independent double oo source
6829 \pgfcircdeclarebipolescaled{sources}
6830 {
6831 \anchor{centerprim}{
6832 \northeast
6833 \pgf@y=0pt\relax
6834 \pgf@x=-\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
6835 }
6836 \anchor{centersec}{
6837 \northeast
6838 \pgf@y=0pt\relax
6839 \pgf@x=\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
6840 }
6841 }
6842 {\ctikzvalof{bipoles/oosource/height}}
6843 {oosource}
6844 {\ctikzvalof{bipoles/oosource/height}}
6845 {\ctikzvalof{bipoles/oosource/width}}
6846 {
6847 % the offset is relative to the width (...@left/@right), and the size to the height (...@up/@down)
6848 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6849 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6850 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
6851 \pgf@circ@maybefill
6852 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
6853 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
6854 \pgf@circ@draworfill
6855 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6856 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
6857 \pgfusepath{draw}
6858 }
6859
6860 % % % winding symbols
6861 \ctikzset{sources/symbol/delta scale/.initial={1}}
6862 \ctikzset{sources/symbol/wye scale/.initial={1}}
6863 \ctikzset{sources/symbol/eyw scale/.initial={1}}
6864 \ctikzset{sources/symbol/zig scale/.initial={1}}
6865 % Notice that the scale of the symbol should go with the size of the circle, which in the oo-type
6866 % components is linked to the .../height key, which translates in ...res@up and ...res@down
6867 % triangle
6868 \def\pgf@circ@delta#1{
6869 \pgfscope
6870 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/delta scale}*\pgf@circ@res@up*#1}
6871 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6872 \pgftransformrotate{-\pgfcircmathresult}
6873
6874 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6875 \pgf@circ@set@relative@thickness{symbol/thickness}
6876 % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6877 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6878 % \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
6879 \pgfpathmoveto{\pgfpointpolar{90}{\pgf@circ@res@up}}
6880 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@up}}
6881 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@up}}
6882 \pgfpathclose
6883 \pgfusepath{stroke}
6884 \endpgfscope
6885 }
6886 % star
6887 \def\pgf@circ@wye#1{
6888 \pgfscope
6889 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/wye scale}*\pgf@circ@res@up*#1}
6890 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6891 \pgftransformrotate{-\pgfcircmathresult}
6892
6893 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6894 \pgf@circ@set@relative@thickness{symbol/thickness}
6895 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
6896 \pgfpathlineto{\pgfpointorigin}
6897 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
6898 \pgfpathmoveto{\pgfpointorigin}
6899 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
6900 \pgfusepath{stroke}
6901 \endpgfscope
6902 }
6903 % reverse star
6904 \def\pgf@circ@eyw#1{
6905 \pgfscope
6906 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/eyw scale}*\pgf@circ@res@up*#1}
6907 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6908 \pgftransformrotate{-\pgfcircmathresult}
6909
6910 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6911 \pgf@circ@set@relative@thickness{symbol/thickness}
6912 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
6913 \pgfpathlineto{\pgfpointorigin}
6914 \pgfpathlineto{\pgfpointpolar{30}{\pgf@circ@res@down}}
6915 \pgfpathmoveto{\pgfpointorigin}
6916 \pgfpathlineto{\pgfpointpolar{150}{\pgf@circ@res@down}}
6917 \pgfusepath{stroke}
6918 \endpgfscope
6919 }
6920 % zigzag
6921 \def\pgf@circ@zig#1{
6922 \pgfscope
6923 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/zig scale}*\pgf@circ@res@up*#1}
6924 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6925 \pgftransformrotate{-\pgfcircmathresult}
6926
6927 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6928 \pgf@circ@set@relative@thickness{symbol/thickness}
6929 \pgfpathmoveto{\pgfpointorigin}
6930 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
6931 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
6932
6933 \pgfpathmoveto{\pgfpointorigin}
6934 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
6935 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
6936
6937 \pgfpathmoveto{\pgfpointorigin}
6938 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
6939 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
6940 \pgfusepath{stroke}
6941 \endpgfscope
6942 }
6943 % % % % round three-phase auto transformer
6944 \pgfcircdeclarebipolescaled{sources}
6945 {
6946 \anchor{centerprim}{
6947 \northeast
6948 \advance\pgf@x by -\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@y
6949 \pgf@y=0pt\relax
6950 }
6951 \anchor{symbolprim}{
6952 \northeast
6953 \advance\pgf@x by -\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@y
6954 \pgf@y=0pt\relax
6955 }
6956 }
6957 {\ctikzvalof{bipoles/oosourceatrans/height}}
6958 {oosourceatrans}
6959 {\ctikzvalof{bipoles/oosourceatrans/height}}
6960 {\ctikzvalof{bipoles/oosourceatrans/width}}
6961 {
6962 % we do not use the offset here; the circle is "seated" to the right side
6963 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6964 \pgf@circ@res@other=\dimexpr\pgf@circ@res@right-\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up\relax
6965 \pgfpathcircle{\pgfpoint{\pgf@circ@res@other}{0}}
6966 {\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}
6967 \pgf@circ@draworfill
6968 % draw arc
6969 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}%
6970 {\ctikzvalof{bipoles/oosourceatrans/circlesize}*\pgf@circ@res@up}}
6971 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@left}{\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}}
6972 {\pgfpoint{0.5\pgf@circ@res@left}{\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}}
6973 {\pgfpoint{\pgf@circ@res@left}{0}}
6974 \pgfusepath{draw}
6975 % % % % draw inner symbols
6976 %%only (primary) winding
6977 \ifpgf@circ@prim@delta
6978 \pgfscope
6979 \pgftransformxshift{\pgf@circ@res@other}
6980 \pgf@circ@delta{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
6981 \endpgfscope
6982
6983 \else\ifpgf@circ@prim@wye
6984 \pgfscope
6985 \pgftransformxshift{\pgf@circ@res@other}
6986 \pgf@circ@wye{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
6987 \endpgfscope
6988
6989 \else\ifpgf@circ@prim@eyw
6990 \pgfscope
6991 \pgftransformxshift{\pgf@circ@res@other}
6992 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
6993 \endpgfscope
6994
6995 \else\ifpgf@circ@prim@zig
6996 \pgfscope
6997 \pgftransformxshift{\pgf@circ@res@other}
6998 \pgf@circ@zig{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
6999 \endpgfscope
7000 \fi\fi\fi\fi
7001 }
7002 % % % % round three-phase transformer
7003 \pgfcircdeclarebipolescaled{sources}
7004 {
7005 \anchor{centerprim}{
7006 \northeast
7007 \pgf@y=0pt\relax
7008 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
7009 }
7010 \anchor{centersec}{
7011 \northeast
7012 \pgf@y=0pt\relax
7013 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
7014 }
7015 \anchor{symbolprim}{
7016 \northeast
7017 \pgf@y=0pt\relax
7018 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@x
7019 }
7020 \anchor{symbolsec}{
7021 \northeast
7022 \pgf@y=0pt\relax
7023 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@x
7024 }
7025 }
7026 {\ctikzvalof{bipoles/oosourcetrans/height}}
7027 {oosourcetrans}
7028 {\ctikzvalof{bipoles/oosourcetrans/height}}
7029 {\ctikzvalof{bipoles/oosourcetrans/width}}
7030 {
7031 % the offset is relative to the width (...@left/@right), and the size to the height (...@up/@down)
7032 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7033 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
7034 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7035 \pgf@circ@maybefill
7036 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
7037 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7038 \pgf@circ@draworfill
7039 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
7040 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7041 \pgfusepath{draw}
7042 % % % % draw inner symbols
7043 %%primary winding
7044 \ifpgf@circ@prim@delta
7045 \pgfscope
7046 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7047 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7048 \endpgfscope
7049
7050 \else\ifpgf@circ@prim@wye
7051 \pgfscope
7052 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7053 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7054 \endpgfscope
7055
7056 \else\ifpgf@circ@prim@eyw
7057 \pgfscope
7058 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7059 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7060 \endpgfscope
7061
7062 \else\ifpgf@circ@prim@zig
7063 \pgfscope
7064 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7065 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7066 \endpgfscope
7067 \fi\fi\fi\fi
7068
7069 %%secondary winding
7070 \ifpgf@circ@sec@delta
7071 \pgfscope
7072 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7073 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7074 \endpgfscope
7075
7076 \else\ifpgf@circ@sec@wye
7077 \pgfscope
7078 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7079 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7080 \endpgfscope
7081
7082 \else\ifpgf@circ@sec@eyw
7083 \pgfscope
7084 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7085 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7086 \endpgfscope
7087
7088 \else\ifpgf@circ@sec@zig
7089 \pgfscope
7090 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7091 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7092 \endpgfscope
7093 \fi\fi\fi\fi
7094 }
7095 % % % % ooosource for three phase transformer
7096 % This component is 3-way symmetric. It uses ONLY bipoles/ooosource/height for sizing
7097 \pgfcircdeclarebipolescaled{sources}
7098 {
7099 \anchor{right}{
7100 \northeast
7101 \pgf@y=0pt
7102 \pgfmathparse{
7103 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
7104 %%the sqrt must be > 0, the circles have to intersect
7105 sqrt(
7106 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
7107 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
7108 )
7109 }
7110 \pgf@x=\pgfmathresult\pgf@x
7111 }
7112 \anchor{east}{
7113 \northeast
7114 \pgf@y=0pt
7115 }
7116 \savedanchor{\centerprim}{
7117 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7118 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7119 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7120 \pgf@y=0pt
7121 \pgf@x=.5\pgf@circ@res@other
7122 }
7123 \anchor{centerprim}{
7124 \centerprim
7125 }
7126 \savedanchor{\centersec}{
7127 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7128 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7129 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7130 \pgfpointpolar{60}{.5\pgf@circ@res@other}
7131 \pgf@y=-\pgf@y
7132 \pgf@x=-\pgf@x
7133 }
7134 \anchor{centersec}{
7135 \centersec
7136 }
7137 \savedanchor{\centertert}{
7138 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7139 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7140 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7141 \pgfpointpolar{60}{.5\pgf@circ@res@other}
7142 \pgf@y=\pgf@y
7143 \pgf@x=-\pgf@x
7144 }
7145 \anchor{centertert}{
7146 \centertert
7147 }
7148 % add some anchors in case the are needed :)
7149 \anchor{prim1}{
7150 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7151 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7152 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7153 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@res@other}}
7154 }
7155 \anchor{prim2}{
7156 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7157 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7158 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7159 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@res@other}}
7160 }
7161 \anchor{sec1}{
7162 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7163 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7164 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7165 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
7166 }
7167 \anchor{sec2}{
7168 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7169 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7170 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7171 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@res@other}}
7172 }
7173 \anchor{sec3}{
7174 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7175 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7176 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7177 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@res@other}}
7178 }
7179 \anchor{tert1}{
7180 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7181 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7182 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7183 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
7184 }
7185 \anchor{tert2}{
7186 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7187 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7188 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7189 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@res@other}}
7190 }
7191 \anchor{tert3}{
7192 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7193 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7194 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7195 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@res@other}}
7196 }
7197 % symbol "center" anchors
7198 \anchor{symbolprim}{
7199 \northeast
7200 \pgf@y=0pt
7201 \pgf@x=-0.6\pgf@x
7202 }
7203 \anchor{symbolsec}{
7204 \northeast
7205 \pgf@ya=\pgf@y
7206 \pgf@xa=\pgf@x
7207 \pgfpointpolar{60}{0.6\pgf@ya}
7208 }
7209 \anchor{symboltert}{
7210 \northeast
7211 \pgf@ya=\pgf@y
7212 \pgf@xa=\pgf@x
7213 \pgfpointpolar{-60}{0.6\pgf@ya}
7214 }
7215 }
7216 {\ctikzvalof{bipoles/ooosource/height}}
7217 {ooosource}
7218 {\ctikzvalof{bipoles/ooosource/height}}
7219 {\ctikzvalof{bipoles/ooosource/height}}% Notice that here right=down and left=up
7220 {
7221 % % filling
7222 % left
7223 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7224 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
7225 \pgf@circ@maybefill
7226
7227 % up
7228 \pgfscope
7229 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7230 \pgf@circ@maybefill
7231 \endpgfscope
7232 % down
7233 \pgfscope
7234 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7235 \pgf@circ@draworfill
7236 \endpgfscope
7237
7238 % drawing
7239 % left
7240 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
7241 \pgfusepath{draw}
7242
7243 % up
7244 \pgfscope
7245 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7246 \pgfusepath{draw}
7247 \endpgfscope
7248
7249 % % % draw inner symbols
7250
7251 % % primary winding
7252 \ifpgf@circ@prim@delta
7253 \pgfscope
7254 \pgftransformxshift{.6\pgf@circ@res@left}
7255 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7256 \endpgfscope
7257
7258 \else\ifpgf@circ@prim@wye
7259 \pgfscope
7260 \pgftransformxshift{.6\pgf@circ@res@left}
7261 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7262 \endpgfscope
7263
7264 \else\ifpgf@circ@prim@eyw
7265 \pgfscope
7266 \pgftransformxshift{.6\pgf@circ@res@left}
7267 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7268 \endpgfscope
7269
7270 \else\ifpgf@circ@prim@zig
7271 \pgfscope
7272 \pgftransformxshift{.6\pgf@circ@res@left}
7273 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7274 \endpgfscope
7275 \fi\fi\fi\fi
7276
7277 % % secondary winding
7278 \ifpgf@circ@sec@delta
7279 \pgfscope
7280 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7281 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7282 \endpgfscope
7283
7284 \else\ifpgf@circ@sec@wye
7285 \pgfscope
7286 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7287 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7288 \endpgfscope
7289
7290 \else\ifpgf@circ@sec@eyw
7291 \pgfscope
7292 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7293 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7294 \endpgfscope
7295
7296 \else\ifpgf@circ@sec@zig
7297 \pgfscope
7298 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7299 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7300 \endpgfscope
7301 \fi\fi\fi\fi
7302
7303 % % tertiary winding
7304 \ifpgf@circ@tert@delta
7305 \pgfscope
7306 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7307 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7308 \endpgfscope
7309
7310 \else\ifpgf@circ@tert@wye
7311 \pgfscope
7312 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7313 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7314 \endpgfscope
7315
7316 \else\ifpgf@circ@tert@eyw
7317 \pgfscope
7318 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7319 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7320 \endpgfscope
7321
7322 \else\ifpgf@circ@tert@zig
7323 \pgfscope
7324 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7325 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7326 \endpgfscope
7327 \fi\fi\fi\fi
7328 }
7329
7330 %% Independent current source - American
7331 \pgfcircdeclarebipolescaled{sources}
7332 {}
7333 {\ctikzvalof{bipoles/isourceam/height}}
7334 {isourceAM}
7335 {\ctikzvalof{bipoles/isourceam/height}}
7336 {\ctikzvalof{bipoles/isourceam/width}}
7337 {
7338 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7339 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7340 \pgf@circ@draworfill
7341
7342 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
7343 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
7344 \pgfusepath{draw}
7345 \pgfscope
7346 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
7347 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
7348 \endpgfscope
7349 }
7350
7351 %% Independent sinusoidal current source with open shape
7352 \pgfcircdeclarebipolescaled{sources}
7353 {}
7354 {\ctikzvalof{bipoles/isource/height}}
7355 {isourcesin}
7356 {\ctikzvalof{bipoles/isource/height}}
7357 {\ctikzvalof{bipoles/isource/width}}
7358 {
7359 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7360 \pgfscope
7361 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7362 \pgf@circ@maybefill
7363 \endpgfscope
7364 \edef\@@angle{\ctikzvalof{bipoles/isourcesin/angle}}
7365 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
7366 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
7367 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
7368 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
7369 \pgfusepath{draw}
7370
7371 \pgf@circ@res@up = .5\pgf@circ@res@up
7372 \pgfscope
7373 \pgf@circ@sources@symbol@setup
7374 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7375 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7376 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7377 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7378 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7379 \pgfusepath{draw}
7380 \endpgfscope
7381 }
7382
7383 %% Empty controlled source
7384 \pgfcircdeclarebipolescaled{csources}
7385 {}
7386 {\ctikzvalof{bipoles/ecsource/height}}
7387 {ecsource}
7388 {\ctikzvalof{bipoles/ecsource/height}}
7389 {\ctikzvalof{bipoles/ecsource/width}}
7390 {
7391
7392 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7393
7394 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7396 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7397 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7398 \pgfpathclose
7399 \pgf@circ@draworfill
7400 }
7401
7402 %% Controlled voltage source
7403 \pgfcircdeclarebipolescaled{csources}
7404 {}
7405 {\ctikzvalof{bipoles/cvsource/height}}
7406 {cvsource}
7407 {\ctikzvalof{bipoles/cvsource/height}}
7408 {\ctikzvalof{bipoles/cvsource/width}}
7409 {
7410
7411 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7412
7413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7414 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7416 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7417 \pgfpathclose
7418 \pgf@circ@draworfill
7419
7420 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7421 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7422 \pgfusepath{draw}
7423 }
7424
7425 %% To change the internal symbols of the controlled voltage source american style
7426 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
7427 % In the mayority of fonts, the size of - is smaller than +, so we have
7428 % unaligned signs when positioned independently.
7429 % See https://github.com/circuitikz/circuitikz/issues/721
7430 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$\vphantom{+}-$}}
7431 %% Controlled voltage source - American
7432 \pgfcircdeclarebipolescaled{csources}
7433 {}
7434 {\ctikzvalof{bipoles/cvsourceam/height}}
7435 {cvsourceAM}
7436 {\ctikzvalof{bipoles/cvsourceam/height}}
7437 {\ctikzvalof{bipoles/cvsourceam/width}}
7438 {
7439 \pgfscope
7440 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7441 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7442 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7444 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7445 \pgfpathclose
7446 \pgf@circ@draworfill
7447 \endpgfscope
7448 \pgf@circ@text@strokecolor
7449 \pgf@circ@vsources@draw@signs
7450 }
7451
7452 %% Controlled sinusoidal voltage source
7453 \pgfcircdeclarebipolescaled{csources}
7454 {}
7455 {\ctikzvalof{bipoles/cvsourcesin/height}}
7456 {cvsourcesin}
7457 {\ctikzvalof{bipoles/cvsourcesin/height}}
7458 {\ctikzvalof{bipoles/cvsourcesin/width}}
7459 {
7460
7461 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7462
7463 \pgfscope
7464 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7465 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7466 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7467 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7468 \pgfpathclose
7469 \pgf@circ@draworfill
7470 \endpgfscope
7471
7472 \pgf@circ@res@up = .5\pgf@circ@res@up
7473 \pgfscope
7474 \pgf@circ@sources@symbol@setup
7475 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7476 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7477 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7478 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7479 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7480 \pgfusepath{draw}
7481 \endpgfscope
7482 }
7483
7484 %% Controlled sinusoidal current source
7485 \pgfcircdeclarebipolescaled{csources}
7486 {}
7487 {\ctikzvalof{bipoles/cvsourcesin/height}}
7488 {cisourcesin}
7489 {\ctikzvalof{bipoles/cvsourcesin/height}}
7490 {\ctikzvalof{bipoles/cvsourcesin/width}}
7491 {
7492
7493 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7494
7495 \pgfscope
7496 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7497 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7498 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7500 \pgfpathclose
7501 \pgf@circ@draworfill
7502 \endpgfscope
7503
7504 \pgf@circ@res@up = .5\pgf@circ@res@up
7505 \pgfscope
7506 \pgf@circ@sources@symbol@setup
7507 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7508 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7509 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7510 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7511 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7512 \pgfusepath{draw}
7513 \endpgfscope
7514 }
7515
7516 %% Controlled current source
7517 \pgfcircdeclarebipolescaled{csources}
7518 {}
7519 {\ctikzvalof{bipoles/cisource/height}}
7520 {cisource}
7521 {\ctikzvalof{bipoles/cisource/height}}
7522 {\ctikzvalof{bipoles/cisource/width}}
7523 {
7524
7525 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7526
7527 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7528 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7529 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7530 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7531 \pgfpathclose
7532 \pgf@circ@draworfill
7533
7534 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7535 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7536 \pgfusepath{draw}
7537 }
7538
7539 %% Controlled current source - American
7540 \pgfcircdeclarebipolescaled{csources}
7541 {}
7542 {\ctikzvalof{bipoles/cisourceam/height}}
7543 {cisourceAM}
7544 {\ctikzvalof{bipoles/cisourceam/height}}
7545 {\ctikzvalof{bipoles/cisourceam/width}}
7546 {
7547 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7548
7549 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7550 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7551 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7552 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7553 \pgfpathclose
7554 \pgf@circ@draworfill
7555 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
7556 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
7557 \pgfusepath{draw}
7558 \pgfscope
7559 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
7560 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
7561 \endpgfscope
7562 }
7563
7564 %% Cute Independent voltage source
7565 \pgfcircdeclarebipolescaled{sources}
7566 {}
7567 {\ctikzvalof{bipoles/vsource/height}}
7568 {vsourceC}
7569 {\ctikzvalof{bipoles/vsource/height}}
7570 {\ctikzvalof{bipoles/vsource/width}}
7571 {
7572 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7573 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7574 \pgf@circ@draworfill
7575 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7576 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7577 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7578 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7579 \pgfsetroundcap\pgfusepath{draw}
7580 }
7581
7582 %% Cute Independent current source
7583 \pgfcircdeclarebipolescaled{sources}
7584 {}
7585 {\ctikzvalof{bipoles/isource/height}}
7586 {isourceC}
7587 {\ctikzvalof{bipoles/isource/height}}
7588 {\ctikzvalof{bipoles/isource/width}}
7589 {
7590 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7591 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7592 \pgf@circ@draworfill
7593 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7594 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7595 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
7596 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
7597 \pgfsetroundcap\pgfusepath{draw}
7598 }
7599
7600 %% Cute Controlled voltage source
7601 \pgfcircdeclarebipolescaled{csources}
7602 {}
7603 {\ctikzvalof{bipoles/cvsource/height}}
7604 {cvsourceC}
7605 {\ctikzvalof{bipoles/cvsource/height}}
7606 {\ctikzvalof{bipoles/cvsource/width}}
7607 {
7608 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7609 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7610 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7611 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7612 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7613 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7614 \pgf@circ@draworfill
7615 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7616 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7617 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7618 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7619 \pgfsetroundcap\pgfusepath{draw}
7620 }
7621
7622 %% Cute Controlled current source
7623 \pgfcircdeclarebipolescaled{csources}
7624 {}
7625 {\ctikzvalof{bipoles/cisource/height}}
7626 {cisourceC}
7627 {\ctikzvalof{bipoles/cisource/height}}
7628 {\ctikzvalof{bipoles/cisource/width}}
7629 {
7630 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7631 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7632 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7633 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7634 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7635 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7636 \pgf@circ@draworfill
7637 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7638 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
7640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
7641 \pgfsetroundcap\pgfusepath{draw}
7642 }
7643
7644 %% Noise voltage source
7645 \pgfcircdeclarebipolescaled{sources}
7646 {}
7647 {\ctikzvalof{bipoles/vsource/height}}
7648 {vsourceN}
7649 {\ctikzvalof{bipoles/vsource/height}}
7650 {\ctikzvalof{bipoles/vsource/width}}
7651 {
7652 \pgfscope
7653 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7654 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7655 %
7656 \pgf@circ@scaled@Rlen=\scaledRlen
7657 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
7658 \edef\pgf@noise@temp{dashed}
7659 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
7660 \ifx\pgf@noise@temp\pgf@noise@fill
7661 % fillable in this case
7662 \pgf@circ@draworfillandclip
7663 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
7664 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
7665 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7667 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7668 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7669 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7670 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7671 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7672 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7673 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7674 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7675 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7676 %
7677 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
7678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7679 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7680 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7681 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7682 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7683 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7684 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7685 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7686 \pgfusepath{draw}
7687 \else
7688 \pgfsetfillcolor{\pgf@noise@fill}
7689 \pgfusepath{draw,fill}
7690 \fi
7691 \endpgfscope
7692 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7693 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7694 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7695 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7696 \pgfsetroundcap\pgfusepath{draw}
7697 }
7698 %% Noise current source
7699
7700 \pgfcircdeclarebipolescaled{sources}
7701 {}
7702 {\ctikzvalof{bipoles/isource/height}}
7703 {isourceN}
7704 {\ctikzvalof{bipoles/isource/height}}
7705 {\ctikzvalof{bipoles/isource/width}}
7706 {
7707 \pgfscope
7708 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7709 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7710 %
7711 \pgf@circ@scaled@Rlen=\scaledRlen
7712 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
7713 \edef\pgf@noise@temp{dashed}
7714 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
7715 \ifx\pgf@noise@temp\pgf@noise@fill
7716 % fillable in this case
7717 \pgf@circ@draworfillandclip
7718 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
7719 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
7720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7721 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7722 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7725 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7726 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7727 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7728 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7729 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7730 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7731 %
7732 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
7733 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7735 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7736 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7738 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7741 \pgfusepath{draw}
7742 \else
7743 \pgfsetfillcolor{\pgf@noise@fill}
7744 \pgfusepath{draw,fill}
7745 \fi
7746 \endpgfscope
7747 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7748 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7749 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
7750 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
7751 \pgfsetroundcap\pgfusepath{draw}
7752 }
7753
7754 % nullator
7755 \pgfcircdeclarebipolescaled{sources}
7756 {}
7757 {\ctikzvalof{bipoles/nullator/height}}
7758 {nullator}
7759 {\ctikzvalof{bipoles/nullator/height}}
7760 {\ctikzvalof{bipoles/nullator/width}}
7761 {
7762 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7763 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7764 \pgf@circ@draworfill
7765 }
7766 % norator
7767 \pgfcircdeclarebipolescaled{sources}
7768 {}
7769 {\ctikzvalof{bipoles/norator/height}}
7770 {norator}
7771 {\ctikzvalof{bipoles/norator/height}}
7772 {\ctikzvalof{bipoles/norator/width}}
7773 {
7774 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7775 \pgf@circ@res@other=\dimexpr\pgf@circ@res@right-\pgf@circ@res@up\relax
7776 \pgfmathsetmacro{\@@angle}{atan2(\pgf@circ@res@other,\pgf@circ@res@up)}
7777 % \typeout{ANGLE\space\@@angle}
7778 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@up*cos(\@@angle)}
7779 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up*sin(\@@angle)}
7780 % right semicircle
7781 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgf@circ@res@temp}}
7782 \pgfpatharc{180-\@@angle}{-180+\@@angle}{\pgf@circ@res@up}
7783 % connect to left semicircle
7784 \pgfpathlineto
7785 {\pgfpoint{-\pgf@circ@res@other+\pgf@circ@res@step}{\pgf@circ@res@temp}}
7786 % left semicircle
7787 \pgfpatharc{\@@angle}{360-\@@angle}{\pgf@circ@res@up}
7788 % connect to right semicircle
7789 \pgfpathlineto
7790 {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgf@circ@res@temp}}
7791 \pgfpathclose
7792 \pgf@circ@draworfill
7793 }
7794
7795 % %>>>
7796
7797 %% Paths definitions for Sources%<<<
7798
7799 %% Batteries
7800
7801 \pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true,
7802 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7803 \pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true,
7804 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7805 \pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true,
7806 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7807 \pgfcirc@activate@bipole@opt{v}{solarsource}{solar}{solar}{\circuitikzbasekey/bipole/is voltage=true,
7808 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7809
7810 %% Sources: voltage
7811
7812 \pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{%
7813 \circuitikzbasekey/bipole/is voltage=true,
7814 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7815 \pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{%
7816 \circuitikzbasekey/bipole/is voltage=true,
7817 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
7818 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source}
7819 \pgfcirc@style@to@style{voltage source}{vsource}
7820 \pgfcirc@style@to@style{voltage source}{V}
7821
7822 \pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{%
7823 \circuitikzbasekey/bipole/is voltage=true,
7824 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7825 \pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{%
7826 \circuitikzbasekey/bipole/is voltage=true,
7827 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
7828 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source}
7829 \pgfcirc@style@to@style{controlled voltage source}{cvsource}
7830 \pgfcirc@style@to@style{controlled voltage source}{controlled vsource}
7831 \pgfcirc@style@to@style{controlled voltage source}{cV}
7832 %% fix the mess about not having the shortcut accessible in every mode...
7833 \pgfcirc@style@to@style{american voltage source}{vsourceAM}
7834 \pgfcirc@style@to@style{american controlled voltage source}{cvsourceAM}
7835 \pgfcirc@style@to@style{european voltage source}{vsourceEU}
7836 \pgfcirc@style@to@style{european controlled voltage source}{cvsourceEU}
7837
7838 \pgfcirc@activate@bipole@simple@opt{v}{esource}{%
7839 \circuitikzbasekey/bipole/is voltage=true,
7840 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7841
7842 \pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{%
7843 \circuitikzbasekey/bipole/is voltage=true,
7844 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7845 \pgfcirc@style@to@style{empty controlled source}{ecsource}
7846
7847 \pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{%
7848 \circuitikzbasekey/bipole/is voltage=true,
7849 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7850 \pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin}
7851 \pgfcirc@style@to@style{sinusoidal voltage source}{sV}
7852
7853 \pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{%
7854 \circuitikzbasekey/bipole/is voltage=true,
7855 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7856 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin}
7857 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin}
7858 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV}
7859
7860 \pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{%
7861 \circuitikzbasekey/bipole/is voltage=true,
7862 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7863 \pgfcirc@style@to@style{square voltage source}{vsourcesquare}
7864 \pgfcirc@style@to@style{square voltage source}{sqV}
7865
7866 \pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{%
7867 \circuitikzbasekey/bipole/is voltage=true,
7868 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7869 \pgfcirc@style@to@style{triangle voltage source}{vsourcetri}
7870 \pgfcirc@style@to@style{triangle voltage source}{tV}
7871
7872 \pgfcirc@activate@bipole@simple@opt{v}{pvsource}{%
7873 \circuitikzbasekey/bipole/is voltage=true,
7874 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7875
7876 \pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{%
7877 \circuitikzbasekey/bipole/is voltage=true,
7878 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7879
7880 \pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{%
7881 \circuitikzbasekey/bipole/is voltage=true,
7882 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7883
7884 \pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{%
7885 \circuitikzbasekey/bipole/is voltage=true,
7886 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7887
7888 \pgfcirc@activate@bipole@simple@opt{v}{ooosource}{%
7889 \circuitikzbasekey/bipole/is voltage=true,
7890 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7891
7892 \pgfcirc@activate@bipole@simple@opt{v}{oosourceatrans}{%
7893 \circuitikzbasekey/bipole/is voltage=true,
7894 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7895
7896 \pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{%
7897 \circuitikzbasekey/bipole/is voltage=true,
7898 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7899
7900 \pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{%
7901 \circuitikzbasekey/bipole/is voltage=true,
7902 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7903 \pgfcirc@style@to@style{cute european voltage source}{vsourceC}
7904 \pgfcirc@style@to@style{cute european voltage source}{ceV}
7905
7906 \pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{%
7907 \circuitikzbasekey/bipole/is voltage=true,
7908 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7909 \pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC}
7910 \pgfcirc@style@to@style{cute european controlled voltage source}{cceV}
7911
7912 \pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{%
7913 \circuitikzbasekey/bipole/is voltage=true,
7914 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7915 \pgfcirc@style@to@style{noise voltage source}{vsourceN}
7916 \pgfcirc@style@to@style{noise voltage source}{nV}
7917
7918 %% Sources: current
7919
7920 \pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{%
7921 \circuitikzbasekey/bipole/is current=true}
7922 \pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{%
7923 \circuitikzbasekey/bipole/is current=true}
7924 \pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source}
7925 \pgfcirc@style@to@style{current source}{isource}
7926 \pgfcirc@style@to@style{current source}{I}
7927
7928 \pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{%
7929 \circuitikzbasekey/bipole/is current=true}
7930 \pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{%
7931 \circuitikzbasekey/bipole/is current=true}
7932 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source}
7933 \pgfcirc@style@to@style{controlled current source}{cisource}
7934 \pgfcirc@style@to@style{controlled current source}{controlled isource}
7935 \pgfcirc@style@to@style{controlled current source}{cI}
7936 %% fix the mess about not having the shortcut accessible in every mode...
7937 \pgfcirc@style@to@style{american current source}{isourceAM}
7938 \pgfcirc@style@to@style{american controlled current source}{cisourceAM}
7939 \pgfcirc@style@to@style{european current source}{isourceEU}
7940 \pgfcirc@style@to@style{european controlled current source}{cisourceEU}
7941
7942 \pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{%
7943 \circuitikzbasekey/bipole/is current=true}
7944 \pgfcirc@style@to@style{sinusoidal current source}{isourcesin}
7945 \pgfcirc@style@to@style{sinusoidal current source}{sI}
7946
7947 \pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{%
7948 \circuitikzbasekey/bipole/is current=true}
7949 \pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin}
7950 \pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin}
7951 \pgfcirc@style@to@style{controlled sinusoidal current source}{csI}
7952
7953 \pgfcirc@activate@bipole@simple@opt{i}{dcisource}{%
7954 \circuitikzbasekey/bipole/is current=true}
7955
7956 \pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{%
7957 \circuitikzbasekey/bipole/is current=true}
7958
7959 \pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{%
7960 \circuitikzbasekey/bipole/is current=true}
7961 \pgfcirc@style@to@style{cute european current source}{isourceC}
7962 \pgfcirc@style@to@style{cute european current source}{ceI}
7963
7964 \pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{%
7965 \circuitikzbasekey/bipole/is current=true}
7966 \pgfcirc@style@to@style{cute european controlled current source}{cisourceC}
7967 \pgfcirc@style@to@style{cute european controlled current source}{cceI}
7968
7969 \pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{%
7970 \circuitikzbasekey/bipole/is current=true}
7971 \pgfcirc@style@to@style{noise current source}{isourceN}
7972 \pgfcirc@style@to@style{noise current source}{nI}
7973
7974 % norator, nullator
7975 \pgfcirc@activate@bipole@simple{l}{nullator}
7976 \pgfcirc@activate@bipole@simple{l}{norator}
7977
7978 % build alias with voltage and current directions (legacy)
7979
7980 \def\pgf@temp#1{
7981 \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1}
7982 \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1}
7983 \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1}
7984 \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1}
7985 }
7986 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
7987 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
7988 \def\pgf@temp#1{
7989 \pgfcirc@style@to@style@label{current source}{I#1}{i#1}
7990 \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1}
7991 \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1}
7992 \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1}
7993 }
7994 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
7995 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
7996 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
7997 % %>>>
7998
7999
8000 %%%%%%%%%%%%%%
8001 %% Diodes
8002 %%%%%%%%%%%%%%
8003
8004 % Definitions for diodes%<<<1
8005
8006 \ctikzset{bipoles/diode/height/.initial=.50}
8007 \ctikzset{bipoles/diode/width/.initial=.40}
8008 % for horizontally-double-sided diodes, like tvs diodes (transorb)
8009 \ctikzset{bipoles/ddiode/width/.initial=.80}% must be 2*diode width
8010 % for vertically taller diodes
8011 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
8012 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
8013 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
8014 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
8015 \ctikzset{bipoles/varcap/height/.initial=.50}
8016 \ctikzset{bipoles/varcap/width/.initial=.45}
8017
8018 \ctikzset{tripoles/thyristor/height/.initial=1.10}
8019 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
8020 \ctikzset{tripoles/thyristor/width/.initial=1.0}
8021 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
8022 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
8023 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
8024 \ctikzset{tripoles/thyristor/gate height/.initial=0.0} % legacy 0
8025 \ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0
8026 \ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5
8027 \ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0
8028 \ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2
8029
8030 \ctikzset{tripoles/triac/height/.initial=1.1}
8031 \ctikzset{tripoles/triac/width/.initial=1}
8032 \ctikzset{tripoles/triac/diode width left/.initial=.3}
8033 \ctikzset{tripoles/triac/diode width right/.initial=.3}
8034 \ctikzset{tripoles/triac/gate kink/.initial=1}
8035
8036 \ctikzset{thyristor style/.is choice}
8037 \ctikzset{thyristor style/legacy/.code={%
8038 \ctikzset{tripoles/thyristor/height=1.1}%
8039 \ctikzset{tripoles/thyristor/height 2=.5}%
8040 \ctikzset{tripoles/thyristor/width=1.0}%
8041 \ctikzset{tripoles/thyristor/diode height=.5}%
8042 \ctikzset{tripoles/thyristor/diode width left=.4}%
8043 \ctikzset{tripoles/thyristor/diode width right=.3}%
8044 \ctikzset{tripoles/thyristor/gate height=0.0}%
8045 \ctikzset{tripoles/thyristor/gate kink=1.0}%
8046 \ctikzset{tripoles/thyristor/gto space up=0.5}%
8047 \ctikzset{tripoles/thyristor/gto space down=0.0}%
8048 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
8049 \ctikzset{tripoles/triac/gate kink=1}%
8050 }}
8051 \ctikzset{thyristor style/compact/.code={%
8052 \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1
8053 \ctikzset{tripoles/thyristor/height 2=.5}%
8054 \ctikzset{tripoles/thyristor/width=1.0}%
8055 \ctikzset{tripoles/thyristor/diode height=.5}%
8056 \ctikzset{tripoles/thyristor/diode width left=.4}%
8057 \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3
8058 \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0
8059 \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0
8060 \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5
8061 \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0
8062 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
8063 \ctikzset{tripoles/triac/gate kink=.7}%
8064 }}
8065
8066 %
8067 % Whiskers for ZZener and TVS
8068 %
8069 \newif\ifpgf@zz@straightwhisk
8070 \pgf@zz@straightwhiskfalse
8071 \ctikzset{diode straight whiskers/.code=\pgf@zz@straightwhisktrue}
8072 \ctikzset{diode sloped whiskers/.code=\pgf@zz@straightwhiskfalse}
8073 %
8074 % Flipping arrows in LED and photodiodes
8075 %
8076 \newif\ifpgf@led@fliparrows
8077 \newif\ifpgf@pd@fliparrows
8078 \pgf@led@fliparrowsfalse
8079 \pgf@pd@fliparrowsfalse
8080 %
8081 % by default the arrows start (LED) and go (PD) to the anode.
8082 %
8083 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
8084 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
8085 %
8086 % but they can start form the cathode (LED) or go to it (PD)
8087 %
8088 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
8089 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
8090
8091 \newif\ifpgf@circuit@strokediode
8092 \newif\ifpgf@circuit@fulldiode
8093 \pgf@circuit@strokediodefalse
8094 \pgf@circuit@fulldiodefalse
8095
8096 \ctikzset{diode/.is choice}
8097 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
8098 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue\pgf@circuit@strokediodefalse}
8099 \ctikzset{diode/stroke/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodetrue}
8100
8101 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
8102 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
8103 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
8104
8105 %%>>>
8106
8107 %% Node components for diodes %<<<1
8108
8109 % beware, this shift to the left the coordinates
8110 \def\pgf@circ@fulldiode@triangle@shift{%
8111 \pgftransformxshift{\pgf@circ@res@left}
8112 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8113 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8114 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8115 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8116 \pgf@circ@fill@strokecolor
8117 \pgfusepath{draw,fill}
8118 % \pgf@circ@debug@colors
8119 }
8120
8121 %% Black generic diode
8122 \pgfcircdeclarebipolescaled{diodes}
8123 {}
8124 {\ctikzvalof{bipoles/diode/height}}
8125 {fulldiode}
8126 {\ctikzvalof{bipoles/diode/height}}
8127 {\ctikzvalof{bipoles/diode/width}}
8128 {
8129
8130 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8131 \pgfscope
8132 \pgf@circ@fulldiode@triangle@shift
8133 \endpgfscope
8134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8136 \pgfusepath{draw}
8137 }
8138
8139 %% Black Zener diode
8140 \pgfcircdeclarebipolescaled{diodes}
8141 {}
8142 {\ctikzvalof{bipoles/diode/height}}
8143 {fullzdiode}
8144 {\ctikzvalof{bipoles/diode/height}}
8145 {\ctikzvalof{bipoles/diode/width}}
8146 {
8147 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8148 \pgf@circ@fulldiode@triangle@shift
8149 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8150 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8151 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8152 \pgfusepath{draw}
8153 }
8154
8155 %% Black alternative zigzag Zener diode
8156 \pgfcircdeclarebipolescaled{diodes}
8157 {% fix the anchor border
8158 \pgfcirc@border@extend@updown{1.3}{1.3}
8159 }
8160 {\ctikzvalof{bipoles/diode/height}}
8161 {fullzzdiode}
8162 {\ctikzvalof{bipoles/diode/height}}
8163 {\ctikzvalof{bipoles/diode/width}}
8164 {
8165 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8166 \pgf@circ@fulldiode@triangle@shift
8167 \ifpgf@zz@straightwhisk
8168 \edef\@@tmp{0.0}
8169 \else
8170 \edef\@@tmp{0.5}
8171 \fi
8172 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down-\@@tmp\pgf@circ@res@up}}
8173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8174 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8175 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up-\@@tmp\pgf@circ@res@down}}
8176 \pgfusepath{draw}
8177 }
8178
8179 %% Black Schottky diode
8180 \pgfcircdeclarebipolescaled{diodes}
8181 {}
8182 {\ctikzvalof{bipoles/diode/height}}
8183 {fullsdiode}
8184 {\ctikzvalof{bipoles/diode/height}}
8185 {\ctikzvalof{bipoles/diode/width}}
8186 {
8187 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8188 \pgf@circ@fulldiode@triangle@shift
8189 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
8190 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8191 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8192 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8193 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8194 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8195 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8196 \pgfusepath{draw}
8197 }
8198
8199 %% Black tunnel diode
8200 \pgfcircdeclarebipolescaled{diodes}
8201 {}
8202 {\ctikzvalof{bipoles/diode/height}}
8203 {fulltdiode}
8204 {\ctikzvalof{bipoles/diode/height}}
8205 {\ctikzvalof{bipoles/diode/width}}
8206 {
8207 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8208 \pgf@circ@fulldiode@triangle@shift
8209 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8210 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8212 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8213 \pgfusepath{draw}
8214 }
8215 % the styling of optical arrows is defined in pgfcirc.define.tex because
8216 % they are common to phototransistors
8217
8218 %
8219 % draw LED arrows
8220 %
8221 \def\pgf@circ@draw@ledarrows{%
8222 \pgfsetlinewidth{\pgfstartlinewidth}
8223 \pgf@circ@fill@strokecolor
8224 \pgf@circ@set@optoarrow@style
8225 \ifpgf@led@fliparrows
8226 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8227 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8228 \pgfusepath{draw}
8229 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
8230 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
8231 \pgfusepath{draw}
8232 \else
8233 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
8234 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
8235 \pgfusepath{draw}
8236 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8237 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8238 \pgfusepath{draw}
8239 \fi
8240 }
8241 %
8242 % ---and photodiode arrows
8243 %
8244 \def\pgf@circ@draw@pdarrows{%
8245 \pgfsetlinewidth{\pgfstartlinewidth}
8246 \pgf@circ@fill@strokecolor
8247 \pgf@circ@set@optoarrow@style
8248 \ifpgf@pd@fliparrows
8249 \pgfpathmoveto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8250 \pgfpathlineto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8251 \pgfusepath{draw}
8252 \pgfpathmoveto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
8253 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
8254 \pgfusepath{draw}
8255 \else
8256 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
8257 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
8258 \pgfusepath{draw}
8259 \pgfpathmoveto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8260 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8261 \pgfusepath{draw}
8262 \fi
8263 }
8264 %
8265 % --and laser diode arrows - contributed by Andre Alves
8266 %
8267 \def\pgf@circ@draw@laserarrows{%
8268 \pgfsetlinewidth{\pgfstartlinewidth}
8269 \pgf@circ@fill@strokecolor
8270 \pgf@circ@set@optoarrow@style
8271 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
8272 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
8273 \pgfusepath{draw}
8274 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
8275 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
8276 \pgfusepath{draw}
8277 }
8278
8279 \def\pgf@circ@generate@diode@saved@arrows#1#2#3#4#5{%
8280 \savedanchor{\arrows}{%
8281 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
8282 \pgf@ya=\ctikzvalof{bipoles/diode/height}\pgf@circ@scaled@Rlen
8283 \pgf@xa=\ctikzvalof{bipoles/diode/width}\pgf@circ@scaled@Rlen
8284 \pgf@x=.5\pgf@xa\pgf@y=.5\pgf@ya
8285 \csname ifpgf@#5@fliparrows\endcsname
8286 \pgf@x=#1\pgf@x\pgf@y=#2\pgf@y
8287 \else
8288 \pgf@x=#3\pgf@x\pgf@y=#4\pgf@y
8289 \fi
8290 }
8291 }
8292 %% Black light emitting diode
8293 \pgfcircdeclarebipolescaled{diodes}
8294 {% fix the anchor border
8295 \pgfcirc@border@extend@updown{1.8}{1}
8296 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{led}
8297 \anchor{arrows}{\arrows}
8298 }
8299 {\ctikzvalof{bipoles/diode/height}}
8300 {fulllediode}
8301 {\ctikzvalof{bipoles/diode/height}}
8302 {\ctikzvalof{bipoles/diode/width}}
8303 {
8304 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8305 \pgfscope
8306 \pgf@circ@fulldiode@triangle@shift
8307 \endpgfscope
8308 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8309 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8310 \pgfusepath{draw}
8311 \pgf@circ@draw@ledarrows
8312 }
8313
8314 %% Black laser diode - contributed by Andre Alves
8315 \pgfcircdeclarebipolescaled{diodes}
8316 {% fix the anchor border
8317 \pgfcirc@border@extend@updown{1.8}{1}
8318 \pgf@circ@generate@diode@saved@arrows{-0.1}{2.2}{-0.1}{2.2}{pd}%pd or led dosen't matter
8319 \anchor{arrows}{\arrows}
8320 }
8321 {\ctikzvalof{bipoles/diode/height}}
8322 {fulllaserdiode}
8323 {\ctikzvalof{bipoles/diode/height}}
8324 {\ctikzvalof{bipoles/diode/width}}
8325 {
8326 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8327 \pgfscope
8328 \pgf@circ@fulldiode@triangle@shift
8329 \endpgfscope
8330 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8331 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8332 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
8333 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
8334 \pgfusepath{draw}
8335 \pgf@circ@draw@laserarrows
8336 }
8337
8338 %% Black photodiode
8339 \pgfcircdeclarebipolescaled{diodes}
8340 {% fix the anchor border
8341 \pgfcirc@border@extend@updown{1.8}{1}
8342 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{pd}
8343 \anchor{arrows}{\arrows}
8344 }
8345 {\ctikzvalof{bipoles/diode/height}}
8346 {fullpdiode}
8347 {\ctikzvalof{bipoles/diode/height}}
8348 {\ctikzvalof{bipoles/diode/width}}
8349 {
8350 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8351 \pgfscope
8352 \pgf@circ@fulldiode@triangle@shift
8353 \endpgfscope
8354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8356 \pgfusepath{draw}
8357 \pgf@circ@draw@pdarrows
8358 }
8359
8360 %% Black varcap
8361 \pgfcircdeclarebipolescaled{diodes}
8362 {}
8363 {\ctikzvalof{bipoles/varcap/height}}
8364 {fullvarcap}
8365 {\ctikzvalof{bipoles/varcap/height}}
8366 {\ctikzvalof{bipoles/varcap/width}}
8367 {
8368 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8369 \pgfsetlinewidth{\pgf@circ@res@temp}
8370 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8372 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8373 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8374 \pgf@circ@fill@strokecolor
8375 \pgfusepath{draw,fill}
8376 %
8377 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
8378 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
8379 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8380 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8381 \pgfusepath{draw}
8382 }
8383
8384 %% Code for the diode triangle
8385 \def\pgf@circ@basicdiodeshape{
8386 % \pgfscope
8387 \pgftransformxshift{\pgf@circ@res@left}
8388 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8389 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8390 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8391 \pgfpathclose
8392 \pgf@circ@draworfill
8393 \pgfscope
8394 % to allow filling, we need to draw explicitly the stroke here.
8395 \pgfsetlinewidth{\pgfstartlinewidth}
8396 \ifpgf@circuit@bipole@strokedsymbol
8397 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8398 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
8399 \pgfusepath{draw}
8400 \fi
8401 \endpgfscope
8402 % \endpgfscope
8403 }
8404
8405 %% Empty generic diode
8406 \pgfcircdeclarebipolescaled{diodes}
8407 {}
8408 {\ctikzvalof{bipoles/diode/height}}
8409 {emptydiode}
8410 {\ctikzvalof{bipoles/diode/height}}
8411 {\ctikzvalof{bipoles/diode/width}}
8412 {
8413 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8414 \pgfscope
8415 \pgf@circ@basicdiodeshape
8416 \endpgfscope
8417 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8418 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8419 \pgfusepath{draw}
8420 }
8421
8422 %% Empty Zener diode
8423 \pgfcircdeclarebipolescaled{diodes}
8424 {}
8425 {\ctikzvalof{bipoles/diode/height}}
8426 {emptyzdiode}
8427 {\ctikzvalof{bipoles/diode/height}}
8428 {\ctikzvalof{bipoles/diode/width}}
8429 {
8430
8431 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8432
8433 \pgfscope
8434 \pgf@circ@basicdiodeshape
8435 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8437 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8438 \pgfusepath{draw}
8439 \endpgfscope
8440 }
8441
8442 %% Empty alternative zigzag Zener diode
8443 \pgfcircdeclarebipolescaled{diodes}
8444 {% fix the anchor border
8445 \pgfcirc@border@extend@updown{1.3}{1.3}
8446 }
8447 {\ctikzvalof{bipoles/diode/height}}
8448 {emptyzzdiode}
8449 {\ctikzvalof{bipoles/diode/height}}
8450 {\ctikzvalof{bipoles/diode/width}}
8451 {
8452
8453 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8454
8455 \pgfscope
8456 \pgf@circ@basicdiodeshape
8457 \ifpgf@zz@straightwhisk
8458 \edef\@@tmp{0.0}
8459 \else
8460 \edef\@@tmp{0.5}
8461 \fi
8462 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down-\@@tmp\pgf@circ@res@up}}
8463 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8465 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up-\@@tmp\pgf@circ@res@down}}
8466 \pgfusepath{draw}
8467 \endpgfscope
8468 }
8469 %% Empty Schottky diode
8470 \pgfcircdeclarebipolescaled{diodes}
8471 {}
8472 {\ctikzvalof{bipoles/diode/height}}
8473 {emptysdiode}
8474 {\ctikzvalof{bipoles/diode/height}}
8475 {\ctikzvalof{bipoles/diode/width}}
8476 {
8477
8478 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8479 \pgfscope
8480 \pgf@circ@basicdiodeshape
8481 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
8482 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8484 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8485 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8486 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8487 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8488 \pgfusepath{draw}
8489 \endpgfscope
8490
8491 }
8492
8493 %% Empty tunnel diode
8494 \pgfcircdeclarebipolescaled{diodes}
8495 {}
8496 {\ctikzvalof{bipoles/diode/height}}
8497 {emptytdiode}
8498 {\ctikzvalof{bipoles/diode/height}}
8499 {\ctikzvalof{bipoles/diode/width}}
8500 {
8501
8502 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8503 \pgfscope
8504 \pgf@circ@basicdiodeshape
8505 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8506 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8507 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8508 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8509 \pgfusepath{draw}
8510 \endpgfscope
8511 }
8512
8513 %% Empty light emitting diode
8514 \pgfcircdeclarebipolescaled{diodes}
8515 {% fix the anchor border
8516 \pgfcirc@border@extend@updown{1.8}{1}
8517 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{led}
8518 \anchor{arrows}{\arrows}
8519 }
8520 {\ctikzvalof{bipoles/diode/height}}
8521 {emptylediode}
8522 {\ctikzvalof{bipoles/diode/height}}
8523 {\ctikzvalof{bipoles/diode/width}}
8524 {
8525
8526 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8527 \pgfscope
8528 \pgf@circ@basicdiodeshape
8529 \endpgfscope
8530 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8531 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8532 \pgfusepath{draw}
8533
8534 \pgf@circ@draw@ledarrows
8535 }
8536
8537 %% Empty laser diode - contributed by Andre Alves
8538 \pgfcircdeclarebipolescaled{diodes}
8539 {% fix the anchor border
8540 \pgfcirc@border@extend@updown{1.8}{1}
8541 \pgf@circ@generate@diode@saved@arrows{-0.1}{2.2}{-0.1}{2.2}{pd}%pd or led dosen't matter
8542 \anchor{arrows}{\arrows}
8543 }
8544 {\ctikzvalof{bipoles/diode/height}}
8545 {emptylaserdiode}
8546 {\ctikzvalof{bipoles/diode/height}}
8547 {\ctikzvalof{bipoles/diode/width}}
8548 {
8549
8550 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8551 \pgfscope
8552 \pgf@circ@basicdiodeshape
8553 \endpgfscope
8554 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8555 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8556 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
8557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
8558 \pgfusepath{draw}
8559
8560 \pgf@circ@draw@laserarrows
8561 }
8562
8563 %% Empty photodiode
8564 \pgfcircdeclarebipolescaled{diodes}
8565 {% fix the anchor border
8566 \pgfcirc@border@extend@updown{1.8}{1}
8567 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{pd}
8568 \anchor{arrows}{\arrows}
8569 }
8570 {\ctikzvalof{bipoles/diode/height}}
8571 {emptypdiode}
8572 {\ctikzvalof{bipoles/diode/height}}
8573 {\ctikzvalof{bipoles/diode/width}}
8574 {
8575
8576 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8577 \pgfscope
8578 \pgf@circ@basicdiodeshape
8579 \endpgfscope
8580 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8581 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8582 \pgfusepath{draw}
8583
8584 \pgf@circ@draw@pdarrows
8585 }
8586
8587 %% Empty varcap
8588 \pgfcircdeclarebipolescaled{diodes}
8589 {}
8590 {\ctikzvalof{bipoles/varcap/height}}
8591 {emptyvarcap}
8592 {\ctikzvalof{bipoles/varcap/height}}
8593 {\ctikzvalof{bipoles/varcap/width}}
8594 {
8595 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8596 \pgfsetlinewidth{\pgf@circ@res@temp}
8597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8599 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8600 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8601 \pgfpathclose
8602 \pgf@circ@draworfill
8603 \pgfscope
8604 % to allow filling, we need to draw explicitily the stroke here.
8605 \pgfsetlinewidth{\pgfstartlinewidth}
8606 \ifpgf@circuit@bipole@strokedsymbol
8607 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8608 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8609 \pgfusepath{draw}
8610 \fi
8611 \endpgfscope
8612 %
8613 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
8614 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
8615 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8616 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8617 \pgfusepath{draw}
8618 }
8619
8620 %% Transorbs
8621 %% Empty zigzag TVS diode (transorb)
8622 \pgfcircdeclarebipolescaled{diodes}
8623 {% fix the anchor border
8624 \pgfcirc@border@extend@updown{1.3}{1.3}
8625 }
8626 {\ctikzvalof{bipoles/diode/height}}
8627 {emptytvsdiode}
8628 {\ctikzvalof{bipoles/diode/height}}
8629 {\ctikzvalof{bipoles/ddiode/width}}
8630 {
8631 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8632 \pgfscope
8633 \pgfscope
8634 \pgftransformxscale{0.5}
8635 \pgftransformxshift{\pgf@circ@res@left}
8636 \pgf@circ@basicdiodeshape
8637 \endpgfscope
8638 \pgfscope
8639 \pgftransformxscale{-0.5}
8640 \pgftransformxshift{\pgf@circ@res@left}
8641 \pgf@circ@basicdiodeshape
8642 \endpgfscope
8643 \ifpgf@zz@straightwhisk
8644 \edef\@@tmp{1.0}
8645 \else
8646 \edef\@@tmp{1.3}
8647 \fi
8648 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{\@@tmp\pgf@circ@res@up}}
8649 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8650 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8651 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{\@@tmp\pgf@circ@res@down}}
8652 \pgfusepath{draw}
8653 \endpgfscope
8654 }
8655 %% Black zigzag TVS diode (transorb)
8656 \pgfcircdeclarebipolescaled{diodes}
8657 {% fix the anchor border
8658 \pgfcirc@border@extend@updown{1.3}{1.3}
8659 }
8660 {\ctikzvalof{bipoles/diode/height}}
8661 {fulltvsdiode}
8662 {\ctikzvalof{bipoles/diode/height}}
8663 {\ctikzvalof{bipoles/ddiode/width}}
8664 {
8665 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8666 \pgfscope
8667 \pgftransformxscale{0.5}
8668 \pgftransformxshift{\pgf@circ@res@left}
8669 \pgf@circ@fulldiode@triangle@shift
8670 \endpgfscope
8671 \pgfscope
8672 \pgftransformxscale{-0.5}
8673 \pgftransformxshift{\pgf@circ@res@left}
8674 \pgf@circ@fulldiode@triangle@shift
8675 \endpgfscope
8676 \ifpgf@zz@straightwhisk
8677 \edef\@@tmp{1.0}
8678 \else
8679 \edef\@@tmp{1.3}
8680 \fi
8681 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{\@@tmp\pgf@circ@res@up}}
8682 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8683 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8684 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{\@@tmp\pgf@circ@res@down}}
8685 \pgfusepath{draw}
8686 }
8687
8688 %% Black Shockley diode
8689 \pgfcircdeclarebipolescaled{diodes}
8690 {}
8691 {\ctikzvalof{bipoles/diode/height}}
8692 {fullshdiode}
8693 {\ctikzvalof{bipoles/diode/height}}
8694 {\ctikzvalof{bipoles/diode/width}}
8695 {
8696
8697 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8698 \pgfscope
8699 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8701 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8702 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8703 \pgfpathclose
8704 \pgf@circ@fill@strokecolor
8705 \pgfusepath{draw,fill}
8706 \endpgfscope
8707 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8708 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8709 \pgfusepath{draw}
8710 }
8711 %% Empty generic diode
8712 \pgfcircdeclarebipolescaled{diodes}
8713 {}
8714 {\ctikzvalof{bipoles/diode/height}}
8715 {emptyshdiode}
8716 {\ctikzvalof{bipoles/diode/height}}
8717 {\ctikzvalof{bipoles/diode/width}}
8718 {
8719 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8720 \pgfscope
8721 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8722 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8723 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8725 \pgfpathclose
8726 \pgf@circ@draworfill
8727 \endpgfscope
8728 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8729 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8730 \pgfusepath{draw}
8731 }
8732
8733 %% Empty bidirectionaldiode
8734 \pgfcircdeclarebipolescaled{diodes}
8735 {}
8736 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
8737 {emptybidirectionaldiode}
8738 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
8739 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
8740 {
8741
8742 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8743
8744 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
8745 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
8746
8747 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8748 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8749 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8750 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8751
8752 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8753 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8754 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8755 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8756
8757 \pgf@circ@draworfill
8758
8759 \pgfsetlinewidth{\pgfstartlinewidth}
8760
8761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8763
8764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8766
8767 \pgfusepath{draw}
8768 }
8769
8770 %% Full bidirectionaldiode
8771 \pgfcircdeclarebipolescaled{diodes}
8772 {}
8773 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
8774 {fullbidirectionaldiode}
8775 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
8776 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
8777 {
8778
8779 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8780
8781 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
8782 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
8783
8784 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8785 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8786 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8787 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8788
8789 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8790 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8791 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8792 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8793
8794 \pgf@circ@fill@strokecolor
8795 \pgfusepath{draw, fill}
8796
8797 \pgfsetlinewidth{\pgfstartlinewidth}
8798
8799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8801
8802 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8803 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8804
8805 \pgfusepath{draw}
8806 }
8807
8808 %%% Thyristors in general
8809
8810
8811 \def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code
8812 \pgfcircdeclarebipolescaled{diodes}
8813 {
8814 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}}
8815 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
8816 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
8817 \anchor{anode}{\southwest\pgf@y=0cm}
8818 \anchor{cathode}{\northeast\pgf@y=0cm }
8819 }
8820 {\ctikzvalof{tripoles/thyristor/height 2}}
8821 {#1}
8822 {\ctikzvalof{tripoles/thyristor/height}}
8823 {\ctikzvalof{tripoles/thyristor/width}}
8824 {
8825 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
8826 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
8827
8828 \pgfscope
8829 % draw the thick parts here (shifted horizontally)
8830 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8831 % draw the basic triangle
8832 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8833
8834 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
8835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
8836 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8837 \pgfpathclose
8838 \ifnum#2=0\relax
8839 \pgf@circ@fill@strokecolor
8840 \pgfusepath{draw,fill}
8841 \else
8842 \pgf@circ@draworfill
8843 \fi
8844 % draw the vertical bar
8845 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
8846 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
8847 \pgfusepath{draw}
8848 \endpgfscope
8849
8850 % back to normal linewidth
8851 % stroke if needed
8852 \ifpgf@circuit@bipole@strokedsymbol
8853 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8854 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8855 \pgfusepath{draw}
8856 \fi
8857
8858 % draw the gate thing;
8859 #4%
8860
8861 % draw the leads in/out
8862 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8863 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8864
8865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8867
8868 \pgfusepath{draw}
8869 }
8870 }
8871
8872 \def\pgfcirc@thyristor@simplegate{%
8873 \pgfpathmoveto{\pgfpoint
8874 {\pgf@circ@res@step}
8875 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8876 }
8877 \pgfpathlineto{\pgfpoint
8878 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8879 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8880 }
8881 \pgfpathlineto{\pgfpoint
8882 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8883 {\pgf@circ@res@up}
8884 }
8885 \pgfusepath{draw}
8886 }
8887
8888 %% Black thyristor
8889 \pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate}
8890 %% Empty thyristor
8891 \pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate}
8892 %% black and empty GTO (standard: double line symbol, no arrow)
8893
8894 \def\pgfcirc@doublegate@gto@add{
8895 % connection to gate terminal
8896 \pgfpathmoveto{\pgfpoint
8897 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8898 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
8899 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8900 }
8901 \pgfpathlineto{\pgfpoint
8902 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8903 {\pgf@circ@res@up}
8904 }
8905 \pgfusepath{draw}
8906 \pgfscope
8907 \pgfcirc@set@arrows{gto gate}{}{}
8908 % \pgfsetarrowsstart{latexslim}
8909 % first (lower) gto line: from body to gate
8910 \pgfpathmoveto{\pgfpoint
8911 {\pgf@circ@res@step}
8912 {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down})
8913 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8914 }
8915 \pgfpathlineto{\pgfpoint
8916 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8917 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
8918 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8919 }
8920 \pgfusepath{draw}
8921 % second (higher) gto line: from gate to body
8922 \pgfpathmoveto{\pgfpoint
8923 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8924 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up +
8925 \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8926 }
8927 \pgfpathlineto{\pgfpoint
8928 {\pgf@circ@res@step}
8929 {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up})
8930 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8931 }
8932 \pgfusepath{draw}
8933 \endpgfscope
8934 }
8935 \pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add}
8936 \pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add}
8937
8938 \def\pgfcirc@bargate@gto@add{%
8939 \pgfpathmoveto{\pgfpoint
8940 {\pgf@circ@res@step}
8941 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8942 }
8943 \pgfpathlineto{\pgfpoint
8944 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8945 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8946 }
8947 \pgfpathlineto{\pgfpoint
8948 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
8949 {\pgf@circ@res@up}
8950 }
8951 % draw bar line.
8952 \pgfpathmoveto{\pgfpoint
8953 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
8954 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8955 }
8956 \pgfpathlineto{\pgfpoint
8957 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
8958 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8959 }
8960 \pgfusepath{draw}
8961 }
8962
8963 \pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add}
8964 \pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add}
8965
8966 %% Thyristors with anode-connected gate
8967
8968 \def\pgfcirc@thyristor@anodegate{%
8969 \pgfpathmoveto{\pgfpoint
8970 {\pgf@circ@res@other}
8971 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8972 }
8973 \pgfpathlineto{\pgfpoint
8974 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8975 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8976 }
8977 \pgfpathlineto{\pgfpoint
8978 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8979 {\pgf@circ@res@up}
8980 }
8981 \pgfusepath{draw}
8982 }
8983
8984 %% Black PUT
8985 \pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate}
8986 %% Empty PUT
8987 \pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate}
8988 %% black and empty GTO (standard: double line symbol, no arrow)
8989
8990 \def\pgfcirc@anodebargate@gto@add{%
8991 \pgfpathmoveto{\pgfpoint
8992 {\pgf@circ@res@other}
8993 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8994 }
8995 \pgfpathlineto{\pgfpoint
8996 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8997 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8998 }
8999 \pgfpathlineto{\pgfpoint
9000 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
9001 {\pgf@circ@res@up}
9002 }
9003 % draw bar line.
9004 \pgfpathmoveto{\pgfpoint
9005 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
9006 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9007 }
9008 \pgfpathlineto{\pgfpoint
9009 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
9010 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9011 }
9012 \pgfusepath{draw}
9013 }
9014
9015 \pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add}
9016 \pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add}
9017
9018 % Triacs
9019
9020 \def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty)
9021 \pgfcircdeclarebipolescaled{diodes}
9022 {
9023 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}}
9024 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x}
9025 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x}
9026 \anchor{anode}{\southwest\pgf@y=0cm}
9027 \anchor{cathode}{\northeast\pgf@y=0cm }
9028 }
9029 {\ctikzvalof{tripoles/triac/height}}
9030 {#1}
9031 {\ctikzvalof{tripoles/triac/height}}
9032 {\ctikzvalof{tripoles/triac/width}}
9033 {
9034 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9035
9036 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
9037 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
9038
9039 % diodes forms
9040 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9041 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9042 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9043 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9044
9045 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9046 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9047 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9048 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9049
9050 \ifnum#2=0\relax
9051 \pgf@circ@fill@strokecolor
9052 \pgfusepath{draw,fill}
9053 \else
9054 \pgf@circ@draworfill
9055 \fi
9056
9057 \pgfsetlinewidth{\pgfstartlinewidth}
9058
9059 % draw gate
9060 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9061 \pgfpathlineto{\pgfpoint
9062 {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}
9063 {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9064 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
9065
9066 % draw leads
9067 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9068 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9069
9070 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9071 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9072
9073 \pgfusepath{draw}
9074
9075 }
9076 }
9077
9078 \pgfcircdeclaretriac{fulltriac}{0}
9079 \pgfcircdeclaretriac{emptytriac}{1}
9080
9081 % end of shape definitions for diodes%>>>
9082
9083 %% Paths definitions for Diodes%<<<
9084
9085 \def\pgfcirc@tmp@generatediodes#1#2{
9086 \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode}
9087 \pgfcirc@style@to@style{#1 diode}{D#2}
9088 \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode}
9089 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
9090 \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode}
9091 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
9092 \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode}
9093 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
9094 \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode}
9095 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
9096 \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led}
9097 \pgfcirc@style@to@style{#1 led}{leD#2}
9098 \pgfcirc@activate@bipole{l}{#1laserdiode}{#1laserdiode}{#1 laser diode}
9099 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
9100 \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode}
9101 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
9102 \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap}
9103 \pgfcirc@style@to@style{#1 varcap}{VC#2}
9104 \pgfcirc@activate@bipole{l}{#1tvsdiode}{#1tvsdiode}{#1 TVS diode}
9105 \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2}
9106 \pgfcirc@activate@bipole{l}{#1shdiode}{#1shdiode}{#1 Shockley diode}
9107 \pgfcirc@style@to@style{#1 Shockley diode}{shD#2}
9108 \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode}
9109 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
9110 \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor}
9111 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
9112 \pgfcirc@activate@bipole{l}{#1put}{#1put}{#1 put}
9113 \pgfcirc@style@to@style{#1 put}{PUT#2}
9114 \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto}
9115 \pgfcirc@style@to@style{#1 gto}{GTO#2}
9116 \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar}
9117 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
9118 \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar}
9119 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
9120 \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac}
9121 \pgfcirc@style@to@style{#1 triac}{Tr#2}
9122 }
9123 \pgfcirc@tmp@generatediodes{full}{*}
9124 \pgfcirc@tmp@generatediodes{empty}{o}
9125 \def\pgfcirc@tmp@generatestrokeddiodes#1#2{
9126 \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9127 \pgfcirc@style@to@style{#1 diode}{D#2}
9128 \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9129 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
9130 \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9131 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
9132 \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9133 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
9134 \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9135 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
9136 \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9137 \pgfcirc@style@to@style{#1 led}{leD#2}
9138 \pgfcirc@node@to@style{l}{emptylaserdiode}{#1 laser diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9139 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
9140 \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9141 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
9142 \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9143 \pgfcirc@style@to@style{#1 varcap}{VC#2}
9144 \pgfcirc@node@to@style{l}{emptytvsdiode}{#1 TVS diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9145 \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2}
9146 \pgfcirc@node@to@style{l}{emptyshdiode}{#1 Shockley diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9147 \pgfcirc@style@to@style{#1 Shockley diode}{shD#2}
9148 \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9149 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
9150 \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9151 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
9152 \pgfcirc@node@to@style{l}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9153 \pgfcirc@style@to@style{#1 put}{PUT#2}
9154 \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9155 \pgfcirc@style@to@style{#1 gto}{GTO#2}
9156 \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9157 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
9158 \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9159 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
9160 \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9161 \pgfcirc@style@to@style{#1 triac}{Tr#2}
9162 \pgfcirc@node@to@style{l}{emptytvsdiode}{#1 tvsdiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9163 \pgfcirc@style@to@style{#1 tvsdiode}{Tr#2}
9164 }
9165 \pgfcirc@tmp@generatestrokeddiodes{stroke}{-}
9166 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
9167 % these are auto-switching styles
9168 \pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode}
9169 \pgfcirc@style@to@style{diode}{D}
9170 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode}
9171 \pgfcirc@style@to@style{Zener diode}{zD}
9172 \pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode}
9173 \pgfcirc@style@to@style{ZZener diode}{zzD}
9174 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode}
9175 \pgfcirc@style@to@style{Schottky diode}{sD}
9176 \pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode}
9177 \pgfcirc@style@to@style{tunnel diode}{tD}
9178 \pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led}
9179 \pgfcirc@style@to@style{led}{leD}
9180 \pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode}
9181 \pgfcirc@style@to@style{photodiode}{pD}
9182 \pgfcirc@style@to@style{\pgfcircdiodestylemacro laser diode}{laser diode}
9183 \pgfcirc@style@to@style{laser diode}{lasD}
9184 \pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap}
9185 \pgfcirc@style@to@style{varcap}{VC}
9186 \pgfcirc@style@to@style{\pgfcircdiodestylemacro TVS diode}{TVS diode}
9187 \pgfcirc@style@to@style{TVS diode}{tvsD}
9188 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Shockley diode}{Shockley diode}
9189 \pgfcirc@style@to@style{Shockley diode}{shD}
9190 \pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode}
9191 \pgfcirc@style@to@style{bidirectionaldiode}{biD}
9192 \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor}
9193 \pgfcirc@style@to@style{thyristor}{Ty}
9194 \pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put}
9195 \pgfcirc@style@to@style{put}{PUT}
9196 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto}
9197 \pgfcirc@style@to@style{gto}{GTO}
9198 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar}
9199 \pgfcirc@style@to@style{gtobar}{GTOb}
9200 \pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar}
9201 \pgfcirc@style@to@style{agtobar}{aGTOb}
9202 \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac}
9203 \pgfcirc@style@to@style{triac}{Tr}
9204 % %>>>
9205
9206 %%%%%%%%%%%%%
9207 %% switches, buttons and jumpers
9208 %%%%%%%%%%%%%
9209
9210 %% Definitions for switches%<<<1
9211
9212 \ctikzset{bipoles/spst/height/.initial=.35}
9213 \ctikzset{bipoles/spst/width/.initial=.35}
9214 \ctikzset{bipoles/spst/depth/.initial=.2}
9215 \ctikzset{bipoles/nos/height/.initial=.3}
9216 \ctikzset{bipoles/nos/width/.initial=.35}
9217 \ctikzset{bipoles/nos/depth/.initial=.2}
9218 \ctikzset{bipoles/ncs/height/.initial=.35}
9219 \ctikzset{bipoles/ncs/width/.initial=.35}
9220 \ctikzset{bipoles/ncs/depth/.initial=.2}
9221 \ctikzset{bipoles/pushbutton/height/.initial=.5}
9222 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
9223 \ctikzset{bipoles/pushbutton/width/.initial=.50}
9224 %%% reed switch
9225 \ctikzset{bipoles/reed/height/.initial=.4}
9226 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
9227 \ctikzset{bipoles/reed/depth/.initial=.4}
9228 %% Cute switches
9229 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
9230 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
9231 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
9232 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
9233 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
9234
9235 \ctikzset{tripoles/spdt/width/.initial=.85}
9236 \ctikzset{tripoles/spdt/height/.initial=.45}
9237 \ctikzset{tripoles/spdt/margin/.initial=.45}
9238
9239 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
9240 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
9241 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
9242 %% arrow configurability
9243 \ctikzset{switch arrows/.is family}
9244 \ctikzset{switch arrows/relative thickness/.initial=1}
9245 \ctikzset{switch arrows/color/.initial=default}
9246 \ctikzset{switch arrows/dash/.initial=default}
9247 \def\pgf@circ@set@switcharrow@style{%
9248 % You *must* be sure that this is called inside a \pgfscope!
9249 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
9250 \pgf@circ@subset@color@dash{switch arrows}
9251 \pgfcirc@set@arrows{switch}{}{latexslim}
9252 }
9253 \def\pgf@circ@savedanchor@trad@midlever#1#2{% #1 -> name #2 -> relative height
9254 \savedanchor\midlever{% this is the full height of the "handle" of switch
9255 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9256 \pgf@y=\ctikzvalof{bipoles/#1/height}\pgf@circ@scaled@Rlen
9257 \pgf@x=0pt\pgf@y=0.5\pgf@y
9258 }
9259 \anchor{mid}{\midlever\pgf@y=#2\pgf@y}
9260 }
9261 %%>>>
9262
9263 %% Shapes Node for bipoles switches and similar things%<<<
9264 %% (Closing) SPST
9265 \pgfcircdeclarebipolescaled{switches}
9266 {
9267 \pgf@circ@savedanchor@trad@midlever{spst}{0.6}
9268 }
9269 {\ctikzvalof{bipoles/spst/depth}}
9270 {cspst}
9271 {\ctikzvalof{bipoles/spst/height}}
9272 {\ctikzvalof{bipoles/spst/width}}
9273 {
9274 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9275 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9276 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9277 \pgfusepath{draw}
9278 \pgfscope
9279 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9280 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
9281 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
9282 \pgf@circ@set@switcharrow@style
9283 \pgfsetbeveljoin
9284 \pgfusepath{draw}
9285 \endpgfscope
9286 }
9287
9288 %% Opening SPST
9289 \pgfcircdeclarebipolescaled{switches}
9290 {
9291 \pgf@circ@savedanchor@trad@midlever{spst}{0.6}
9292 }
9293 {\ctikzvalof{bipoles/spst/depth}}
9294 {ospst}
9295 {\ctikzvalof{bipoles/spst/height}}
9296 {\ctikzvalof{bipoles/spst/width}}
9297 {
9298 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9299 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9300 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9301 \pgfusepath{draw}
9302 \pgfscope
9303 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9304 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
9305 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
9306 \pgf@circ@set@switcharrow@style
9307 \pgfsetbeveljoin
9308 \pgfusepath{draw}
9309 \endpgfscope
9310 }
9311
9312 %% Normal open Switch
9313 \pgfcircdeclarebipolescaled{switches}
9314 {
9315 \pgf@circ@savedanchor@trad@midlever{nos}{0.5}
9316 }
9317 {\ctikzvalof{bipoles/nos/depth}}
9318 {nos}
9319 {\ctikzvalof{bipoles/nos/height}}
9320 {\ctikzvalof{bipoles/nos/width}}
9321 {
9322 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9323 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9324 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9325 \pgfsetbuttcap
9326 \pgfusepath{draw}
9327 }
9328
9329 %% Normal closed Switch
9330 \pgfcircdeclarebipolescaled{switches}
9331 {
9332 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9333 }
9334 {\ctikzvalof{bipoles/ncs/depth}}
9335 {ncs}
9336 {\ctikzvalof{bipoles/ncs/height}}
9337 {\ctikzvalof{bipoles/ncs/width}}
9338 {
9339 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9340 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9341 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9342 \pgfusepath{draw}
9343 \pgfsetlinewidth{\pgfstartlinewidth}
9344 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9345 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9346 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9347 \pgfusepath{draw}
9348 }
9349
9350 % Opening normal closed Switch
9351 \pgfcircdeclarebipolescaled{switches}
9352 {
9353 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9354 }
9355 {\ctikzvalof{bipoles/ncs/depth}}
9356 {oncs}
9357 {\ctikzvalof{bipoles/ncs/height}}
9358 {\ctikzvalof{bipoles/ncs/width}}
9359 {
9360 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9361 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9362 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9363 \pgfusepath{draw}
9364 \pgfsetlinewidth{\pgfstartlinewidth}
9365 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9366 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9367 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9368 \pgfusepath{draw}
9369 \pgfscope
9370 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9371 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9372 \pgfpathmoveto{\pgfpointpolar{-10}{.9\pgf@circ@res@right}}
9373 \pgfpatharc{-10}{95}{.9\pgf@circ@res@right}
9374 \pgf@circ@set@switcharrow@style
9375 \pgfsetbeveljoin
9376 \pgfusepath{draw}
9377 \endpgfscope
9378 }
9379
9380 %% Closing normal closed Switch
9381 \pgfcircdeclarebipolescaled{switches}
9382 {
9383 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9384 }
9385 {\ctikzvalof{bipoles/ncs/depth}}
9386 {cncs}
9387 {\ctikzvalof{bipoles/ncs/height}}
9388 {\ctikzvalof{bipoles/ncs/width}}
9389 {
9390 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9391 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9392 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9393 \pgfusepath{draw}
9394 \pgfsetlinewidth{\pgfstartlinewidth}
9395 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9396 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9397 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9398 \pgfusepath{draw}
9399 \pgfscope
9400 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9401 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9402 \pgfpathmoveto{\pgfpointpolar{90}{.9\pgf@circ@res@right}}
9403 \pgfpatharc{90}{-35}{.9\pgf@circ@res@right}
9404 \pgf@circ@set@switcharrow@style
9405 \pgfsetbeveljoin
9406 \pgfusepath{draw}
9407 \endpgfscope
9408 }
9409
9410 %% Opening normal open Switch
9411 \pgfcircdeclarebipolescaled{switches}
9412 {
9413 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9414 }
9415 {\ctikzvalof{bipoles/ncs/depth}}
9416 {onos}
9417 {\ctikzvalof{bipoles/ncs/height}}
9418 {\ctikzvalof{bipoles/ncs/width}}
9419 {
9420 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9422 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9423 \pgfusepath{draw}
9424 \pgfsetlinewidth{\pgfstartlinewidth}
9425 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9426 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9427 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9428 \pgfusepath{draw}
9429 \pgfscope
9430 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9431 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9432 \pgfpathmoveto{\pgfpointpolar{-10}{.9\pgf@circ@res@right}}
9433 \pgfpatharc{-10}{95}{.9\pgf@circ@res@right}
9434 \pgf@circ@set@switcharrow@style
9435 \pgfsetbeveljoin
9436 \pgfusepath{draw}
9437 \endpgfscope
9438 }
9439
9440 %% Closing normal open Switch
9441 \pgfcircdeclarebipolescaled{switches}
9442 {
9443 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9444 }
9445 {\ctikzvalof{bipoles/ncs/depth}}
9446 {cnos}
9447 {\ctikzvalof{bipoles/ncs/height}}
9448 {\ctikzvalof{bipoles/ncs/width}}
9449 {
9450 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9451 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9452 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9453 \pgfusepath{draw}
9454 \pgfsetlinewidth{\pgfstartlinewidth}
9455 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9456 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9457 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9458 \pgfusepath{draw}
9459 \pgfscope
9460 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9461 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9462 \pgfpathmoveto{\pgfpointpolar{90}{.9\pgf@circ@res@right}}
9463 \pgfpatharc{90}{-35}{.9\pgf@circ@res@right}
9464 \pgf@circ@set@switcharrow@style
9465 \pgfsetbeveljoin
9466 \pgfusepath{draw}
9467 \endpgfscope
9468 }
9469
9470 %% Push Button
9471 \pgfcircdeclarebipolescaled{switches}
9472 {
9473 \anchor{tip}{\northeast\pgf@x=0pt\relax}
9474 % we can use the generic here, the "bar" is related to bipoles/*/height
9475 \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5}
9476 }
9477 {\ctikzvalof{bipoles/pushbutton/height 2}}
9478 {pushbutton}
9479 {\ctikzvalof{bipoles/pushbutton/height}}
9480 {\ctikzvalof{bipoles/pushbutton/width}}
9481 {
9482 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9483 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
9484 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
9485 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
9486 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
9487 \pgfusepath{draw}
9488
9489 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9490 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9491 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9492 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9493 }
9494
9495 %% Normally closed Push Button
9496 \pgfcircdeclarebipolescaled{switches}
9497 {
9498 \anchor{tip}{\northeast\pgf@x=0pt\relax}
9499 \savedanchor{\nodeheight}{
9500 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9501 }
9502 \anchor{mid}{\nodeheight\pgf@y=-\pgf@y}
9503 % \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5}
9504 }
9505 {\ctikzvalof{bipoles/pushbutton/height 2}}
9506 {ncpushbutton}
9507 {\ctikzvalof{bipoles/pushbutton/height}}
9508 {\ctikzvalof{bipoles/pushbutton/width}}
9509 {
9510 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9511 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9512 % Warning, if the nodes will have a class, we have to touch this.
9513 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9514 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
9515 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
9516 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
9517 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
9518 \pgfusepath{draw}
9519 %
9520 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9521 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9522 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9523 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9524 }
9525 %% Push Button (normally closed but now open :-) see
9526 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
9527 \pgfcircdeclarebipolescaled{switches}
9528 {
9529 \savedanchor{\nodeheight}{
9530 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9531 }
9532 \anchor{tip}{
9533 \nodeheight\pgf@circ@res@temp=\pgf@y
9534 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
9535 \pgf@x=0pt\relax
9536 }
9537 \anchor{mid}{\nodeheight}
9538 }
9539 {\ctikzvalof{bipoles/pushbutton/height 2}}
9540 {pushbuttonc}
9541 {\ctikzvalof{bipoles/pushbutton/height}}
9542 {\ctikzvalof{bipoles/pushbutton/width}}
9543 {
9544 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9545 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9546 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
9547 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
9548 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
9549 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
9550 \pgfusepath{draw}
9551
9552 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9553 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9554 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9555 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9556 }
9557
9558 %% Normally closed Push Button now open
9559 \pgfcircdeclarebipolescaled{switches}
9560 {
9561 \savedanchor{\nodeheight}{
9562 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9563 }
9564 \anchor{tip}{
9565 \nodeheight\pgf@circ@res@temp=\pgf@y
9566 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
9567 \pgf@x=0pt\relax
9568 }
9569 \anchor{mid}{\northeast\pgf@x=0pt\pgf@y=-0.5\pgf@y}
9570 }
9571 {\ctikzvalof{bipoles/pushbutton/height 2}}
9572 {ncpushbuttono}
9573 {\ctikzvalof{bipoles/pushbutton/height}}
9574 {\ctikzvalof{bipoles/pushbutton/width}}
9575 {
9576 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9577 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9578 % Warning, if the nodes will have a class, we have to touch this.
9579 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9580 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
9581 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
9582 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
9583 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
9584 \pgfusepath{draw}
9585 %
9586 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9587 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9588 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9589 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9590 }
9591 %%% reed switches
9592 \pgfcircdeclarebipolescaled{switches}
9593 {
9594 \pgf@circ@savedanchor@trad@midlever{nos}{0.5}
9595 }
9596 {\ctikzvalof{bipoles/reed/depth}}
9597 {reed}
9598 {\ctikzvalof{bipoles/reed/height}}
9599 {\ctikzvalof{bipoles/reed/width}}
9600 {
9601 % this is designed to be the same as a "nos".
9602 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
9603 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
9604 \pgfscope
9605 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9606 % eclosure
9607 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
9608 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
9609 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
9610 \pgfpatharc{270}{90}{\pgf@circ@res@up}
9611 \pgfpathclose
9612 \pgf@circ@draworfill
9613 % switch
9614 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
9615 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
9616 % connection lines
9617 \pgfsetbuttcap
9618 \pgfusepath{draw}
9619 \endpgfscope
9620 % connection lines
9621 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9622 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
9623 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9624 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
9625 \pgfusepath{draw}
9626 }
9627
9628 % cute switch "to" shapes help function
9629 % #1 -> name
9630 % #2 -> barposition
9631 % #3 -> arrowcode
9632 \long\def\pgfcircdeclarecutesw#1#2#3{
9633 \pgfcircdeclarebipolescaled{switches}
9634 {
9635 \savedanchor\midlever{
9636 % these values are calculated when we create the definition of the shape.
9637 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9638 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9639 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
9640 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9641 \pgf@circ@res@down = -.5\pgf@y
9642 \pgf@circ@res@up = .5\pgf@y
9643 \pgfextracty{\pgf@circ@res@other}{#2}
9644 \pgf@x=0pt
9645 \pgf@y=.5\pgf@circ@res@other
9646 }
9647 % radius of the connector
9648 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9649 % If cnnecting nodes are scaled, we have to modify this
9650 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
9651 % shapename
9652 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
9653 % shape type
9654 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
9655 % mid of the lever, to stack switches
9656 \anchor{mid}{\midlever}
9657 \anchor{cout}{\northeast \pgf@y=0cm}
9658 \anchor{cin}{\southwest\pgf@y=0cm}
9659 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
9660 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
9661 }
9662 {\ctikzvalof{bipoles/cuteswitch/height 2}}
9663 {#1}
9664 {\ctikzvalof{bipoles/cuteswitch/height}}
9665 {\ctikzvalof{bipoles/cuteswitch/width}}{
9666 \pgfscope
9667 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9668 % If connecting nodes are scaled, we have to modify this
9669 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9670 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9671 \pgfsetlinewidth{2\pgf@circ@res@temp}
9672 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9673 \pgfpathlineto{#2}
9674 \pgfsetroundcap\pgfusepath{draw}
9675 \endpgfscope
9676 \pgfscope % arrow
9677 \pgf@circ@fill@strokecolor
9678 #3%
9679 \endpgfscope
9680 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9681 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
9682 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9683 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
9684 }
9685 }
9686
9687 %% closed cute switch
9688 \pgfcircdeclarecutesw{cuteclosedswitch}
9689 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
9690 {}
9691
9692 %% open cute switch
9693 \pgfcircdeclarecutesw{cuteopenswitch}
9694 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9695 {}
9696
9697 %% closing cute switch
9698 \pgfcircdeclarecutesw{cuteclosingswitch}
9699 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9700 {
9701 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9702 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9703 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
9704 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
9705 \pgf@circ@set@switcharrow@style
9706 \pgfusepath{draw}
9707 }
9708
9709 %% opening cute switch
9710 \pgfcircdeclarecutesw{cuteopeningswitch}
9711 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
9712 {
9713 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9714 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9715 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
9716 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
9717 \pgf@circ@set@switcharrow@style
9718 \pgfusepath{draw}
9719 }
9720
9721 \pgfcircdeclarebipole{
9722 \anchor{out 1}{\northeast\pgf@y=0pt\relax}
9723 \anchor{out 2}{\northeast\pgf@y=.8\pgf@y}
9724 \anchor{in}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
9725 \anchor{mid}{\northeast\pgf@x=0.2\pgf@x\pgf@y=0.25\pgf@y}
9726 }
9727 {\ctikzvalof{tripoles/toggleswitch/height 2}}
9728 {toggleswitch}
9729 {\ctikzvalof{tripoles/toggleswitch/height}}
9730 {\ctikzvalof{tripoles/toggleswitch/width}}
9731 {
9732
9733 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9734 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
9735 \pgfusepath{draw}
9736 \pgfscope
9737 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
9738 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9739 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
9740 \pgfusepath{draw}
9741 \endpgfscope
9742
9743 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9744 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
9745
9746 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
9747 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
9748 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
9749 \pgfusepath{draw}
9750
9751
9752 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
9753 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9754 \pgfusepath{draw}
9755
9756 \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}
9757 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
9758 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
9759 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
9760 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
9761 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
9762 \pgfusepath{draw}
9763 \pgfsetdash{}{0cm}
9764 }
9765
9766 % %>>>
9767
9768 %% Shape nodes for switches (non-bipoles)%<<<
9769
9770 %%%%%%%%%%%%%
9771 %% switches
9772 %%%%%%%%%%%%%
9773
9774 % Legacy spdt
9775 \pgfdeclareshape{spdt}{
9776 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
9777 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9778 \savedanchor\northwest{%
9779 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9780 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
9781 \pgf@y=.5\pgf@y
9782 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
9783 \pgf@x=.5\pgf@x
9784 }
9785 \pgfcirc@northwest@symmetric@geoanchors
9786 \anchor{in}{\northwest\pgf@y=0pt}
9787 \anchor{out 1}{\northwest\pgf@x=-\pgf@x}
9788 % this is "by eye", it'll be wrong with non-standard ocirc
9789 \anchor{mid}{\northwest\pgf@x=0pt\pgf@y=0.37\pgf@y}
9790 \anchor{out 2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
9791 \anchor{center}{\pgf@y=0pt\pgf@x=0pt}
9792 \pgf@circ@draw@component{
9793 \pgf@circ@setcolor
9794 \northwest
9795 \pgf@circ@res@up = \pgf@y
9796 \pgf@circ@res@down = -\pgf@y
9797 \pgf@circ@res@right = -\pgf@x
9798 \pgf@circ@res@left = \pgf@x
9799 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
9800 %
9801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9802 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
9803 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9804 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
9805 %
9806 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9808 \pgfusepath{draw}
9809 \pgfscope
9810 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
9811 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
9812 \endpgfscope
9813 \pgfscope
9814 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
9815 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
9816 \endpgfscope
9817 \pgfscope
9818 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
9819 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
9820 \endpgfscope
9821 \pgfscope
9822 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
9823 \pgfpathlineto{
9824 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
9825 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
9826 }
9827 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
9828 \pgfusepath{draw}
9829 \endpgfscope
9830 }
9831 }
9832
9833
9834 % cute switch "node" shapes, matching with cute "to" shapes
9835 % #1 -> name
9836 % #2 -> barposition
9837 % #3 -> arrowcode
9838 \long\def\pgfcircdeclarecutespdt#1#2#3{
9839 \pgfdeclareshape{#1}
9840 {
9841 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
9842 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9843 \savedanchor\northwest{%
9844 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9845 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9846 \pgf@y=.5\pgf@y
9847 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
9848 \pgf@x=.25\pgf@x
9849 }
9850 \savedanchor\midlever{
9851 % these values are calculated when we create the definition of the shape.
9852 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9853 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9854 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
9855 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9856 \pgf@circ@res@down = -.5\pgf@y
9857 \pgf@circ@res@up = .5\pgf@y
9858 \pgfextracty{\pgf@circ@res@other}{#2}
9859 \pgf@x=0pt
9860 \pgf@y=.5\pgf@circ@res@other
9861 }
9862 % radius of the connector
9863 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9864 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
9865 % shapename
9866 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
9867 % shape type
9868 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
9869 % mid of the lever, to stack switches
9870 \anchor{mid}{\midlever}
9871 % center anchors
9872 \anchor{cin}{ \northwest \pgf@y=0pt}
9873 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
9874 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9875 % horizontal angles
9876 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
9877 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
9878 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
9879
9880 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
9881 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
9882 \anchor{west}{ \northwest \pgf@y=0pt }
9883 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
9884 \anchor{north}{ \northwest \pgf@x=0pt }
9885 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
9886 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
9887 \anchor{north west}{ \northwest }
9888 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9889
9890 \pgf@circ@draw@component{
9891 \pgf@circ@setcolor
9892 \northwest
9893 \pgf@circ@res@up = \pgf@y
9894 \pgf@circ@res@down = -\pgf@y
9895 \pgf@circ@res@right = -\pgf@x
9896 \pgf@circ@res@left = \pgf@x
9897
9898 \pgfscope
9899 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9900 \pgf@circ@res@temp=\radius\relax
9901 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9902 \pgfsetlinewidth{2\pgf@circ@res@temp}
9903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9904 \pgfpathlineto{#2}
9905 \pgfsetroundcap\pgfusepath{draw}
9906 \endpgfscope
9907 \pgfscope % arrow
9908 \pgf@circ@fill@strokecolor
9909 #3%
9910 \endpgfscope
9911 % terminals
9912 \pgfscope
9913 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9914 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
9915 \endpgfscope
9916 \pgfscope
9917 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9918 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
9919 \endpgfscope
9920 \pgfscope
9921 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9922 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
9923 \endpgfscope
9924
9925 }
9926 }
9927 }
9928
9929 \pgfcircdeclarecutespdt{cute spdt up}
9930 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
9931 {}
9932
9933 \pgfcircdeclarecutespdt{cute spdt mid}
9934 {\pgfpoint{\pgf@circ@res@right}{0pt}}
9935 {}
9936
9937 \pgfcircdeclarecutespdt{cute spdt down}
9938 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
9939 {}
9940
9941 \pgfcircdeclarecutespdt{cute spdt up arrow}
9942 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
9943 {
9944 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9945 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
9946 \pgf@circ@subset@color@dash{switch arrows}
9947 \pgfcirc@set@arrows{switch}{}{latexslim}
9948 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9949 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
9950 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
9951 \pgfusepath{draw}
9952 }
9953
9954 \pgfcircdeclarecutespdt{cute spdt mid arrow}
9955 {\pgfpoint{\pgf@circ@res@right}{0pt}}
9956 {
9957 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9958 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
9959 \pgf@circ@subset@color@dash{switch arrows}
9960 \pgfcirc@set@arrows{switch}{latexslim}{latexslim}
9961 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9962 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
9963 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
9964 \pgfusepath{draw}
9965 }
9966
9967 \pgfcircdeclarecutespdt{cute spdt down arrow}
9968 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
9969 {
9970 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9971 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
9972 \pgf@circ@subset@color@dash{switch arrows}
9973 \pgfcirc@set@arrows{switch}{}{latexslim}
9974 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9975 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
9976 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
9977 \pgfusepath{draw}
9978 }
9979 % %>>>
9980
9981 %% Paths Switches and buttons%<<<
9982
9983 \pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch}
9984 \pgfcirc@style@to@style{closing switch}{switch}
9985 \pgfcirc@style@to@style{closing switch}{cspst}
9986 \pgfcirc@style@to@style{switch}{spst}
9987 \pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch}
9988 \pgfcirc@style@to@style{opening switch}{ospst}
9989
9990 \pgfcirc@activate@bipole@simple{l}{nos}
9991 \pgfcirc@style@to@style{nos}{normal open switch}
9992 \pgfcirc@activate@bipole@simple{l}{ncs}
9993 \pgfcirc@style@to@style{ncs}{normal closed switch}
9994 \pgfcirc@activate@bipole@simple{l}{oncs}
9995 \pgfcirc@style@to@style{oncs}{opening normal closed switch}
9996 \pgfcirc@activate@bipole@simple{l}{cncs}
9997 \pgfcirc@style@to@style{cncs}{closing normal closed switch}
9998 \pgfcirc@activate@bipole@simple{l}{onos}
9999 \pgfcirc@style@to@style{onos}{opening normal open switch}
10000 \pgfcirc@activate@bipole@simple{l}{cnos}
10001 \pgfcirc@style@to@style{cnos}{closing normal open switch}
10002
10003 \pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button}
10004 \pgfcirc@style@to@style{push button}{nopb}
10005 \pgfcirc@style@to@style{push button}{normally open push button}
10006 \pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb}
10007 \pgfcirc@style@to@style{ncpb}{normally closed push button}
10008 \pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc}
10009 \pgfcirc@style@to@style{nopbc}{normally open push button closed}
10010 \pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo}
10011 \pgfcirc@style@to@style{ncpbo}{normally closed push button open}
10012
10013 \pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch}
10014 \pgfcirc@activate@bipole@simple{l}{reed}
10015
10016 \pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch}
10017 \pgfcirc@style@to@style{cute closed switch}{ccsw}
10018 \pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch}
10019 \pgfcirc@style@to@style{cute open switch}{cosw}
10020 \pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch}
10021 \pgfcirc@style@to@style{cute closing switch}{ccgsw}
10022 \pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch}
10023 \pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>>
10024
10025 %% Proximity switch auxiliary shapes%<<<
10026 %% proximeter shape, for usage with switches
10027 \ctikzset{proximeter/width/.initial=0.3}
10028 \ctikzset{proximeter/hlines thickness/.initial=0.5}
10029 \ctikzset{proximeter/hlines position/.initial=0.3}
10030 \pgfdeclareshape{proximeter}
10031 {
10032 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10033 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10034 \savedmacro{\hlinepos}{\edef\hlinepos{\ctikzvalof{proximeter/hlines position}}}
10035 \savedanchor\northeast{%
10036 \pgfmathsetlength{\pgf@y}{\ctikzvalof{proximeter/width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10037 \pgf@x=\pgf@y
10038 }
10039 \anchor{center}{\pgfpointorigin}
10040 % geo anchors based on north-east
10041 \pgfcirc@northeast@symmetric@geoanchors
10042 \anchor{text}{%
10043 \northeast
10044 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10045 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10046 }
10047 \anchor{hlines ne}{%
10048 \northeast
10049 \pgf@y=\hlinepos\pgf@y
10050 \advance\pgf@x by -\pgf@y
10051 }
10052 \anchor{hlines nw}{%
10053 \northeast
10054 \pgf@y=\hlinepos\pgf@y
10055 \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x
10056 }
10057 \anchor{hlines se}{%
10058 \northeast
10059 \pgf@y=\hlinepos\pgf@y
10060 \advance\pgf@x by -\pgf@y
10061 \pgf@y=-\pgf@y
10062 }
10063 \anchor{hlines sw}{%
10064 \northeast
10065 \pgf@y=\hlinepos\pgf@y
10066 \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x
10067 \pgf@y=-\pgf@y
10068 }
10069 \anchorborder{
10070 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
10071 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
10072 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
10073 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
10074 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
10075 \pgfextracty{\pgf@circ@res@up}{\northeast}
10076 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
10077 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
10078 \pgfpointintersectionoflines
10079 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
10080 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
10081 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
10082 \pgf@x=\@@switchx\pgf@x
10083 \pgf@y=\@@switchy\pgf@y
10084 }
10085 \pgf@circ@draw@component{
10086 \northeast\pgf@circ@res@temp=\pgf@y
10087 \pgf@circ@setcolor
10088 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10089 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp}{0pt}}
10090 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
10091 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{0pt}}
10092 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@temp}}
10093 \pgfpathclose
10094 \pgf@circ@draworfill
10095 \pgfsetlinewidth{\ctikzvalof{proximeter/hlines thickness}*\pgflinewidth}
10096 \pgfmathsetlength{\pgf@circ@res@up}{\hlinepos*\pgf@circ@res@temp}
10097 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@temp-\pgf@circ@res@up}
10098 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
10099 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10100 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgf@circ@res@up}}
10101 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
10102 \pgfusepath{draw}
10103 }
10104
10105 }
10106 \pgfcirc@node@to@path{proximeter}{inline proximeter}{}
10107 % %>>>
10108
10109 % jumpers: definitions and code %<<<
10110 % definitons for jumpers
10111 \ctikzset{bipoles/jumper/width/.initial=0.4}
10112 \ctikzset{bipoles/tjumper/width/.initial=0.6}% normally is less than 0.4*2
10113 \ctikzset{tjumper connections/.initial=00}% bare-bare
10114 \ctikzset{bipoles/jumper/height/.initial=0.4}
10115 \ctikzset{bipoles/jumper/depth/.initial=0.1}
10116 \ctikzset{bipoles/jumper/shape/.initial=ocirc}
10117 \ctikzset{bipoles/jumper/curvature/.initial=2} % curvature of the arc
10118 \ctikzset{bipoles/jumper/open shift/.initial=3} % displacement to open the arc
10119
10120 % jumpers
10121 % simple jumpers
10122 % #1 -> name
10123 % #2 -> height of the link arc (0 means no link, 1 closed, 2 open)
10124 \long\def\pgfcircdeclarejumper#1#2{
10125 \pgfcircdeclarebipolescaled{switches}
10126 {
10127 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10128 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10129 % shapename
10130 \savedmacro{\thisshape}{\edef\thisshape{\tikz@fig@name}}
10131 % shape type
10132 \savedmacro{\cshape}{\edef\cshape{\ctikzvalof{bipoles/jumper/shape}}}
10133 % arc characteristics (can vary, must be saved...)
10134 \savedmacro{\curvature}{\edef\curvature{\ctikzvalof{bipoles/jumper/curvature}}}
10135 \savedmacro{\openshift}{\edef\openshift{\ctikzvalof{bipoles/jumper/open shift}}}
10136 %
10137 \anchor{cout}{\northeast \pgf@y=0cm}
10138 \anchor{cin}{\southwest\pgf@y=0cm}
10139 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
10140 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
10141 \anchor{text}{\northeast
10142 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10143 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10144 }
10145 \anchor{top arc}{\northeast
10146 \pgf@circ@res@other=\pgf@x
10147 \pgf@circ@res@temp=\radius
10148 \ifnum #2=1 \edef\@@b{1}\else\edef\@@b{\openshift}\fi
10149 \pgfpointcurveattime{0.5}
10150 {\pgfpoint{-0.9\pgf@circ@res@other}{{(\@@b)*\radius}}}
10151 {\pgfpoint{-0.5\pgf@circ@res@other}{{(\@@b+\curvature)*\radius}}}
10152 {\pgfpoint{0.5\pgf@circ@res@other}{{(\@@b+\curvature)*\radius}}}
10153 {\pgfpoint{0.9\pgf@circ@res@other}{{(\@@b)*\radius}}}
10154 }
10155 }
10156 {\ctikzvalof{bipoles/jumper/depth}}
10157 {#1}
10158 {\ctikzvalof{bipoles/jumper/height}}
10159 {\ctikzvalof{bipoles/jumper/width}}{
10160 %
10161 \ifnum #2=0 \else
10162 \ifnum #2=1 \edef\@@b{1}\else\edef\@@b{\openshift}\fi
10163 \pgfpathmoveto{\pgfpoint{0.9*\pgf@circ@res@left}{(\@@b)*\radius}}
10164 \pgfpathcurveto
10165 {\pgfpoint{.5\pgf@circ@res@left}{(\@@b+\curvature)*\radius}}
10166 {\pgfpoint{.5\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10167 {\pgfpoint{0.9*\pgf@circ@res@right}{(\@@b)*\radius}}
10168 \pgfusepath{draw}
10169 \fi
10170 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10171 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
10172 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
10173 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
10174 }
10175 }
10176 \pgfcircdeclarejumper{bjumper}{0}
10177 \pgfcircdeclarejumper{cjumper}{1}
10178 \pgfcircdeclarejumper{ojumper}{2}
10179 \pgfcirc@activate@bipole{l}{bjumper}{bjumper}{bare jumper}
10180 \pgfcirc@activate@bipole{l}{ojumper}{ojumper}{open jumper}
10181 \pgfcirc@activate@bipole{l}{cjumper}{cjumper}{closed jumper}
10182 % jumpers
10183 % three pins (two-ways) jumpers
10184 % #1 -> name
10185 % #2 -> height of the first link arc (0 means no link, 1 closed, 2 open)
10186 % #3 -> height of the second link arc (0 means no link, 1 closed, 2 open)
10187 \def\pgf@circ@tjumper@splitstatus#1#2\relax{%split the two values
10188 \edef\@@a{#1}\edef\@@b{#2}%
10189 }
10190 \pgfcircdeclarebipolescaled{switches}
10191 {
10192 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10193 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10194 % shapename
10195 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10196 % shape type
10197 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/jumper/shape}}}
10198 % arc characteristics (can vary, must be saved...)
10199 \savedmacro{\curvature}{\edef\curvature{\ctikzvalof{bipoles/jumper/curvature}}}
10200 \savedmacro{\openshift}{\edef\openshift{\ctikzvalof{bipoles/jumper/open shift}}}
10201 \savedmacro{\jumpertype}{\edef\jumpertype{\ctikzvalof{tjumper connections}}}
10202 %
10203 \anchor{cout}{\northeast \pgf@y=0cm}
10204 \anchor{cin}{\southwest\pgf@y=0cm}
10205 \anchor{ctap}{\pgf@x=0cm\pgf@y=0cm}
10206 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
10207 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
10208 \anchor{tap}{\pgf@x=0cm\pgf@y=0cm\advance\pgf@y by -\radius}
10209 \anchor{top arc left}{\northeast
10210 \pgf@circ@res@other=-\pgf@x
10211 \pgf@circ@res@temp=\pgf@x
10212 %
10213 % read the status of the jumper
10214 %
10215 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10216 \edef\@@S{S}%the "S" letter
10217 \ifx\@@a\@@S %span, it's in the center
10218 \ifnum \@@b=0\pgfpointorigin\else % no arc, anchor on the center-base
10219 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10220 \pgfpointcurveattime{0.5}
10221 {\pgfpoint{0.9*\pgf@circ@res@other}{(\@@b)*\radius}}
10222 {\pgfpoint{.5*\pgf@circ@res@other}{(\@@b+\curvature)*\radius}}
10223 {\pgfpoint{.5*\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10224 {\pgfpoint{0.9*\pgf@circ@res@temp}{(\@@b)*\radius}}
10225 \fi
10226 \else
10227 % adjust the lengths of the gap, if needed
10228 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10229 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10230 % left join
10231 \ifnum \@@a=0 \pgfpoint{0.475*\pgf@circ@res@other}{0pt}\else
10232 \pgfpointcurveattime{0.5}
10233 {\pgfpoint{0.95*\pgf@circ@res@other}{\@@a*\radius}}
10234 {\pgfpoint{.75*\pgf@circ@res@other}{(\@@a+\curvature)*\radius}}
10235 {\pgfpoint{.25*\pgf@circ@res@other}{(\@@a+\curvature)*\radius}}
10236 {\pgfpoint{0.05*\pgf@circ@res@other}{\@@a*\radius}}
10237 \fi
10238 \fi
10239 }
10240 \anchor{top arc right}{\northeast
10241 \pgf@circ@res@other=-\pgf@x
10242 \pgf@circ@res@temp=\pgf@x
10243 %
10244 % read the status of the jumper
10245 %
10246 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10247 \edef\@@S{S}%the "S" letter
10248 \ifx\@@a\@@S %span, it's in the center
10249 \ifnum \@@b=0\pgfpointorigin\else % no arc, anchor on the center-base
10250 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10251 \pgfpointcurveattime{0.5}
10252 {\pgfpoint{0.9*\pgf@circ@res@other}{(\@@b)*\radius}}
10253 {\pgfpoint{.5*\pgf@circ@res@other}{(\@@b+\curvature)*\radius}}
10254 {\pgfpoint{.5*\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10255 {\pgfpoint{0.9*\pgf@circ@res@temp}{(\@@b)*\radius}}
10256 \fi
10257 \else
10258 % adjust the lengths of the gap, if needed
10259 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10260 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10261 % right join
10262 \ifnum \@@b=0 \pgfpoint{0.475*\pgf@circ@res@temp}{0pt}\else
10263 \pgfpointcurveattime{0.5}
10264 {\pgfpoint{0.95*\pgf@circ@res@temp}{\@@b*\radius}}
10265 {\pgfpoint{.75\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10266 {\pgfpoint{.25\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10267 {\pgfpoint{0.05*\pgf@circ@res@temp}{\@@b*\radius}}
10268 \fi
10269 \fi
10270 }
10271 }
10272 {\ctikzvalof{bipoles/jumper/depth}}
10273 {tjumper}
10274 {\ctikzvalof{bipoles/jumper/height}}
10275 {\ctikzvalof{bipoles/tjumper/width}}{
10276 %
10277 % read the status of the jumper
10278 %
10279 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10280 \edef\@@S{S}%the "S" letter
10281 \ifx\@@a\@@S %span
10282 \ifnum \@@b=0 \else
10283 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10284 \pgfpathmoveto{\pgfpoint{0.9*\pgf@circ@res@left}{(\@@b)*\radius}}
10285 \pgfpathcurveto
10286 {\pgfpoint{.5\pgf@circ@res@left}{(\@@b+\curvature)*\radius}}
10287 {\pgfpoint{.5\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10288 {\pgfpoint{0.9*\pgf@circ@res@right}{(\@@b)*\radius}}
10289 \pgfusepath{draw}
10290 \fi
10291 \else
10292 % let's do the connection, if needed
10293 % adjust the lengths of the gap, if needed
10294 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10295 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10296 % left arc
10297 \ifnum \@@a=0 \else
10298 \pgfpathmoveto{\pgfpoint{0.95*\pgf@circ@res@left}{\@@a*\radius}}
10299 \pgfpathcurveto
10300 {\pgfpoint{.75\pgf@circ@res@left}{(\@@a+\curvature)*\radius}}
10301 {\pgfpoint{.25\pgf@circ@res@left}{(\@@a+\curvature)*\radius}}
10302 {\pgfpoint{0.05*\pgf@circ@res@left}{\@@a*\radius}}
10303 \pgfusepath{draw}
10304 \fi
10305 % right arc
10306 \ifnum \@@b=0 \else
10307 \pgfpathmoveto{\pgfpoint{0.95*\pgf@circ@res@right}{\@@b*\radius}}
10308 \pgfpathcurveto
10309 {\pgfpoint{.75\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10310 {\pgfpoint{.25\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10311 {\pgfpoint{0.05*\pgf@circ@res@right}{\@@b*\radius}}
10312 \pgfusepath{draw}
10313 \fi
10314 \fi
10315 % draw the poles (always filled!)
10316 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10317 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
10318 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
10319 \pgfnode{\cshape}{center}{}{\thisshape-tap}{\pgfusepath{draw}}
10320 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
10321 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
10322 }
10323
10324 \pgfcirc@activate@bipole{l}{tjumper}{tjumper}{three-pins jumper}
10325
10326 % %>>>
10327
10328 % solder jumpers: definitions and code %<<<
10329 \ctikzset{bipoles/solder jumper/width/.initial=0.36}
10330 \ctikzset{bipoles/solder jumper/height/.initial=0.3} % must be less than width, otherwise no gap!
10331 \ctikzset{bipoles/solder jumper/close height/.initial=0.6}% fraction of the vertical gap filled
10332 \ctikzset{bipoles/double solder jumper/width/.initial=0.57}
10333 %
10334 \def\pgfcirc@base@solder@jumper{%
10335 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{\pgf@circ@res@up}}
10336 \pgfpatharc{90}{270}{\pgf@circ@res@up}
10337 \pgfpathclose
10338 \pgfusepath{draw,fill}
10339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
10340 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
10341 \pgfpathclose
10342 \pgfusepath{draw,fill}
10343 }
10344 % simple solder jumpers
10345 % #1 -> name
10346 % #2 -> open or close (0 means open, 1 closed)
10347 \long\def\pgfcircdeclaresolderjumper#1#2{
10348 \pgfcircdeclarebipolescaled{switches}
10349 {
10350 \anchor{out}{\northeast \pgf@y=0cm}
10351 \anchor{in}{\southwest\pgf@y=0cm}
10352 \anchor{text}{\northeast
10353 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10354 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10355 }
10356 }
10357 {\ctikzvalof{bipoles/solder jumper/height}}
10358 {#1}
10359 {\ctikzvalof{bipoles/solder jumper/height}}
10360 {\ctikzvalof{bipoles/solder jumper/width}}{
10361 %
10362 \pgfcirc@base@solder@jumper
10363 \ifnum #2=0 \else
10364 \pgfpathrectanglecorners
10365 {\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}
10366 {\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10367 {\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}
10368 {\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10369 \pgfusepath{fill, draw}
10370 \fi
10371 }
10372 }
10373 \pgfcircdeclaresolderjumper{osjumper}{0}
10374 \pgfcircdeclaresolderjumper{csjumper}{1}
10375 \pgfcirc@activate@bipole{l}{osjumper}{osjumper}{open solder jumper}
10376 \pgfcirc@activate@bipole{l}{csjumper}{csjumper}{closed solder jumper}
10377 % three pins (two-ways) solder jumpers
10378 % #1 -> name
10379 % #2 -> first side open or closed
10380 % #3 -> second side open or closed
10381 \long\def\pgfcircdeclaredoublesolderjumper#1#2#3{
10382 \pgfcircdeclarebipolescaled{switches}
10383 {
10384 %
10385 \anchor{out}{\northeast \pgf@y=0cm}
10386 \anchor{in}{\southwest\pgf@y=0cm}
10387 \anchor{tap}{\northeast\pgf@x=0cm}
10388 \anchor{tap up}{\northeast\pgf@x=0cm}
10389 \anchor{tap down}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
10390 \anchor{text}{\northeast
10391 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10392 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10393 }
10394 }
10395 {\ctikzvalof{bipoles/solder jumper/height}}
10396 {#1}
10397 {\ctikzvalof{bipoles/solder jumper/height}}
10398 {\ctikzvalof{bipoles/double solder jumper/width}}
10399 {
10400 \pgfcirc@base@solder@jumper
10401 \pgfpathrectanglecorners
10402 {\pgfpoint{-.5\pgf@circ@res@up}{\pgf@circ@res@up}}
10403 {\pgfpoint{.5\pgf@circ@res@up}{\pgf@circ@res@down}}
10404 \pgfusepath{fill, draw}
10405 \ifnum #2=0 \else
10406 \pgfpathrectanglecorners
10407 {\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10408 {\pgfpoint{-.5\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10409 \pgfusepath{fill, draw}
10410 \fi
10411 \ifnum #3=0 \else
10412 \pgfpathrectanglecorners
10413 {\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10414 {\pgfpoint{.5\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10415 \pgfusepath{fill, draw}
10416 \fi
10417 }
10418 }
10419 %
10420 \pgfcircdeclaredoublesolderjumper{odsjumper}{0}{0}
10421 \pgfcircdeclaredoublesolderjumper{ldsjumper}{1}{0}
10422 \pgfcircdeclaredoublesolderjumper{rdsjumper}{0}{1}
10423 \pgfcircdeclaredoublesolderjumper{cdsjumper}{1}{1}
10424 \pgfcirc@activate@bipole{l}{odsjumper}{odsjumper}{open double solder jumper}
10425 \pgfcirc@activate@bipole{l}{ldsjumper}{ldsjumper}{left double solder jumper}
10426 \pgfcirc@activate@bipole{l}{rdsjumper}{rdsjumper}{right double solder jumper}
10427 \pgfcirc@activate@bipole{l}{cdsjumper}{cdsjumper}{closed double solder jumper}
10428
10429 % %>>>
10430
10431 %%%%%%%%%%%%%%%%%
10432 %% Instruments
10433 %%%%%%%%%%%%%%%%%
10434
10435 %% Definitions for Instruments %<<<1
10436 \ctikzset{bipoles/ammeter/height/.initial=.60}
10437 \ctikzset{bipoles/ammeter/width/.initial=.60}
10438 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
10439 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
10440 \ctikzset{bipoles/voltmeter/height/.initial=.60}
10441 \ctikzset{bipoles/voltmeter/width/.initial=.60}
10442 \ctikzset{bipoles/smeter/height/.initial=.60}
10443 \ctikzset{bipoles/smeter/width/.initial=.60}
10444 \ctikzset{bipoles/smeter/index position/.initial=80}
10445 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
10446 \ctikzset{bipoles/qmeter/depth/.initial=.40}
10447 \ctikzset{bipoles/qmeter/height/.initial=.80}
10448 \ctikzset{bipoles/qmeter/width/.initial=.60}
10449 \ctikzset{bipoles/qmeter/index position/.initial=80}
10450 % this must be specified for each one
10451 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
10452 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
10453 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
10454 \ctikzset{bipoles/iloop/width/.initial=.40}
10455 \ctikzset{bipoles/iloop/height/.initial=.60}
10456 % currtap see https://github.com/circuitikz/circuitikz/issues/807
10457 \ctikzset{bipoles/currtap/height/.initial=0.4}
10458 \ctikzset{bipoles/currtap/dot size/.initial=0.5}
10459 \ctikzset{bipoles/currtap/fill/.initial=default}
10460 \ctikzset{bipoles/currtap/dash/.initial=none}
10461 \ctikzset{bipoles/currtap/color/.initial=default}
10462 \ctikzset{bipoles/currtap/thickness/.initial=default}
10463
10464 \ctikzset{bipoles/oscope/height/.initial=.60}
10465 \ctikzset{bipoles/oscope/width/.initial=.60}
10466 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
10467
10468
10469 % option to not rotate the new (Romano's) instruments
10470 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
10471 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
10472 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
10473 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
10474 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
10475 %%>>>
10476
10477 %% Node shapes for instruments%<<<
10478
10479 % % METERINGSHAPE
10480 \long\def\drawmeteringcircle{
10481 \def\pgf@circ@temp{right}
10482 \ifx\tikz@res@label@pos\pgf@circ@temp
10483 \pgf@circ@res@step=-1.2\pgf@circ@res@up
10484 \else
10485 \def\pgf@circ@temp{below}
10486 \ifx\tikz@res@label@pos\pgf@circ@temp
10487 \pgf@circ@res@step=-1.2\pgf@circ@res@up
10488 \else
10489 \pgf@circ@res@step=1.2\pgf@circ@res@up
10490 \fi
10491 \fi
10492 %draw connections to circle
10493 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10494 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
10495 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
10496 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10497 \pgfusepath{draw}
10498 %draw circle
10499 \pgfscope
10500 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10501 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10502 \pgf@circ@draworfill
10503 \endpgfscope
10504 %draw arrow
10505 \pgfscope
10506 \pgfsetarrowsend{latex}
10507 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10508 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
10509 \pgfusepath{draw}
10510 \endpgfscope
10511 }
10512
10513 %AMPEREMETER
10514 \pgfcircdeclarebipolescaled{instruments}
10515 {}
10516 {\ctikzvalof{bipoles/ammeter/height}}
10517 {ammeter}
10518 {\ctikzvalof{bipoles/ammeter/height}}
10519 {\ctikzvalof{bipoles/ammeter/width}}
10520 {
10521 \drawmeteringcircle
10522 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
10523 }
10524 %OHMMETER
10525 \pgfcircdeclarebipolescaled{instruments}
10526 {}
10527 {\ctikzvalof{bipoles/ohmmeter/height}}
10528 {ohmmeter}
10529 {\ctikzvalof{bipoles/ohmmeter/height}}
10530 {\ctikzvalof{bipoles/ohmmeter/width}}
10531 {
10532 \drawmeteringcircle
10533 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
10534 }
10535 %VOLTMETER
10536 \pgfcircdeclarebipolescaled{instruments}
10537 {}
10538 {\ctikzvalof{bipoles/voltmeter/height}}
10539 {voltmeter}
10540 {\ctikzvalof{bipoles/voltmeter/height}}
10541 {\ctikzvalof{bipoles/voltmeter/width}}
10542 {
10543 \drawmeteringcircle
10544 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
10545
10546 }
10547
10548 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
10549 %
10550 % oscilloscope waveforms
10551
10552 \ctikzset{%
10553 bipoles/oscope/waveform/sin/.code={%
10554 \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}}
10555 \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}}
10556 \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}}
10557 \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}}
10558 \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}}
10559 \pgfusepath{draw}
10560 },
10561 bipoles/oscope/waveform/ramps/.code={%
10562 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
10563 \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}}
10564 \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}}
10565 \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}}
10566 \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}}
10567 \pgfusepath{draw}
10568 },
10569 bipoles/oscope/waveform/square/.code={%
10570 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
10571 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
10572 \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}}
10573 \pgfpathlineto{\pgfpoint{0cm}{0.25cm}}
10574 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
10575 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
10576 \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}}
10577 \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}}
10578 \pgfusepath{draw}
10579 },
10580 bipoles/oscope/waveform/triangle/.code={%
10581 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
10582 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
10583 \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}}
10584 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
10585 \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}}
10586 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
10587 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
10588 \pgfusepath{draw}
10589 },
10590 bipoles/oscope/waveform/zero/.code={
10591 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
10592 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
10593 \pgfusepath{draw}
10594 },%
10595 bipoles/oscope/waveform/lissajous/.code={%
10596 \pgfpathellipse{\pgfpoint{0cm}{0cm}}
10597 {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}}
10598 \pgfusepath{draw}
10599 },
10600 bipoles/oscope/waveform/none/.code={},%
10601 }
10602 % default waveform (backward compatible)
10603 \ctikzset{bipoles/oscope/waveform/.initial=ramps}
10604
10605 \pgfcircdeclarebipolescaled{instruments}
10606 {
10607 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
10608 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
10609 % put the node text above and centered
10610 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
10611 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
10612 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10613 }
10614 }
10615 }
10616 {\ctikzvalof{bipoles/oscope/height}}
10617 {oscope}
10618 {\ctikzvalof{bipoles/oscope/height}}
10619 {\ctikzvalof{bipoles/oscope/width}}
10620 {
10621 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10622 \pgfextracty{\pgf@circ@res@up}{\northeast}
10623 \pgfextractx{\pgf@circ@res@right}{\northeast}
10624 \pgfextractx{\pgf@circ@res@left}{\southwest}
10625 \pgfextracty{\pgf@circ@res@down}{\southwest}
10626 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
10627 \pgfscope
10628 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
10629 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10630 \pgf@circ@draworfill
10631 \endpgfscope
10632 % get the rotation
10633 \ifpgf@circuit@straightinstruments
10634 \pgfgettransformentries\a\b\temp\temp\temp\temp
10635 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10636 \else
10637 \edef\rot{0}
10638 \fi
10639 % and unrotate the scope
10640 \pgfscope
10641 \pgftransformrotate{\rot}
10642 % grid
10643 \pgfscope
10644 \pgfsetlinewidth{0.5\pgfstartlinewidth}
10645 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
10646 % the "almost one" make the grid complete most of the time --- beware of antialiasing
10647 \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]%
10648 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
10649 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
10650 \pgfsetstrokeopacity{0.5}
10651 \pgfusepath{draw}
10652 \endpgfscope
10653 % function displayed
10654 \pgfscope
10655 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
10656 \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
10657 \pgftransformxscale{\@@scalex}
10658 \pgftransformyscale{\@@scaley}
10659 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10660 \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}}
10661 \endpgfscope
10662 \endpgfscope
10663 }
10664 % generic round meter with always horizontal text, no arrow
10665 \pgfcircdeclarebipolescaled{instruments}
10666 {}
10667 {\ctikzvalof{bipoles/esource/height}}
10668 {rmeter}
10669 {\ctikzvalof{bipoles/esource/height}}
10670 {\ctikzvalof{bipoles/esource/width}}
10671 {
10672 \pgfscope
10673 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10674 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10675 \pgf@circ@draworfill
10676 \endpgfscope
10677 % draw the text label
10678 % get the rotation
10679 \ifpgf@circuit@straightinstruments
10680 \pgfgettransformentries\a\b\temp\temp\temp\temp
10681 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10682 \else
10683 \edef\rot{0}
10684 \fi
10685 % and unrotate the scope
10686 \pgfscope
10687 \pgf@circ@text@strokecolor
10688 \pgftransformrotate{\rot}
10689 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
10690 \endpgfscope
10691 }
10692
10693 % generic round meter with always horizontal text, with arrow
10694 \pgfcircdeclarebipolescaled{instruments}
10695 {}
10696 {\ctikzvalof{bipoles/esource/height}}
10697 {rmeterwa}
10698 {\ctikzvalof{bipoles/esource/height}}
10699 {\ctikzvalof{bipoles/esource/width}}
10700 {
10701 \pgfscope
10702 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10703 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10704 \pgf@circ@draworfill
10705 \endpgfscope
10706 % draw the text label
10707 % get the rotation
10708 \ifpgf@circuit@straightinstruments
10709 \pgfgettransformentries\a\b\temp\temp\temp\temp
10710 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10711 \else
10712 \edef\rot{0}
10713 \fi
10714 % and unrotate the scope
10715 \pgfscope
10716 \pgftransformrotate{\rot}
10717 \pgf@circ@setcolor
10718 \pgfsetlinewidth{\pgfstartlinewidth}
10719 % arrow: create a center hole to have better visual
10720 \pgfscope
10721 % clipping path: first a rectangle bigger then the shape
10722 % to avoid problems with the line thickness
10723 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
10724 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
10725 % next open a circle into it
10726 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
10727 % do the difference and clip before drawing
10728 \pgfseteorule
10729 \pgfusepath{clip}
10730 \pgfsetarrowsend{latexslim}
10731 % the arrow is better if it has a bit of breath and it's not 45º
10732 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
10733 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
10734 \pgfusepath{draw}
10735 \endpgfscope
10736 \pgf@circ@text@strokecolor
10737 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
10738 \endpgfscope
10739 }
10740
10741 % generic square meter with always horizontal text
10742 \pgfcircdeclarebipolescaled{instruments}
10743 {
10744 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
10745 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
10746 % put the node text above and centered
10747 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
10748 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
10749 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10750 }
10751 }
10752 }
10753 {\ctikzvalof{bipoles/smeter/height}}
10754 {smeter}
10755 {\ctikzvalof{bipoles/smeter/height}}
10756 {\ctikzvalof{bipoles/smeter/width}}
10757 {
10758 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10759 \pgfextracty{\pgf@circ@res@up}{\northeast}
10760 \pgfextractx{\pgf@circ@res@right}{\northeast}
10761 \pgfextractx{\pgf@circ@res@left}{\southwest}
10762 \pgfextracty{\pgf@circ@res@down}{\southwest}
10763 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
10764 \pgfscope
10765 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
10766 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10767 \pgf@circ@draworfill
10768 \endpgfscope
10769 % get the rotation
10770 \ifpgf@circuit@straightinstruments
10771 \pgfgettransformentries\a\b\temp\temp\temp\temp
10772 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10773 \else
10774 \edef\rot{0}
10775 \fi
10776 % and unrotate the scope
10777 \pgfscope
10778 \pgftransformrotate{\rot}
10779 % the metering window
10780 \pgfscope
10781 \def\@starta{105}\def\@stopa{75}
10782 \pgfsetlinewidth{\pgfstartlinewidth}
10783 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
10784 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
10785 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
10786 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
10787 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
10788 \pgfpathclose
10789 \pgfmathsetmacro{\@indexa}{\@starta - \ctikzvalof{bipoles/smeter/index position}*(\@starta - \@stopa)/100}
10790 \pgfpathmoveto{\pgfpointpolar{\@indexa}{2\pgf@circ@res@up}}
10791 \pgfpathlineto{\pgfpointpolar{\@indexa}{2.4\pgf@circ@res@up}}
10792 \pgfusepath{draw}
10793 \endpgfscope
10794 \pgf@circ@text@strokecolor
10795 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
10796 \endpgfscope
10797 }
10798
10799 % probes qucs style:
10800 % #1 : name
10801 % #2 : extra code
10802 \long\def\pgfcirc@qucsprobe#1#2{
10803 \pgfcircdeclarebipolescaled{instruments}
10804 {
10805 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
10806 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
10807 % put the node text above and centered
10808 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
10809 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
10810 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10811 }
10812 }
10813 }
10814 {\ctikzvalof{bipoles/qmeter/depth}}
10815 {#1}
10816 {\ctikzvalof{bipoles/qmeter/height}}
10817 {\ctikzvalof{bipoles/qmeter/width}}
10818 {
10819 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10820 \pgfextracty{\pgf@circ@res@up}{\northeast}
10821 \pgfextractx{\pgf@circ@res@right}{\northeast}
10822 \pgfextractx{\pgf@circ@res@left}{\southwest}
10823 \pgfextracty{\pgf@circ@res@down}{\southwest}
10824 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
10825 \pgfscope
10826 \pgfscope
10827 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
10828 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10829 \pgf@circ@draworfill
10830 \endpgfscope
10831 \def\@starta{103}\def\@stopa{77}
10832 \pgfsetlinewidth{\pgfstartlinewidth}
10833 \pgfscope
10834 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
10835 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
10836 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
10837 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
10838 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
10839 \pgfpathclose
10840 \pgfmathsetmacro{\@indexa}{\@starta - \ctikzvalof{bipoles/qmeter/index position}*(\@starta - \@stopa)/100}
10841 \pgfpathmoveto{\pgfpointpolar{\@indexa}{2.1\pgf@circ@res@up}}
10842 \pgfpathlineto{\pgfpointpolar{\@indexa}{2.4\pgf@circ@res@up}}
10843 \pgfusepath{draw}
10844 \pgf@circ@draworfill
10845 \endpgfscope
10846 #2%
10847 \endpgfscope
10848 }
10849 }
10850
10851 \pgfcirc@qucsprobe{qiprobe}{
10852 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10853 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10854 \pgfusepath{draw}
10855 \pgfnode{currarrow}{center}{}{}{}
10856 }
10857
10858 \pgfcirc@qucsprobe{qvprobe}{
10859 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
10860 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10861 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
10862 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
10863 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
10864 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10865 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
10866 \pgfusepath{draw}
10867 \pgfscope
10868 % "+" and "-", drawn so that they scale correctly
10869 \pgfsetlinewidth{2\pgfstartlinewidth}
10870 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
10871 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
10872 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
10873 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
10874 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
10875 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
10876 \pgfusepath{draw}
10877 \endpgfscope
10878 }
10879
10880 \pgfcirc@qucsprobe{qpprobe}{
10881 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10882 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10883 \pgfusepath{draw}
10884 \pgfnode{currarrow}{center}{}{}{}
10885 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
10886 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
10887 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
10888 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
10889 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
10890 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
10891 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
10892 \pgfusepath{draw}
10893 \pgfscope
10894 % "+" and "-", drawn so that they scale correctly
10895 \pgfsetlinewidth{2\pgfstartlinewidth}
10896 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
10897 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
10898 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
10899 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
10900 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
10901 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
10902 \pgfusepath{draw}
10903 \endpgfscope
10904 }
10905
10906 % current loop for oscope and similar: stylized
10907 \pgfcircdeclarebipolescaled{instruments}
10908 {
10909 \anchor{i}{\northeast\pgf@x=0pt\relax}
10910 \anchor{text}{
10911 \pgfextracty{\pgf@circ@res@up}{\northeast}
10912 \pgfextractx{\pgf@circ@res@left}{\northeast}
10913 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
10914 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10915 }
10916 }
10917 }
10918 {\ctikzvalof{bipoles/iloop/height}}
10919 {iloop}
10920 {\ctikzvalof{bipoles/iloop/height}}
10921 {\ctikzvalof{bipoles/iloop/width}}
10922 {
10923 \pgfextracty{\pgf@circ@res@up}{\northeast}
10924 \pgfextractx{\pgf@circ@res@right}{\northeast}
10925 \pgf@circ@res@down=-\pgf@circ@res@up
10926 \pgf@circ@res@left=-\pgf@circ@res@right
10927 \pgfscope
10928 \pgfstartlinewidth=\pgflinewidth
10929 \pgf@circ@setcolor
10930 % external ellipse
10931 \pgfscope
10932 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10933 % clipping path: first a rectangle bigger then the shape
10934 % to avoid problems with the line thickness
10935 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
10936 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
10937 % next the opening to the left
10938 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
10939 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
10940 % do the difference and clip before drawing
10941 \pgfseteorule
10942 \pgfusepath{clip}
10943 \pgfpathellipse{\pgfpointorigin}{
10944 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
10945 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
10946 \pgfusepath{draw}
10947 \endpgfscope
10948 % internal wire
10949 \pgfsetlinewidth{\pgfstartlinewidth}
10950 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10951 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
10952 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
10953 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10954 % and the contact line up
10955 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
10956 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10957 \pgfusepath{draw}
10958 \endpgfscope
10959 }
10960
10961 % current loop for oscope and similar: real (double connection)
10962 \pgfcircdeclarebipolescaled{instruments}
10963 {
10964 \anchor{i+}{
10965 \pgfextracty{\pgf@circ@res@up}{\northeast}
10966 \pgfextractx{\pgf@circ@res@right}{\northeast}
10967 \pgf@circ@res@step=0.4\pgf@circ@res@right
10968 \pgf@circ@res@other=0.8\pgf@circ@res@up
10969 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
10970 \pgf@y=\pgf@circ@res@up
10971 }
10972 \anchor{i-}{
10973 \pgfextracty{\pgf@circ@res@up}{\northeast}
10974 \pgfextractx{\pgf@circ@res@right}{\northeast}
10975 \pgf@circ@res@step=0.4\pgf@circ@res@right
10976 \pgf@circ@res@other=0.8\pgf@circ@res@up
10977 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
10978 \pgf@y=\pgf@circ@res@up
10979 }
10980 \anchor{text}{
10981 \pgfextracty{\pgf@circ@res@up}{\northeast}
10982 \pgfextractx{\pgf@circ@res@left}{\northeast}
10983 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
10984 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10985 }
10986 }
10987 }
10988 {\ctikzvalof{bipoles/iloop/height}}
10989 {iloop2}
10990 {\ctikzvalof{bipoles/iloop/height}}
10991 {\ctikzvalof{bipoles/iloop/width}}
10992 {
10993 \pgfextracty{\pgf@circ@res@up}{\northeast}
10994 \pgfextractx{\pgf@circ@res@right}{\northeast}
10995 \pgf@circ@res@down=-\pgf@circ@res@up
10996 \pgf@circ@res@left=-\pgf@circ@res@right
10997 % must be the same than internal i+ and i- anchors definition
10998 \pgf@circ@res@step=0.4\pgf@circ@res@right
10999 \pgf@circ@res@other=0.8\pgf@circ@res@up
11000 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
11001 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
11002 \pgfscope
11003 \pgfstartlinewidth=\pgflinewidth
11004 \pgf@circ@setcolor
11005 % external ellipse
11006 \pgfscope
11007 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11008 % clipping path: first a rectangle bigger then the shape
11009 % to avoid problems with the line thickness
11010 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
11011 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
11012 % next the opening to the left
11013 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
11014 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
11015 % do the difference and clip before drawing
11016 \pgfseteorule
11017 \pgfusepath{clip}
11018 \pgfpathmoveto{\@plus}
11019 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
11020 \pgfusepath{draw}
11021 \endpgfscope
11022 % internal wire
11023 \pgfsetlinewidth{\pgfstartlinewidth}
11024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11025 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
11026 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
11027 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11028 % and the contact line up
11029 % I use ...left and ---right as temporal lengths here to avoid defining more
11030 \pgfextractx{\pgf@circ@res@left}{\@plus}
11031 \pgfextractx{\pgf@circ@res@right}{\@minus}
11032 \pgfpathmoveto{\@plus}
11033 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11034 \pgfpathmoveto{\@minus}
11035 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11036 \pgfusepath{draw}
11037 \endpgfscope
11038 }
11039 %% currtap
11040 \pgfcircdeclarebipolescaled{instruments}
11041 {
11042 \savedmacro{\@@dotsize}{\def\@@dotsize{\ctikzvalof{bipoles/currtap/dot size}}}
11043 \anchor{tap}{\northeast\pgf@x=0pt\pgf@y=\@@dotsize\pgf@y\pgf@y=-\pgf@y}
11044 }
11045 {\ctikzvalof{bipoles/currtap/height}}
11046 {currtap}
11047 {\ctikzvalof{bipoles/currtap/height}}
11048 {\ctikzvalof{bipoles/currtap/height}}
11049 {
11050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11051 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@left}{0pt}}
11052 \pgfpatharc{180}{0}{0.95\pgf@circ@res@right}
11053 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11054 \pgfusepath{draw}
11055 \pgf@circ@subset@color@dash{bipoles/currtap}
11056 \pgf@circ@subset@thickness{bipoles/currtap}
11057 \pgfusepath{draw}
11058 \pgfpathcircle{\pgfpoint{0pt}{0pt}}{\@@dotsize*\pgf@circ@res@up}
11059 \pgf@circ@subset@fill@or@draw{bipoles/currtap}
11060 }
11061 % %>>>
11062
11063 % Path definitions for Instruments%<<<
11064
11065 \pgfcirc@activate@bipole@simple{l}{ammeter}
11066 \pgfcirc@activate@bipole@simple{l}{ohmmeter}
11067 \pgfcirc@activate@bipole@simple{l}{voltmeter}
11068 \pgfcirc@activate@bipole@simple{l}{oscope}
11069 \pgfcirc@activate@bipole@simple{l}{rmeter}
11070 \pgfcirc@activate@bipole@simple{l}{rmeterwa}
11071 \pgfcirc@activate@bipole@simple{l}{smeter}
11072 \pgfcirc@activate@bipole@simple{l}{iloop}
11073 \pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2}
11074 \pgfcirc@activate@bipole@simple{l}{currtap}
11075 \pgfcirc@activate@bipole@simple{l}{qvprobe}
11076 \pgfcirc@activate@bipole@simple{l}{qiprobe}
11077 \pgfcirc@activate@bipole@simple{l}{qpprobe}
11078 % %>>>
11079
11080 %%%%%%%%%%%%%%%%%%%%%%%
11081 %% MECHANICAL SYMBOLS
11082 %%%%%%%%%%%%%%%%%%%%%%%
11083
11084 %% Settings for Mechanical section%<<<1
11085 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
11086 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
11087 \ctikzset{bipoles/spring/height/.initial=.5}
11088 \ctikzset{bipoles/spring/width/.initial=.5}
11089 \ctikzset{bipoles/inerter/height/.initial=.7}
11090 \ctikzset{bipoles/inerter/width/.initial=.175}
11091 \ctikzset{bipoles/mass/height/.initial=.55}
11092 \ctikzset{bipoles/mass/box height/.initial=.4}
11093 \ctikzset{bipoles/mass/width/.initial=.5}
11094
11095 \ctikzset{bipoles/damper/height/.initial=.35}
11096 \ctikzset{bipoles/damper/length/.initial=.3}
11097 \ctikzset{bipoles/damper/width/.initial=.4}
11098 %%>>>
11099
11100 %% Node shapes Mechanical analog system%<<<
11101 %% mechanical capacitance - stiffness/spring
11102
11103 \pgfcircdeclarebipolescaled{mechanicals}
11104 {}
11105 {\ctikzvalof{bipoles/spring/height}}
11106 {spring}
11107 {\ctikzvalof{bipoles/spring/height}}
11108 {\ctikzvalof{bipoles/spring/width}}{
11109 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11110 \pgftransformationadjustments
11111
11112 \pgfmathsetlength{\pgf@circ@res@step}
11113 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
11114
11115 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
11116 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
11117 \pgf@circ@res@other = \pgf@circ@res@left
11118 \advance\pgf@circ@res@other by \pgf@circ@res@step
11119 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11120 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11121 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11122 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11124 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11126 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11127 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11128 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11130 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11131 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11132 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11133 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11134 \advance\pgf@circ@res@other by \pgf@circ@res@step
11135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
11136 \pgfsetbuttcap
11137 \pgfsetbeveljoin
11138 \pgfusepath{stroke}
11139 }
11140
11141 %% mechanical capacitance - inerter
11142 \pgfcircdeclarebipolescaled{mechanicals}
11143 {}
11144 {\ctikzvalof{bipoles/inerter/height}}
11145 {inerter}
11146 {\ctikzvalof{bipoles/inerter/height}}
11147 {\ctikzvalof{bipoles/inerter/width}}
11148 {
11149 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11150 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11151 \pgf@circ@draworfill
11152 }
11153
11154
11155 %% mechanical inductance - mass
11156 \pgfcircdeclarebipolescaled{mechanicals}
11157 {}
11158 {\ctikzvalof{bipoles/mass/box height}}
11159 {mass}
11160 {\ctikzvalof{bipoles/mass/height}}
11161 {\ctikzvalof{bipoles/mass/width}}
11162 {
11163 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11164 \pgftransformationadjustments
11165 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11166 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
11167 \pgf@circ@draworfill
11168
11169 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11170 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11171 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11172 \pgfsetrectcap
11173 \pgfsetmiterjoin
11174 \pgfusepath{stroke}
11175 }
11176
11177 %% mechanical resistor - damper
11178 \pgfcircdeclarebipolescaled{mechanicals}
11179 {}
11180 {\ctikzvalof{bipoles/damper/height}}
11181 {damper}
11182 {\ctikzvalof{bipoles/damper/height}}
11183 {\ctikzvalof{bipoles/damper/width}}
11184 {
11185 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11186 \pgf@circ@maybefill
11187
11188 % line into the damper
11189 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11190 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11191 {\pgf@circ@res@zero}}
11192 \pgfusepath{stroke}
11193
11194 % damper box
11195 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11198 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11200
11201 \pgfsetrectcap
11202 \pgfsetmiterjoin
11203 \pgfusepath{stroke}
11204
11205 % damper vertical element
11206 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11207 {.8\pgf@circ@res@down}}
11208 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11209 {.8\pgf@circ@res@up}}
11210 \pgfsetbuttcap
11211 \pgfusepath{stroke}
11212
11213 }
11214 %% mechanical viscoelastic element, suggested by @alex
11215 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
11216 \pgfcircdeclarebipolescaled{mechanicals}
11217 {} % extra anchors
11218 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
11219 {viscoe} % name
11220 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
11221 {\ctikzvalof{bipoles/damper/width}} % width
11222 { % draw the bipole
11223 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11224 \pgf@circ@maybefill
11225
11226 % spring into the damper
11227 \pgfscope
11228 \pgfscope
11229 \pgftransformationadjustments
11230 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11231 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
11232 \pgfpathlineto{\pgfpoint{.95\pgf@circ@res@left}{\pgf@circ@res@zero}}
11233 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
11234 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
11235 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
11236 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
11237 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
11238 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
11239 \pgfsetbuttcap
11240 \pgfsetbeveljoin
11241 \pgfusepath{stroke}
11242 \endpgfscope
11243 \endpgfscope
11244 % damper box
11245 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11246 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11247 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11248 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11249 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11250
11251 \pgfsetrectcap
11252 \pgfsetmiterjoin
11253 \pgfusepath{stroke}
11254
11255 % damper vertical element
11256 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11257 {.8\pgf@circ@res@down}}
11258 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11259 {.8\pgf@circ@res@up}}
11260 \pgfsetbuttcap
11261 \pgfusepath{stroke}
11262
11263 }
11264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11265 %% electromechanical device (motor/generator)
11266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11267
11268 \pgfdeclareshape{elmech}
11269 {
11270 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
11271 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11272 \savedanchor\northwest{
11273 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11274 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
11275 \pgf@y=.5\pgf@y
11276 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
11277 \pgf@x=.5\pgf@x
11278 }
11279 \anchor{center}{
11280 \pgfpointorigin
11281 }
11282 \anchor{text}{
11283 \pgfpointorigin
11284 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
11285 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
11286 }
11287 \anchor{left}{%
11288 \northwest
11289 \pgf@y=0pt
11290 }
11291 \anchor{right}{%
11292 \northwest
11293 \pgf@y=0pt
11294 \pgf@x=-\pgf@x
11295 }
11296 \anchor{top}{
11297 \northwest
11298 \pgf@x=0pt
11299 }
11300 \anchor{pathstart}{
11301 \northwest
11302 \pgf@x=0pt
11303 }
11304 \anchor{pathend}{
11305 \northwest
11306 \pgf@x=0pt
11307 \pgf@y=-\pgf@y
11308 }
11309 \anchor{bottom}{
11310 \northwest
11311 \pgf@x=0pt
11312 \pgf@y=-\pgf@y
11313 }
11314 \anchor{center}{
11315 \pgf@y=0pt
11316 \pgf@x=0pt
11317 }
11318 \anchor{east}{
11319 \northwest
11320 \pgf@y=0pt
11321 \pgf@x=-\pgf@x
11322 }
11323 \anchor{west}{
11324 \northwest
11325 \pgf@y=0pt
11326 }
11327 \anchor{south}{
11328 \northwest
11329 \pgf@x=0pt
11330 \pgf@y=-\pgf@y
11331 }
11332 \anchor{north}{
11333 \northwest
11334 \pgf@x=0pt
11335 }
11336 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
11337 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
11338 \anchor{north west}{ \northwest }
11339 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
11340 \anchorborder{%
11341 \@tempdima=\pgf@x\@tempdimb=\pgf@y
11342 \northwest\pgf@circ@res@other=-\pgf@x
11343 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
11344 }
11345 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
11346 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
11347 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
11348 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
11349 \anchor{block up right}{
11350 \northwest
11351 % remember that pgf@x is negative
11352 % center of the block is at 0.5*H+W*cos(30)/2
11353 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11354 \pgf@x=-0.5\pgf@x
11355 }
11356 \anchor{block up left}{
11357 \northwest
11358 % remember that pgf@x is negative
11359 % center of the block is at 0.5*H+W*cos(30)/2
11360 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11361 \pgf@x=0.5\pgf@x
11362 }
11363 \anchor{block down right}{
11364 \northwest
11365 % remember that pgf@x is negative
11366 % center of the block is at 0.5*H+W*cos(30)/2
11367 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11368 \pgf@y=-\pgf@y
11369 \pgf@x=-0.5\pgf@x
11370 }
11371 \anchor{block down left}{
11372 \northwest
11373 % remember that pgf@x is negative
11374 % center of the block is at 0.5*H+W*cos(30)/2
11375 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11376 \pgf@y=-\pgf@y
11377 \pgf@x=0.5\pgf@x
11378 }
11379 \pgf@circ@draw@component{
11380 \pgf@circ@setcolor
11381 \pgf@circ@scaled@Rlen=\scaledRlen
11382 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
11383 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
11384 \pgfscope
11385 \pgfstartlinewidth=\pgflinewidth
11386 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11387 \pgfscope % clip the bar: whole size minus the circle
11388 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
11389 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
11390 \pgfseteorule
11391 \pgfusepath{clip}
11392 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
11393 \pgf@circ@fill@strokecolor
11394 \pgfusepath{fill, draw}
11395 \endpgfscope
11396 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
11397 \ifx\tikz@fillcolor\pgfutil@empty
11398 % set the default fill color to white
11399 \pgfsetfillcolor{white}
11400 % ...but override it if the class is defined!
11401 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
11402 \else
11403 \pgfsetfillcolor{\tikz@fillcolor}
11404 \pgfusepath{draw, fill}
11405 \fi
11406 \endpgfscope
11407 }
11408 }
11409
11410 % %>>>
11411
11412 %% Path definitions for Mechanical%<<<
11413
11414 \pgf@circ@definetranspath{elmech}
11415 \pgfcirc@activate@bipole@simple{l}{spring}
11416 \pgfcirc@activate@bipole@simple{l}{inerter}
11417 \pgfcirc@activate@bipole@simple{l}{mass}
11418 \pgfcirc@activate@bipole@simple{l}{damper}
11419 \pgfcirc@activate@bipole@simple{l}{viscoe}
11420 % %>>>
11421
11422 %%%%%%%%%%%%%%%%%%%%%%%%%
11423 %% Miscellaneous bipoles
11424 %%%%%%%%%%%%%%%%%%%%%%%%%
11425
11426 % settings for microphone, loudspeaker, fuses and misc%<<<1
11427
11428 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
11429 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
11430 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
11431 \ctikzset{bipoles/mic/height/.initial=1.2}
11432 \ctikzset{bipoles/mic/depth/.initial=.1}
11433 \ctikzset{bipoles/mic/width/.initial=.8}%
11434 \ctikzset{bipoles/tlmic/width/.initial=.5}% it MUST be mic width *5/8
11435 \ctikzset{bipoles/mic/bar thickness/.initial=1}
11436
11437 % arresters, fuses, relais, lamps, etc
11438
11439 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
11440 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
11441 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
11442 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
11443 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
11444 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
11445 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
11446 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
11447 % fuses: normal, asymmetric, wiggle
11448 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
11449 \ctikzset{bipoles/fuse/height/.initial=.20}
11450 \ctikzset{bipoles/fuse/width/.initial=.50}
11451 \ctikzset{bipoles/afuse/height/.initial=.20}
11452 \ctikzset{bipoles/afuse/width/.initial=.50}
11453 \ctikzset{bipoles/lamp/height/.initial=.60}
11454 \ctikzset{bipoles/lamp/width/.initial=.60}
11455 \ctikzset{bipoles/wfuse/height/.initial=.20}
11456 \ctikzset{bipoles/wfuse/width/.initial=.50}
11457 \ctikzset{bipoles/wfuse/shape/.initial=ocirc}
11458 \newif\ifpgf@circ@wfuse@dots\pgf@circ@wfuse@dotstrue
11459 \ctikzset{bipoles/wfuse/dots/.is choice}
11460 \ctikzset{bipoles/wfuse/dots/.is if=pgf@circ@wfuse@dots}
11461 %
11462 \ctikzset{bipoles/relais/height/.initial=.8}
11463 \ctikzset{bipoles/relais/width/.initial=.3}
11464 %
11465 \ctikzset{bipoles/bulb/height/.initial=.8}
11466 \ctikzset{bipoles/bulb/width/.initial=.8}
11467 \ctikzset{bipoles/wbulb/height/.initial=.8}
11468 \ctikzset{bipoles/wbulb/width/.initial=.8}
11469 % suggested by @bogger33, see https://github.com/circuitikz/circuitikz/issues/793
11470 \ctikzset{bipoles/neonlampcc/height/.initial=.60}
11471 \ctikzset{bipoles/neonlampac/height/.initial=.60}
11472 \pgf@circ@declare@family@arrows{sparkgap}
11473 \newif\ifpgf@sparkgap@dot
11474 \newif\ifpgf@sparkgap@circle
11475 \ctikzset{sparkgap/circle/.is if=pgf@sparkgap@circle}
11476 \ctikzset{sparkgap/dot/.is if=pgf@sparkgap@dot}
11477 \ctikzset{sparkgap/gap/.initial=.05}
11478 \ctikzset{bipoles/sparkgap/height/.initial=.60}
11479 %
11480 \ctikzset{bipoles/squid/height/.initial=.60}
11481 \ctikzset{bipoles/squid/width/.initial=.60}
11482 \ctikzset{bipoles/barrier/height/.initial=.21}
11483 \ctikzset{bipoles/barrier/width/.initial=.0}
11484 \ctikzset{bipoles/openbarrier/width/.initial=.3}
11485 \ctikzset{bipoles/openbarrier/gap/.initial=1}
11486 \ctikzset{bipoles/thermocouple/height/.initial=.250}
11487 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
11488 \ctikzset{bipoles/thermocouple/width/.initial=.140}
11489 \newif\ifpgf@circuit@europeangfsurgearrester
11490 \ctikzset{gas filled surge arrester choice/.is choice}
11491 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
11492 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
11493
11494 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
11495 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
11496 %%>>>
11497
11498 %% Node shapes for miscellaneous symbols %<<<
11499 %% loudspeaker and microphone
11500
11501 \pgfcircdeclarebipolescaled{misc}
11502 {}
11503 {\ctikzvalof{bipoles/loudspeaker/depth}}
11504 {loudspeaker}
11505 {\ctikzvalof{bipoles/loudspeaker/height}}
11506 {\ctikzvalof{bipoles/loudspeaker/width}}{
11507
11508 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
11509 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11510 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
11511 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
11512 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
11513 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
11514 \pgfpathclose
11515 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11516 \pgf@circ@draworfill
11517 }
11518
11519 \def\pgf@circ@draw@mic@bar#1{%relative length of the bar
11520 \pgfsetroundcap
11521 \pgfsetlinewidth{\ctikzvalof{bipoles/mic/bar thickness}\pgflinewidth}%
11522 % adjust the vertical position; the symbol looks better if the circle touch the bar
11523 \pgfpathmoveto{\pgfpoint{#1\pgf@circ@res@left}{\pgf@circ@res@up+0.4\pgflinewidth}}
11524 \pgfpathlineto{\pgfpoint{#1\pgf@circ@res@right}{\pgf@circ@res@up+0.4\pgflinewidth}}
11525 \pgfusepath{draw}
11526 }
11527
11528 \pgfcircdeclarebipolescaled{misc}
11529 {}
11530 {\ctikzvalof{bipoles/mic/depth}}
11531 {mic}
11532 {\ctikzvalof{bipoles/mic/height}}
11533 {\ctikzvalof{bipoles/mic/width}}{
11534
11535 \pgfscope
11536 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11537 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
11538 \pgf@circ@draworfill
11539 \pgf@circ@draw@mic@bar{.6}
11540 \endpgfscope
11541 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11542 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
11543 % 0.25358 is 0.6-0.4*cos(30)
11544 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
11545 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
11546 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
11547 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11548 \pgfusepath{draw}
11549 }
11550 \pgfcircdeclarebipolescaled{misc}
11551 {}
11552 {\ctikzvalof{bipoles/tlmic/width}}
11553 {tlmic}
11554 {\ctikzvalof{bipoles/tlmic/width}}
11555 {\ctikzvalof{bipoles/tlmic/width}}{
11556
11557 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11558 \pgfpathcircle{\pgfpoint{0pt}{0pt}}{\pgf@circ@res@up}
11559 \pgf@circ@draworfill
11560 \pgf@circ@draw@mic@bar{1}
11561 }
11562
11563 %% european gas filled surge arrester
11564 \pgfcircdeclarebipolescaled{misc}
11565 {}
11566 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
11567 {european gas filled surge arrester}
11568 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
11569 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
11570 {
11571
11572 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11573 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11574
11575 \pgf@circ@draworfill
11576
11577 \pgfscope
11578 \pgfsetarrowsend{latexslim}
11579 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11580 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
11581 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11582 \pgfusepath{draw}
11583
11584 \endpgfscope
11585 }
11586
11587 %% american gas filled surge arrester
11588 \pgfcircdeclarebipolescaled{misc}
11589 {}
11590 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
11591 {american gas filled surge arrester}
11592 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
11593 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
11594
11595 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11596 \pgf@circ@res@other=-\pgf@circ@res@up
11597 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
11598 \pgfusepath{draw}
11599
11600 \pgfscope
11601 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11602 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
11603 \pgf@circ@draworfill
11604 \endpgfscope
11605
11606 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
11607 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11608 \pgfusepath{draw}
11609
11610 \pgfscope
11611 \pgfsetarrowsend{latex}
11612
11613 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11614 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
11615 \pgfusepath{draw}
11616
11617 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11618 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
11619 \pgfusepath{draw}
11620 \endpgfscope{}
11621
11622 \pgfpathcircle{\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}
11623 \pgfusepath{fill}
11624 }
11625
11626 %% thermocouple
11627 \pgfcircdeclarebipolescaled{misc}
11628 {}
11629 {\ctikzvalof{bipoles/thermocouple/height 2}}
11630 {thermocouple}
11631 {\ctikzvalof{bipoles/thermocouple/height}}
11632 {\ctikzvalof{bipoles/thermocouple/width}}
11633 {
11634 \pgfsetrectcap
11635 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11636 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
11637 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
11638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
11639 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11640 \pgfusepath{draw}
11641 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11642 \pgfsetroundcap
11643 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
11644 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
11645 \pgfusepath{draw}
11646 }
11647 %% fuse
11648 \pgfcircdeclarebipolescaled{misc}
11649 {}
11650 {\ctikzvalof{bipoles/fuse/height}}
11651 {fuse}
11652 {\ctikzvalof{bipoles/fuse/height}}
11653 {\ctikzvalof{bipoles/fuse/width}}
11654 {
11655 \pgfscope
11656 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11658 \pgf@circ@draworfill
11659 \endpgfscope
11660
11661 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11662 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11663 \pgfusepath{draw}
11664
11665 }
11666 %% asymmetric fuse
11667 \pgfcircdeclarebipolescaled{misc}
11668 {}
11669 {\ctikzvalof{bipoles/afuse/height}}
11670 {afuse}
11671 {\ctikzvalof{bipoles/afuse/height}}
11672 {\ctikzvalof{bipoles/afuse/width}}
11673 {
11674 \pgfscope
11675 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11676 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11677 \pgf@circ@draworfill
11678 \endpgfscope
11679
11680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11682 \pgfusepath{draw}
11683
11684 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11685 \pgf@circ@fill@strokecolor
11686 \pgfusepath{stroke,fill}
11687 }
11688 %% wiggly fuse
11689 \pgfcircdeclarebipolescaled{misc}
11690 {
11691 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
11692 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/wfuse/shape}}}
11693 }
11694 {\ctikzvalof{bipoles/wfuse/height}}
11695 {wfuse}
11696 {\ctikzvalof{bipoles/wfuse/height}}
11697 {\ctikzvalof{bipoles/wfuse/width}}
11698 {
11699 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11700 \pgfpatharc{0}{180}{.5\pgf@circ@res@left}
11701 \pgfpatharc{0}{-180}{.5\pgf@circ@res@left}
11702 \pgfusepath{draw}
11703 \ifpgf@circ@wfuse@dots
11704 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
11705 \pgfnode{\cshape}{center}{}{\thisshape-left}{\pgfusepath{draw}}
11706 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
11707 \pgfnode{\cshape}{center}{}{\thisshape-right}{\pgfusepath{draw}}
11708 \fi
11709 }
11710
11711 %% Relais
11712 \pgfcircdeclarebipolescaled{misc}
11713 {}
11714 {\ctikzvalof{bipoles/relais/height}}
11715 {relais}
11716 {\ctikzvalof{bipoles/relais/height}}
11717 {\ctikzvalof{bipoles/relais/width}}
11718 {
11719 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11720 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11721 \pgf@circ@draworfill
11722 \pgfscope
11723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11725 \pgfusepath{draw}
11726 \endpgfscope
11727 }
11728
11729 %% SQUID added by Cor Molenaar 5 March 2010
11730 \pgfcircdeclarebipolescaled{misc}
11731 {}
11732 {\ctikzvalof{bipoles/squid/height}}
11733 {squid}
11734 {\ctikzvalof{bipoles/squid/height}}
11735 {\ctikzvalof{bipoles/squid/width}}
11736 {
11737 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11738
11739 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
11740 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
11741 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
11742 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
11743 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
11744 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
11745 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
11746 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
11747 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
11748
11749 \pgfusepath{draw}
11750 }
11751
11752 % Generic barrier added by Cor Molenaar 5 March 2010
11753 \pgfcircdeclarebipolescaled{misc}
11754 {}
11755 {\ctikzvalof{bipoles/barrier/height}}
11756 {barrier}
11757 {\ctikzvalof{bipoles/barrier/height}}
11758 {\ctikzvalof{bipoles/barrier/width}}
11759 {
11760 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
11761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
11762 \pgfusepath{draw}
11763 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@up}}
11765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@down}}
11766 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@down}}
11767 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
11768 \pgfusepath{draw}
11769 }
11770
11771 % open version of the barrier symbol
11772 % suggested by Radványi Patrik Tamás <[email protected]>
11773 \pgfcircdeclarebipolescaled{misc}
11774 {}
11775 {\ctikzvalof{bipoles/barrier/height}}
11776 {openbarrier}
11777 {\ctikzvalof{bipoles/barrier/height}}
11778 {\ctikzvalof{bipoles/openbarrier/width}}
11779 {
11780 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11781 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
11782 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11783 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
11784 \pgfusepath{draw}
11785 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11786 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@up}}
11787 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@down}}
11788 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@down}}
11789 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
11790 \pgfusepath{draw}
11791 }
11792
11793 %% Lamp
11794 \pgfcircdeclarebipolescaled{misc}
11795 {}
11796 {\ctikzvalof{bipoles/lamp/height}}
11797 {lamp}
11798 {\ctikzvalof{bipoles/lamp/height}}
11799 {\ctikzvalof{bipoles/lamp/width}}
11800 {
11801 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11802
11803 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
11804 \pgf@circ@draworfill
11805 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
11806 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
11807 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
11808 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
11809 \pgfusepath{draw}
11810 }
11811
11812 %% bulb
11813 \pgfcircdeclarebipolescaled{misc}
11814 {}
11815 {\ctikzvalof{bipoles/bulb/height}}
11816 {bulb}
11817 {\ctikzvalof{bipoles/bulb/height}}
11818 {\ctikzvalof{bipoles/bulb/width}}
11819 {%
11820 % circles are smaller than the size of the component, for historical reasons.
11821 % Join the circle to the wires
11822 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11823 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
11824 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11825 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
11826 \pgfusepath{draw}
11827 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11828 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
11829 \pgf@circ@draworfill
11830 \pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
11831 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
11832 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
11833 \pgfsetbeveljoin
11834 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
11835 \pgfusepath{draw}
11836 }%
11837 % Wiggly bulbm see https://github.com/circuitikz/circuitikz/issues/845
11838 \pgfcircdeclarebipolescaled{misc}
11839 {}
11840 {\ctikzvalof{bipoles/wbulb/height}}
11841 {wbulb}
11842 {\ctikzvalof{bipoles/wbulb/height}}
11843 {\ctikzvalof{bipoles/wbulb/width}}
11844 {%
11845 % circles are smaller than the size of the component, for historical reasons.
11846 % Join the circle to the wires
11847 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11848 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
11849 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11850 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
11851 \pgfusepath{draw}
11852 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11853 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
11854 \pgf@circ@draworfill
11855 \pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
11856 % CP: Control Point; FP: Final Point
11857 \pgfpathcurveto
11858 {\pgfpoint{0.5\pgf@circ@res@left}{+0pt}} % CP1
11859 {\pgfpoint{0.4\pgf@circ@res@left}{0.6\pgf@circ@res@left}} % CP2
11860 {\pgfpoint{+0pt}{+0pt}} % FPA
11861 \pgfpathcurveto
11862 {\pgfpoint{.2\pgf@circ@res@right}{.2\pgf@circ@res@right}} % CP3
11863 {\pgfpoint{.2\pgf@circ@res@right}{0.6\pgf@circ@res@right}} % CP4
11864 {\pgfpoint{+0pt}{0.6\pgf@circ@res@right}} % FPB
11865 \pgfpathcurveto
11866 {\pgfpoint{.2\pgf@circ@res@left}{0.6\pgf@circ@res@right}} % symmetric to CP4
11867 {\pgfpoint{.2\pgf@circ@res@left}{.2\pgf@circ@res@right}} % symmetric to CP3
11868 {\pgfpoint{+0pt}{+0pt}} % same as FPA
11869 \pgfpathcurveto
11870 {\pgfpoint{0.4\pgf@circ@res@right}{0.6\pgf@circ@res@left}} % symmetric to CP2
11871 {\pgfpoint{0.5\pgf@circ@res@right}{+0pt}} % symmetric to CP1
11872 {\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}} % symmetric to FPB
11873 \pgfusepath{draw}
11874 }%
11875 % neon lamps, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/793
11876 % implemented by Romano
11877 % double-cathode (capacitor) style
11878 \pgfcircdeclarebipolescaled{misc}
11879 {}
11880 {\ctikzvalof{bipoles/neonlampcc/height}}
11881 {neonlampcc}
11882 {\ctikzvalof{bipoles/neonlampcc/height}}
11883 {\ctikzvalof{bipoles/neonlampcc/height}}
11884 {
11885 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11886 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
11887 \pgf@circ@draworfill
11888 %% leads in
11889 \pgfsetlinewidth{\pgfstartlinewidth}
11890 \def\@@w{0.2}\def\@@h{0.6}
11891 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11892 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}}
11893 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11894 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
11895 %% "capacitor style" symbol
11896 \pgfusepath{draw}
11897 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11898 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}}
11899 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@up}}
11900 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}}
11901 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}}
11902 \pgfusepath{draw}
11903 %% dot
11904 \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@left-3*\ctikzvalof{nodes width}\pgf@circ@Rlen}
11905 {\@@h\pgf@circ@res@down + 2*\ctikzvalof{nodes width}\pgf@circ@Rlen}}
11906 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
11907 }
11908 % anode-cathode style
11909 \pgfcircdeclarebipolescaled{misc}
11910 {}
11911 {\ctikzvalof{bipoles/neonlampac/height}}
11912 {neonlampac}
11913 {\ctikzvalof{bipoles/neonlampac/height}}
11914 {\ctikzvalof{bipoles/neonlampac/height}}
11915 {
11916 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11917 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
11918 \pgf@circ@draworfill
11919 %% leads in
11920 \pgfsetlinewidth{\pgfstartlinewidth}
11921 \def\@@w{0.5}\def\@@h{0.5}
11922 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11923 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}}
11924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11925 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
11926 \pgfusepath{draw}
11927 %% one terminal is a straight plate
11928 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11929 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}}
11930 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}}
11931 \pgfusepath{draw}
11932 %% the other is an "ocirc" shape
11933 \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
11934 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw,fill}}
11935 %% dot
11936 \pgftransformshift{\pgfpoint{-\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}}
11937 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
11938 }
11939 % spark gap, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/800
11940 \pgfcircdeclarebipolescaled{misc}
11941 {
11942 \savedmacro{\changeh}{\edef\changeh{\ifpgf@sparkgap@circle 1 \else 0.5 \fi}}
11943 \pgfcirc@border@extend@updown{\changeh}{\changeh}
11944 }
11945 {\ctikzvalof{bipoles/sparkgap/height}}
11946 {sparkgap}
11947 {\ctikzvalof{bipoles/sparkgap/height}}
11948 {\ctikzvalof{bipoles/sparkgap/height}}{
11949 % circle (if requested)
11950 \pgfscope
11951 \ifpgf@sparkgap@circle
11952 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11953 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up}
11954 \pgf@circ@draworfill
11955 \fi
11956 \endpgfscope
11957 % arrows
11958 \pgfscope
11959 \pgfcirc@set@arrows{sparkgap}{}{Triangle[scale=2]}
11960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11961 \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@right}{0pt}}
11962 \pgfusepath{draw}
11963 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11964 \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@left}{0pt}}
11965 \pgfusepath{draw}
11966 \endpgfscope{}
11967 % dot (if requested)
11968 \ifpgf@sparkgap@dot
11969 \pgftransformshift{\pgfpoint
11970 {\ctikzvalof{sparkgap/gap}\pgf@circ@res@left-1*\ctikzvalof{nodes width}\pgf@circ@Rlen}
11971 {-4*\ctikzvalof{nodes width}\pgf@circ@Rlen}}
11972 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
11973 \fi
11974 }
11975
11976 %>>>
11977
11978 %% Path definitions for Miscellaneous%<<<
11979
11980 \pgfcirc@activate@bipole@simple{l}{lamp}
11981 \pgfcirc@activate@bipole@simple{l}{neonlampcc}
11982 \pgfcirc@activate@bipole@simple{l}{neonlampac}
11983 \pgfcirc@activate@bipole@simple{l}{sparkgap}
11984 \pgfcirc@activate@bipole@simple{l}{bulb}
11985 \pgfcirc@activate@bipole@simple{l}{wbulb}
11986 \pgfcirc@activate@bipole@simple{l}{squid}
11987 \pgfcirc@activate@bipole@simple{l}{barrier}
11988 \pgfcirc@activate@bipole@simple{l}{openbarrier}
11989 \pgfcirc@activate@bipole@simple{l}{thermocouple}
11990 \pgfcirc@activate@bipole@simple{l}{fuse}
11991 \pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse}
11992 \pgfcirc@style@to@style{asymmetric fuse}{afuse}
11993 \pgfcirc@activate@bipole@simple{l}{wfuse}
11994 \pgfcirc@activate@bipole{l}{wfuse}{wfuse}{wiggly fuse}
11995 \pgfcirc@activate@bipole@simple{l}{relais}
11996 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
11997 \pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester}
11998 \pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester}
11999 \pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{}
12000 \pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{}
12001 \pgfcirc@activate@bipole@simple{l}{mic}
12002 \pgfcirc@activate@bipole@simple{l}{tlmic}
12003 \pgfcirc@activate@bipole@simple{l}{loudspeaker}
12004 % %>>>
12005
12006 %% Buzzer and reverse buzzer %<<<
12007 \ctikzset{bipoles/buzzer/height/.initial=0.6}
12008 \ctikzset{bipoles/buzzer/width/.initial=.4}%
12009 \ctikzset{bipoles/buzzer/span/.initial=.6}%
12010
12011 \pgfcircdeclarebipolescaled{misc}
12012 {}
12013 {0}
12014 {buzzer}
12015 {\ctikzvalof{bipoles/buzzer/height}}
12016 {\ctikzvalof{bipoles/buzzer/width}}{
12017 % this is the height of the semicircle
12018 \pgf@circ@res@other=\dimexpr\pgf@circ@res@up-\pgf@circ@res@right\relax
12019 \pgfscope
12020 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12021 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@other}}
12022 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
12023 \pgfpatharc{0}{180}{\pgf@circ@res@right}
12024 \pgfpathclose
12025 \pgf@circ@draworfill
12026 \endpgfscope
12027 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{\pgf@circ@res@other}}
12028 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{0pt}}
12029 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12030 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{\pgf@circ@res@other}}
12031 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{0pt}}
12032 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12033 \pgfusepath{draw}
12034 }
12035 \pgfcirc@activate@bipole@simple{l}{buzzer}
12036 %
12037 \pgfcircdeclarebipolescaled{misc}
12038 {}
12039 {0}
12040 {rbuzzer}
12041 {\ctikzvalof{bipoles/buzzer/height}}
12042 {\ctikzvalof{bipoles/buzzer/width}}{
12043 % this is the height of the semicircle
12044 \pgf@circ@res@other=\dimexpr\pgf@circ@res@up-\pgf@circ@res@right\relax
12045 % this is the height where the pins touch the semicircle
12046 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@res@up-
12047 \pgf@circ@res@right*sqrt(1-\ctikzvalof{bipoles/buzzer/span}*\ctikzvalof{bipoles/buzzer/span})}
12048 \pgfscope
12049 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12051 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12052 \pgfpatharc{0}{-180}{\pgf@circ@res@right}
12053 \pgfpathclose
12054 \pgf@circ@draworfill
12055 \endpgfscope
12056 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{\pgf@circ@res@temp}}
12057 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{0pt}}
12058 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12059 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{\pgf@circ@res@temp}}
12060 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{0pt}}
12061 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12062 \pgfusepath{draw}
12063 }
12064 \pgfcirc@activate@bipole@simple{l}{rbuzzer}
12065 % %>>>
12066
12067 % end of pgfcircbipoles.tex
12068 % vim: set fdm=marker fmr=%<<<,%>>>:
12069 %%%---------- close: tex/pgfcircbipoles
12070 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
12071 %%%---------- open: tex/pgfcirctripoles.tex
12072 % Copyright 2018-2026 by Romano Giannetti
12073 % Copyright 2015-2026 by Stefan Lindner
12074 % Copyright 2013-2026 by Stefan Erhardt
12075 % Copyright 2007-2026 by Massimo Redaelli
12076 %
12077 % This file may be distributed and/or modified
12078 %
12079 % 1. under the LaTeX Project Public License and/or
12080 % 2. under the GNU Public License.
12081 %
12082 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12083
12084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12085 %% Tripoles
12086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12087
12088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12089 %% Logic Ports
12090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12091
12092 %% Settings for Logic ports%<<<1
12093 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
12094
12095 % switches for logic gates
12096 %
12097 \pgfkeys{/tikz/number inputs/.initial=0}
12098 \pgfkeys{/tikz/number inputs/.default=0}
12099 % by default, use the default font (and color, etc.)
12100 \ctikzset{european ports font/.initial={}}
12101 \newif\ifpgf@circuit@europeanlogicport
12102 \ctikzset{logic ports/.is choice}
12103 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
12104 \tikzset{and port/.style={shape=european and port}}%
12105 \tikzset{or port/.style={shape=european or port}}%
12106 \tikzset{xor port/.style={shape=european xor port}}%
12107 \tikzset{buffer port/.style={shape=european buffer port}}%
12108 \tikzset{not port/.style={shape=european not port}}%
12109 \tikzset{nand port/.style={shape=european nand port}}%
12110 \tikzset{nor port/.style={shape=european nor port}}%
12111 \tikzset{xnor port/.style={shape=european xnor port}}%
12112 \tikzset{blank port/.style={shape=european blank port}}%
12113 \tikzset{blank not port/.style={shape=european blank not port}}%
12114 % there is no Schmitt ports in european style (yet)
12115 \tikzset{schmitt port/.style={shape=schmitt}}%
12116 \tikzset{invschmitt port/.style={shape=invschmitt}}%
12117 }}
12118 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
12119 \tikzset{and port/.style={shape=american and port}}%
12120 \tikzset{or port/.style={shape=american or port}}%
12121 \tikzset{xor port/.style={shape=american xor port}}%
12122 \tikzset{buffer port/.style={shape=american buffer port}}%
12123 \tikzset{not port/.style={shape=american not port}}%
12124 \tikzset{nand port/.style={shape=american nand port}}%
12125 \tikzset{nor port/.style={shape=american nor port}}%
12126 \tikzset{xnor port/.style={shape=american xnor port}}%
12127 \tikzset{schmitt port/.style={shape=schmitt}}%
12128 \tikzset{invschmitt port/.style={shape=invschmitt}}%
12129 %%% there are no blank ports for american (no sense to have them)
12130 \tikzset{blank port/.style={shape=european blank port}}%
12131 \tikzset{blank not port/.style={shape=european blank not port}}%
12132 }}
12133
12134 \ctikzset{logic ports origin/.is choice}
12135 \ctikzset{logic ports origin/legacy/.code={
12136 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
12137 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
12138 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
12139 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
12140 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
12141 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
12142 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
12143 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
12144 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
12145 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
12146 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
12147 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
12148 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
12149 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
12150 \ctikzset{tripoles/european blank port/origin/.initial=0.8}%
12151 \ctikzset{tripoles/european blank not port/origin/.initial=0.8}%
12152 }%
12153 }
12154 \ctikzset{logic ports origin/center/.code={%
12155 \ctikzset{tripoles/american and port/origin/.initial=0}%
12156 \ctikzset{tripoles/american nand port/origin/.initial=0}%
12157 \ctikzset{tripoles/american nor port/origin/.initial=0}%
12158 \ctikzset{tripoles/american or port/origin/.initial=0}%
12159 \ctikzset{tripoles/american xor port/origin/.initial=0}%
12160 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
12161 \ctikzset{tripoles/european and port/origin/.initial=0}%
12162 \ctikzset{tripoles/european nand port/origin/.initial=0}%
12163 \ctikzset{tripoles/european or port/origin/.initial=0}%
12164 \ctikzset{tripoles/european nor port/origin/.initial=0}%
12165 \ctikzset{tripoles/european xor port/origin/.initial=0}%
12166 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
12167 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
12168 \ctikzset{tripoles/european not port/origin/.initial=0}%
12169 \ctikzset{tripoles/european blank port/origin/.initial=0}%
12170 \ctikzset{tripoles/european blank not port/origin/.initial=0}%
12171 }%
12172 }
12173
12174 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
12175 \ctikzset{american or shape/.is choice}
12176 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
12177 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
12178
12179 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
12180 \ctikzset{logic ports draw input leads/.is choice}
12181 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
12182 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
12183 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
12184 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
12185
12186 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
12187 \ctikzset{logic ports draw output leads/.is choice}
12188 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
12189 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
12190 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
12191 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
12192
12193 \ctikzset{logic ports draw leads/.is choice}
12194 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
12195 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
12196 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
12197 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
12198
12199 % adding a different style of xnor port
12200 % see https://github.com/circuitikz/circuitikz/issues/467
12201 \ctikzset{european xnor style/.is choice}
12202 \ctikzset{european xnor style/default/.code={%
12203 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
12204 }
12205 \ctikzset{european xnor style/direct/.code={%
12206 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
12207 }
12208
12209
12210 % old, legacy keys that should be killed over
12211 \ctikzset{bipoles/buffer/height/.initial=1}
12212 \ctikzset{bipoles/buffer/width/.initial=1}
12213 \ctikzset{bipoles/not port/width/.initial=1}
12214 \ctikzset{bipoles/not port/height/.initial=.8}
12215 \ctikzset{bipoles/not port/circle width/.initial=.15}
12216
12217 \ctikzset{tripoles/american and port/width/.initial=1.1}
12218 \ctikzset{tripoles/american and port/height/.initial=.8}
12219 \ctikzset{tripoles/american and port/port width/.initial=.7}
12220 \ctikzset{tripoles/american and port/input height/.initial=.5}
12221 \ctikzset{tripoles/american nand port/width/.initial=1.1}
12222 \ctikzset{tripoles/american nand port/height/.initial=.8}
12223 \ctikzset{tripoles/american nand port/port width/.initial=.7}
12224 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
12225 \ctikzset{tripoles/american nand port/input height/.initial=.5}
12226 \ctikzset{tripoles/american or port/width/.initial=1.1}
12227 \ctikzset{tripoles/american or port/height/.initial=.8}
12228 \ctikzset{tripoles/american or port/port width/.initial=.7}
12229 \ctikzset{tripoles/american or port/input height/.initial=.5}
12230 \ctikzset{tripoles/american or port/input skip/.initial=.25}
12231 \ctikzset{tripoles/american or port/aaa/.initial=.6}
12232 \ctikzset{tripoles/american or port/bbb/.initial=.4}
12233 \ctikzset{tripoles/american or port/ccc/.initial=.5}
12234 \ctikzset{tripoles/american or port/ddd/.initial=.0}
12235 \ctikzset{tripoles/american nor port/width/.initial=1.1}
12236 \ctikzset{tripoles/american nor port/height/.initial=.8}
12237 \ctikzset{tripoles/american nor port/port width/.initial=.7}
12238 \ctikzset{tripoles/american nor port/input height/.initial=.5}
12239 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
12240 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
12241 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
12242 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
12243 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
12244 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
12245 \ctikzset{tripoles/american xor port/width/.initial=1.1}
12246 \ctikzset{tripoles/american xor port/height/.initial=.8}
12247 \ctikzset{tripoles/american xor port/port width/.initial=.7}
12248 \ctikzset{tripoles/american xor port/input height/.initial=.5}
12249 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
12250 \ctikzset{tripoles/american xor port/distance/.initial=.1}
12251 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
12252 \ctikzset{tripoles/american xnor port/height/.initial=.8}
12253 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
12254 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
12255 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
12256 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
12257 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
12258 \ctikzset{tripoles/american and port/origin/.initial=0.8}
12259 \ctikzset{tripoles/american and port/inputs/.initial=2}
12260 % variable number of inputs
12261 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
12262 \ctikzset{tripoles/american nand port/inputs/.initial=2}
12263 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
12264 \ctikzset{tripoles/american nor port/inputs/.initial=2}
12265 \ctikzset{tripoles/american nor port/angle/.initial=70}
12266 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
12267 \ctikzset{tripoles/american or port/origin/.initial=0.8}
12268 \ctikzset{tripoles/american or port/inputs/.initial=2}
12269 \ctikzset{tripoles/american or port/angle/.initial=70}
12270 \ctikzset{tripoles/american or port/inner/.initial=0.3}
12271 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
12272 \ctikzset{tripoles/american xor port/inputs/.initial=2}
12273 \ctikzset{tripoles/american xor port/angle/.initial=70}
12274 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
12275 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
12276 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
12277 \ctikzset{tripoles/american xnor port/angle/.initial=70}
12278 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
12279 %
12280 \ctikzset{tripoles/european and port/width/.initial=1.4}
12281 \ctikzset{tripoles/european and port/height/.initial=.65}
12282 \ctikzset{tripoles/european and port/reserved/.initial=.6}
12283 \ctikzset{tripoles/european and port/input height/.initial=.6}
12284 \ctikzset{tripoles/european or port/width/.initial=1.4}
12285 \ctikzset{tripoles/european or port/height/.initial=.65}
12286 \ctikzset{tripoles/european or port/reserved/.initial=.6}
12287 \ctikzset{tripoles/european or port/input height/.initial=.6}
12288 \ctikzset{tripoles/european xor port/width/.initial=1.4}
12289 \ctikzset{tripoles/european xor port/height/.initial=.65}
12290 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
12291 \ctikzset{tripoles/european xor port/input height/.initial=.6}
12292 \ctikzset{tripoles/european nand port/width/.initial=1.4}
12293 \ctikzset{tripoles/european nand port/not height/.initial=.3}
12294 \ctikzset{tripoles/european nand port/not width/.initial=.9}
12295 \ctikzset{tripoles/european nand port/height/.initial=.65}
12296 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
12297 \ctikzset{tripoles/european nand port/input height/.initial=.6}
12298 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
12299 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
12300 \ctikzset{tripoles/european buffer port/not width/.initial=.9}
12301 \ctikzset{tripoles/european buffer port/height/.initial=.65}
12302 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
12303 \ctikzset{tripoles/european buffer port/input height/.initial=0}
12304 \ctikzset{tripoles/european not port/width/.initial=1.4}
12305 \ctikzset{tripoles/european not port/not height/.initial=.3}
12306 \ctikzset{tripoles/european not port/not width/.initial=.9}
12307 \ctikzset{tripoles/european not port/height/.initial=.65}
12308 \ctikzset{tripoles/european not port/reserved/.initial=.6}
12309 \ctikzset{tripoles/european not port/input height/.initial=0}
12310 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
12311 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
12312 \ctikzset{tripoles/european xnor port/not width/.initial=.9}
12313 \ctikzset{tripoles/european xnor port/height/.initial=.65}
12314 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
12315 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
12316 \ctikzset{tripoles/european nor port/width/.initial=1.4}
12317 \ctikzset{tripoles/european nor port/not height/.initial=.3}
12318 \ctikzset{tripoles/european nor port/not width/.initial=.9}
12319 \ctikzset{tripoles/european nor port/height/.initial=.65}
12320 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
12321 \ctikzset{tripoles/european nor port/input height/.initial=.6}
12322 % variable number of inputs
12323 \ctikzset{tripoles/european and port/origin/.initial=0.8}
12324 \ctikzset{tripoles/european and port/inputs/.initial=2}
12325 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
12326 \ctikzset{tripoles/european nand port/inputs/.initial=2}
12327 \ctikzset{tripoles/european or port/origin/.initial=0.8}
12328 \ctikzset{tripoles/european or port/inputs/.initial=2}
12329 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
12330 \ctikzset{tripoles/european nor port/inputs/.initial=2}
12331 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
12332 \ctikzset{tripoles/european xor port/inputs/.initial=2}
12333 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
12334 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
12335 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
12336 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
12337 \ctikzset{tripoles/european not port/origin/.initial=0.8}
12338 \ctikzset{tripoles/european not port/inputs/.initial=1}%
12339 %% "blank" ports
12340 \ctikzset{tripoles/european blank port/width/.initial=1.4}
12341 \ctikzset{tripoles/european blank port/height/.initial=.65}
12342 \ctikzset{tripoles/european blank port/reserved/.initial=.6}
12343 \ctikzset{tripoles/european blank port/input height/.initial=.6}
12344 \ctikzset{tripoles/european blank not port/width/.initial=1.4}
12345 \ctikzset{tripoles/european blank not port/not height/.initial=.3}
12346 \ctikzset{tripoles/european blank not port/not width/.initial=.9}
12347 \ctikzset{tripoles/european blank not port/height/.initial=.65}
12348 \ctikzset{tripoles/european blank not port/reserved/.initial=.6}
12349 \ctikzset{tripoles/european blank not port/input height/.initial=.6}
12350 \ctikzset{tripoles/european blank port/origin/.initial=0.8}
12351 \ctikzset{tripoles/european blank port/inputs/.initial=2}
12352 \ctikzset{tripoles/european blank not port/origin/.initial=0.8}
12353 \ctikzset{tripoles/european blank not port/inputs/.initial=2}
12354 %%% parameters that are not used anymore after multi-input
12355 %%% gates --- left for compatibility of source code.
12356 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
12357 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
12358 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
12359 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
12360 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
12361 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
12362 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
12363 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
12364 %%>>>
12365
12366 %% Node shapes for Logic ports%<<<
12367 %%
12368 %% Code from John Kormylo at tex.stackexchange.com
12369 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
12370 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
12371 %%
12372
12373 \newcount\pgf@circ@res@count% reserve global register
12374
12375 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
12376 {%
12377 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12378 \step
12379 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12380 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12381 }%
12382
12383 % #1 = \pgfmathcounter #2=type #3 specificic port
12384 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
12385 \def\pgf@circ@logicport@baseinput#1#2#3%
12386 {%
12387 % and and nand
12388 \ifnum #2=1\relax
12389 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12390 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12391 \step
12392 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12393 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12394 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
12395 \fi
12396 % or and nor
12397 \ifnum #2=2\relax
12398 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12399 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12400 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12401 \step
12402 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12403 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12404 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
12405 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
12406 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12407 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12408 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
12409 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12410 \pgf@circ@res@temp=\pgf@y
12411 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12412 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12413 \pgf@x=\pgf@circ@res@other
12414 \fi
12415 % xor and xnor
12416 \ifnum #2=3\relax
12417 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12418 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12419 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12420 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
12421 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
12422 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12423 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
12424 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
12425 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12426 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
12427 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
12428 % this compensates for the effect of the line width on the gap between the arcs
12429 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
12430 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
12431
12432 \step
12433 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12434 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12435 \pgf@circ@res@temp=\pgf@y
12436 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
12437 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12438 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
12439 \pgf@x=\pgf@circ@res@other
12440 \fi
12441 % european
12442 \ifnum #2=4\relax
12443 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12444 \pgfextractx{\pgf@circ@res@other}{\left}%
12445 \step
12446 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12447 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12448 \pgf@x=\pgf@circ@res@other
12449 \fi
12450 }%
12451
12452 %%% american
12453 \long\def\pgfcircdeclarelogicport#1#2#3{%
12454 \pgfdeclareshape{american #1 port}%
12455 {%
12456 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12457 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12458 \savedmacro\resize{% automatic
12459 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12460 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
12461 \pgf@circ@res@up = .5\pgf@circ@res@up
12462 \pgf@circ@res@down = -\pgf@circ@res@up
12463 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
12464 \pgf@circ@res@right = .5\pgf@circ@res@right
12465 \pgf@circ@res@left = -\pgf@circ@res@right
12466 }%
12467 \savedmacro\inputs{% get number of inputs
12468 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
12469 \ifnum\pgf@circ@res@count=0
12470 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
12471 \fi
12472 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
12473 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
12474 \def\inputs{\the\pgf@circ@res@count}%
12475 }%
12476 \savedanchor\step{% 1/2 gap at edges
12477 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12478 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
12479 \divide\pgf@circ@res@step by \pgf@circ@res@count
12480 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
12481 }%
12482 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12483 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12484 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
12485 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
12486 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
12487
12488 \anchor{center}{\origin}% for backwards compatibility
12489 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12490
12491 % create input anchors
12492 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
12493 \pgfmathloop%
12494 \ifnum\pgfmathcounter>\pgf@circ@res@count%
12495 \else%
12496 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
12497 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
12498 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
12499 }%
12500 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
12501 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
12502 }%
12503 %}{}%
12504 \repeatpgfmathloop%
12505 }
12506
12507 \anchor{out}{\northeast\pgf@y=0pt}
12508 \anchor{bout}{\right\pgf@y=0pt}
12509
12510
12511 \anchor{left}{\left}% edges of component minus leads
12512 \anchor{right}{\right}
12513
12514 \anchor{north east}{\northeast}% see \Compass macro
12515 \anchor{south west}{\southwest}
12516 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12517 \pgfpoint{0cm}{\pgf@circ@res@up}}
12518 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12519 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12520 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12521 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
12522 \pgfpoint{\pgf@circ@res@left}{0cm}}
12523 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12524 \pgfpoint{0cm}{\pgf@circ@res@down}}
12525 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12526 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12527 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12528 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
12529 \pgfpoint{\pgf@circ@res@right}{0cm}}
12530
12531 \pgf@circ@draw@component{
12532 \pgf@circ@setcolor
12533 % \pgf@circ@debug@colors
12534 #3%
12535 }
12536 }
12537 }
12538 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12539 \pgfcircdeclarelogicport{and}{1}{
12540 \pgfextracty{\pgf@circ@res@temp}{\step}%
12541 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12542 \pgf@circ@res@count = \inputs\relax
12543 \ifpgfcirc@draw@input@leads
12544 %input leads
12545 \loop\ifnum\pgf@circ@res@count>0
12546 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12548 \pgfpathlineto{\pgfpoint
12549 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
12550 {\pgf@circ@res@temp}}
12551 \advance\pgf@circ@res@count by -1
12552 \repeat
12553 \fi
12554 % output lead
12555 \ifpgfcirc@draw@output@leads
12556 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12557 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
12558 \pgfusepath{draw}
12559 \fi
12560
12561
12562 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12563 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
12564
12565 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
12566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
12567 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
12568 \pgfpathclose
12569 \pgf@circ@draworfill
12570 }
12571 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12572 \pgfcircdeclarelogicport{nand}{1}{
12573 \pgfextracty{\pgf@circ@res@temp}{\step}%
12574 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12575 \pgf@circ@res@count = \inputs\relax
12576 \ifpgfcirc@draw@input@leads
12577 %input leads
12578 \loop\ifnum\pgf@circ@res@count>0
12579 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12580 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12581 \pgfpathlineto{\pgfpoint
12582 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
12583 {\pgf@circ@res@temp}}
12584 \advance\pgf@circ@res@count by -1
12585 \repeat
12586 \fi
12587
12588 \ifpgfcirc@draw@output@leads
12589 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12590 \pgfpathlineto{\pgfpoint
12591 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
12592 \pgfusepath{draw}
12593 \fi
12594 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12595 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
12596 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
12597 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
12598
12599 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
12600 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
12601 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
12602 \pgfpathclose
12603
12604 \pgfpathellipse
12605 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
12606 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
12607 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
12608
12609 \pgf@circ@draworfill
12610 }
12611 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12612 \pgfcircdeclarelogicport{nor}{2}{
12613 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
12614 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
12615 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12616 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12617 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
12618 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12619
12620 \pgfextracty{\pgf@circ@res@temp}{\step}%
12621 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12622 \pgf@circ@res@count = \inputs\relax
12623 \ifpgfcirc@draw@input@leads
12624 %input leads
12625 \loop\ifnum\pgf@circ@res@count>0
12626 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12627 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12628 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12629 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12630 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12631 \advance\pgf@circ@res@count by -1
12632 \repeat
12633 \fi
12634
12635 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
12636 \ifpgfcirc@draw@output@leads
12637 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12639 \pgfusepath{draw}
12640 \fi
12641
12642 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12643
12644 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
12645 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
12646 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
12647 \advance\pgf@circ@res@other by -\pgf@circ@res@step
12648
12649 % main shape
12650 \ifpgfcirc@roundy@or@shapes
12651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
12652 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12653 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12654 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12655 \pgfpathclose
12656 \else
12657 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12658 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
12659 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12660 \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}}
12661 \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}}
12662 \pgfpathclose
12663 \fi
12664
12665 % not dot
12666 \pgfpathellipse
12667 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
12668 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
12669 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
12670
12671 \pgf@circ@draworfill
12672 }
12673 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12674 \pgfcircdeclarelogicport{or}{2}{
12675 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
12676 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
12677 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12678 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12679 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
12680 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12681
12682 \pgfextracty{\pgf@circ@res@temp}{\step}%
12683 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12684 \pgf@circ@res@count = \inputs\relax
12685 \ifpgfcirc@draw@input@leads
12686 %input leads
12687 \loop\ifnum\pgf@circ@res@count>0
12688 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12689 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12690 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12691 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12692 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12693 \advance\pgf@circ@res@count by -1
12694 \repeat
12695 \fi
12696
12697 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
12698 \ifpgfcirc@draw@output@leads
12699 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12701 \pgfusepath{draw}
12702 \fi
12703
12704 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12705
12706 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
12707
12708 % main shape
12709 \ifpgfcirc@roundy@or@shapes
12710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
12711 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
12712 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12713 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
12714 \pgfpathclose
12715 \else
12716 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
12718 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12719 \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}}
12720 \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}}
12721 \pgfpathclose
12722 \fi
12723
12724 \pgf@circ@draworfill
12725 }
12726 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12727 \pgfcircdeclarelogicport{xor}{3}{
12728 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
12729 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
12730 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12731 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
12732 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
12733 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12734 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
12735 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
12736 % this compensates for the effect of the line width on the gap between the arcs
12737 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
12738 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
12739
12740 \pgfextracty{\pgf@circ@res@temp}{\step}%
12741 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12742 \pgf@circ@res@count = \inputs\relax
12743 \ifpgfcirc@draw@input@leads
12744 %input leads
12745 \loop\ifnum\pgf@circ@res@count>0
12746 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12747 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12748 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
12749 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12750 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
12751 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12752 \advance\pgf@circ@res@count by -1
12753 \repeat
12754 \fi
12755
12756 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
12757 \ifpgfcirc@draw@output@leads
12758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12760 \pgfusepath{draw}
12761 \fi
12762
12763 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12764
12765 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
12766
12767 % main shape
12768 \ifpgfcirc@roundy@or@shapes
12769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
12770 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
12771 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12772 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
12773 \pgfpathclose
12774 \else
12775 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12776 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
12777 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12778 \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}}
12779 \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}}
12780 \pgfpathclose
12781 \fi
12782 \pgf@circ@draworfill
12783
12784 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
12785
12786 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
12787 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
12788
12789 \pgfusepath{draw}
12790 }
12791 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12792 \pgfcircdeclarelogicport{xnor}{3}{
12793 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
12794 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
12795 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12796 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
12797 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
12798 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12799 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
12800 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
12801 % this compensates for the effect of the line width on the gap between the arcs
12802 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
12803 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
12804
12805 \pgfextracty{\pgf@circ@res@temp}{\step}%
12806 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12807 \pgf@circ@res@count = \inputs\relax
12808 \ifpgfcirc@draw@input@leads
12809 %input leads
12810 \loop\ifnum\pgf@circ@res@count>0
12811 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12812 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12813 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
12814 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12815 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
12816 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12817 \advance\pgf@circ@res@count by -1
12818 \repeat
12819 \fi
12820
12821 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
12822 \ifpgfcirc@draw@output@leads
12823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12824 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12825 \pgfusepath{draw}
12826 \fi
12827
12828 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12829
12830 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
12831 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
12832 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
12833 \advance\pgf@circ@res@other by -\pgf@circ@res@step
12834
12835 % main shape
12836 \ifpgfcirc@roundy@or@shapes
12837 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
12838 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12839 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12840 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12841 \pgfpathclose
12842 \else
12843 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12844 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
12845 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12846 \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}}
12847 \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}}
12848 \pgfpathclose
12849 \fi
12850
12851 \pgfpathellipse
12852 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
12853 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
12854 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
12855 \pgf@circ@draworfill
12856
12857 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
12858 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
12859
12860 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
12861 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
12862
12863 \pgfusepath{draw}
12864 }
12865
12866 %%% Original one-input ports
12867
12868 \pgfdeclareshape{american not port}{
12869 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12870 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12871 \anchor{center}{\pgfpointorigin}
12872 \savedanchor\northwest{%
12873 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12874 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
12875 \pgf@y=.5\pgf@y
12876 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
12877 \pgf@x=.5\pgf@x
12878 }
12879 \anchor{in}{
12880 \northwest
12881 \pgf@y=0pt
12882 }
12883 \anchor{in 1}{
12884 \northwest
12885 \pgf@y=0pt
12886 }
12887 \anchor{left}{
12888 \northwest
12889 \pgf@x=0.7\pgf@x
12890 \pgf@y=0pt
12891 }
12892 \anchor{bin}{
12893 \northwest
12894 \pgf@x=0.7\pgf@x
12895 \pgf@y=0pt
12896 }
12897 \anchor{bin 1}{
12898 \northwest
12899 \pgf@y=0pt
12900 \pgf@x=0.7\pgf@x
12901 }
12902 \anchor{out}{
12903 \northwest
12904 \pgf@y=0pt
12905 \pgf@x=-\pgf@x
12906 }
12907 \anchor{right}{
12908 \northwest
12909 \pgf@y=0pt
12910 \pgf@x=-0.7\pgf@x
12911 }
12912 \anchor{bout}{
12913 \northwest
12914 \pgf@y=0pt
12915 \pgf@x=-0.7\pgf@x
12916 }
12917 \anchor{center}{
12918 \pgfpointorigin
12919 }
12920 \anchor{east}{
12921 \northwest
12922 \pgf@y=0pt
12923 \pgf@x=-\pgf@x
12924 }
12925 \anchor{west}{
12926 \northwest
12927 \pgf@y=0pt
12928 }
12929 \anchor{south}{
12930 \northwest
12931 \pgf@x=0pt
12932 \pgf@y=-\pgf@y
12933 }
12934 \anchor{north}{
12935 \northwest
12936 \pgf@x=0pt
12937 }
12938 \anchor{south west}{
12939 \northwest
12940 \pgf@y=-\pgf@y
12941 }
12942 \anchor{north east}{
12943 \northwest
12944 \pgf@x=-\pgf@x
12945 }
12946 \anchor{north west}{
12947 \northwest
12948 }
12949 \anchor{south east}{
12950 \northwest
12951 \pgf@x=-\pgf@x
12952 \pgf@y=-\pgf@y
12953 }
12954 \anchorborder{% this is used when the node is used as a path element
12955 \pgf@xa=\pgf@x
12956 \pgf@ya=\pgf@y
12957 \pgfextracty{\pgf@circ@res@up}{\northwest}
12958 \pgfextractx{\pgf@circ@res@left}{\northwest}
12959 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12960 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12961 }
12962 \anchor{text}{%
12963 % centered and a bit to the left (it's a triangle)!
12964 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
12965 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
12966 }
12967 \pgf@circ@draw@component{
12968 \pgf@circ@setcolor
12969
12970 \northwest
12971 \pgf@circ@res@up = \pgf@y
12972 \pgf@circ@res@down = -\pgf@y
12973 \pgf@circ@res@right = -\pgf@x
12974 \pgf@circ@res@left = \pgf@x
12975
12976 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
12977
12978 \pgfscope
12979 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12980 \pgftransformxshift{.7\pgf@circ@res@left}
12981 \pgf@circ@res@step=\pgf@circ@res@right
12982 \advance\pgf@circ@res@step by -\pgf@circ@res@left
12983 \pgf@circ@res@step=.7\pgf@circ@res@step
12984
12985 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
12986 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
12987 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
12988 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
12989 \pgf@circ@draworfill
12990 \pgfpathellipse
12991 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
12992 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
12993 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
12994 \pgf@circ@draworfill
12995 \endpgfscope
12996
12997 \ifpgfcirc@draw@input@leads
12998 %input leads
12999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13000 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13001 \fi
13002
13003 \ifpgfcirc@draw@output@leads
13004 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13005 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13006 \fi
13007
13008 \pgfusepath{draw}
13009 }
13010 }
13011
13012 \pgfdeclareshape{american buffer port}{
13013 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13014 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13015 \anchor{center}{\pgfpointorigin}
13016 \savedanchor\northwest{%
13017 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13018 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13019 \pgf@y=.5\pgf@y
13020 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13021 \pgf@x=.5\pgf@x
13022 }
13023 \anchor{in}{
13024 \northwest
13025 \pgf@y=0pt
13026 }
13027 \anchor{in 1}{
13028 \northwest
13029 \pgf@y=0pt
13030 }
13031 \anchor{left}{
13032 \northwest
13033 \pgf@x=0.7\pgf@x
13034 \pgf@y=0pt
13035 }
13036 \anchor{bin}{
13037 \northwest
13038 \pgf@x=0.7\pgf@x
13039 \pgf@y=0pt
13040 }
13041 \anchor{bin 1}{
13042 \northwest
13043 \pgf@y=0pt
13044 \pgf@x=0.7\pgf@x
13045 }
13046 \anchor{out}{
13047 \northwest
13048 \pgf@y=0pt
13049 \pgf@x=-\pgf@x
13050 }
13051 \anchor{right}{
13052 \northwest
13053 \pgf@y=0pt
13054 \pgf@x=-0.7\pgf@x
13055 }
13056 \anchor{bout}{
13057 \northwest
13058 \pgf@y=0pt
13059 \pgf@x=-0.7\pgf@x
13060 }
13061 \anchor{center}{
13062 \pgfpointorigin
13063 }
13064 \anchor{east}{
13065 \northwest
13066 \pgf@y=0pt
13067 \pgf@x=-\pgf@x
13068 }
13069 \anchor{west}{
13070 \northwest
13071 \pgf@y=0pt
13072 }
13073 \anchor{south}{
13074 \northwest
13075 \pgf@x=0pt
13076 \pgf@y=-\pgf@y
13077 }
13078 \anchor{north}{
13079 \northwest
13080 \pgf@x=0pt
13081 }
13082 \anchor{south west}{
13083 \northwest
13084 \pgf@y=-\pgf@y
13085 }
13086 \anchor{north east}{
13087 \northwest
13088 \pgf@x=-\pgf@x
13089 }
13090 \anchor{north west}{
13091 \northwest
13092 }
13093 \anchor{south east}{
13094 \northwest
13095 \pgf@x=-\pgf@x
13096 \pgf@y=-\pgf@y
13097 }
13098 \anchorborder{% this is used when the node is used as a path element
13099 \pgf@xa=\pgf@x
13100 \pgf@ya=\pgf@y
13101 \pgfextracty{\pgf@circ@res@up}{\northwest}
13102 \pgfextractx{\pgf@circ@res@left}{\northwest}
13103 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13104 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13105 }
13106 \anchor{text}{%
13107 % centered and a bit to the left (it's a triangle)!
13108 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13109 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13110 }
13111 \pgf@circ@draw@component{
13112 \pgf@circ@setcolor
13113
13114 \northwest
13115 \pgf@circ@res@up = \pgf@y
13116 \pgf@circ@res@down = -\pgf@y
13117 \pgf@circ@res@right = -\pgf@x
13118 \pgf@circ@res@left = \pgf@x
13119
13120 \pgfscope
13121 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13122 \pgftransformxshift{.7\pgf@circ@res@left}
13123 \pgf@circ@res@step=\pgf@circ@res@right
13124 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13125 \pgf@circ@res@step=.7\pgf@circ@res@step
13126
13127 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13128 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13129 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13131 \pgf@circ@draworfill
13132 \endpgfscope
13133
13134 \ifpgfcirc@draw@input@leads
13135 %input leads
13136 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13137 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13138 \fi
13139
13140 \ifpgfcirc@draw@output@leads
13141 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13142 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13143 \fi
13144
13145 \pgfusepath{draw}
13146 }
13147 }
13148 \pgfdeclareshape{invschmitt}{
13149 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13150 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13151 \anchor{center}{\pgfpointorigin}
13152 \savedanchor\northwest{%
13153 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13154 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13155 \pgf@y=.5\pgf@y
13156 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13157 \pgf@x=.5\pgf@x
13158 }
13159 \anchor{in}{
13160 \northwest
13161 \pgf@y=0pt
13162 }
13163 \anchor{in 1}{
13164 \northwest
13165 \pgf@y=0pt
13166 }
13167 \anchor{left}{
13168 \northwest
13169 \pgf@y=0pt
13170 \pgf@x=0.7\pgf@x
13171 }
13172 \anchor{bin}{
13173 \northwest
13174 \pgf@y=0pt
13175 \pgf@x=0.7\pgf@x
13176 }
13177 \anchor{bin 1}{
13178 \northwest
13179 \pgf@y=0pt
13180 \pgf@x=0.7\pgf@x
13181 }
13182 \anchor{out}{
13183 \northwest
13184 \pgf@y=0pt
13185 \pgf@x=-\pgf@x
13186 }
13187 \anchor{right}{
13188 \northwest
13189 \pgf@y=0pt
13190 \pgf@x=-0.7\pgf@x
13191 }
13192 \anchor{bout}{
13193 \northwest
13194 \pgf@y=0pt
13195 \pgf@x=-0.7\pgf@x
13196 }
13197 \anchor{center}{
13198 \pgfpointorigin
13199 }
13200 \anchor{east}{
13201 \northwest
13202 \pgf@y=0pt
13203 \pgf@x=-\pgf@x
13204 }
13205 \anchor{west}{
13206 \northwest
13207 \pgf@y=0pt
13208 }
13209 \anchor{south}{
13210 \northwest
13211 \pgf@x=0pt
13212 \pgf@y=-\pgf@y
13213 }
13214 \anchor{north}{
13215 \northwest
13216 \pgf@x=0pt
13217 }
13218 \anchor{south west}{
13219 \northwest
13220 \pgf@y=-\pgf@y
13221 }
13222 \anchor{north east}{
13223 \northwest
13224 \pgf@x=-\pgf@x
13225 }
13226 \anchor{north west}{
13227 \northwest
13228 }
13229 \anchor{south east}{
13230 \northwest
13231 \pgf@x=-\pgf@x
13232 \pgf@y=-\pgf@y
13233 }
13234 \anchorborder{% this is used when the node is used as a path element
13235 \pgf@xa=\pgf@x
13236 \pgf@ya=\pgf@y
13237 \pgfextracty{\pgf@circ@res@up}{\northwest}
13238 \pgfextractx{\pgf@circ@res@left}{\northwest}
13239 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13240 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13241 }
13242 \anchor{text}{%
13243 % centered and a bit to the left (it's a triangle)!
13244 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13245 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13246 }
13247 \pgf@circ@draw@component{
13248 \pgf@circ@setcolor
13249
13250 \northwest
13251 \pgf@circ@res@up = \pgf@y
13252 \pgf@circ@res@down = -\pgf@y
13253 \pgf@circ@res@right = -\pgf@x
13254 \pgf@circ@res@left = \pgf@x
13255
13256 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
13257
13258 \pgfscope
13259 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13260 \pgftransformxshift{.7\pgf@circ@res@left}
13261 \pgf@circ@res@step=\pgf@circ@res@right
13262 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13263 \pgf@circ@res@step=.7\pgf@circ@res@step
13264
13265 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
13266 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13267 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13268 \pgfpathclose
13269 \pgf@circ@draworfill
13270 \pgfpathellipse
13271 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
13272 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
13273 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
13274 \pgf@circ@draworfill
13275 \endpgfscope
13276
13277 \ifpgfcirc@draw@input@leads
13278 %input leads
13279 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13280 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13281 \fi
13282
13283 \ifpgfcirc@draw@output@leads
13284 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13285 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13286 \fi
13287 \pgfusepath{draw}
13288 %draw inner shape
13289
13290 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13291
13292 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13293 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13294 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13295 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13296 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13297 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13298 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13299 \pgfusepath{draw}
13300
13301 }
13302 }
13303
13304 \pgfdeclareshape{schmitt}{
13305 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13306 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13307 \anchor{center}{\pgfpointorigin}
13308 \savedanchor\northwest{%
13309 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13310 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13311 \pgf@y=.5\pgf@y
13312 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13313 \pgf@x=.5\pgf@x
13314 }
13315 \anchor{in}{
13316 \northwest
13317 \pgf@y=0pt
13318 }
13319 \anchor{in 1}{
13320 \northwest
13321 \pgf@y=0pt
13322 }
13323 \anchor{left}{
13324 \northwest
13325 \pgf@y=0pt
13326 \pgf@x=0.7\pgf@x
13327 }
13328 \anchor{bin}{
13329 \northwest
13330 \pgf@y=0pt
13331 \pgf@x=0.7\pgf@x
13332 }
13333 \anchor{bin 1}{
13334 \northwest
13335 \pgf@y=0pt
13336 \pgf@x=0.7\pgf@x
13337 }
13338 \anchor{out}{
13339 \northwest
13340 \pgf@y=0pt
13341 \pgf@x=-\pgf@x
13342 }
13343 \anchor{right}{
13344 \northwest
13345 \pgf@y=0pt
13346 \pgf@x=-.7\pgf@x
13347 }
13348 \anchor{bout}{
13349 \northwest
13350 \pgf@y=0pt
13351 \pgf@x=-.7\pgf@x
13352 }
13353 \anchor{center}{
13354 \pgfpointorigin
13355 }
13356 \anchor{east}{
13357 \northwest
13358 \pgf@y=0pt
13359 \pgf@x=-\pgf@x
13360 }
13361 \anchor{west}{
13362 \northwest
13363 \pgf@y=0pt
13364 }
13365 \anchor{south}{
13366 \northwest
13367 \pgf@x=0pt
13368 \pgf@y=-\pgf@y
13369 }
13370 \anchor{north}{
13371 \northwest
13372 \pgf@x=0pt
13373 }
13374 \anchor{south west}{
13375 \northwest
13376 \pgf@y=-\pgf@y
13377 }
13378 \anchor{north east}{
13379 \northwest
13380 \pgf@x=-\pgf@x
13381 }
13382 \anchor{north west}{
13383 \northwest
13384 }
13385 \anchor{south east}{
13386 \northwest
13387 \pgf@x=-\pgf@x
13388 \pgf@y=-\pgf@y
13389 }
13390 \anchorborder{% this is used when the node is used as a path element
13391 \pgf@xa=\pgf@x
13392 \pgf@ya=\pgf@y
13393 \pgfextracty{\pgf@circ@res@up}{\northwest}
13394 \pgfextractx{\pgf@circ@res@left}{\northwest}
13395 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13396 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13397 }
13398 \anchor{text}{%
13399 % centered and a bit to the left (it's a triangle)!
13400 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13401 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13402 }
13403 \pgf@circ@draw@component{
13404 \pgf@circ@setcolor
13405
13406
13407 \northwest
13408 \pgf@circ@res@up = \pgf@y
13409 \pgf@circ@res@down = -\pgf@y
13410 \pgf@circ@res@right = -\pgf@x
13411 \pgf@circ@res@left = \pgf@x
13412
13413 \pgfscope
13414 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13415 \pgftransformxshift{.7\pgf@circ@res@left}
13416 \pgf@circ@res@step=\pgf@circ@res@right
13417 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13418 \pgf@circ@res@step=.7\pgf@circ@res@step
13419
13420 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13421 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13423 \pgfpathclose
13424 \pgf@circ@draworfill
13425 \endpgfscope
13426
13427 \ifpgfcirc@draw@input@leads
13428 %input leads
13429 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13430 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13431 \fi
13432
13433 \ifpgfcirc@draw@output@leads
13434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13435 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
13436 \fi
13437 \pgfusepath{draw}
13438 %draw inner shape
13439
13440 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13441
13442 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13443 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13444 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13445 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13446 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13447 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13448 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13449 \pgfusepath{draw}
13450
13451 }
13452 }
13453
13454
13455 %%% start european logic ports, from John Kormylo
13456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13457 %%
13458
13459 % #1 - name
13460 % #2 - text inside
13461 % #3 - number of inputs
13462 % #4 = is it a not?
13463 %
13464 % option to add a circle for not-output, see
13465 % https://github.com/circuitikz/circuitikz/issues/385
13466 %
13467 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
13468 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
13469 \ctikzset{tripoles/european not shape/.initial=ocirc}
13470 \ctikzset{tripoles/european not symbol/.is choice}
13471 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
13472 \ctikzset{tripoles/european not symbol/circle/.code={%
13473 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
13474 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
13475 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
13476
13477 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
13478 \pgfdeclareshape{european #1 port}
13479 {
13480 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13481 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13482 \saveddimen{\boutshift}{%
13483 \edef\pgf@temp{not}
13484 \edef\pgf@circ@temp{#4}
13485 \ifx\pgf@temp\pgf@circ@temp % is a not
13486 \ifpgf@circ@european@port@circle
13487 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13488 \edef\pgf@temp{ocirc}
13489 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
13490 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
13491 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13492 \else % it's ieee not circ
13493 \pgf@circ@notradius % defined together with ieeestd ports
13494 \pgf@x=2\pgf@circ@res@temp
13495 \fi
13496 \else
13497 \pgf@x=0pt
13498 \fi
13499 \else
13500 \pgf@x=0pt
13501 \fi
13502 }
13503 \savedmacro\resize{% automatic
13504 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13505 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
13506 \pgf@circ@res@up = .5\pgf@circ@res@up
13507 \pgf@circ@res@down = -\pgf@circ@res@up
13508 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
13509 \pgf@circ@res@right = .5\pgf@circ@res@right
13510 \pgf@circ@res@left = -\pgf@circ@res@right
13511 }%
13512 \savedmacro\inputs{% get number of inputs
13513 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
13514 \ifnum\pgf@circ@res@count=0
13515 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
13516 \fi
13517 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
13518 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
13519 \def\inputs{\the\pgf@circ@res@count}%
13520 }%
13521 \savedanchor\step{% 1/2 gap at edges
13522 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13523 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
13524 \divide\pgf@circ@res@step by #3
13525 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
13526 }%
13527 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
13528 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
13529 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
13530 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
13531 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
13532
13533 \anchor{center}{\origin}% for backwards compatibility
13534 % the text anchor overlaps the logic symbol
13535 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
13536 % create input anchors
13537 \ifnum#3=1\relax
13538 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
13539 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
13540 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
13541 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
13542 \else
13543 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
13544 \pgfmathloop%
13545 \ifnum\pgfmathcounter>#3
13546 \else%
13547 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
13548 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
13549 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
13550 }%
13551 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
13552 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
13553 }%
13554 %}{}%
13555 \repeatpgfmathloop%
13556 }
13557 \fi
13558 \anchor{out}{\northeast\pgf@y=0pt}
13559 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
13560
13561 \anchor{left}{\left}% edges of component minus leads
13562 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
13563
13564 \anchor{north east}{\northeast}% see \Compass macro
13565 \anchor{south west}{\southwest}
13566 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
13567 \pgfpoint{0cm}{\pgf@circ@res@up}}
13568 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
13569 \pgfextractx{\pgf@circ@res@left}{\southwest}%
13570 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
13571 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
13572 \pgfpoint{\pgf@circ@res@left}{0cm}}
13573 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
13574 \pgfpoint{0cm}{\pgf@circ@res@down}}
13575 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
13576 \pgfextractx{\pgf@circ@res@right}{\northeast}%
13577 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
13578 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
13579 \pgfpoint{\pgf@circ@res@right}{0cm}}
13580
13581 \anchorborder{% this is used when the node is used as a path element
13582 \pgf@xa=\pgf@x
13583 \pgf@ya=\pgf@y
13584 \pgfextracty{\pgf@circ@res@up}{\northeast}
13585 \pgfextractx{\pgf@circ@res@right}{\northeast}
13586 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13587 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13588 }
13589 \pgf@circ@draw@component{
13590 \pgf@circ@setcolor
13591 \pgfstartlinewidth=\pgflinewidth
13592 \pgfscope
13593 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13594 \pgfpathrectanglecorners
13595 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
13596 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
13597 \pgf@circ@draworfill
13598 \endpgfscope
13599 \ifpgfcirc@draw@input@leads
13600 %input leads
13601 \ifnum#3=1\relax
13602 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
13603 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
13604 \else
13605 \pgfextracty{\pgf@circ@res@temp}{\step}%
13606 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
13607 %\pgf@circ@res@count = #3\relax% redundant
13608 \loop\ifnum\pgf@circ@res@count>0
13609 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
13610 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
13611 \pgfpathlineto{\pgfpoint
13612 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
13613 {\pgf@circ@res@temp}}
13614 \advance\pgf@circ@res@count by -1
13615 \repeat
13616 \fi
13617 \pgfusepath{draw}
13618 \fi
13619 %
13620 \ifpgfcirc@draw@output@leads
13621 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13622 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
13623 \pgfusepath{draw}
13624 \fi
13625 %
13626 \edef\pgf@temp{not}
13627 \edef\pgf@circ@temp{#4}
13628 \ifx\pgf@temp\pgf@circ@temp % is a not
13629 \ifpgf@circ@european@port@circle
13630 \pgfscope
13631 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13632 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
13633 % reset linewidth for IEEE ports, otherwise they will multiply...
13634 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
13635 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
13636 \endpgfscope
13637 \else
13638 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
13639 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
13640 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
13641 \pgfusepath{draw}
13642 \fi
13643 \fi
13644 \pgf@circ@text@strokecolor
13645 \pgfpathmoveto{\pgfpointorigin}
13646 \pgfscope
13647 % text is always in standard direction
13648 \pgftransformresetnontranslations
13649 \pgftext{\ctikzvalof{european ports font}#2}%
13650 \endpgfscope
13651 }
13652 }
13653 }
13654 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
13655 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
13656 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
13657 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
13658 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
13659 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
13660 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
13661 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
13662 \pgfcircdeclareeurologicport{blank}{}{\pgf@circ@res@count}{}
13663 \pgfcircdeclareeurologicport{blank not}{}{\pgf@circ@res@count}{not}
13664 %% end european logic ports
13665 % %>>>
13666
13667 %% IEEE standard logic ports module%<<<
13668
13669 %%
13670 %% Original multi-input code from John Kormylo at tex.stackexchange.com
13671 %% Help by TheTeXnician <[email protected]>
13672 %% Suggested idea and example code by Jason Sachs <[email protected]>
13673 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
13674 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
13675 %% Everything is in the same place here --- more or less; first step to move towards
13676 %% a module interface for circutikz
13677 %%
13678
13679 % base settings for ieeestd ports.
13680
13681 \ctikzset{ieeestd ports/.is family}
13682 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
13683 % the value of 0.4 is the standard pin distance for a port with height=num pins
13684 % and matches the chip distance
13685 \ctikzset{ieeestd ports/baselen/.initial=0.4}
13686 % these are in term of baselen; width depends on height (fixed proportions)
13687 \ctikzset{ieeestd ports/height/.initial=2}
13688 \ctikzset{ieeestd ports/pin length/.initial=0.7}
13689 % the standard "not" circle should be 1/6.5 of height (diameter);
13690 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
13691 \ctikzset{ieeestd ports/not radius/.initial=0.154}
13692 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
13693 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
13694 % xor/xnor leads go full in in IEEE; let this be optional
13695 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
13696 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
13697 %
13698 % base size of a small external schmitt symbol
13699 %
13700 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
13701 %
13702 % input management
13703 % we are using the same /tikz/number inputs than the legacy ports
13704 %
13705 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
13706 %
13707 % integrate with the other logic ports
13708 %
13709 %
13710 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
13711 \ctikzset{logic ports/ieee/.code= {%
13712 \pgf@circuit@ieeelogicporttrue
13713 \pgf@circuit@europeanlogicportfalse
13714 \tikzset{and port/.style={shape=ieeestd and port}}%
13715 \tikzset{or port/.style={shape=ieeestd or port}}%
13716 \tikzset{xor port/.style={shape=ieeestd xor port}}%
13717 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
13718 \tikzset{not port/.style={shape=ieeestd not port}}%
13719 \tikzset{nand port/.style={shape=ieeestd nand port}}%
13720 \tikzset{nor port/.style={shape=ieeestd nor port}}%
13721 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
13722 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
13723 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
13724 }}
13725 % add code to be compatible with the other ports
13726 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
13727 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
13728 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
13729 %
13730 % the base angle for the or port. See the drawings. This will not change with height
13731 %
13732 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
13733 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
13734 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
13735 {%
13736 \ifnum#1>\inputs
13737 \PackageError{circuitikz}{%
13738 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
13739 which has been defined with \inputs\space pins%
13740 }{Please check the manual about logic ports; if you press return I'll try to continue}
13741 \fi
13742 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
13743 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
13744 \pgf@circ@res@step=\pind
13745 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
13746 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
13747 }%
13748
13749 % #1 = \pgfmathcounter #2=type
13750 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
13751 \def\pgf@circ@ieeeport@baseinput#1#2%
13752 {%
13753 \ifnum#1>\inputs
13754 \PackageError{circuitikz}{%
13755 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
13756 which has been defined with \inputs\space pins%
13757 }{Please check the manual about logic ports; if you press return I'll try to continue}
13758 \fi
13759 % Find the vertical position (this is the same for any port)
13760 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
13761 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
13762 % rack (extended) pins; they are the same for all the ports
13763 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
13764 % above: 1..K (included)
13765 % below: inputs-K..inputs
13766 % Find the pins on the rack; they are 1...
13767 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
13768 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
13769 % border anchors for rack should be ok
13770 \pgfextractx{\pgf@circ@res@left}{\topleft}
13771 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
13772 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
13773 % we have finished if we are in the rack
13774 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
13775 % we are on the inner ports; we have to do the hard work here
13776 % and and nand
13777 \ifnum #2=1
13778 \relax % It's an and/nand, all border ports are on the rack line
13779 \fi
13780 % or and nor
13781 \ifnum #2=2
13782 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
13783 \fi
13784 % xor and xnor
13785 \ifnum #2=3\relax
13786 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
13787 \fi
13788 \fi\fi
13789 }%
13790 % inner base ports for xor types port
13791 % #1 = \pgfmathcounter #2=type
13792 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
13793 \def\pgf@circ@ieeeport@innerbaseinput#1%
13794 {%
13795 \ifnum#1>\inputs
13796 \PackageError{circuitikz}{%
13797 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
13798 which has been defined with \inputs\space pins%
13799 }{Please check the manual about logic ports; if you press return I'll try to continue}
13800 \fi
13801 % Find the vertical position (this is the same for any port)
13802 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
13803 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
13804 % rack (extended) pins; they are the same for all the ports
13805 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
13806 % above: 1..K (included)
13807 % below: inputs-K..inputs
13808 % Find the pins on the rack; they are 1...
13809 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
13810 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
13811 % border anchors for rack should be ok
13812 \pgfextractx{\pgf@circ@res@left}{\topleft}
13813 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
13814 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
13815 % we have finished if we are in the rack
13816 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
13817 % we are on the inner ports; we have to do the hard work here
13818 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
13819 \fi\fi
13820 }%
13821
13822 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
13823 \def\pgf@circ@ieeestd@baselen{%
13824 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13825 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
13826 }
13827 \def\pgf@circ@ieeestd@stdH{%
13828 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13829 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
13830 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
13831 }
13832 \def\pgf@circ@ieeestd@pinlen{%
13833 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13834 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
13835 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
13836 }
13837 \def\pgf@circ@ieeestd@xorbar{%
13838 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
13839 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
13840 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
13841 }
13842 %% Not circle
13843 \def\pgf@circ@notradius{
13844 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
13845 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
13846 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
13847 }
13848 %% Find (in ...@other) the height of the rack
13849 \def\pgf@circ@findrackH{%
13850 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
13851 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
13852 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
13853 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
13854 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
13855 \pgf@circ@ieeestd@stdH
13856 \multiply\pgf@circ@res@temp by 2\relax% full height
13857 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
13858 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
13859 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
13860 }
13861 %%
13862 \def\pgf@circ@find@ieeeport@up{% leave it in up
13863 % Normal port limits
13864 \pgf@circ@ieeestd@stdH
13865 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
13866 % rack top size
13867 \pgf@circ@findrackH
13868 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
13869 \pgf@circ@res@up=\pgf@circ@res@other
13870 \else
13871 \fi
13872 }
13873 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
13874 % Normal port limits
13875 \pgf@circ@ieeestd@stdH
13876 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
13877 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
13878 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
13879 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
13880 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
13881 % this is the normal left border
13882 % For the or or xor port, the limit can be the pointy thing (in case the
13883 % pinlen is zero or too small)
13884 % add to the body margin the or/nor peak:
13885 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
13886 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
13887 \advance\pgf@circ@res@right by \pgf@circ@res@other
13888 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
13889 \fi
13890 % add to the body margin the xor/xnor distance
13891 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
13892 \pgf@circ@ieeestd@xorbar
13893 \advance\pgf@circ@res@right by \pgf@circ@res@temp
13894 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
13895 \fi
13896 % and if this exceeds the normal margin, this is it
13897 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
13898 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
13899 \pgf@circ@res@left=\pgf@circ@res@right
13900 \fi
13901 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
13902 \pgf@circ@res@left=-\pgf@circ@res@left
13903 }
13904 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
13905 % Normal port limits
13906 \pgf@circ@ieeestd@stdH
13907 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
13908 \pgf@circ@notradius
13909 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
13910 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
13911 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
13912 \pgf@circ@res@right=\pgf@circ@res@other
13913 \fi
13914 }
13915 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
13916 % Normal port limits
13917 \pgf@circ@ieeestd@stdH
13918 % notice 0.8660254 is cos(30)
13919 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
13920 \pgf@circ@notradius
13921 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
13922 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
13923 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
13924 \pgf@circ@res@right=\pgf@circ@res@other
13925 \fi
13926 }
13927
13928
13929 %%% ieeestd multi-input ports
13930 %%% #1: name
13931 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
13932 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
13933 %%% #4: drawing for the port
13934 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
13935 \pgfdeclareshape{ieeestd #1 port}%
13936 {%
13937 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13938 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13939 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
13940 \saveddimen{\baselen}{%
13941 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
13942 }
13943 \saveddimen{\stdH}{% This is HALF the height of the inner port
13944 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
13945 }
13946 \saveddimen{\notdiameter}{
13947 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
13948 }
13949 \saveddimen{\pind}{% pin distance;
13950 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
13951 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
13952 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
13953 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
13954 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
13955 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
13956 \divide\pgf@x by \pgf@circ@count@b
13957 }
13958 \saveddimen{\pinlen}{%
13959 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
13960 }
13961 \saveddimen{\xorbar}{%
13962 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
13963 }
13964 % anchors for the body (no pins included here)
13965 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
13966 \pgf@circ@ieeestd@stdH
13967 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
13968 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
13969 }
13970 \savedanchor{\topleft}{%
13971 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
13972 \pgf@circ@ieeestd@stdH
13973 \pgf@circ@res@other=0pt\relax
13974 \ifnum #2 = 2\relax% "or" or "nor" gates.
13975 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
13976 \fi
13977 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
13978 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
13979 +\pgf@circ@res@right}
13980 \fi
13981 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
13982 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
13983 }
13984 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
13985 \pgf@circ@ieeestd@stdH
13986 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
13987 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
13988 }
13989 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
13990 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
13991 \pgf@circ@ieeestd@stdH
13992 % #3 is =1 if the port is a negated output one
13993 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
13994 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
13995 }
13996 % geographical anchors --- must be rectangulars!
13997 \savedanchor{\northwest}{%
13998 \pgf@circ@find@ieeeport@up
13999 \pgf@circ@find@ieeeport@left{#2}
14000 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
14001 \pgf@x=\pgf@circ@res@left
14002 \pgf@y=\pgf@circ@res@up
14003 }
14004 \savedanchor{\southwest}{%
14005 \pgf@circ@find@ieeeport@up
14006 \pgf@circ@find@ieeeport@left{#2}
14007 \pgf@x=\pgf@circ@res@left
14008 \pgf@y=-\pgf@circ@res@up
14009 }
14010 \savedanchor{\southeast}{%
14011 \pgf@circ@find@ieeeport@up
14012 \pgf@circ@find@ieeeport@right{#3}
14013 \pgf@x=\pgf@circ@res@right
14014 \pgf@y=-\pgf@circ@res@up
14015 }
14016 \savedanchor{\northeast}{%
14017 \pgf@circ@find@ieeeport@up
14018 \pgf@circ@find@ieeeport@right{#3}
14019 \pgf@x=\pgf@circ@res@right
14020 \pgf@y=\pgf@circ@res@up
14021 }
14022 \savedmacro\inputs{% get number of inputs
14023 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
14024 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
14025 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
14026 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
14027 \def\inputs{\the\pgf@circ@count@a}%
14028 }%
14029 \savedmacro\inners{% get number of "inner" inputs (for racks)
14030 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
14031 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
14032 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
14033 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
14034 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
14035 % \typeout{INNER is \the\pgf@circ@count@b}%
14036 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
14037 \def\inners{\the\pgf@circ@count@b}%
14038 }%
14039 \anchor{center}{\pgfpointorigin}
14040 \anchor{text}{
14041 \ifpgf@circ@center@text
14042 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14043 \else
14044 \pgf@circ@ieeestd@stdH
14045 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
14046 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14047 \fi
14048 }
14049 % create input anchors
14050 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
14051 \pgf@circ@count@a=\inputs
14052 \pgfmathloop%
14053 \ifnum\pgfmathcounter>\pgf@circ@count@a%
14054 \else%
14055 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
14056 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
14057 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
14058 }%
14059 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
14060 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
14061 }%
14062 \ifnum #2 = 3\relax % xor/xnor inner border pins
14063 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
14064 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
14065 }%
14066 \fi
14067 %}{}%
14068 \repeatpgfmathloop%
14069 }
14070 % output anchor
14071 \anchor{out}{%
14072 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
14073 \advance\pgf@circ@res@other by\pinlen
14074 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
14075 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
14076 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
14077 \fi
14078 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
14079 }
14080 \anchor{bout}{\bottomright\pgf@y=0pt}
14081
14082 \anchor{body right}{\bodyright\pgf@y=0pt}
14083 \anchor{right}{\bottomright\pgf@y=0pt}
14084 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
14085 \anchor{left}{% central edge of the component
14086 \bodyleft\pgf@y=0pt
14087 \ifnum #2=3\relax
14088 \advance\pgf@x by -\xorbar
14089 \fi
14090 }
14091 \anchor{up}{%
14092 \bodyleft
14093 \ifnum #2 > 1 % pointy shapes
14094 \pgf@circ@ieeestd@stdH
14095 % horizontal coordinate where the right semicircle starts
14096 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
14097 % vertical drop of the circle at the above coordinate
14098 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
14099 \advance \pgf@y by -\pgf@circ@res@step
14100 \fi
14101 \pgf@x=0pt
14102 }
14103 \anchor{down}{%
14104 \bodyleft
14105 \ifnum #2 > 1 % pointy shapes
14106 \pgf@circ@ieeestd@stdH
14107 % horizontal coordinate where the right semicircle starts
14108 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
14109 % vertical drop of the circle at the above coordinate
14110 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
14111 \advance \pgf@y by -\pgf@circ@res@step
14112 \fi
14113 \pgf@y=-\pgf@y\pgf@x=0pt
14114 }
14115
14116 % geographical anchors
14117 \anchor{nw}{\northwest}
14118 \anchor{ne}{\northeast}
14119 \anchor{se}{\southeast}
14120 \anchor{sw}{\southwest}
14121 \anchor{north west}{\northwest}
14122 \anchor{north east}{\northeast}
14123 \anchor{south east}{\southeast}
14124 \anchor{south west}{\southwest}
14125 % over 0,0 even if asymmetric
14126 % will break if the geocoords are not rectangular
14127 \anchor{n}{\northwest\pgf@x=0pt\relax}
14128 \anchor{e}{\northeast\pgf@y=0pt\relax}
14129 \anchor{s}{\southwest\pgf@x=0pt\relax}
14130 \anchor{w}{\northwest\pgf@y=0pt\relax}
14131 \anchor{north}{\northwest\pgf@x=0pt\relax}
14132 \anchor{east}{\northeast\pgf@y=0pt\relax}
14133 \anchor{south}{\southwest\pgf@x=0pt\relax}
14134 \anchor{west}{\northwest\pgf@y=0pt\relax}
14135
14136 \pgf@circ@draw@component{
14137 \pgfscope
14138 \pgf@circ@setcolor
14139 #4%
14140 \endpgfscope
14141 % output lead:
14142 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
14143 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
14144 \advance\pgf@circ@res@other by \pinlen\relax
14145 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
14146 \ifpgfcirc@draw@output@leads
14147 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14148 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
14149 \pgfusepath{draw}
14150 \fi
14151 \fi
14152 \ifnum #3=1\relax\pgfscope
14153 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
14154 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
14155 \endpgfscope\fi
14156 }
14157 }
14158 }
14159
14160 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
14161 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
14162 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
14163 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
14164 }
14165 %
14166 % ieeestd "and" and "nand"
14167 %
14168 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
14169 \pgf@circ@count@a = \inputs\relax
14170 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
14171 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
14172 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14173 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
14174 \ifpgfcirc@draw@input@leads
14175 %input leads --- all the same for AND ports
14176 \loop\ifnum\pgf@circ@count@a>0
14177 \advance\pgf@circ@res@temp by -\pind
14178 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
14179 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
14180 \advance\pgf@circ@count@a by -1
14181 \repeat
14182 \fi
14183 \pgfusepath{draw}
14184 %% Body. let's start from the top left
14185 \pgfscope
14186 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14187 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
14188 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
14189 \pgfpatharc{90}{-90}{\stdH}
14190 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
14191 \pgfpathclose
14192 \pgf@circ@draworfill
14193 % rack now; skip if not needed.
14194 % \typeout{WHAT\space \inputs\space \inners}
14195 \ifnum\inputs>\inners
14196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
14198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
14199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14200 \pgfusepath{draw}
14201 \fi
14202 \endpgfscope
14203 }
14204 %
14205 % or/nor and xor/xnor are practically the same. Let factor out everything
14206 % the argument #1 is put just before the drawing of the inner pins
14207 % the argument #2 is put after the drawing of the body
14208 %
14209 \long\def\pgf@circ@ieeeport@orxor#1#2{%
14210 \pgf@circ@count@a = \inputs\relax
14211 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
14212 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
14213 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14214 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
14215 % rack (extended) pins; they are the same for all the ports
14216 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
14217 % above: 1..K (included)
14218 % below: inputs-K..inputs
14219 % Find the pins on the rack; they are 1...
14220 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
14221 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
14222 \ifpgfcirc@draw@input@leads
14223 %input leads --- for or ports
14224 \loop\ifnum\pgf@circ@count@a>0
14225 \pgfextractx{\pgf@circ@res@right}{\topleft}
14226 \advance\pgf@circ@res@temp by -\pind
14227 % this is the height; let's find the "right" position
14228 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
14229 % inner pins
14230 % \typeout{INNER\space\pgf@circ@count@a}
14231 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
14232 % hook for xor/xnor
14233 #1%
14234 \fi\fi
14235 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
14236 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
14237 \pgfusepath{draw}
14238 \advance\pgf@circ@count@a by -1
14239 \repeat
14240 \fi
14241 %% Body. let's start from the top left
14242 \pgfscope
14243 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14244 % it should start here, but with this trick the close comes out better.
14245 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14246 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
14247 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
14248 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
14249 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
14250 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
14251 %% this should be 2 and 2; but the round part is not a perfect circle that way
14252 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
14253 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14254 \pgfpathclose
14255 \pgf@circ@draworfill
14256 % hook for xor/xnor
14257 #2%
14258 % rack now; skip if not needed.
14259 % \typeout{WHAT\space \inputs\space \inners}
14260 \ifnum\inputs>\inners
14261 \pgfextractx{\pgf@circ@res@left}{\topleft}
14262 \pgfextracty{\pgf@circ@res@down}{\topleft}
14263 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14264 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
14265 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
14266 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14267 \pgfusepath{draw}
14268 \fi
14269 \endpgfscope
14270 }
14271 %
14272 % ieeestd "or" and "nor"
14273 %
14274 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
14275 \pgf@circ@ieeeport@orxor{}{}
14276 }
14277 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
14278 \pgf@circ@ieeeport@orxor{
14279 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
14280 \ifnum\@@tmp=0\relax
14281 % move pin start to the left to leave the xor gap free (not standard)
14282 \advance\pgf@circ@res@right by -\xorbar
14283 \fi
14284 }{%
14285 % add the xor/xnor bar
14286 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
14287 % see the comment on the main body about the 2.2
14288 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14289 \pgfusepath{draw}
14290 }
14291 }
14292 %
14293 % Buffer and inverters
14294 %
14295 % #1: name
14296 % #2: polarity
14297 % #3: content
14298 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
14299 \pgfdeclareshape{ieeestd #1 port}%
14300 {%
14301 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14302 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14303 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14304 \saveddimen{\baselen}{%
14305 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
14306 }
14307 \saveddimen{\stdH}{% This is HALF the height of the inner port
14308 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
14309 }
14310 \saveddimen{\notdiameter}{
14311 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
14312 }
14313 \saveddimen{\pinlen}{%
14314 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
14315 }
14316 % anchors for the body (no pins included here)
14317 % Notice that 0.8660254 is cos(30)
14318 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
14319 \pgf@circ@ieeestd@stdH
14320 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14321 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14322 }
14323 \savedanchor{\topleft}{%
14324 \pgf@circ@ieeestd@stdH
14325 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14326 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14327 }
14328 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
14329 \pgf@circ@ieeestd@stdH
14330 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
14331 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14332 }
14333 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
14334 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
14335 \pgf@circ@ieeestd@stdH
14336 % #2 is =1 if the port is a negated output one
14337 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
14338 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14339 }
14340 % geographical anchors --- must be rectangulars!
14341 \savedanchor{\northwest}{%
14342 \pgf@circ@ieeestd@stdH
14343 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14344 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14345 }
14346 \savedanchor{\southwest}{%
14347 \pgf@circ@ieeestd@stdH
14348 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14349 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14350 }
14351 \savedanchor{\southeast}{%
14352 \pgf@circ@ieeestd@stdH
14353 \pgf@circ@res@up=\pgf@circ@res@temp
14354 \pgf@circ@find@ieeeport@not@right{#2}
14355 \pgf@x=\pgf@circ@res@right
14356 \pgf@y=-\pgf@circ@res@up
14357 }
14358 \savedanchor{\northeast}{%
14359 \pgf@circ@ieeestd@stdH
14360 \pgf@circ@res@up=\pgf@circ@res@temp
14361 \pgf@circ@find@ieeeport@not@right{#2}
14362 \pgf@x=\pgf@circ@res@right
14363 \pgf@y=\pgf@circ@res@up
14364 }
14365 \anchor{center}{\pgfpointorigin}
14366 \anchor{text}{
14367 \ifpgf@circ@center@text
14368 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14369 \else
14370 \pgf@circ@ieeestd@stdH
14371 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14372 \fi
14373 }
14374 % input anchors
14375 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14376 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14377 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
14378 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
14379 % output anchors
14380 \anchor{out}{%
14381 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
14382 \advance\pgf@circ@res@other by\pinlen
14383 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
14384 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
14385 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
14386 \fi
14387 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
14388 }
14389 \anchor{bout}{\bottomright\pgf@y=0pt}
14390
14391 \anchor{body right}{\bodyright\pgf@y=0pt}
14392 \anchor{right}{\bottomright\pgf@y=0pt}
14393 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
14394 \anchor{left}{\bodyleft\pgf@y=0pt}
14395 \anchor{up}{%
14396 \bodyleft
14397 \pgf@y=+0.5\pgf@y\pgf@x=0pt
14398 }
14399 \anchor{down}{%
14400 \bodyleft
14401 \pgf@y=-0.5\pgf@y\pgf@x=0pt
14402 }
14403 % this is for when it's used as a bipole
14404 % we use the enclosing rectangle (see below)
14405 \anchorborder{%
14406 %% This (commented out) is the correct border anchor. But if we use the correct
14407 %% border anchor there is no horizontal space for the label ;-) because
14408 %% the triangle is too steep. So we will use a simple square border
14409 %%
14410 %% find the border anchor of a triangle (like a not port or an
14411 %% amplifier) ---
14412 %%
14413 %% -----^ up
14414 %% I --- |
14415 %% I -|--
14416 %%left I | --- right
14417 %% ----I-----|-------I-----
14418 %%
14419 %%
14420 %\pgf@xa=\pgf@x
14421 %% it's simmetrical w/ vertical side, use only positive y
14422 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
14423 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
14424 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
14425 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
14426 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
14427 %% limit angle for the left (vertical) side
14428 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
14429 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
14430 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
14431 %% find the border
14432 %\ifnum\@@leftside>0
14433 % % vertical side
14434 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
14435 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14436 %\else
14437 % % triangle upper line
14438 % \pgfpointintersectionoflines
14439 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
14440 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
14441 %\fi
14442 %% readjust y sign
14443 %\pgf@y=\@@switchy\pgf@y
14444 %
14445 % this is the square border to position the path label with a bit of horizontal space
14446 %
14447 \pgf@xa=\pgf@x
14448 \pgf@ya=\pgf@y
14449 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14450 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14451 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
14452 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14453 }
14454 % geographical anchors
14455 \anchor{nw}{\northwest}
14456 \anchor{ne}{\northeast}
14457 \anchor{se}{\southeast}
14458 \anchor{sw}{\southwest}
14459 \anchor{north west}{\northwest}
14460 \anchor{north east}{\northeast}
14461 \anchor{south east}{\southeast}
14462 \anchor{south west}{\southwest}
14463 % over 0,0 even if asymmetric
14464 % will break if the geocoords are not rectangular
14465 \anchor{n}{\northwest\pgf@x=0pt\relax}
14466 \anchor{e}{\northeast\pgf@y=0pt\relax}
14467 \anchor{s}{\southwest\pgf@x=0pt\relax}
14468 \anchor{w}{\northwest\pgf@y=0pt\relax}
14469 \anchor{north}{\northwest\pgf@x=0pt\relax}
14470 \anchor{east}{\northeast\pgf@y=0pt\relax}
14471 \anchor{south}{\southwest\pgf@x=0pt\relax}
14472 \anchor{west}{\northwest\pgf@y=0pt\relax}
14473
14474 \pgf@circ@draw@component{
14475 \pgfscope
14476 \pgf@circ@setcolor
14477 #3%
14478 \endpgfscope
14479 % output lead:
14480 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
14481 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
14482 \advance\pgf@circ@res@other by \pinlen\relax
14483 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
14484 \ifpgfcirc@draw@output@leads
14485 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14486 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
14487 \pgfusepath{draw}
14488 \fi
14489 \fi
14490 \ifnum #2=1\relax\pgfscope
14491 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
14492 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
14493 \endpgfscope\fi
14494 }
14495 }
14496 }
14497
14498 %%% #1 direct name #2 negated name #3 drawing (without output)
14499 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
14500 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
14501 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
14502 }
14503
14504 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
14505 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14506 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14507 \pgfextractx{\pgf@circ@res@right}{\bodyright}
14508 % \draw input pin
14509 \ifpgfcirc@draw@input@leads
14510 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14511 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
14512 \pgfusepath{draw}
14513 \fi
14514 \pgfscope
14515 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14516 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14517 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14518 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14519 \pgfpathclose
14520 \pgf@circ@draworfill
14521 \endpgfscope
14522 }
14523
14524 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
14525 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14526 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14527 \pgfextractx{\pgf@circ@res@right}{\bodyright}
14528 % \draw input pin
14529 \ifpgfcirc@draw@input@leads
14530 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14531 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
14532 \pgfusepath{draw}
14533 \fi
14534 \pgfscope
14535 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14536 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14537 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14538 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14539 \pgfpathclose
14540 \pgf@circ@draworfill
14541 \endpgfscope
14542 % draw schmitt symbol in normal line thickness
14543 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14544 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14545 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14546 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14547 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14548 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14549 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14550 \pgfusepath{draw}
14551 }
14552
14553
14554 \pgfdeclareshape{schmitt symbol}{
14555 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14556 \anchor{center}{\pgfpointorigin}
14557 \savedanchor\northwest{%
14558 \pgf@circ@ieeestd@stdH
14559 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
14560 \pgf@x=-1.5\pgf@y
14561 }
14562 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
14563 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
14564 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
14565 \anchor{west}{\northwest\pgf@y=0pt}
14566 \anchor{w}{\northwest \pgf@y=0pt}
14567 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
14568 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
14569 \anchor{north}{\northwest\pgf@x=0pt}
14570 \anchor{n}{\northwest\pgf@x=0pt}
14571 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
14572 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
14573 \anchor{north west}{\northwest}
14574 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
14575 \pgf@circ@draw@component{
14576 \pgfscope
14577 \pgf@circ@setcolor
14578 \pgfextractx{\pgf@circ@res@left}{\northwest}
14579 \pgfextracty{\pgf@circ@res@up}{\northwest}
14580 \pgf@circ@res@left=0.7\pgf@circ@res@left
14581 \pgf@circ@res@up=0.7\pgf@circ@res@up
14582 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14583 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
14584 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
14585 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14586 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
14587 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
14588 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14589 \pgfusepath{draw}
14590 \endpgfscope
14591 }
14592 }
14593
14594 \pgfdeclareshape{notcirc}{
14595 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14596 \savedanchor\northwest{%
14597 \pgf@circ@notradius
14598 \pgf@y=\pgf@circ@res@temp
14599 \pgf@x=-\pgf@y
14600 }
14601 \pgfcirc@northwest@symmetric@geoanchors
14602 \anchor{center}{\pgfpointorigin}
14603 \anchorborder{
14604 \pgf@circ@res@left=\pgf@x
14605 \pgf@circ@res@up=\pgf@y
14606 \northwest\pgf@circ@res@temp=\pgf@y
14607 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
14608 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
14609 }
14610 \pgf@circ@draw@component{
14611 \pgfscope
14612 \northwest\pgf@circ@res@temp=\pgf@y
14613 \pgf@circ@setcolor
14614 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14615 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
14616 \ifx\tikz@fillcolor\pgfutil@empty
14617 % set the default fill color to white
14618 \pgfsetfillcolor{white}
14619 % ...but override it if the class is defined!
14620 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
14621 \else
14622 \pgfsetfillcolor{\tikz@fillcolor}
14623 \fi
14624 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
14625 \pgfusepath{draw,fill}
14626 \endpgfscope
14627 }
14628 }
14629
14630 %%%% Transmission gates
14631 % tgates are only ieee style for now
14632 \tikzset{%
14633 tgate/.style ={shape=ieee tgate},
14634 double tgate/.style ={shape=ieee double tgate},
14635 }
14636 \ctikzset{tgate scale/.initial=0.7}
14637 % Buffer and inverters
14638 %
14639 % #1: name
14640 % #2: 1: one-not, 2:double-not
14641 % #3: content
14642 \long\def\pgfcircdeclareieeetgate#1#2#3{%
14643 \pgfdeclareshape{ieee #1}%
14644 {%
14645 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14646 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14647 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14648 \saveddimen{\baselen}{%
14649 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
14650 }
14651 \saveddimen{\stdH}{% This is HALF the height of the inner port
14652 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
14653 }
14654 \saveddimen{\notdiameter}{
14655 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
14656 }
14657 \saveddimen{\notradius}{
14658 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
14659 }
14660 \saveddimen{\pinlen}{%
14661 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
14662 }
14663 % anchors for the body (no pins included here)
14664 % Notice that 0.8660254 is cos(30)
14665 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
14666 \pgf@circ@ieeestd@stdH
14667 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14668 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14669 }
14670 \savedanchor{\topleft}{%
14671 \pgf@circ@ieeestd@stdH
14672 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14673 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14674 }
14675 \savedanchor{\bodyright}{%
14676 \pgf@circ@ieeestd@stdH
14677 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14678 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14679 }
14680 \savedanchor{\bottomright}{% Here it is the same as \bodyright
14681 \pgf@circ@ieeestd@stdH
14682 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14683 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14684 }
14685 % geographical anchors --- must be rectangulars!
14686 \savedanchor{\northwest}{%
14687 \pgf@circ@ieeestd@stdH
14688 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14689 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14690 }
14691 \savedanchor{\southwest}{%
14692 \pgf@circ@ieeestd@stdH
14693 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14694 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14695 }
14696 \savedanchor{\southeast}{%
14697 \pgf@circ@ieeestd@stdH
14698 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14699 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14700 }
14701 \savedanchor{\northeast}{%
14702 \pgf@circ@ieeestd@stdH
14703 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14704 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14705 }
14706 \anchor{center}{\pgfpointorigin}
14707 \anchor{text}{
14708 \ifpgf@circ@center@text
14709 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14710 \else
14711 \pgf@circ@ieeestd@stdH
14712 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14713 \fi
14714 }
14715 % input anchors
14716 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14717 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14718 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
14719 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
14720 % gates
14721 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
14722 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
14723 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
14724 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
14725 % gate (up) (2.1547 = 1+1/cos(30)
14726 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
14727 \pgf@x=0pt\relax
14728 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
14729 \ifdim\pinlen>\pgf@circ@res@temp
14730 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
14731 \else
14732 \pgf@y=\pgf@circ@res@temp
14733 \fi
14734 }
14735 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
14736 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
14737
14738 % output anchors
14739 \anchor{out}{%
14740 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
14741 \advance\pgf@circ@res@other by\pinlen
14742 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
14743 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
14744 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
14745 \fi
14746 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
14747 }
14748 \anchor{bout}{\bottomright\pgf@y=0pt}
14749
14750 \anchor{body right}{\bodyright\pgf@y=0pt}
14751 \anchor{right}{\bottomright\pgf@y=0pt}
14752 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
14753 \anchor{left}{\bodyleft\pgf@y=0pt}
14754 \anchor{up}{%
14755 \bodyleft
14756 \pgf@x=0pt
14757 \ifnum#2=1\relax
14758 \pgf@y=0pt
14759 \else
14760 \pgf@y=.5\pgf@y
14761 \fi
14762 \advance\pgf@y by \notdiameter
14763 }
14764 \anchor{down}{%
14765 \bodyleft
14766 \pgf@x=0pt
14767 \ifnum#2=1\relax
14768 \pgf@y=0pt
14769 \else
14770 \pgf@y=-.5\pgf@y
14771 \fi
14772 }
14773 % this is for when it's used as a bipole
14774 % we use the enclosing rectangle (see below)
14775 \anchorborder{%
14776 %
14777 % this is the square border to position the path label with a bit of horizontal space
14778 %
14779 \pgf@xa=\pgf@x
14780 \pgf@ya=\pgf@y
14781 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14782 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14783 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
14784 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14785 }
14786 % geographical anchors
14787 \anchor{nw}{\northwest}
14788 \anchor{ne}{\northeast}
14789 \anchor{se}{\southeast}
14790 \anchor{sw}{\southwest}
14791 \anchor{north west}{\northwest}
14792 \anchor{north east}{\northeast}
14793 \anchor{south east}{\southeast}
14794 \anchor{south west}{\southwest}
14795 % over 0,0 even if asymmetric
14796 % will break if the geocoords are not rectangular
14797 \anchor{n}{\northwest\pgf@x=0pt\relax}
14798 \anchor{e}{\northeast\pgf@y=0pt\relax}
14799 \anchor{s}{\southwest\pgf@x=0pt\relax}
14800 \anchor{w}{\northwest\pgf@y=0pt\relax}
14801 \anchor{north}{\northwest\pgf@x=0pt\relax}
14802 \anchor{east}{\northeast\pgf@y=0pt\relax}
14803 \anchor{south}{\southwest\pgf@x=0pt\relax}
14804 \anchor{west}{\northwest\pgf@y=0pt\relax}
14805
14806 \pgf@circ@draw@component{
14807 \pgfscope
14808 \pgf@circ@setcolor
14809 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14810 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14811 \pgfextractx{\pgf@circ@res@right}{\bodyright}
14812 % \draw input pins
14813 \ifpgfcirc@draw@input@leads
14814 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
14816 % gate (down)
14817 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
14818 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
14819 % gate (up) (2.1547 = 1+1/cos(30)
14820 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
14821 \ifdim\pinlen>\pgf@circ@res@temp
14822 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
14823 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
14824 \fi
14825 \pgfusepath{draw}
14826 \fi
14827 #3%
14828 \endpgfscope
14829 % output lead:
14830 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
14831 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
14832 \advance\pgf@circ@res@other by \pinlen\relax
14833 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
14834 \ifpgfcirc@draw@output@leads
14835 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14836 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
14837 \pgfusepath{draw}
14838 \fi
14839 \fi
14840 }
14841 }
14842 }
14843
14844 \pgfcircdeclareieeetgate{tgate}{1}{%
14845 \pgfscope
14846 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14847 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14848 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
14849 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14850 \pgfpathclose
14851 \pgf@circ@draworfill
14852 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14853 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
14854 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
14855 \pgfpathclose
14856 \pgf@circ@draworfill
14857 \endpgfscope
14858 \pgfscope
14859 % 1.1547 is 1/cos(30)
14860 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
14861 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
14862 \endpgfscope
14863 }
14864
14865 \pgfcircdeclareieeetgate{double tgate}{2}{%
14866 \pgfscope
14867 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14868 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14869 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
14870 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14871 \pgfpathclose
14872 \pgf@circ@draworfill
14873 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
14874 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
14875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14876 \pgfpathclose
14877 \pgf@circ@draworfill
14878 % bottom triangles
14879 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14880 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
14881 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14882 \pgfpathclose
14883 \pgf@circ@draworfill
14884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
14885 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
14886 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14887 \pgfpathclose
14888 \pgf@circ@draworfill
14889 \endpgfscope
14890 \pgfscope
14891 % 1.1547 is 1/cos(30)
14892 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
14893 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
14894 \endpgfscope
14895 }% %>>>
14896
14897 %% Path-style definitions for logical ports%<<<
14898 %
14899 % create path-style element for one input --- one output logical ports
14900 %
14901 \def\pgfcirc@port@node@to@path#1#2{%
14902 %
14903 % add a logic port path style component --- we need to suppress leads
14904 % and use the correct center
14905 %
14906 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
14907 }
14908 \pgfcirc@port@node@to@path{not port}{inline not}
14909 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
14910 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
14911 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
14912
14913 \pgfcirc@port@node@to@path{tgate}{inline tgate}
14914 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
14915 % %>>>
14916
14917 %%%%%%%%%%%%%%%%%%%%%%%%
14918 %% Transistors
14919 %%%%%%%%%%%%%%%%%%%%%%%%
14920
14921 % Settings for Transistors %<<<1
14922
14923 \newif\ifpgf@circuit@trans@depletiontype
14924 \pgf@circuit@trans@depletiontypefalse
14925
14926 \newif\ifpgf@circuit@mos@arrows
14927 \ctikzset{tripoles/mos style/.is choice}
14928 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
14929 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
14930 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
14931 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
14932
14933 % Fixed label positions
14934 \newif\ifpgf@circuit@transisors@fixlabels
14935 \pgf@circuit@transisors@fixlabelstrue
14936 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
14937 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
14938 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
14939 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
14940
14941 % Option solderdot for fet
14942 \newif\ifpgf@circuit@fet@solderdot
14943 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
14944 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
14945 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
14946 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
14947
14948 %%%% activate doublegate
14949 \newif\ifpgf@circuit@fet@doublegate
14950 \pgfkeys{/tikz/doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}}
14951 \ctikzset{doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}}
14952 \pgfkeys{/tikz/nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}}
14953 \ctikzset{nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}}
14954
14955 % Option bodydiode for fet
14956 \newif\ifpgf@circuit@fet@bodydiode
14957 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
14958 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
14959 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
14960 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
14961
14962 % Option draw fet without gate connection
14963 \newif\ifpgf@circuit@bpt@drawgate
14964 \pgf@circuit@bpt@drawgatetrue
14965 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
14966 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
14967 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
14968 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
14969
14970 % Option draw bpt with schottky base
14971 \newif\ifpgf@circuit@bpt@schottky
14972 \pgf@circuit@bpt@schottkyfalse
14973 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
14974 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
14975 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
14976 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
14977 \ctikzset{tripoles/schottky base size/.initial=0.05}
14978
14979 % Option to add ferroelectric symbol
14980 \newif\ifpgf@circuit@tr@ferroel
14981 \pgf@circuit@tr@ferroelfalse
14982 \pgfkeys{/tikz/ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
14983 \ctikzset{ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
14984 \pgfkeys{/tikz/no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
14985 \ctikzset{no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
14986
14987
14988 % Option draw bpt without base connection
14989 \newif\ifpgf@circuit@bpt@drawbase
14990 \pgf@circuit@bpt@drawbasetrue
14991 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
14992 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
14993 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
14994 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
14995
14996 % Option draw bpt with optical input
14997 \newif\ifpgf@circuit@bpt@drawphoto
14998 \pgf@circuit@bpt@drawphotofalse
14999 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15000 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15001 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15002 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15003
15004 % Option draw fet without bulk connection -- Added by Burak Kelleci
15005 \newif\ifpgf@circuit@bpt@drawbulk
15006 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
15007 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
15008 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
15009 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
15010
15011 % Option draw pmos with empty circle
15012 \newif\ifpgf@circuit@pmos@emptycircle
15013 \pgf@circuit@pmos@emptycirclefalse
15014 \ctikzset{tripoles/pmos style/.is choice}
15015 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
15016 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
15017 % Option draw pmos with no circle
15018 \newif\ifpgf@circuit@pmos@nocircle
15019 \pgf@circuit@pmos@nocirclefalse
15020 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
15021 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
15022 % back to normal
15023 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
15024 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
15025 % arrows at the end, the correct way
15026 \newif\ifpgf@circuit@trans@arrowatend
15027 \pgf@circuit@trans@arrowatendfalse
15028 \ctikzset{transistors/arrow pos/.is choice}
15029 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
15030 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
15031
15032 \newif\ifpgf@circuit@trans@ntype
15033 \pgf@circuit@trans@ntypetrue %default true
15034 %\newif\ifpgf@circuit@trans@ptype
15035 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
15036 \ctikzset{tripoles/nmos/width/.initial=.7}
15037 \ctikzset{tripoles/nmos/gate height/.initial=.35}
15038 \ctikzset{tripoles/nmos/base height/.initial=.5}
15039 \ctikzset{tripoles/nmos/conn height/.initial=0}
15040 \ctikzset{tripoles/nmos/height/.initial=1.1}
15041 \ctikzset{tripoles/nmos/base width/.initial=.5}
15042 \ctikzset{tripoles/nmos/gate width/.initial=.62}
15043 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
15044 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
15045 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
15046 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
15047 \ctikzset{tripoles/nmos/curr direction/.initial=1}
15048
15049 \ctikzset{tripoles/pmos/width/.initial=.7}
15050 \ctikzset{tripoles/pmos/gate height/.initial=.35}
15051 \ctikzset{tripoles/pmos/base height/.initial=.5}
15052 \ctikzset{tripoles/pmos/conn height/.initial=0}
15053 \ctikzset{tripoles/pmos/height/.initial=1.1}
15054 \ctikzset{tripoles/pmos/base width/.initial=.5}
15055 \ctikzset{tripoles/pmos/gate width/.initial=.62}
15056 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
15057 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
15058 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
15059 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
15060 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
15061
15062 \ctikzset{tripoles/nmosd/width/.initial=.7}
15063 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
15064 \ctikzset{tripoles/nmosd/base height/.initial=.5}
15065 \ctikzset{tripoles/nmosd/conn height/.initial=0}
15066 \ctikzset{tripoles/nmosd/height/.initial=1.1}
15067 \ctikzset{tripoles/nmosd/base width/.initial=.5}
15068 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
15069 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
15070 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
15071 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
15072 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
15073 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
15074 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
15075 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
15076
15077 \ctikzset{tripoles/pmosd/width/.initial=.7}
15078 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
15079 \ctikzset{tripoles/pmosd/base height/.initial=.5}
15080 \ctikzset{tripoles/pmosd/conn height/.initial=0}
15081 \ctikzset{tripoles/pmosd/height/.initial=1.1}
15082 \ctikzset{tripoles/pmosd/base width/.initial=.5}
15083 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
15084 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
15085 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
15086 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
15087 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
15088 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
15089 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
15090 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
15091 \ctikzset{tripoles/hemt/width/.initial=.7}
15092 \ctikzset{tripoles/hemt/gate height/.initial=.35}
15093 \ctikzset{tripoles/hemt/base height/.initial=.5}
15094 \ctikzset{tripoles/hemt/conn height/.initial=0}
15095 \ctikzset{tripoles/hemt/height/.initial=1.1}
15096 \ctikzset{tripoles/hemt/base width/.initial=.5}
15097 \ctikzset{tripoles/hemt/gate width/.initial=.5}% the horizontal position is the same
15098 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
15099 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
15100 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
15101 \ctikzset{tripoles/hemt/curr direction/.initial=1}
15102 %% New parameters
15103 \ctikzset{tripoles/hemt/curr direction/.initial=1}
15104 \ctikzset{tripoles/hemt/gate asym/.initial=0}
15105 \newif\ifpgf@circ@hemt@split
15106 \ctikzset{tripoles/hemt/split gate/.is if=pgf@circ@hemt@split}
15107 \ctikzset{tripoles/hemt/source arrow/.initial=0}
15108
15109 \ctikzset{tripoles/nfet/width/.initial=.7}
15110 \ctikzset{tripoles/nfet/gate height/.initial=.35}
15111 \ctikzset{tripoles/nfet/base height/.initial=.5}
15112 \ctikzset{tripoles/nfet/conn height/.initial=0}
15113 \ctikzset{tripoles/nfet/height/.initial=1.1}
15114 \ctikzset{tripoles/nfet/base width/.initial=.5}
15115 \ctikzset{tripoles/nfet/gate width/.initial=.62}
15116 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
15117 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
15118 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
15119 \ctikzset{tripoles/nfet/curr direction/.initial=1}
15120
15121 \ctikzset{tripoles/pfet/width/.initial=.7}
15122 \ctikzset{tripoles/pfet/gate height/.initial=.35}
15123 \ctikzset{tripoles/pfet/base height/.initial=.5}
15124 \ctikzset{tripoles/pfet/conn height/.initial=0}
15125 \ctikzset{tripoles/pfet/height/.initial=1.1}
15126 \ctikzset{tripoles/pfet/base width/.initial=.5}
15127 \ctikzset{tripoles/pfet/gate width/.initial=.62}
15128 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
15129 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
15130 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
15131 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
15132
15133 \ctikzset{tripoles/nfetd/width/.initial=.7}
15134 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
15135 \ctikzset{tripoles/nfetd/base height/.initial=.5}
15136 \ctikzset{tripoles/nfetd/conn height/.initial=0}
15137 \ctikzset{tripoles/nfetd/height/.initial=1.1}
15138 \ctikzset{tripoles/nfetd/base width/.initial=.5}
15139 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
15140 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
15141 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
15142 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
15143 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
15144
15145 \ctikzset{tripoles/pfetd/width/.initial=.7}
15146 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
15147 \ctikzset{tripoles/pfetd/base height/.initial=.5}
15148 \ctikzset{tripoles/pfetd/conn height/.initial=0}
15149 \ctikzset{tripoles/pfetd/height/.initial=1.1}
15150 \ctikzset{tripoles/pfetd/base width/.initial=.5}
15151 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
15152 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
15153 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
15154 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
15155 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
15156
15157 \ctikzset{tripoles/nigfete/width/.initial=.7}
15158 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
15159 \ctikzset{tripoles/nigfete/base height/.initial=.5}
15160 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
15161 \ctikzset{tripoles/nigfete/height/.initial=1.1}
15162 \ctikzset{tripoles/nigfete/base width/.initial=.5}
15163 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
15164 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
15165 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
15166 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
15167 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
15168
15169 \ctikzset{tripoles/nigfetd/width/.initial=.7}
15170 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
15171 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
15172 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
15173 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
15174 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
15175 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
15176 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
15177 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
15178 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
15179 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
15180
15181 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
15182 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
15183 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
15184 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
15185 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
15186 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
15187 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
15188 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
15189 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
15190 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
15191 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
15192
15193 \ctikzset{tripoles/pigfete/width/.initial=.7}
15194 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
15195 \ctikzset{tripoles/pigfete/base height/.initial=.5}
15196 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
15197 \ctikzset{tripoles/pigfete/height/.initial=1.1}
15198 \ctikzset{tripoles/pigfete/base width/.initial=.5}
15199 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
15200 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
15201 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
15202 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
15203 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
15204
15205 \ctikzset{tripoles/pigfetd/width/.initial=.7}
15206 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
15207 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
15208 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
15209 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
15210 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
15211 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
15212 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
15213 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
15214 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
15215 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
15216
15217 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
15218 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
15219 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
15220 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
15221 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
15222 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
15223 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
15224 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
15225 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
15226 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
15227 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
15228
15229 \ctikzset{tripoles/npn/width/.initial=.6}
15230 \ctikzset{tripoles/npn/base height/.initial=.45}
15231 \ctikzset{tripoles/npn/base height 2/.initial=.15}
15232 \ctikzset{tripoles/npn/base height/.initial=.4}
15233 \ctikzset{tripoles/npn/conn height/.initial=0}
15234 \ctikzset{tripoles/npn/height/.initial=1.1}
15235 \ctikzset{tripoles/npn/base width/.initial=.5}
15236 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
15237 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
15238 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
15239 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
15240 \ctikzset{tripoles/npn/curr direction/.initial=1}
15241
15242 \ctikzset{tripoles/pnp/width/.initial=.6}
15243 \ctikzset{tripoles/pnp/base height/.initial=.45}
15244 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
15245 \ctikzset{tripoles/pnp/base height/.initial=.4}
15246 \ctikzset{tripoles/pnp/conn height/.initial=0}
15247 \ctikzset{tripoles/pnp/height/.initial=1.1}
15248 \ctikzset{tripoles/pnp/base width/.initial=.5}
15249 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
15250 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
15251 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
15252 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
15253 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
15254
15255 \ctikzset{tripoles/pigbt/width/.initial=.6}
15256 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
15257 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
15258 \ctikzset{tripoles/pigbt/base height/.initial=.4}
15259 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
15260 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
15261 \ctikzset{tripoles/pigbt/conn height/.initial=0}
15262 \ctikzset{tripoles/pigbt/height/.initial=1.1}
15263 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
15264 \ctikzset{tripoles/pigbt/base width/.initial=.5}
15265 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
15266 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
15267 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
15268 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
15269
15270 \ctikzset{tripoles/nigbt/width/.initial=.6}
15271 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
15272 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
15273 \ctikzset{tripoles/nigbt/base height/.initial=.4}
15274 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
15275 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
15276 \ctikzset{tripoles/nigbt/conn height/.initial=0}
15277 \ctikzset{tripoles/nigbt/height/.initial=1.1}
15278 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
15279 \ctikzset{tripoles/nigbt/base width/.initial=.5}
15280 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
15281 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
15282 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
15283 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
15284
15285 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
15286 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
15287 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
15288 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
15289 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
15290 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
15291 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
15292 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
15293 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
15294 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
15295 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
15296 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
15297 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
15298 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
15299
15300 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
15301 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
15302 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
15303 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
15304 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
15305 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
15306 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
15307 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
15308 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
15309 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
15310 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
15311 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
15312 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
15313 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
15314
15315 \ctikzset{tripoles/igbt/outer base height/.code={
15316 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
15317 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
15318 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
15319 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
15320 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
15321 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
15322 }}
15323 \ctikzset{tripoles/igbt/outer base thickness/.code={
15324 \ctikzset{tripoles/nigbt/outer base thickness=#1}
15325 \ctikzset{tripoles/pigbt/outer base thickness=#1}
15326 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
15327 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
15328 }}
15329
15330 \ctikzset{tripoles/njfet/width/.initial=.7}
15331 \ctikzset{tripoles/njfet/gate height/.initial=.5}
15332 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
15333 \ctikzset{tripoles/njfet/gate width/.initial=.5}
15334 \ctikzset{tripoles/njfet/base width/.initial=.5}
15335 \ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior
15336 \ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate
15337 \ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink
15338 \ctikzset{tripoles/njfet/height/.initial=1.1}
15339 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
15340 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
15341 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
15342 \ctikzset{tripoles/njfet/curr direction/.initial=1}
15343
15344 \ctikzset{tripoles/pjfet/width/.initial=.7}
15345 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
15346 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
15347 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
15348 \ctikzset{tripoles/pjfet/base width/.initial=.5}
15349 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
15350 \ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate
15351 \ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink
15352 \ctikzset{tripoles/pjfet/height/.initial=1.1}
15353 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
15354 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
15355 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
15356 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
15357
15358 \ctikzset{tripoles/nujt/width/.initial=.7}
15359 \ctikzset{tripoles/nujt/gate height/.initial=.5}
15360 \ctikzset{tripoles/nujt/gate height 2/.initial=.35}
15361 \ctikzset{tripoles/nujt/gate width/.initial=.5}
15362 \ctikzset{tripoles/nujt/base width/.initial=.5}
15363 \ctikzset{tripoles/nujt/conn height/.initial=.35}
15364 \ctikzset{tripoles/nujt/union height/.initial=0}% at the gate
15365 \ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position
15366 \ctikzset{tripoles/nujt/height/.initial=1.1}
15367 \ctikzset{tripoles/nujt/bodydiode scale/.initial=.3}
15368 \ctikzset{tripoles/nujt/bodydiode distance/.initial=.3}
15369 \ctikzset{tripoles/nujt/bodydiode conn/.initial=.6}
15370 \ctikzset{tripoles/nujt/curr direction/.initial=1}
15371
15372 \ctikzset{tripoles/pujt/width/.initial=.7}
15373 \ctikzset{tripoles/pujt/gate height/.initial=.5}
15374 \ctikzset{tripoles/pujt/gate height 2/.initial=.35}
15375 \ctikzset{tripoles/pujt/gate width/.initial=.5}
15376 \ctikzset{tripoles/pujt/base width/.initial=.5}
15377 \ctikzset{tripoles/pujt/conn height/.initial=.35}
15378 \ctikzset{tripoles/pujt/union height/.initial=0}% at the gate
15379 \ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position
15380 \ctikzset{tripoles/pujt/height/.initial=1.1}
15381 \ctikzset{tripoles/pujt/bodydiode scale/.initial=.3}
15382 \ctikzset{tripoles/pujt/bodydiode distance/.initial=.3}
15383 \ctikzset{tripoles/pujt/bodydiode conn/.initial=.6}
15384 \ctikzset{tripoles/pujt/curr direction/.initial=-1}
15385
15386 \ctikzset{tripoles/isfet/width/.initial=1}
15387 \ctikzset{tripoles/isfet/gate height/.initial=.35}
15388 \ctikzset{tripoles/isfet/base height/.initial=.5}
15389 \ctikzset{tripoles/isfet/height/.initial=1.1}
15390 \ctikzset{tripoles/isfet/base width/.initial=.3}
15391 \ctikzset{tripoles/isfet/gate width/.initial=.5}
15392 \ctikzset{tripoles/isfet/conn height/.initial=0}
15393 \ctikzset{tripoles/isfet/wave width/.initial=.16}
15394 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
15395 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
15396 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
15397 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
15398 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
15399 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
15400 \ctikzset{tripoles/isfet/curr direction/.initial=1}
15401 %
15402 % graphene FET
15403 %
15404 \ctikzset{tripoles/pgfet/width/.initial=.6}
15405 \ctikzset{tripoles/pgfet/gate height/.initial=.5}
15406 \ctikzset{tripoles/pgfet/gate height 2/.initial=0.25} % must be "gate height"/2
15407 \ctikzset{tripoles/pgfet/base height/.initial=.5} % must be "gate height"
15408 \ctikzset{tripoles/pgfet/outer base height/.initial=.25} % must be "gate height 2"
15409 \ctikzset{tripoles/pgfet/outer base thickness/.initial=1}
15410 \ctikzset{tripoles/pgfet/conn height/.initial=0}
15411 \ctikzset{tripoles/pgfet/height/.initial=1.1}
15412 \ctikzset{tripoles/pgfet/gate width/.initial=.5}
15413 \ctikzset{tripoles/pgfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
15414 \ctikzset{tripoles/pgfet/bodydiode scale/.initial=.3}
15415 \ctikzset{tripoles/pgfet/bodydiode distance/.initial=.6}
15416 \ctikzset{tripoles/pgfet/bodydiode conn/.initial=.6}
15417 \ctikzset{tripoles/pgfet/curr direction/.initial=-1}
15418
15419 \ctikzset{tripoles/ngfet/width/.initial=.6}
15420 \ctikzset{tripoles/ngfet/gate height/.initial=.5}
15421 \ctikzset{tripoles/ngfet/gate height 2/.initial=0.25} % must be "gate height"/2
15422 \ctikzset{tripoles/ngfet/base height/.initial=.5} % must be "gate height"
15423 \ctikzset{tripoles/ngfet/outer base height/.initial=.25} % must be "gate height 2"
15424 \ctikzset{tripoles/ngfet/outer base thickness/.initial=1}
15425 \ctikzset{tripoles/ngfet/conn height/.initial=0}
15426 \ctikzset{tripoles/ngfet/height/.initial=1.1}
15427 \ctikzset{tripoles/ngfet/gate width/.initial=.5}
15428 \ctikzset{tripoles/ngfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
15429 \ctikzset{tripoles/ngfet/bodydiode scale/.initial=.3}
15430 \ctikzset{tripoles/ngfet/bodydiode distance/.initial=.6}
15431 \ctikzset{tripoles/ngfet/bodydiode conn/.initial=.6}
15432 \ctikzset{tripoles/ngfet/curr direction/.initial=1}
15433 %
15434 % multi-emitter and multi-collector BJTs by Romano Giannetti
15435 %
15436 \ctikzset{tripoles/bjt/emitters/.initial=1}
15437 \ctikzset{tripoles/bjt/collectors/.initial=1}
15438 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
15439 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
15440 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
15441 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
15442 \ctikzset{tripoles/bjt/multi height/.initial=.5}
15443 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
15444 %
15445 \ctikzset{tripoles/bjt/width/.initial=.3}
15446 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
15447 \ctikzset{tripoles/bjt/base height/.initial=1.1}
15448 \ctikzset{tripoles/bjt/height/.initial=.4}
15449 \ctikzset{tripoles/bjt/base width/.initial=1}
15450 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
15451 % do NOT touch these two!
15452 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
15453 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
15454
15455
15456 %
15457 % definitions for transistor circles
15458 %
15459 \ctikzset{transistor circle/.is family}
15460 \ctikzset{transistor circle/relative thickness/.initial=1}
15461 \ctikzset{transistor circle/color/.initial=default}
15462 \ctikzset{transistor circle/dash/.initial=default}
15463 \ctikzset{transistor circle/scale circle radius/.initial=1}
15464 \ctikzset{transistor circle/default base in/.initial=0.9}
15465 \ctikzset{transistor circle/njfet base in/.initial=1.05}
15466 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
15467 \ctikzset{transistor circle/isfet base in/.initial=0.65}
15468
15469 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
15470 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
15471 \tikzset{tr circle/.is if=pgf@circ@trcircle}
15472 % partial borders styles
15473 % this can be "none" or 4 numbers saying the style for each part:
15474 % 0 --- nothing, 1 --- solid, 2 --- dashed
15475 \ctikzset{transistor circle/partial borders/.initial=none} % Value none for normal borders
15476 \ctikzset{transistor circle/partial border dash/.initial={{2pt}{2pt}}}
15477 %
15478 % body diode style
15479 \ctikzset{transistor bodydiode/.is family}
15480 \ctikzset{transistor bodydiode/relative thickness/.initial=1}
15481 \ctikzset{transistor bodydiode/color/.initial=default}
15482 \ctikzset{transistor bodydiode/dash/.initial=default}
15483 \ctikzset{transistor bodydiode/dot scale/.initial=0.7}
15484 \ctikzset{transistor solderdot scale/.initial=0.7}
15485 % this is unfortunate, but needed for backward compatibility
15486 \ctikzset{transistor bodydiode/scale/.code={%
15487 \ctikzset{tripoles/nmos/bodydiode scale=#1}%
15488 \ctikzset{tripoles/pmos/bodydiode scale=#1}%
15489 \ctikzset{tripoles/nmosd/bodydiode scale=#1}%
15490 \ctikzset{tripoles/pmosd/bodydiode scale=#1}%
15491 \ctikzset{tripoles/hemt/bodydiode scale=#1}%
15492 \ctikzset{tripoles/nfet/bodydiode scale=#1}%
15493 \ctikzset{tripoles/pfet/bodydiode scale=#1}%
15494 \ctikzset{tripoles/nfetd/bodydiode scale=#1}%
15495 \ctikzset{tripoles/pfetd/bodydiode scale=#1}%
15496 \ctikzset{tripoles/nigfete/bodydiode scale=#1}%
15497 \ctikzset{tripoles/nigfetd/bodydiode scale=#1}%
15498 \ctikzset{tripoles/nigfetebulk/bodydiode scale=#1}%
15499 \ctikzset{tripoles/pigfete/bodydiode scale=#1}%
15500 \ctikzset{tripoles/pigfetd/bodydiode scale=#1}%
15501 \ctikzset{tripoles/pigfetebulk/bodydiode scale=#1}%
15502 \ctikzset{tripoles/npn/bodydiode scale=#1}%
15503 \ctikzset{tripoles/pnp/bodydiode scale=#1}%
15504 \ctikzset{tripoles/pigbt/bodydiode scale=#1}%
15505 \ctikzset{tripoles/nigbt/bodydiode scale=#1}%
15506 \ctikzset{tripoles/Lpigbt/bodydiode scale=#1}%
15507 \ctikzset{tripoles/Lnigbt/bodydiode scale=#1}%
15508 \ctikzset{tripoles/njfet/bodydiode scale=#1}%
15509 \ctikzset{tripoles/pjfet/bodydiode scale=#1}%
15510 \ctikzset{tripoles/nujt/bodydiode scale=#1}%
15511 \ctikzset{tripoles/pujt/bodydiode scale=#1}%
15512 \ctikzset{tripoles/isfet/bodydiode scale=#1}%
15513 \ctikzset{tripoles/pgfet/bodydiode scale=#1}%
15514 \ctikzset{tripoles/ngfet/bodydiode scale=#1}%
15515 }}
15516 %%>>>
15517
15518
15519 %% definitions of transistor shapes%<<<
15520 %
15521 % draw partial transistor outline
15522 %
15523 \def\pgf@circ@trcircle@split#1#2#3#4\relax{%split the six numbers
15524 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}%
15525 }
15526 \def\pgf@circ@trcircle@setdash{%
15527 \edef\@@dash{\ctikzvalof{transistor circle/partial border dash}}%
15528 % \typeout{DASH:\@@dash}%
15529 \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}%
15530 }
15531 % this is the same as the tubes' one, but let's keep it separated
15532 \def\pgf@circ@trcircle@draw@style#1{%
15533 \ifcase#1
15534 \pgfusepath{discard}% case 0, will discard the path
15535 \or
15536 \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid
15537 \or
15538 \pgf@circ@trcircle@setdash\pgfusepath{draw}% case 2, dashed
15539 \else
15540 \pgfutil@packagewarning{circuitikz}{Transistor circle draw style not known!}%
15541 \pgfusepath{draw}%
15542 \fi
15543 }
15544 %
15545 % add a circle to the transistor:
15546 \def\pgf@circ@trcircle@draw@partial#1{%
15547 \expandafter\pgf@circ@trcircle@split#1\relax
15548 % \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d}
15549 \pgfscope % right side upper arc
15550 \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{\circleradius}}
15551 \pgfpatharc{90}{0}{\circleradius}
15552 \pgf@circ@trcircle@draw@style{\@@a}
15553 \endpgfscope
15554 \pgfscope % right side lower arc
15555 \pgfpathmoveto{\pgfpoint{\circleleft+2*\circleradius}{0pt}}
15556 \pgfpatharc{0}{-90}{\circleradius}
15557 \pgf@circ@trcircle@draw@style{\@@b}
15558 \endpgfscope
15559 \pgfscope % left side lower arc
15560 \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{-\circleradius}}
15561 \pgfpatharc{-90}{-180}{\circleradius}
15562 \pgf@circ@trcircle@draw@style{\@@c}
15563 \endpgfscope
15564 \pgfscope % left side upper arc
15565 \pgfpathmoveto{\pgfpoint{\circleleft}{0pt}}
15566 \pgfpatharc{-180}{-270}{\circleradius}
15567 \pgf@circ@trcircle@draw@style{\@@d}
15568 \endpgfscope
15569 }
15570 %
15571 \def\pgfcirc@transistorcircle{
15572 \ifpgf@circ@trcircle
15573 \pgfscope
15574 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15575 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
15576 \pgf@circ@subset@color@dash{transistor circle}
15577 % radius of the circle
15578 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
15579 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
15580 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
15581 \edef\@@partial{\ctikzvalof{transistor circle/partial borders}}
15582 \ifx\@@partial\pgf@nonetext
15583 % Circle fill and draw if it's not partial... for speed
15584 \pgf@circ@draworfill
15585 \else
15586 % otherwise, just fill and do the partial fill
15587 \pgf@circ@maybefill
15588 \pgf@circ@trcircle@draw@partial{\@@partial}
15589 \fi
15590 \endpgfscope
15591 \fi
15592 }
15593
15594 % add a ferroelectric squish to transistors
15595
15596 \def\pgfcirc@ferroelectric#1#2{% #1 -> transistor type, #2 horizontal enlargment (prop to ...@left),
15597 \ifpgf@circuit@tr@ferroel\pgfscope
15598 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15599 \pgf@circ@set@relative@thickness{modifier thickness}
15600 % base-gate center and width of the sigmoid
15601 \pgfmathsetlength{\pgf@circ@res@other}
15602 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width}-(#2))*\pgf@circ@res@left}
15603 \pgfmathsetlength{\pgf@circ@res@temp}
15604 {1.2*abs(\ctikzvalof{tripoles/#1/gate width}-\ctikzvalof{tripoles/#1/base width}+0.5*(#2))*\pgf@circ@res@left}
15605 \pgfsetcornersarced{\pgfpoint{-0.2\pgf@circ@res@temp}{-0.2\pgf@circ@res@temp}}
15606 \pgfpathmoveto{\pgfpoint
15607 {\pgf@circ@res@other+\pgf@circ@res@temp}
15608 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
15609 \pgfpathlineto{\pgfpoint
15610 {\pgf@circ@res@other+\pgf@circ@res@temp}
15611 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
15612 \pgfpathlineto{\pgfpoint
15613 {\pgf@circ@res@other-\pgf@circ@res@temp}
15614 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
15615 \pgfpathlineto{\pgfpoint
15616 {\pgf@circ@res@other-\pgf@circ@res@temp}
15617 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
15618 \pgfusepath{draw}
15619 \endpgfscope\fi
15620 }
15621
15622 \ctikzset{tr gap fill/.initial=none}
15623 \tikzset{tr gap fill/.style={\circuitikzbasekey/tr gap fill={#1}}}
15624 % fill the gap in relevant transistors
15625 \def\pgfcirc@fillgategap#1{% #1 transistor type
15626 \edef\@@@none{none}\edef\@@@color{\ctikzvalof{tr gap fill}}% always exists
15627 \ifx\@@@none\@@@color\relax\else
15628 \begingroup % save the value of @res: other, step, temp
15629 \edef\@@@doit{1}% draw it, set to zero if we give up
15630 % ok, we have the color here. we have to get center position, with and height
15631 % normally is gate height; but in igbt is outer base height (grrrr)
15632 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/outer base height}{
15633 % yes, it's an IGBT
15634 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/outer base height}*\pgf@circ@res@up}
15635 }{
15636 %no. Let's try with gate height
15637 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate height}{
15638 % yes, go for it
15639 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/gate height}*\pgf@circ@res@up}
15640 }{
15641 %no, give up, let value to 0
15642 \edef\@@@doit{0}
15643 }
15644 }
15645 % now we have to find x1 and x2: these are base width and gate width
15646 % if do not have one of that, bail out.
15647 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
15648 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{tripoles/#1/gate width}*\pgf@circ@res@left}
15649 }{
15650 \edef\@@@doit{0}
15651 }
15652 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/base width}{
15653 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}
15654 }{
15655 \edef\@@@doit{0}
15656 }
15657 % if found, draw it.
15658 \ifnum\@@@doit>0\relax
15659 \pgfscope
15660 \pgfsetfillcolor{\@@@color}
15661 \pgfsetcolor{\@@@color}
15662 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@other}}
15663 \pgfusepath{fill, draw}
15664 \endpgfscope
15665 \fi
15666 \endgroup
15667 \fi
15668 }
15669
15670 \long\def\pgfcircdeclaretransistor#1#2#3{
15671 \pgfdeclareshape{#1}
15672 {
15673 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
15674 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15675 \savedmacro{\circlebase}{
15676 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
15677 {% yes, we have it
15678 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
15679 }{% no, use default
15680 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
15681 }}
15682 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
15683 \saveddimen{\extrabodydiodelen}{
15684 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15685 \ifpgf@circuit@fet@bodydiode
15686 % try to put the text to the right of the flyback diode
15687 \pgfmathsetlength{\pgf@x}{(
15688 \ctikzvalof{tripoles/#1/bodydiode distance}*
15689 \ctikzvalof{tripoles/#1/width} +
15690 \ctikzvalof{tripoles/#1/bodydiode scale}*
15691 \ctikzvalof{bipoles/diode/height}/2
15692 )*\pgf@circ@scaled@Rlen}
15693 \else
15694 \pgf@x=0pt\relax
15695 \fi
15696 }
15697 \savedmacro{\scalecircleradius}{
15698 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
15699 }
15700 \saveddimen{\circleradius}{
15701 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15702 % repeat the extrabodydiodelen (grrr)
15703 \ifpgf@circuit@fet@bodydiode
15704 % try to put the text to the right of the flyback diode
15705 \pgfmathsetlength{\pgf@circ@res@other}{(
15706 \ctikzvalof{tripoles/#1/bodydiode distance}*
15707 \ctikzvalof{tripoles/#1/width} +
15708 \ctikzvalof{tripoles/#1/bodydiode scale}*
15709 \ctikzvalof{bipoles/diode/height}/2
15710 )*\pgf@circ@scaled@Rlen}
15711 \else
15712 \pgf@circ@res@other=0pt\relax
15713 \fi
15714 % left
15715 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15716 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
15717 % northeast
15718 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
15719 \pgf@yb=.5\pgf@yb
15720 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
15721 %
15722 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
15723 % find the radius of the circle
15724 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
15725 }
15726 \saveddimen{\circleleft}{
15727 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15728 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15729 \pgf@x=\circlebase\pgf@xa
15730 }
15731 \anchor{circle center}{
15732 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
15733 }
15734 \anchor{circle top}{
15735 \pgf@y=\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius
15736 }
15737 \anchor{circle bottom}{
15738 \pgf@y=-\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius
15739 }
15740 \anchor{circle left}{
15741 \pgf@y=0pt\pgf@x=\circleleft
15742 }
15743 \anchor{circle right}{
15744 \pgf@y=0pt\pgf@x=\circleleft
15745 \advance\pgf@x by \circleradius\advance\pgf@x by \circleradius
15746 }
15747 \savedanchor{\centergap}{% this is the center position between gate and base
15748 % get "left"
15749 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15750 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15751 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
15752 % yes, we have a separated gate
15753 \pgfmathsetlength{\pgf@x}
15754 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width})*\pgf@xa}
15755 }{
15756 % no, use just the base
15757 \pgfmathsetlength{\pgf@x}
15758 {\ctikzvalof{tripoles/#1/base width}*\pgf@xa}
15759 }
15760 \pgf@y=0pt\relax
15761 }
15762 \anchor{centergap}{\centergap}
15763 \anchor{center}{
15764 \pgfpointorigin
15765 }
15766 \savedanchor\northeast{% upper right
15767 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15768 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
15769 \pgf@y=.5\pgf@y
15770 \pgf@x=0pt
15771 }
15772 \savedanchor\left{%center left
15773 \pgf@y=0pt
15774 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15775 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15776 }
15777 \savedanchor\right{
15778 \pgf@x=0pt\pgf@y=0pt
15779 \ifpgf@circ@trcircle
15780 % repeat the \circleradius computation (GRRRR)
15781 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15782 % repeat the extrabodydiodelen (grrr)
15783 \ifpgf@circuit@fet@bodydiode
15784 % try to put the text to the right of the flyback diode
15785 \pgfmathsetlength{\pgf@circ@res@other}{(
15786 \ctikzvalof{tripoles/#1/bodydiode distance}*
15787 \ctikzvalof{tripoles/#1/width} +
15788 \ctikzvalof{tripoles/#1/bodydiode scale}*
15789 \ctikzvalof{bipoles/diode/height}/2
15790 )*\pgf@circ@scaled@Rlen}
15791 \else
15792 \pgf@circ@res@other=0pt\relax
15793 \fi
15794 % left
15795 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15796 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
15797 % northeast
15798 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
15799 \pgf@yb=.5\pgf@yb
15800 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
15801 %
15802 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
15803 % find the radius of the circle
15804 \pgfmathsetlength{\pgf@circ@res@other}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
15805 % repeat the circleleft computation
15806 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
15807 \pgf@xb=\circlebase\pgf@xa
15808 \pgfmathsetlength{\pgf@x}{\pgf@xb+2*\pgf@circ@res@other}
15809 \fi
15810 }
15811 \anchor{text}{
15812 \northeast
15813 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15814 \ifpgf@circuit@transisors@fixlabels
15815 \ifpgf@circuit@fet@bodydiode
15816 \advance \pgf@x by \extrabodydiodelen
15817 \fi
15818 \ifpgf@circ@trcircle
15819 \left\pgf@xa=\pgf@x
15820 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
15821 % \advance \pgf@x by \circleradius
15822 \fi
15823 % add a bit of space to avoid central (substrate) terminal if drawn
15824 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
15825 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15826 \else
15827 \pgf@y=.7\pgf@y
15828 \pgf@x= \pgf@circ@scaled@Rlen
15829 \pgf@x=0.1\pgf@x
15830 \fi
15831 }
15832 \anchor{pathstart}{ % south
15833 \northeast
15834 \pgf@y=-\pgf@y
15835 }
15836 \anchor{pathend}{
15837 \northeast
15838 }
15839 \anchor{north}{
15840 \northeast
15841 \pgf@circ@res@step=\pgf@y
15842 \left
15843 \pgf@y=\pgf@circ@res@step
15844 \pgf@x=.5\pgf@x
15845 }
15846 \anchor{west}{
15847 \left
15848 }
15849 \anchor{left}{
15850 \left
15851 }
15852 \anchor{east}{
15853 \northeast
15854 \pgf@y=0pt
15855 }
15856 \anchor{right}{
15857 \right
15858 }
15859 \anchor{south}{
15860 \northeast
15861 \pgf@circ@res@step=\pgf@y
15862 \left
15863 \pgf@y=-\pgf@circ@res@step
15864 \pgf@x=.5\pgf@x
15865 }
15866 \anchor{south west}{
15867 \northeast
15868 \pgf@circ@res@step=\pgf@y
15869 \left
15870 \pgf@y=-\pgf@circ@res@step
15871 }
15872 \anchor{north east}{
15873 \northeast
15874 }
15875 \anchor{north west}{
15876 \northeast
15877 \pgf@circ@res@step=\pgf@y
15878 \left
15879 \pgf@y=\pgf@circ@res@step
15880 }
15881 \anchor{south east}{
15882 \northeast
15883 \pgf@y=-\pgf@y
15884 }
15885 \anchor{B}{
15886 \northeast
15887 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15888 \left
15889 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15890 }
15891 \anchor{base}{
15892 \northeast
15893 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15894 \left
15895 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15896 }
15897 \anchor{bulk}{ %added by Burak Kelleci
15898 \northeast
15899 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15900 \right
15901 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15902 }
15903 \anchor{nobulk}{ %added by Burak Kelleci
15904 \left
15905 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
15906 }
15907 \anchor{G}{
15908 \northeast
15909 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15910 \left
15911 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15912 }
15913 \anchor{G1}{
15914 \northeast
15915 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15916 \left
15917 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15918 }
15919 \anchor{G2}{
15920 \northeast
15921 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15922 \pgf@circ@res@step=-0.3333333\pgf@circ@res@step
15923 \left
15924 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15925 }
15926 \anchor{gate}{
15927 \northeast
15928 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15929 \left
15930 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15931 }
15932 \anchor{gate1}{
15933 \northeast
15934 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15935 \left
15936 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15937 }
15938 \anchor{gate2}{
15939 \northeast
15940 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
15941 \pgf@circ@res@step=-0.3333333\pgf@circ@res@step
15942 \left
15943 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
15944 }
15945 \anchor{nobase}{
15946 \left
15947 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
15948 }
15949 \anchor{circle base}{
15950 \left
15951 \pgf@x=\circlebase\pgf@x
15952 }
15953 \anchor{nogate}{
15954 \left
15955 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
15956 }
15957 \anchor{E}{
15958 \northeast
15959 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15960 }
15961 \anchor{emitter}{
15962 \northeast
15963 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15964 }
15965 \anchor{C}{
15966 \northeast
15967 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15968 }
15969 \anchor{collector}{
15970 \northeast
15971 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15972 }
15973 \anchor{S}{
15974 \northeast
15975 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15976 }
15977 \anchor{source}{
15978 \northeast
15979 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15980 }
15981 \anchor{D}{
15982 \northeast
15983 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15984 }
15985 \anchor{drain}{
15986 \northeast
15987 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15988 }
15989 \anchor{body C in}{
15990 \northeast
15991 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15992 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
15993 }
15994 \anchor{circle C}{
15995 \left
15996 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
15997 \northeast
15998 \pgf@xb=\pgf@x %this is #2 of the circle
15999 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
16000 % the base of the triangle is x_2 - x_1 - r
16001 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
16002 % so let's go with the height
16003 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
16004 % finally, direction
16005 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
16006 }
16007 \anchor{circle E}{
16008 \left
16009 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
16010 \northeast
16011 \pgf@xb=\pgf@x %this is #2 of the circle
16012 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
16013 % the base of the triangle is x_2 - x_1 - r
16014 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
16015 % so let's go with the height
16016 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
16017 % finally, direction
16018 % finally, direction
16019 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
16020 }
16021 \anchor{body E in}{
16022 \northeast
16023 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16024 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
16025 }
16026 \anchor{body C out}{
16027 \northeast
16028 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16029 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
16030 \pgf@y=\pgf@ya
16031 \left
16032 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
16033 \pgf@y=\pgf@ya
16034 }
16035 \anchor{body E out}{
16036 \northeast
16037 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16038 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
16039 \pgf@y=\pgf@ya
16040 \left
16041 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
16042 \pgf@y=\pgf@ya
16043 }
16044 #2%
16045 \pgf@circ@draw@component{
16046 \pgftransformationadjustments
16047 \pgf@circ@setcolor
16048 %
16049 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
16050 \pgf@circuit@trans@ntypetrue
16051 \else
16052 \pgf@circuit@trans@ntypefalse
16053 \fi
16054 \northeast
16055 \pgf@circ@res@up = \pgf@y
16056 \pgf@circ@res@down = -\pgf@y
16057 \pgf@circ@res@right = \pgf@x
16058 \left
16059 \pgf@circ@res@left = \pgf@x
16060 \pgf@circ@scaled@Rlen=\scaledRlen
16061 %
16062 #3%
16063 % BODY DIODE
16064 \ifpgf@circuit@fet@bodydiode
16065 \drawbodydiode{#1}
16066 \fi
16067 %
16068 }
16069 }
16070 }
16071
16072 \def\drawdobydiodedot#1#2{
16073 % retrieve dot scale
16074 \edef\@@tmp{\ctikzvalof{transistor bodydiode/dot scale}}
16075 \ifdim\@@tmp pt>0pt
16076 \pgfscope
16077 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
16078 {\ctikzvalof{tripoles/#1/bodydiode conn}#2}}
16079 \pgftransformscale{\@@tmp}
16080 % I'm not sure why this is needed, but...
16081 \pgf@circ@maybe@color{transistor bodydiode/color}
16082 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
16083 \endpgfscope
16084 \fi
16085 }
16086
16087 \long\def\drawbodydiode#1{
16088 \pgfsetlinewidth{\ctikzvalof{transistor bodydiode/relative thickness}\pgflinewidth}
16089 \pgf@circ@subset@color@dash{transistor bodydiode}
16090 \pgfscope
16091 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
16092 \pgftransformrotate{90}
16093 % diode scale and bodydiode scale interacts. We want the size of the diode
16094 % proportional to the transistor, so we will:
16095 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
16096 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
16097 \pgftransformscale{\@@BDscale}
16098 \ifpgf@circuit@fulldiode
16099 % I'm not sure why this is needed, but...
16100 \pgf@circ@maybe@color{transistor bodydiode/color}
16101 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
16102 \else
16103 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
16104 \fi
16105 \endpgfscope
16106 % Draw stroke line
16107 \ifpgf@circuit@strokediode
16108 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
16109 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
16110 \pgfusepath{stroke}
16111 \fi
16112 %Draw upper connection to body diode
16113 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
16114 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
16115 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
16116 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
16117 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
16118 \pgfusepath{draw}
16119 \drawdobydiodedot{#1}{\pgf@circ@res@up}
16120 %Draw lower connection to body diode
16121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
16122 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
16123 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
16124 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
16125 \pgfusepath{draw}
16126 \drawdobydiodedot{#1}{\pgf@circ@res@down}
16127 }
16128
16129 \long\def\declarebpt#1{
16130 \pgfcircdeclaretransistor{#1}{
16131 \anchor{inner up}{
16132 \northeast
16133 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
16134 }
16135 \anchor{inner down}{
16136 \northeast
16137 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
16138 }
16139 \anchor{arrows}{
16140 \northeast
16141 \pgf@circ@res@up = \pgf@y
16142 \left
16143 \pgf@circ@res@left = \pgf@x
16144 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left
16145 \advance\pgf@x by 0.6\pgf@circ@res@left
16146 \pgf@y=0.2\pgf@circ@res@up
16147 }
16148 }{
16149 % add the circle if requested (before everything else, so we can fill it)
16150 \pgfcirc@transistorcircle
16151
16152 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16154 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16155 \pgfpathlineto{\pgfpoint
16156 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16157 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
16158 \pgfusepath{draw}
16159
16160 % drawing base
16161 \pgfscope
16162 \pgfpathmoveto{\pgfpoint
16163 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16164 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16165 \pgfpathlineto{\pgfpoint
16166 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16167 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16168 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16169 \ifpgf@circuit@bpt@schottky
16170 % upper
16171 \pgfpathmoveto{\pgfpoint
16172 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16173 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16174 \pgfpathlineto{\pgfpoint
16175 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16176 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
16177 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16178 \pgfpathlineto{\pgfpoint
16179 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
16180 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16181 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
16182 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16183 \pgfpathlineto{\pgfpoint
16184 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
16185 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16186 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16187 % % lower
16188 \pgfpathmoveto{\pgfpoint
16189 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16190 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16191 \pgfpathlineto{\pgfpoint
16192 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16193 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
16194 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16195 \pgfpathlineto{\pgfpoint
16196 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
16197 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16198 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
16199 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16200 \pgfpathlineto{\pgfpoint
16201 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
16202 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16203 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16204 \fi
16205 \pgfusepath{draw}
16206 \endpgfscope
16207
16208 \pgfpathmoveto{\pgfpoint
16209 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16210 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
16211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16212 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16213 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16214 \pgfusepath{draw}
16215 %draw arrow depending on type of transistor
16216 \pgfscope
16217 \pgfslopedattimetrue
16218 \pgfallowupsidedownattimetrue
16219 \pgfresetnontranslationattimefalse
16220 \edef\@@anchor{center}
16221 \ifpgf@circuit@trans@ntype
16222 \ifpgf@circuit@trans@arrowatend
16223 \edef\@@anchor{btip}
16224 \pgftransformlineattime{1.0}{%
16225 \pgfpoint%
16226 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16227 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
16228 }{%
16229 \pgfpoint{\pgf@circ@res@right}%
16230 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
16231 }
16232 \else
16233 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
16234 \pgfpoint%
16235 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16236 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
16237 }{%
16238 \pgfpoint{\pgf@circ@res@right}%
16239 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
16240 }
16241 \fi
16242 \else % p-type
16243 \ifpgf@circuit@trans@arrowatend
16244 \edef\@@anchor{tip}
16245 \pgftransformlineattime{1.0}{%
16246 \pgfpoint{\pgf@circ@res@right}%
16247 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
16248 }{%
16249 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16250 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
16251 }
16252 \else
16253 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
16254 \pgfpoint{\pgf@circ@res@right}%
16255 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
16256 }{%
16257 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16258 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
16259 }
16260 \fi
16261 \fi
16262 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16263 \endpgfscope
16264
16265 \ifpgf@circuit@bpt@drawphoto
16266 \pgfscope
16267 \pgf@circ@fill@strokecolor
16268 \pgf@circ@set@optoarrow@style
16269 \pgfpathmoveto{\pgfpoint
16270 {(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16271 {0.3\pgf@circ@res@up}}
16272 \pgfpathlineto{\pgfpoint
16273 {(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16274 {0.1\pgf@circ@res@up}}
16275 \pgfusepath{draw}
16276 \pgfpathmoveto{\pgfpoint
16277 {(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16278 {0.1\pgf@circ@res@up}}
16279 \pgfpathlineto{\pgfpoint
16280 {(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16281 {-0.1\pgf@circ@res@up}}
16282 \pgfusepath{draw}
16283 \endpgfscope
16284 \else
16285 \ifpgf@circuit@bpt@drawbase
16286 \pgfpathmoveto{\pgfpoint
16287 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16288 {\pgf@circ@res@up+\pgf@circ@res@down}}
16289 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
16290 \pgfusepath{draw}
16291 \fi
16292 \fi
16293 }
16294 }
16295
16296 \declarebpt{npn}
16297 \declarebpt{pnp}
16298 %
16299 % multi-emitter and multi-collector BJTs by Romano Giannetti
16300 %
16301 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
16302 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
16303 \pgfextracty{\pgf@circ@res@other}{\basedimension}
16304 \ifnum\cdir>0 % NPN, above
16305 \pgfpoint{\pgf@circ@res@temp}{%
16306 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
16307 \else % PNP, below
16308 \pgfpoint{\pgf@circ@res@temp}{%
16309 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
16310 \fi
16311 }
16312 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
16313 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
16314 \pgfextracty{\pgf@circ@res@other}{\basedimension}
16315 \ifnum\cdir<0 % PNP, above
16316 \pgfpoint{\pgf@circ@res@temp}{%
16317 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
16318 \else % PNP, below
16319 \pgfpoint{\pgf@circ@res@temp}{%
16320 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
16321 \fi
16322 }
16323
16324 \long\def\declarebjt#1{
16325 \pgfdeclareshape{bjt#1}{
16326 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
16327 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16328 % \cdir is 1 for npn, -1 for pnp
16329 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
16330 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
16331 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
16332 % step up or down for the additional C/Es
16333 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
16334 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16335 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
16336 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
16337 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
16338 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
16339 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16340 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16341 \pgf@y=.5\pgf@y
16342 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16343 \pgf@x=.5\pgf@x
16344 }
16345 \savedanchor\northeast{% upper right
16346 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16347 \pgfmathsetlength{\pgf@circ@res@step}{%
16348 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16349 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16350 \ifnum\cdir> 0
16351 \edef\numup{\numC}\edef\numdown{\numE}
16352 \else
16353 \edef\numup{\numE}\edef\numdown{\numC}
16354 \fi
16355 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16356 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
16357 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16358 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16359 \pgf@x=.5\pgf@x
16360 }
16361 \savedanchor\southeast{% lower right
16362 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16363 \pgfmathsetlength{\pgf@circ@res@step}{%
16364 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16365 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16366 \ifnum\cdir> 0
16367 \edef\numup{\numC}\edef\numdown{\numE}
16368 \else
16369 \edef\numup{\numE}\edef\numdown{\numC}
16370 \fi
16371 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16372 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
16373 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16374 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16375 \pgf@x=.5\pgf@x
16376 }
16377 \savedanchor\southwest{% lower left
16378 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16379 \pgfmathsetlength{\pgf@circ@res@step}{%
16380 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16381 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16382 \ifnum\cdir> 0
16383 \edef\numup{\numC}\edef\numdown{\numE}
16384 \else
16385 \edef\numup{\numE}\edef\numdown{\numC}
16386 \fi
16387 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16388 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
16389 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16390 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
16391 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16392 }
16393 \anchor{center}{\pgfpointorigin}
16394 \anchor{north}{\northeast\pgf@x=0cm\relax}
16395 \anchor{east}{\northeast\pgf@y=0cm\relax}
16396 \anchor{south}{\southwest\pgf@x=0cm\relax}
16397 \anchor{west}{\southwest\pgf@y=0cm}
16398 \anchor{north east}{\northeast}
16399 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
16400 \anchor{south west}{\southwest}
16401 \anchor{south east}{\southeast}
16402
16403 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
16404 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
16405 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
16406 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
16407 % center of the base "bar"
16408 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
16409 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16410 }
16411 % geometrical centers
16412 \anchor{vcenter}{\pgf@x=0cm\relax
16413 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16414 }
16415 \anchor{gcenter}{%
16416 \northeast\pgf@xa=0.5\pgf@x
16417 \southwest\advance\pgf@xa by 0.5\pgf@x
16418 \pgf@x=\pgf@xa
16419 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16420 }
16421 % external connections
16422 \anchor{E}{
16423 \ifnum\cdir>0% npn, emitter down
16424 \southeast
16425 \else
16426 \northeast
16427 \fi
16428 }% first emitter
16429 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
16430 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
16431 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
16432
16433 \pgf@circ@draw@component{
16434 \pgftransformationadjustments
16435 \pgf@circ@setcolor
16436 %
16437 % set the type and up and down number of connections
16438 %
16439 \ifnum\cdir> 0
16440 \pgf@circuit@trans@ntypetrue
16441 \edef\numup{\numC}
16442 \edef\numdown{\numE}
16443 \else
16444 \pgf@circuit@trans@ntypefalse
16445 \edef\numup{\numE}
16446 \edef\numdown{\numC}
16447 \fi
16448 \basedimension
16449 \pgf@circ@res@up = \pgf@y
16450 \pgf@circ@res@down = -\pgf@y
16451 \pgf@circ@res@right = \pgf@x
16452 \pgf@circ@res@left = -\pgf@x
16453 \pgf@circ@scaled@Rlen=\scaledRlen
16454 \pgf@circ@res@step=\multistep
16455 %
16456 % set arrow positions options
16457 %
16458 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
16459 \ifpgf@circuit@trans@arrowatend
16460 \edef\@@pos{1.0}
16461 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
16462 \edef\@@anchor{btip}
16463 \else
16464 \edef\@@anchor{tip}
16465 \fi
16466 \fi
16467 %
16468 % Drawing upper connections
16469 %
16470 \pgfscope
16471 \pgf@circ@count@a=\numup\relax
16472 \pgfmathloop%
16473 \ifnum\pgf@circ@count@a>0
16474 \advance\pgf@circ@count@a-1\relax
16475 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
16476 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
16477 \pgfpathmoveto{\pgfpoint
16478 {\pgf@circ@res@right}%
16479 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16480 \pgfpathlineto{\pgfpoint
16481 {\pgf@circ@res@right}%
16482 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16483 \else
16484 \pgfpathmoveto{\pgfpoint
16485 {\pgf@circ@res@right}%
16486 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16487 \fi
16488 \pgfpathlineto{\pgfpoint
16489 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16490 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
16491 \pgfsetroundcap % better when connecting to sloped lines
16492 \pgfusepath{draw}
16493 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
16494 \pgfscope
16495 \pgfslopedattimetrue
16496 \pgfallowupsidedownattimetrue
16497 \pgfresetnontranslationattimefalse
16498 \pgftransformlineattime{\@@pos}{%
16499 \pgfpoint
16500 {\pgf@circ@res@right}%
16501 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
16502 }{\pgfpoint
16503 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16504 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
16505 }
16506 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16507 \endpgfscope
16508 \fi
16509 \repeatpgfmathloop
16510 \endpgfscope
16511 %
16512 % Drawing base
16513 %
16514 \pgfscope
16515 \pgfpathmoveto{\pgfpoint
16516 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16517 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16518 \pgfpathlineto{\pgfpoint
16519 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16520 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16521 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16522 \ifpgf@circuit@bpt@schottky
16523 % upper
16524 \pgfpathmoveto{\pgfpoint
16525 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16526 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16527 \pgfpathlineto{\pgfpoint
16528 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16529 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
16530 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16531 \pgfpathlineto{\pgfpoint
16532 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
16533 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16534 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
16535 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16536 \pgfpathlineto{\pgfpoint
16537 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
16538 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16539 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16540 % lower
16541 \pgfpathmoveto{\pgfpoint
16542 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16543 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16544 \pgfpathlineto{\pgfpoint
16545 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16546 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
16547 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16548 \pgfpathlineto{\pgfpoint
16549 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
16550 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16551 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
16552 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16553 \pgfpathlineto{\pgfpoint
16554 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
16555 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16556 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16557 \fi
16558 \pgfsetroundcap % I like it more...
16559 \pgfusepath{draw}
16560 \endpgfscope
16561 %
16562 % draw base external connection
16563 %
16564 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
16565 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
16566 \pgfusepath{draw}
16567 %
16568 % Drawing lower connections
16569 %
16570 \pgfscope
16571 \pgf@circ@count@a=\numdown\relax
16572 \pgfmathloop%
16573 \ifnum\pgf@circ@count@a>0
16574 \advance\pgf@circ@count@a-1\relax
16575 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
16576 \pgfpathmoveto{\pgfpoint
16577 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16578 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
16579 \pgfpathlineto{\pgfpoint
16580 {\pgf@circ@res@right}
16581 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
16582 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
16583 \pgfpathlineto{\pgfpoint
16584 {\pgf@circ@res@right}
16585 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
16586 \fi
16587 \pgfsetroundcap % better when connecting to sloped lines
16588 \pgfusepath{draw}
16589 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
16590 \pgfscope
16591 \pgfslopedattimetrue
16592 \pgfallowupsidedownattimetrue
16593 \pgfresetnontranslationattimefalse
16594 \pgftransformlineattime{\@@pos}{%
16595 \pgfpoint
16596 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16597 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
16598 }{\pgfpoint
16599 {\pgf@circ@res@right}%
16600 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
16601 }
16602 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16603 \endpgfscope
16604 \fi
16605 \repeatpgfmathloop
16606 \endpgfscope
16607 }
16608 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
16609 % and is executed just before a node is drawn.
16610 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
16611 % Start with the maximum collector number and go backwards.
16612 \pgf@circ@count@a=\numC\relax
16613 \pgfmathloop%
16614 \ifnum\pgf@circ@count@a>0
16615 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16616 % electrical contact, and the "border one" like `bpin 1` for labels.
16617 % they will coincide if `external pins width` is set to 0.
16618 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
16619 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
16620 }
16621 \advance\pgf@circ@count@a by -1\relax%
16622 \repeatpgfmathloop%
16623 % and emitters
16624 \pgf@circ@count@a=\numE\relax
16625 \pgfmathloop%
16626 \ifnum\pgf@circ@count@a>0
16627 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16628 % electrical contact, and the "border one" like `bpin 1` for labels.
16629 % they will coincide if `external pins width` is set to 0.
16630 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
16631 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
16632 }
16633 \advance\pgf@circ@count@a by -1\relax%
16634 \repeatpgfmathloop%
16635 }%
16636 }
16637 }
16638
16639 \declarebjt{npn}
16640 \declarebjt{pnp}
16641
16642 % end of multi-bjts
16643
16644 \long\def\declareigbt#1{
16645 \pgfcircdeclaretransistor{#1}{
16646 \anchor{inner up}{
16647 \northeast
16648 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
16649 }
16650 \anchor{inner down}{
16651 \northeast
16652 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
16653 }
16654 \anchor{nobase}{
16655 \left
16656 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
16657 }
16658 }
16659 {
16660 % add the circle if requested (before everything else, so we can fill it)
16661 \pgfcirc@transistorcircle
16662 % fill the gap color if requested
16663 \pgfcirc@fillgategap{#1}
16664 %draw upper connection
16665 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16667 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
16668 \pgfpathlineto{\pgfpoint
16669 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16670 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
16671 \pgfusepath{draw}
16672
16673 %draw thicker gate lines
16674 \pgfscope
16675 \pgfscope
16676 \pgfpathmoveto{\pgfpoint
16677 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16678 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16679 \pgfpathlineto{\pgfpoint
16680 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16681 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16682 % set the normal thickness
16683 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16684 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
16685 \pgfsetlinewidth{\@@extrat\pgflinewidth}
16686 \pgfusepath{draw}
16687 \endpgfscope
16688 \pgfpathmoveto{\pgfpoint
16689 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16690 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16691 \pgfpathlineto{\pgfpoint
16692 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16693 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16694 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16695 \pgfusepath{draw}
16696 \endpgfscope
16697 %draw lower connection
16698 \pgfpathmoveto{\pgfpoint
16699 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16700 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
16701 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16702 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
16703 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16704 \pgfusepath{draw}
16705 %draw arrow depending on type of transistor
16706 \pgfscope
16707 \pgfslopedattimetrue
16708 \pgfallowupsidedownattimetrue
16709 \pgfresetnontranslationattimefalse
16710 \ifpgf@circuit@trans@arrowatend
16711 \ifpgf@circuit@trans@ntype
16712 \edef\@@anchor{btip}\edef\@@pos{1.0}
16713 \else
16714 \edef\@@anchor{tip}\edef\@@pos{1.0}
16715 \fi
16716 \else
16717 \edef\@@anchor{center}\edef\@@pos{0.5}
16718 \fi
16719 \ifpgf@circuit@trans@ntype
16720 \pgftransformlineattime{\@@pos}{%
16721 \pgfpoint%
16722 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16723 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
16724 }{%
16725 \pgfpoint{\pgf@circ@res@right}%
16726 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
16727 }
16728 \else
16729 \pgftransformlineattime{\@@pos}{%
16730 \pgfpoint{\pgf@circ@res@right}%
16731 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
16732 }{%
16733 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16734 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
16735 }
16736 \fi
16737 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16738 \endpgfscope
16739 %draw gate
16740 \ifpgf@circuit@bpt@drawgate
16741 \ifpgf@circuit@trans@ntype
16742 \pgfpathmoveto{\pgfpoint
16743 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16744 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
16745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
16746 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
16747 \else
16748 \pgfpathmoveto{\pgfpoint
16749 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16750 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
16751 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
16752 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
16753 \fi
16754 \fi
16755 \pgfusepath{draw}
16756 }
16757 }
16758
16759 \declareigbt{pigbt}
16760 \declareigbt{nigbt}
16761 \declareigbt{Lnigbt}
16762 \declareigbt{Lpigbt}
16763
16764 % Graphene FET, See https://github.com/circuitikz/circuitikz/issues/496
16765 \long\def\declaregfet#1{
16766 \pgfcircdeclaretransistor{#1}{
16767 \anchor{inner up}{
16768 \northeast
16769 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
16770 }
16771 \anchor{inner down}{
16772 \northeast
16773 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
16774 }
16775 \anchor{outer hex up}{
16776 \left
16777 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
16778 \northeast
16779 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
16780 \pgf@x=-\pgf@xa
16781 }
16782 \anchor{outer hex down}{
16783 \left
16784 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
16785 \northeast
16786 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
16787 \pgf@y=-\pgf@y
16788 \pgf@x=-\pgf@xa
16789 }
16790 \anchor{inner hex up}{
16791 \left
16792 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
16793 \northeast
16794 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
16795 \pgf@x=\pgf@xa
16796 }
16797 \anchor{inner hex down}{
16798 \left
16799 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
16800 \northeast
16801 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
16802 \pgf@y=-\pgf@y
16803 \pgf@x=\pgf@xa
16804 }
16805 \anchor{right}{
16806 \northeast\pgf@y=0pt\relax
16807 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
16808 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
16809 \advance \pgf@x by \pgf@xa
16810 }
16811 \anchor{text}{% need a different text: no circle, shift to the right
16812 \northeast
16813 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16814 \ifpgf@circuit@transisors@fixlabels
16815 \ifpgf@circuit@fet@bodydiode
16816 \advance \pgf@x by \extrabodydiodelen
16817 \else
16818 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
16819 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
16820 \advance \pgf@x by \pgf@xa
16821 \fi
16822 % no circle for gfets
16823 % add a bit of space to avoid central (substrate) terminal if drawn
16824 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
16825 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16826 \else
16827 \pgf@y=.7\pgf@y
16828 \pgf@x= \pgf@circ@scaled@Rlen
16829 \pgf@x=0.1\pgf@x
16830 \fi
16831 }
16832 }
16833 {
16834 % no circle for gfets (clearly!)
16835 %draw upper connection to hexagon
16836 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16837 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16838 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
16839 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
16840 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
16841 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16842 \pgfusepath{draw}
16843 % draw (fillable) hexagon
16844 \pgfscope
16845 \pgfpathmoveto{\pgfpoint
16846 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16847 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
16848 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16849 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
16850 \pgfpathlineto{\pgfpoint
16851 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16852 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
16853 \pgfpathlineto{\pgfpoint
16854 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16855 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
16856 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16857 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
16858 \pgfpathlineto{\pgfpoint
16859 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16860 {-\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
16861 \pgfpathclose
16862 \pgf@circ@draworfill
16863 \endpgfscope
16864 %draw thicker gate lines
16865 \pgfscope
16866 \pgfscope
16867 \pgfpathmoveto{\pgfpoint
16868 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16869 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16870 \pgfpathlineto{\pgfpoint
16871 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16872 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16873 % set the normal thickness
16874 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16875 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
16876 \pgfsetlinewidth{\@@extrat\pgflinewidth}
16877 \pgfusepath{draw}
16878 \endpgfscope
16879 \pgfpathmoveto{\pgfpoint
16880 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16881 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16882 \pgfpathlineto{\pgfpoint
16883 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16884 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16885 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16886 \pgfusepath{draw}
16887 \endpgfscope
16888 %draw arrow depending on type of transistor
16889 \pgfscope
16890 \pgfslopedattimetrue
16891 \pgfallowupsidedownattimetrue
16892 \pgfresetnontranslationattimefalse
16893 \ifpgf@circuit@trans@arrowatend
16894 \ifpgf@circuit@trans@ntype
16895 \edef\@@anchor{btip}\edef\@@pos{1.0}
16896 \else
16897 \edef\@@anchor{tip}\edef\@@pos{1.0}
16898 \fi
16899 \else
16900 \edef\@@anchor{center}\edef\@@pos{0.5}
16901 \fi
16902 \ifpgf@circuit@trans@ntype
16903 \pgftransformlineattime{\@@pos}{%
16904 \pgfpoint%
16905 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16906 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
16907 }{%
16908 \pgfpoint{\pgf@circ@res@right}%
16909 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
16910 }
16911 \else
16912 \pgftransformlineattime{\@@pos}{%
16913 \pgfpoint{\pgf@circ@res@right}%
16914 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
16915 }{%
16916 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16917 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
16918 }
16919 \fi
16920 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16921 \endpgfscope
16922 %draw gate
16923 \ifpgf@circuit@trans@ntype
16924 \pgfpathmoveto{\pgfpoint
16925 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16926 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
16927 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
16928 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
16929 \else
16930 \pgfpathmoveto{\pgfpoint
16931 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16932 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
16933 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
16934 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
16935 \fi
16936 \pgfusepath{draw}
16937 }
16938 }
16939
16940 \declaregfet{pgfet}
16941 \declaregfet{ngfet}
16942
16943 % Plain MOSes
16944
16945 \pgfcircdeclaretransistor{nmos}{
16946 \anchor{inner up}{
16947 \northeast
16948 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
16949 }
16950 \anchor{inner down}{
16951 \northeast
16952 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
16953 }
16954 }{%
16955 % add the circle if requested (before everything else, so we can fill it)
16956 \pgfcirc@transistorcircle
16957 % fill the gap color if requested
16958 \pgfcirc@fillgategap{nmos}
16959
16960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16961 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16962 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
16963 \pgfpathlineto{\pgfpoint
16964 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
16965 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
16966
16967 \pgfpathmoveto{\pgfpoint
16968 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
16969 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
16970 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16971 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
16972 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16973 \pgfusepath{draw}
16974
16975 \pgfscope
16976 \pgfpathmoveto{\pgfpoint
16977 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
16978 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
16979 \pgfpathlineto{\pgfpoint
16980 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
16981 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
16982 \pgfpathmoveto{\pgfpoint
16983 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
16984 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
16985 \pgfpathlineto{\pgfpoint
16986 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
16987 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
16988 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16989 \pgfusepath{draw}
16990 \endpgfscope
16991 \ifpgf@circuit@mos@arrows
16992 \pgfscope
16993 \ifpgf@circuit@trans@arrowatend
16994 \pgftransformshift{\pgfpoint
16995 {\pgf@circ@res@right}%
16996 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
16997 }
16998 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
16999 \else
17000 \pgfslopedattimetrue
17001 \pgfallowupsidedownattimetrue
17002 \pgfresetnontranslationattimefalse
17003 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
17004 \pgfpoint%
17005 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
17006 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
17007 }{%
17008 \pgfpoint
17009 {\pgf@circ@res@right}%
17010 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
17011 }
17012 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17013 \fi
17014 \endpgfscope
17015 \fi
17016
17017 \ifpgf@circuit@bpt@drawgate
17018 \pgfpathmoveto{\pgfpoint
17019 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
17020 {\pgf@circ@res@up+\pgf@circ@res@down}}
17021 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17022 \pgfusepath{draw}
17023 \fi
17024
17025 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17026 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17027 {\pgf@circ@res@up+\pgf@circ@res@down}}
17028 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17029 {\pgf@circ@res@up+\pgf@circ@res@down}}
17030 \pgfusepath{draw}
17031 \fi
17032
17033 \pgfcirc@ferroelectric{nmos}{0}
17034 }
17035
17036 \pgfcircdeclaretransistor{pmos}{
17037 \anchor{inner up}{
17038 \northeast
17039 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
17040 }
17041 \anchor{inner down}{
17042 \northeast
17043 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
17044 }
17045 }{%
17046 % add the circle if requested (before everything else, so we can fill it)
17047 \pgfcirc@transistorcircle
17048 % fill the gap color if requested
17049 \pgfcirc@fillgategap{nmos}
17050
17051 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17052 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17053 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17054 \pgfpathlineto{\pgfpoint
17055 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17056 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17057 \pgfusepath{draw}
17058
17059 \ifpgf@circuit@mos@arrows
17060 \pgfscope
17061 \ifpgf@circuit@trans@arrowatend
17062 \pgftransformshift{\pgfpoint
17063 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
17064 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17065 }
17066 \pgftransformrotate{180}
17067 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17068 \else
17069 \pgfslopedattimetrue
17070 \pgfallowupsidedownattimetrue
17071 \pgfresetnontranslationattimefalse
17072 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
17073 \pgfpoint%
17074 {\pgf@circ@res@right}%
17075 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17076 }{%
17077 \pgfpoint
17078 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
17079 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17080 }
17081 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17082 \fi
17083 \endpgfscope
17084 \fi
17085
17086 \pgfscope
17087 \pgfpathmoveto{\pgfpoint
17088 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17089 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
17090 \pgfpathlineto{\pgfpoint
17091 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17092 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
17093 \pgfpathmoveto{\pgfpoint
17094 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17095 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17096 \pgfpathlineto{\pgfpoint
17097 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17098 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17099 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17100 \pgfusepath{draw}
17101 \endpgfscope
17102
17103 \pgfpathmoveto{\pgfpoint
17104 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17105 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17106 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17107 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17108 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17109
17110
17111 \pgfusepath{draw}
17112 \ifpgf@circuit@bpt@drawgate
17113 \pgfpathmoveto{\pgfpoint
17114 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17115 {\pgf@circ@res@up+\pgf@circ@res@down}}
17116 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17117 \pgfusepath{draw}
17118 \fi
17119
17120 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17121 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17122 {\pgf@circ@res@up+\pgf@circ@res@down}}
17123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17124 {\pgf@circ@res@up+\pgf@circ@res@down}}
17125 \pgfusepath{draw}
17126 \fi
17127
17128 \ifpgf@circuit@pmos@nocircle\else
17129 % we are not scaling the circle with the MOS --- I think it's better to have it
17130 % coherent with the poles/nodes of the rest of the circuit.
17131 \pgfpathcircle{\pgfpoint
17132 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
17133 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
17134 \ifpgf@circuit@pmos@emptycircle
17135 \pgfsetfillcolor{white}
17136 \fi
17137 \pgfusepath{draw,fill}
17138 \fi
17139
17140 \pgfcirc@ferroelectric{pmos}{0}
17141 }
17142
17143 %%% depletion MOSFET (simplified symbols)
17144
17145 \long\def\pgfcirc@filldraw@depletion#1{%
17146 \ifx\tikz@fillcolor\pgfutil@empty
17147 % if there is no explicit fill check the specific key
17148 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
17149 \ifx\@@tmp\@@none % if it's none
17150 \pgfusepath{draw}%
17151 \else
17152 \edef\@@default{default}%
17153 \ifx\@@tmp\@@default % fill with the pen color
17154 \pgf@circ@fill@strokecolor
17155 \pgfusepath{draw, fill}%
17156 \else
17157 \pgfsetfillcolor{\@@tmp}%
17158 \pgfusepath{draw, fill}%
17159 \fi
17160 \fi
17161 \else
17162 \pgfsetfillcolor{\tikz@fillcolor}%
17163 \pgfusepath{draw, fill}%
17164 \fi
17165 }
17166
17167 \pgfcircdeclaretransistor{nmosd}{
17168 \anchor{inner up}{
17169 \northeast
17170 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
17171 }
17172 \anchor{inner down}{
17173 \northeast
17174 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
17175 }
17176 \anchor{nobulk}{ %override
17177 \left
17178 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
17179 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
17180 \advance\pgf@x by -\pgf@circ@res@temp
17181 }
17182 }{%
17183 % draw depletion channel
17184 % add the circle if requested (before everything else, so we can fill it)
17185 \pgfcirc@transistorcircle
17186 % fill the gap color if requested
17187 \pgfcirc@fillgategap{nmos}
17188 \pgfscope
17189 \pgfpathrectanglecorners
17190 {\pgfpoint
17191 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17192 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17193 {\pgfpoint
17194 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
17195 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17196 \pgfcirc@filldraw@depletion{nmosd}
17197 \endpgfscope
17198 % draw drain and source terminals
17199 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17201 \pgfpathlineto{\pgfpoint
17202 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17203 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17204
17205 \pgfpathmoveto{\pgfpoint
17206 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17207 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17208 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17209 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17210 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17211 \pgfusepath{draw}
17212
17213 \pgfscope
17214 \pgfpathmoveto{\pgfpoint
17215 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17216 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
17217 \pgfpathlineto{\pgfpoint
17218 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17219 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
17220 \pgfpathmoveto{\pgfpoint
17221 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17222 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17223 \pgfpathlineto{\pgfpoint
17224 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17225 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17226 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17227 \pgfusepath{draw}
17228 \endpgfscope
17229 \ifpgf@circuit@mos@arrows
17230 \pgfscope
17231 \ifpgf@circuit@trans@arrowatend
17232 \pgftransformshift{\pgfpoint
17233 {\pgf@circ@res@right}%
17234 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
17235 }
17236 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
17237 \else
17238 \pgfslopedattimetrue
17239 \pgfallowupsidedownattimetrue
17240 \pgfresetnontranslationattimefalse
17241 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
17242 \pgfpoint%
17243 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
17244 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
17245 }{%
17246 \pgfpoint
17247 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17248 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
17249 }
17250 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17251 \fi
17252 \endpgfscope
17253 \fi
17254
17255 \ifpgf@circuit@bpt@drawgate
17256 \pgfpathmoveto{\pgfpoint
17257 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17258 {\pgf@circ@res@up+\pgf@circ@res@down}}
17259 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17260 \pgfusepath{draw}
17261 \fi
17262
17263 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17264 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
17265 {\pgf@circ@res@up+\pgf@circ@res@down}}
17266 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17267 {\pgf@circ@res@up+\pgf@circ@res@down}}
17268 \pgfusepath{draw}
17269 \fi
17270
17271 \pgfcirc@ferroelectric{nmosd}{\ctikzvalof{tripoles/nmosd/depletion width}}
17272 }
17273
17274 \pgfcircdeclaretransistor{pmosd}{
17275 \anchor{inner up}{
17276 \northeast
17277 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
17278 }
17279 \anchor{inner down}{
17280 \northeast
17281 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
17282 }
17283 \anchor{nobulk}{ %override
17284 \left
17285 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
17286 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
17287 \advance\pgf@x by -\pgf@circ@res@temp
17288 }
17289 }{%
17290 % add the circle if requested (before everything else, so we can fill it)
17291 \pgfcirc@transistorcircle
17292 % fill the gap color if requested
17293 \pgfcirc@fillgategap{nmos}
17294 % draw depletion channel
17295 \pgfscope
17296 \pgfpathrectanglecorners
17297 {\pgfpoint
17298 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17299 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17300 {\pgfpoint
17301 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
17302 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17303 \pgfcirc@filldraw@depletion{pmosd}
17304 \endpgfscope
17305 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17306 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17307 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17308 \pgfpathlineto{\pgfpoint
17309 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17310 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17311 \pgfusepath{draw}
17312
17313 \ifpgf@circuit@mos@arrows
17314 \pgfscope
17315 \ifpgf@circuit@trans@arrowatend
17316 \pgftransformshift{\pgfpoint
17317 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17318 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17319 }
17320 \pgftransformrotate{180}
17321 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17322 \else
17323 \pgfslopedattimetrue
17324 \pgfallowupsidedownattimetrue
17325 \pgfresetnontranslationattimefalse
17326 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
17327 \pgfpoint%
17328 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17329 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17330 }{%
17331 \pgfpoint
17332 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
17333 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17334 }
17335 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17336 \fi
17337 \endpgfscope
17338 \fi
17339
17340 \pgfscope
17341 \pgfpathmoveto{\pgfpoint
17342 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17343 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
17344 \pgfpathlineto{\pgfpoint
17345 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17346 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
17347 \pgfpathmoveto{\pgfpoint
17348 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17349 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17350 \pgfpathlineto{\pgfpoint
17351 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17352 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17353 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17354 \pgfusepath{draw}
17355 \endpgfscope
17356
17357 \pgfpathmoveto{\pgfpoint
17358 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17359 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17360 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17361 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17363
17364
17365 \pgfusepath{draw}
17366 \ifpgf@circuit@bpt@drawgate
17367 \pgfpathmoveto{\pgfpoint
17368 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17369 {\pgf@circ@res@up+\pgf@circ@res@down}}
17370 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17371 \pgfusepath{draw}
17372 \fi
17373
17374 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17375 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
17376 {\pgf@circ@res@up+\pgf@circ@res@down}}
17377 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17378 {\pgf@circ@res@up+\pgf@circ@res@down}}
17379 \pgfusepath{draw}
17380 \fi
17381
17382 \ifpgf@circuit@pmos@nocircle\else
17383 % we are not scaling the circle with the MOS --- I think it's better to have it
17384 % coherent with the poles/nodes of the rest of the circuit.
17385 \pgfpathcircle{\pgfpoint
17386 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
17387 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
17388 \ifpgf@circuit@pmos@emptycircle
17389 \pgfsetfillcolor{white}
17390 \fi
17391 \pgfusepath{draw,fill}
17392 \fi
17393
17394 \pgfcirc@ferroelectric{pmosd}{\ctikzvalof{tripoles/pmosd/depletion width}}
17395 }
17396 %% HEMT FET Transistor
17397 \def\pgf@circ@hemt@gate@anchor@helper{%
17398 \northeast
17399 \pgf@circ@res@up = \pgf@y
17400 \pgf@circ@res@down = -\pgf@y
17401 \pgfmathsetlength{\pgf@circ@res@step}{{(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17402 \left
17403 \pgf@y=\pgf@circ@res@step
17404 }
17405 \pgfcircdeclaretransistor{hemt}{
17406 \savedmacro{\gateasym}{\edef\gateasym{\ctikzvalof{tripoles/hemt/gate asym}}}
17407 \anchor{inner up}{
17408 \northeast
17409 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
17410 }
17411 \anchor{inner down}{
17412 \northeast
17413 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
17414 }
17415 % override gate/base anchors
17416 \anchor{G}{\pgf@circ@hemt@gate@anchor@helper}
17417 \anchor{gate}{\pgf@circ@hemt@gate@anchor@helper}
17418 \anchor{nogate}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x}
17419 \anchor{B}{\pgf@circ@hemt@gate@anchor@helper}
17420 \anchor{base}{\pgf@circ@hemt@gate@anchor@helper}
17421 \anchor{nobase}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x}
17422 }{%
17423 % add the circle if requested (before everything else, so we can fill it)
17424 \pgfcirc@transistorcircle
17425 % upper connection
17426 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17427 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17428 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
17429 \pgfpathlineto{\pgfpoint
17430 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17431 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
17432 % lower connection
17433 \pgfpathmoveto{\pgfpoint
17434 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17435 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17437 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17438 \pgfpathlineto{\pgfpoint
17439 {\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17440 \pgfusepath{draw}
17441 \pgfscope
17442 \edef\@@tmp{\ctikzvalof{tripoles/hemt/source arrow}}
17443 \ifnum\@@tmp=0 \else
17444 \ifpgf@circuit@trans@arrowatend
17445 \ifnum\@@tmp > 0 %
17446 \pgftransformshift{\pgfpoint
17447 {\pgf@circ@res@right}
17448 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17449 \else
17450 \pgftransformshift{\pgfpoint
17451 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17452 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17453 \ifnum\@@tmp < 0 \pgftransformrotate{180}\fi
17454 \fi
17455 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17456 \else
17457 % the position here is a bit strange...
17458 \pgftransformshift{\pgfpoint
17459 {0.5*\pgf@circ@res@right+0.5*\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17460 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17461 \ifnum\@@tmp < 0 \pgftransformrotate{180}\fi
17462 \pgfnode{trarrow}{center}{}{}{\pgfusepath{stroke}}
17463 \fi
17464 \fi
17465 \endpgfscope
17466 \pgfscope
17467 % draw gate (base) bar
17468 \ifpgf@circ@hemt@split
17469 \pgfpathmoveto{\pgfpoint
17470 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17471 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
17472 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17473 {(1.1+\gateasym)*\pgf@circ@res@up +
17474 (0.9-\gateasym)*\pgf@circ@res@down}}
17475 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17476 {(1.05+\gateasym)*\pgf@circ@res@up +
17477 (0.95-\gateasym)*\pgf@circ@res@down}}
17478 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17479 {(0.95+\gateasym)*\pgf@circ@res@up +
17480 (1.05-\gateasym)*\pgf@circ@res@down}}
17481 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17482 {(0.9+\gateasym)*\pgf@circ@res@up +
17483 (1.1-\gateasym)*\pgf@circ@res@down}}
17484 \pgfpathlineto{\pgfpoint
17485 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17486 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
17487 \else
17488 \pgfpathmoveto{\pgfpoint
17489 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17490 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
17491 \pgfpathlineto{\pgfpoint
17492 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17493 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
17494 \fi
17495 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17496 \pgfusepath{draw}
17497 \endpgfscope
17498 % draw the gate horizontal segment
17499 \ifpgf@circuit@bpt@drawgate
17500 \pgfpathmoveto{\pgfpoint
17501 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17502 {(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17503 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17504 {(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17505 \pgfusepath{draw}
17506 \fi
17507 }
17508 \tikzset{GaN hemt/.style={hemt,
17509 circuitikz/tripoles/hemt/base height=0.6,%length of the "base" vertical bar
17510 circuitikz/tripoles/hemt/gate height=0.5,%distance of the S/D terminals
17511 circuitikz/tripoles/hemt/bodydiode conn=0.85,% attachment point of body diode
17512 circuitikz/tripoles/hemt/gate asym=-0.1,% slightly down
17513 circuitikz/tripoles/hemt/split gate=true,% split gate
17514 circuitikz/tripoles/hemt/source arrow=1,% right-facing arrow
17515 },
17516 }
17517
17518 \long\def\drawfetcore#1{
17519 \pgftransformationadjustments
17520 % add the circle if requested (before everything else, so we can fill it)
17521 \pgfcirc@transistorcircle
17522 % fill the gap color if requested
17523 \pgfcirc@fillgategap{#1}
17524
17525 %top connection
17526 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17528 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17529 \pgfpathlineto{\pgfpoint
17530 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17531 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17532 \pgfusepath{draw}
17533 \pgfscope
17534 \pgfpathmoveto{\pgfpoint
17535 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17536 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
17537 \ifpgf@circuit@trans@depletiontype
17538 \pgfpathlineto{\pgfpoint
17539 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17540 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
17541 \else
17542
17543 \pgfpathlineto{\pgfpoint
17544 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17545 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
17546 \pgfpathmoveto{\pgfpoint
17547 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17548 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
17549 \pgfpathlineto{\pgfpoint
17550 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17551 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
17552 \pgfpathmoveto{\pgfpoint
17553 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17554 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
17555 \pgfpathlineto{\pgfpoint
17556 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17557 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
17558 \fi
17559 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17560 \pgfusepath{draw}
17561 \endpgfscope
17562 %Bulk connection line
17563 \pgfpathmoveto{\pgfpoint
17564 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17565 {\pgf@circ@res@up+\pgf@circ@res@down}}
17566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17567 {\pgf@circ@res@up+\pgf@circ@res@down}}
17568
17569 %bottom connection
17570 \pgfpathmoveto{\pgfpoint
17571 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17572 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17573 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17574 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17575 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17576 \pgfusepath{draw}
17577
17578 %draw thick gate line
17579 \pgfscope%%% gate line
17580 \pgfpathmoveto{\pgfpoint
17581 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17582 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17583 \ifpgf@circuit@fet@doublegate
17584 \edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})}
17585 \pgfpathlineto{\pgfpoint
17586 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17587 {\@@gateconnheight*\pgf@circ@res@up/3}}
17588 \pgfpathmoveto{\pgfpoint
17589 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17590 {\@@gateconnheight*\pgf@circ@res@down/3}}
17591 \fi
17592 \pgfpathlineto{\pgfpoint
17593 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17594 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17595 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17596 \pgfusepath{draw}
17597 \endpgfscope
17598
17599 % arrows
17600 \pgfscope
17601 \pgfslopedattimetrue
17602 \pgfallowupsidedownattimetrue
17603 \pgfresetnontranslationattimefalse
17604 \ifpgf@circuit@trans@arrowatend
17605 \ifpgf@circuit@trans@ntype
17606 \edef\@@anchor{tip}
17607 \edef\@@pos{1.0}
17608 \else
17609 \edef\@@anchor{btip}
17610 \edef\@@pos{0.0}
17611 \fi
17612 \else
17613 \edef\@@anchor{center}\edef\@@pos{0.6}
17614 \fi
17615 \pgftransformlineattime{\@@pos}{%
17616 \pgfpoint
17617 {\pgf@circ@res@right}%
17618 {\pgf@circ@res@up+\pgf@circ@res@down}%
17619 }{%
17620 \pgfpoint%
17621 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17622 {\pgf@circ@res@up+\pgf@circ@res@down}%
17623 }
17624 \ifpgf@circuit@trans@ntype
17625 \else
17626 \pgftransformrotate{180}
17627 \fi
17628 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
17629 \endpgfscope
17630
17631 % GATE CONNECTION
17632 \ifpgf@circuit@bpt@drawgate
17633 \pgfscope %% gate connection
17634 \ifpgf@circuit@trans@ntype
17635 \edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})}
17636 \else
17637 \edef\@@gateconnheight{(-\ctikzvalof{tripoles/#1/conn height})}
17638 \fi
17639 \pgfpathmoveto{\pgfpoint
17640 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17641 {\@@gateconnheight*\pgf@circ@res@down}}
17642 \pgfpathlineto{\pgfpoint
17643 {\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17644 {\@@gateconnheight*\pgf@circ@res@down}}
17645 \ifpgf@circuit@fet@doublegate
17646 \pgfpathmoveto{\pgfpoint
17647 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17648 {-\@@gateconnheight*\pgf@circ@res@down/3}}
17649 \pgfpathlineto{\pgfpoint
17650 {\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17651 {-\@@gateconnheight*\pgf@circ@res@down/3}}
17652 \fi
17653 \pgfusepath{draw}
17654 \endpgfscope
17655 \fi
17656
17657 \pgfcirc@ferroelectric{#1}{0}
17658
17659 }
17660
17661 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3{
17662 \pgfcircdeclaretransistor{#1}{
17663 \anchor{bulk}{\left\pgf@x=0pt}
17664 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
17665 \anchor{inner up}{
17666 \northeast
17667 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
17668 }
17669 \anchor{inner down}{
17670 \northeast
17671 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
17672 }
17673 #2%
17674 }
17675 {#3}
17676 }
17677
17678 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
17679 \pgf@circuit@trans@depletiontypefalse
17680 \drawfetcore{nfet}
17681 }
17682
17683 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
17684 \pgf@circuit@trans@depletiontypefalse
17685 \drawfetcore{pfet}
17686 }
17687
17688 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
17689 \pgf@circuit@trans@depletiontypetrue
17690 \drawfetcore{nfetd}
17691 }
17692
17693 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
17694 \pgf@circuit@trans@depletiontypetrue
17695 \drawfetcore{pfetd}
17696 }
17697 % N-CHANNEL IGFET ENHANCEMENT TYPE
17698 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
17699 \pgf@circuit@trans@depletiontypefalse
17700 \drawfetcore{nigfete}
17701
17702 % SOURCE CONNECTION
17703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17704 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17705 \pgfusepath{draw}
17706
17707 % SOLDER DOT at source-bulk connection
17708 \ifpgf@circuit@fet@solderdot
17709 \pgfscope
17710 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
17711 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
17712 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
17713 \pgfnode{circ}{center}{}{}{}
17714 \endpgfscope{}
17715 \fi
17716 }
17717
17718 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
17719 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
17720 \pgf@circuit@trans@depletiontypefalse
17721 \drawfetcore{nigfetebulk}
17722 % SOLDER DOT at source-bulk connection
17723 \ifpgf@circuit@fet@solderdot
17724 \pgfscope
17725 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
17726 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
17727 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
17728 \pgfnode{circ}{center}{}{}{}
17729 \endpgfscope{}
17730 \fi
17731 }
17732
17733 % N-CHANNEL IGFET DEPLETION TYPE
17734 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
17735 \pgf@circuit@trans@depletiontypetrue
17736 \drawfetcore{nigfetd}
17737
17738 % SOURCE CONNECTION
17739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17741 \pgfusepath{draw}
17742
17743 % SOLDER DOT at source-bulk connection
17744 \ifpgf@circuit@fet@solderdot
17745 \pgfscope
17746 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
17747 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
17748 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
17749 \pgfnode{circ}{center}{}{}{}
17750 \endpgfscope{}
17751 \fi
17752 }
17753
17754 % P-CHANNEL IGFET ENHANCEMENT TYPE
17755 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
17756 \pgf@circuit@trans@depletiontypefalse
17757 \drawfetcore{pigfete}
17758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17759
17760 % SOURCE CONNECTION
17761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17763 \pgfusepath{draw}
17764
17765
17766 % SOLDER DOT at source-bulk connection
17767 \ifpgf@circuit@fet@solderdot
17768 \pgfscope
17769 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
17770 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
17771 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
17772 \pgfnode{circ}{center}{}{}{}
17773 \endpgfscope
17774 \fi
17775 }
17776
17777 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
17778 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
17779 \pgf@circuit@trans@depletiontypefalse
17780 \drawfetcore{pigfetebulk}
17781 }
17782
17783 % P-CHANNEL IGFET DEPLETION TYPE
17784 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
17785 \pgf@circuit@trans@depletiontypetrue
17786 \drawfetcore{pigfetd}
17787
17788 % SOURCE CONNECTION
17789 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17790 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
17791 \pgfusepath{draw}
17792
17793
17794 % SOLDER DOT at source-bulk connection
17795 \ifpgf@circuit@fet@solderdot
17796 \pgfscope
17797 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
17798 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
17799 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
17800 \pgfnode{circ}{center}{}{}{}
17801 \endpgfscope{}
17802 \fi
17803 }
17804
17805 %%% uni-junction transistors: jfets, ujts
17806
17807 \long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw
17808 \pgfcircdeclaretransistor{#1}{
17809 \anchor{inner up}{
17810 \northeast
17811 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17812 }
17813 \anchor{inner down}{
17814 \northeast
17815 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17816 }
17817 \anchor{kink}{
17818 \northeast
17819 \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17820 \left
17821 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
17822 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
17823 }
17824 % extra anchors (or override)
17825 #2%
17826 }{%
17827 % add the circle if requested (before everything else, so we can fill it)
17828 \pgfcirc@transistorcircle
17829
17830 % get direction
17831 \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}}
17832
17833 % draw drain/source connections: up
17834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17836 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
17837 \pgfpathlineto{\pgfpoint
17838 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17839 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
17840
17841 % down
17842 \pgfpathmoveto{\pgfpoint
17843 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17844 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
17845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17846 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
17847 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17848 \pgfusepath{draw}
17849
17850 \pgfscope
17851 \pgfpathmoveto{\pgfpoint
17852 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17853 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17854 \pgfpathlineto{\pgfpoint
17855 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17856 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17857 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17858 \pgfusepath{draw}
17859 \endpgfscope
17860
17861 % arrow
17862 \pgfscope
17863 \pgfslopedattimetrue
17864 \pgfallowupsidedownattimetrue
17865 \pgfresetnontranslationattimefalse
17866 \ifpgf@circuit@trans@arrowatend
17867 \ifnum\@@dir>0
17868 \edef\@@anchor{tip}\edef\@@pos{1.0}
17869 \else
17870 \edef\@@anchor{btip}\edef\@@pos{1.0}
17871 \fi
17872 \else
17873 \ifnum\@@dir>0
17874 \edef\@@anchor{center}\edef\@@pos{0.6}
17875 \else
17876 \edef\@@anchor{center}\edef\@@pos{0.4}
17877 \fi
17878 \fi
17879 % find x1, x2 and y for the base arrow
17880 \ifnum\@@dir>0
17881 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
17882 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
17883 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down
17884 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down
17885 \else
17886 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
17887 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
17888 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up
17889 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up
17890 \fi
17891 %
17892 % gate line (called emitter in UJT)
17893 %
17894 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
17895 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
17896 %
17897 % horizontal gate line
17898 %
17899 \ifpgf@circuit@bpt@drawgate
17900 \ifnum\@@dir>0
17901 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
17902 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
17903 \else
17904 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
17905 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
17906 \fi
17907 \fi
17908 \pgfusepath{draw}
17909 %
17910 % gate arrows (called emitter in UJT)
17911 %
17912 \pgftransformlineattime{\@@pos}{%
17913 \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}
17914 }{%
17915 \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}
17916 }
17917 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
17918 %
17919 % gate line (called emitter in UJT)
17920 %
17921 \endpgfscope
17922
17923 % extra drawings
17924 #3%
17925 }
17926 }
17927
17928 % NJFET and PJFET
17929
17930 \pgfcircdeclarejunctiontransistor{njfet}{}{}
17931 \pgfcircdeclarejunctiontransistor{pjfet}{}{}
17932
17933 \def\@ujtanchoroverride#1{
17934 \savedanchor{\ujtrealemitter}{
17935 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17936 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
17937 \pgf@y=.5\pgf@y %north anchor height
17938 % kink AND conn height, they're the same
17939 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17940 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
17941 % horizontal
17942 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left
17943 \ifpgf@circuit@bpt@drawgate\else
17944 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
17945 \fi
17946 }
17947 \anchor{E}{\ujtrealemitter}
17948 \anchor{emitter}{\ujtrealemitter}
17949 \anchor{B2}{\northeast\pgf@y=-\pgf@y}
17950 \anchor{B1}{\northeast}
17951 }
17952
17953
17954 \pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{}
17955 \pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{}
17956
17957
17958 \pgfdeclaretransistorwrapperaddbulk{isfet}{
17959 }{%
17960 % add the circle if requested (before everything else, so we can fill it)
17961 \pgfcirc@transistorcircle
17962 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17963 % DRAIN CONNECTION
17964 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17965 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
17966 % DRAIN
17967 \pgfpathlineto{\pgfpoint
17968 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
17969 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
17970 \pgfusepath{draw}
17971
17972 % GATE, DEPLETION TYPE
17973 \pgfscope %% added
17974 \pgfpathmoveto{\pgfpoint
17975 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
17976 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
17977 \pgfpathlineto{\pgfpoint
17978 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
17979 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
17980 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
17981 \pgfusepath{draw} %% added
17982 \endpgfscope %% added
17983
17984 % BULK
17985 \pgfpathmoveto{\pgfpoint
17986 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
17987 {\pgf@circ@res@up+\pgf@circ@res@down}}
17988 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
17989 {\pgf@circ@res@up+\pgf@circ@res@down}}
17990
17991 % SOURCE
17992 \pgfpathmoveto{\pgfpoint
17993 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
17994 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
17995 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17996 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
17997 % SOURCE CONNECTION
17998 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17999 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
18000 \pgfusepath{draw}
18001
18002 % SOLDER DOT at source-bulk connection
18003 \ifpgf@circuit@fet@solderdot
18004 \pgfscope
18005 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18006 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
18007 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18008 \pgfnode{circ}{center}{}{}{}
18009 \endpgfscope{}
18010 \fi
18011 % ARROW
18012 \pgfscope
18013 \pgfslopedattimetrue
18014 \pgfallowupsidedownattimetrue
18015 \pgfresetnontranslationattimefalse
18016 \ifpgf@circuit@trans@arrowatend
18017 \edef\@@anchor{tip}\edef\@@pos{1.0}
18018 \else
18019 \edef\@@anchor{center}\edef\@@pos{0.6}
18020 \fi
18021 \pgftransformlineattime{\@@pos}{%
18022 \pgfpoint
18023 {\pgf@circ@res@right}%
18024 {\pgf@circ@res@up+\pgf@circ@res@down}%
18025 }{%
18026 \pgfpoint%
18027 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
18028 {\pgf@circ@res@up+\pgf@circ@res@down}%
18029 }
18030 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
18031 \endpgfscope
18032 \pgfusepath{draw}
18033
18034 % Wavy lines
18035 \pgfscope
18036 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
18037 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18038 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18039 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18040 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18041 \pgfusepath{draw}
18042
18043 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
18044 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18045 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18046 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18047 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18048 \pgfusepath{draw}
18049
18050 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
18051 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18052 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18053 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18054 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18055 \pgfusepath{draw}
18056 \endpgfscope
18057 }
18058
18059 % end of transistors
18060 % %>>>
18061
18062 %% Transistor's path definitions%<<<
18063
18064 \pgf@circ@definetranspath{nmos}
18065 \pgf@circ@definetranspath{pmos}
18066 \pgf@circ@definetranspath{nmosd}
18067 \pgf@circ@definetranspath{pmosd}
18068 \pgf@circ@definetranspath{hemt}
18069 \pgf@circ@definetranspath{npn}
18070 \pgf@circ@definetranspath{pnp}
18071 \pgf@circ@definetranspath{nfet}
18072 \pgf@circ@definetranspath{nigfete}
18073 \pgf@circ@definetranspath{nigfetd}
18074 \pgf@circ@definetranspath{nigfetebulk}
18075 \pgf@circ@definetranspath{pfet}
18076 \pgf@circ@definetranspath{pigfete}
18077 \pgf@circ@definetranspath{pigfetd}
18078 \pgf@circ@definetranspath{pigfetebulk}
18079 \pgf@circ@definetranspath{njfet}
18080 \pgf@circ@definetranspath{pjfet}
18081 \pgf@circ@definetranspath{pigbt}
18082 \pgf@circ@definetranspath{nigbt}
18083 \pgf@circ@definetranspath{Lpigbt}
18084 \pgf@circ@definetranspath{Lnigbt}% %>>>
18085
18086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18087 %% Amplifiers
18088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18089
18090 % Settings for Amplifiers%<<<1
18091 %
18092 % switches for op amps
18093 % changing input polarity
18094 %
18095 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
18096 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
18097 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
18098 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
18099 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
18100 %
18101 % changing output polarity (for fully diff objects)
18102 %
18103 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
18104 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
18105 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
18106 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
18107 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
18108
18109 % Operational amplifier
18110 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
18111 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
18112 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
18113 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
18114 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
18115 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18116
18117 % Fully differential operational amplifier
18118 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
18119 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
18120 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
18121 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
18122 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
18123 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
18124 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18125
18126 \ctikzset{tripoles/en amp/width/.initial=1.7}
18127 \ctikzset{tripoles/en amp/port width/.initial=.7}
18128 \ctikzset{tripoles/en amp/height/.initial=1.6}
18129 \ctikzset{tripoles/en amp/input height/.initial=.3}
18130 \ctikzset{tripoles/en amp/up pos/.initial=.45}
18131 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18132 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
18133 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
18134 \tikzset{
18135 en amp text/.code = {%
18136 \ctikzsetvalof{tripoles/en amp/text}{#1}%
18137 },
18138 en amp text A/.code = {%
18139 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
18140 },
18141 }
18142
18143 % Transconductance amplifier
18144 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
18145 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
18146 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
18147 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
18148 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
18149 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
18150 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18151
18152 % Instrumentation amplifier
18153 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
18154 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
18155 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
18156 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
18157 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
18158 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
18159 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
18160 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18161
18162 % Instrumentation amplifier with differential output
18163 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
18164 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
18165 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
18166 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
18167 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
18168 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
18169 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
18170 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
18171 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18172
18173 % Instrumentation amplifier with gain resistor terminals
18174 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
18175 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
18176 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
18177 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
18178 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
18179 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
18180 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
18181 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
18182 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18183
18184 % Plain amplifier
18185 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
18186 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
18187 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
18188 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
18189 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
18190
18191 % changing fonts and symbols of amplifiers
18192 \ctikzset{amplifiers/symbol font/.code={%
18193 \ctikzset{tripoles/inst amp ra/font=#1}%
18194 \ctikzset{tripoles/fd inst amp/font=#1}%
18195 \ctikzset{tripoles/inst amp/font=#1}%
18196 \ctikzset{tripoles/gm amp/font=#1}%
18197 \ctikzset{tripoles/en amp/font=#1}%
18198 \ctikzset{tripoles/fd op amp/font=#1}%
18199 \ctikzset{tripoles/op amp/font=#1}%
18200 }}
18201 \ctikzset{amplifiers/plus/.initial={$+$}}
18202 % In the mayority of fonts, the size of - is smaller than +, so we have
18203 % unaligned signs when positioned independently.
18204 % See https://github.com/circuitikz/circuitikz/issues/721
18205 \ctikzset{amplifiers/minus/.initial={$\vphantom{+}-$}}
18206 \tikzset{amp symbol font/.code={%
18207 \ctikzset{amplifiers/symbol font={#1}}%
18208 }
18209 }
18210 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
18211 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
18212 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
18213 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
18214 %%>>>
18215
18216 %% Nodes for amplifiers%<<<
18217 %% operational and instrumentation amplifiers
18218
18219 \pgfdeclareshape{op amp}
18220 {
18221 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18222 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18223 \anchor{center}{\pgfpointorigin}
18224 \savedanchor\northwest{%
18225 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18226 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18227 \pgf@y=.5\pgf@y
18228 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18229 \pgf@x=.5\pgf@x
18230 }
18231 \savedanchor\left{%
18232 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18233 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18234 \pgf@x=.5\pgf@x
18235 \pgf@y=0pt
18236 }
18237 \anchor{south}{
18238 \northwest
18239 \pgf@y=-\pgf@y
18240 \pgf@x=0pt
18241 }
18242 \anchor{north}{
18243 \northwest
18244 \pgf@x=0pt
18245 }
18246 \savedanchor\left{%
18247 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18248 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18249 \pgf@x=.5\pgf@x
18250 \pgf@y=0pt
18251 }
18252 \savedanchor\inOneFixed{%
18253 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18254 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18255 \pgf@y=.5\pgf@y
18256 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
18257 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18258 \pgf@x=.5\pgf@x
18259 }
18260 \anchor{in up}{
18261 \inOneFixed
18262 }
18263 \anchor{in down}{
18264 \inOneFixed
18265 \pgf@y=-\pgf@y
18266 }
18267 \savedanchor\inOne{%
18268 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18269 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18270 \pgf@y=.5\pgf@y
18271 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
18272 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18273 \pgf@x=.5\pgf@x
18274 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18275 }
18276 \anchor{-}{
18277 \inOne
18278 }
18279 \anchor{+}{
18280 \inOne
18281 \pgf@y=-\pgf@y
18282 }
18283 \savedanchor\up{%
18284 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18285 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18286 \pgf@y=.5\pgf@y
18287 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18288 \pgf@x=.5\pgf@x
18289 \pgf@circ@res@up = \pgf@y
18290 \pgf@circ@res@right = -\pgf@x
18291 \pgf@circ@res@left = \pgf@x
18292 \pgfpointlineattime{
18293 \ctikzvalof{tripoles/op amp/up pos}}{
18294 \pgfpoint{
18295 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18296 {\pgf@circ@res@up}}
18297 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
18298 }
18299 \anchor{up}{
18300 \up
18301 }
18302 \anchor{down}{
18303 \up
18304 \pgf@y=-\pgf@y
18305 }
18306 \anchor{out}{
18307 \northwest
18308 \pgf@y=0pt
18309 \pgf@x=-\pgf@x
18310 }
18311 \anchor{west}{
18312 \left
18313 }
18314 \anchor{east}{
18315 \left
18316 \pgf@x=-\pgf@x
18317 }
18318
18319 % support for border anchors
18320 \savedanchor\leftedge{%
18321 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18322 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18323 \pgf@x=.5\pgf@x
18324 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
18325 \pgf@y=0pt
18326 }
18327 \anchor{leftedge}{\leftedge}
18328 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18329 \anchor{bin up}{
18330 \inOneFixed
18331 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18332 }
18333 \anchor{bin down}{
18334 \inOneFixed
18335 \pgf@y=-\pgf@y
18336 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18337 }
18338 \anchor{b-}{
18339 \inOne
18340 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18341 }
18342 \anchor{b+}{
18343 \inOne
18344 \pgf@y=-\pgf@y
18345 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18346 }
18347 \anchor{bout}{
18348 \leftedge
18349 \pgf@y=0pt
18350 \pgf@x=-\pgf@x
18351 }
18352 % end border anchors
18353 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18354 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18355 \anchor{north west}{ \northwest }
18356 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18357
18358 \anchor{text}{
18359 \ifpgf@circ@center@text
18360 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18361 \else
18362 \leftedge
18363 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18364 \fi
18365 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18366 }
18367
18368 \pgf@circ@draw@component{
18369 \pgf@circ@setcolor
18370 \northwest
18371 \pgf@circ@res@up = \pgf@y
18372 \pgf@circ@res@down = -\pgf@y
18373 \pgf@circ@res@right = -\pgf@x
18374 \pgf@circ@res@left = \pgf@x
18375 \pgf@circ@scaled@Rlen=\scaledRlen
18376 % Triangle
18377 \pgfscope
18378 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18379 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18380 \pgf@circ@res@step=\pgf@circ@res@right
18381 \advance\pgf@circ@res@step by -\pgf@circ@res@left
18382 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
18383 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18384 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18385 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18386 \pgfpathclose
18387 \pgf@circ@draworfill
18388 \endpgfscope
18389 % Negative input terminal
18390 \pgfpathmoveto{\pgfpoint
18391 {\pgf@circ@res@left}
18392 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
18393 \pgfpathlineto{\pgfpoint
18394 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18395 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
18396 % Positive input terminal
18397 \pgfpathmoveto{\pgfpoint
18398 {\pgf@circ@res@left}
18399 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
18400 \pgfpathlineto{\pgfpoint
18401 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18402 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
18403 % Output terminal
18404 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18405 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
18406 \pgfsetrectcap
18407 \pgfusepath{draw}
18408 \pgf@circ@text@strokecolor
18409 \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}
18410 \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}
18411 }
18412 }
18413
18414 % Op amp shape as in european standard EN 60617
18415 \pgfdeclareshape{en amp}
18416 {
18417 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18418 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18419 \anchor{center}{\pgfpointorigin}
18420 \savedanchor\northwest{%
18421 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18422 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18423 \pgf@y=.5\pgf@y
18424 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18425 \pgf@x=.5\pgf@x
18426 }
18427 \savedanchor\left{%
18428 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18429 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18430 \pgf@x=.5\pgf@x
18431 \pgf@y=0pt
18432 }
18433 \anchor{south}{
18434 \northwest
18435 \pgf@y=-\pgf@y
18436 \pgf@x=0pt
18437 }
18438 \anchor{north}{
18439 \northwest
18440 \pgf@x=0pt
18441 }
18442 \savedanchor\inOneFixed{%
18443 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18444 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18445 \pgf@y=.5\pgf@y
18446 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
18447 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18448 \pgf@x=.5\pgf@x
18449 }
18450 \anchor{in up}{
18451 \inOneFixed
18452 }
18453 \anchor{in down}{
18454 \inOneFixed
18455 \pgf@y=-\pgf@y
18456 }
18457 \savedanchor\inOne{%
18458 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18459 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18460 \pgf@y=.5\pgf@y
18461 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
18462 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18463 \pgf@x=.5\pgf@x
18464 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18465 }
18466 \anchor{-}{
18467 \inOne
18468 }
18469 \anchor{+}{
18470 \inOne
18471 \pgf@y=-\pgf@y
18472 }
18473 \anchor{up}{
18474 \northwest
18475 \pgf@x=0pt
18476 }
18477 \anchor{down}{
18478 \northwest
18479 \pgf@x=0pt
18480 \pgf@y=-\pgf@y
18481 }
18482 \anchor{out}{
18483 \northwest
18484 \pgf@y=0pt
18485 \pgf@x=-\pgf@x
18486 }
18487 \anchor{west}{
18488 \left
18489 }
18490 \anchor{east}{
18491 \left
18492 \pgf@x=-\pgf@x
18493 }
18494 % support for border anchors
18495 \savedanchor\leftedge{%
18496 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18497 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18498 \pgf@x=.5\pgf@x
18499 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
18500 \pgf@y=0pt
18501 }
18502 \anchor{leftedge}{\leftedge}
18503 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18504 \anchor{bin up}{
18505 \inOneFixed
18506 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18507 }
18508 \anchor{bin down}{
18509 \inOneFixed
18510 \pgf@y=-\pgf@y
18511 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18512 }
18513 \anchor{b-}{
18514 \inOne
18515 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18516 }
18517 \anchor{b+}{
18518 \inOne
18519 \pgf@y=-\pgf@y
18520 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18521 }
18522 \anchor{bout}{
18523 \leftedge
18524 \pgf@y=0pt
18525 \pgf@x=-\pgf@x
18526 }
18527 % end border anchors
18528 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18529 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18530 \anchor{north west}{ \northwest }
18531 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18532 \anchor{text}{
18533 \ifpgf@circ@center@text
18534 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18535 \else
18536 \leftedge
18537 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18538 \fi
18539 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18540 }
18541
18542 \pgf@circ@draw@component{
18543 \pgf@circ@setcolor
18544 \northwest
18545 \pgf@circ@res@up = \pgf@y
18546 \pgf@circ@res@down = -\pgf@y
18547 \pgf@circ@res@right = -\pgf@x
18548 \pgf@circ@res@left = \pgf@x
18549 \pgf@circ@scaled@Rlen=\scaledRlen
18550
18551 \pgfscope
18552 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18553 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
18554 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
18555 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
18556 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
18557 \pgfpathclose
18558 \pgf@circ@draworfill
18559 \endpgfscope
18560
18561 \pgfpathmoveto{\pgfpoint
18562 {\pgf@circ@res@left}
18563 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
18564 \pgfpathlineto{\pgfpoint
18565 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
18566 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
18567
18568 \pgfpathmoveto{\pgfpoint
18569 {\pgf@circ@res@left}
18570 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
18571 \pgfpathlineto{\pgfpoint
18572 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
18573 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
18574
18575 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18576 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
18577 \pgfsetrectcap
18578 \pgfusepath{draw}
18579 \pgf@circ@text@strokecolor
18580 \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}
18581 \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}
18582 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
18583 }
18584 }
18585
18586 % Fully differential output op amp
18587 % Contributed by Kristofer M. Monisit
18588 \pgfdeclareshape{fd op amp}
18589 {
18590 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18591 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18592 \anchor{center}{\pgfpointorigin}
18593 \savedanchor\northwest{%
18594 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18595 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18596 \pgf@y=.5\pgf@y
18597 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18598 \pgf@x=.5\pgf@x
18599 }
18600 \savedanchor\outline{%
18601 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18602 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18603 \pgf@y=.5\pgf@y
18604 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18605 \pgf@x=.5\pgf@x
18606 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
18607 }
18608 \anchor{south}{
18609 \northwest
18610 \pgf@y=-\pgf@y\pgf@x=0pt\relax
18611 }
18612 \anchor{north}{
18613 \northwest\pgf@x=0pt\relax
18614 }
18615 \savedanchor\left{%
18616 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18617 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18618 \pgf@x=.5\pgf@x
18619 \pgf@y=0pt
18620 }
18621 \savedanchor\inOneFixed{%
18622 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18623 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18624 \pgf@y=.5\pgf@y
18625 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
18626 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18627 \pgf@x=.5\pgf@x
18628 }
18629 \anchor{in up}{
18630 \inOneFixed
18631 }
18632 \anchor{in down}{
18633 \inOneFixed
18634 \pgf@y=-\pgf@y
18635 }
18636 \savedanchor\inOne{%
18637 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18638 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18639 \pgf@y=.5\pgf@y
18640 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
18641 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18642 \pgf@x=.5\pgf@x
18643 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18644 }
18645 \anchor{-}{
18646 \inOne
18647 }
18648 \anchor{+}{
18649 \inOne
18650 \pgf@y=-\pgf@y
18651 }
18652 \savedanchor\up{%
18653 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18654 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18655 \pgf@y=.5\pgf@y
18656 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18657 \pgf@x=.5\pgf@x
18658 \pgf@circ@res@up = \pgf@y
18659 \pgf@circ@res@right = -\pgf@x
18660 \pgf@circ@res@left = \pgf@x
18661 \pgfpointlineattime{
18662 \ctikzvalof{tripoles/fd op amp/up pos}}{
18663 \pgfpoint{
18664 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
18665 {\pgf@circ@res@up}}
18666 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
18667 }
18668 \anchor{up}{
18669 \up
18670 }
18671 \anchor{down}{
18672 \up
18673 \pgf@y=-\pgf@y
18674 }
18675 \anchor{out up}{
18676 \northwest
18677 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18678 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18679 }
18680 \anchor{out down}{
18681 \northwest
18682 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18683 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18684 }
18685 \anchor{out +}{
18686 \outline
18687 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18688 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18689 }
18690 \anchor{out -}{
18691 \outline
18692 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18693 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18694 }
18695 % support for border anchors
18696 \savedanchor\leftedge{%
18697 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18698 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18699 \pgf@x=.5\pgf@x
18700 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18701 \pgf@y=0pt
18702 }
18703 \anchor{leftedge}{\leftedge}
18704 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18705 \anchor{bin up}{
18706 \inOneFixed
18707 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18708 }
18709 \anchor{bin down}{
18710 \inOneFixed
18711 \pgf@y=-\pgf@y
18712 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18713 }
18714 \anchor{b-}{
18715 \inOne
18716 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18717 }
18718 \anchor{b+}{
18719 \inOne
18720 \pgf@y=-\pgf@y
18721 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18722 }
18723 \anchor{bout}{
18724 \leftedge
18725 \pgf@y=0pt
18726 \pgf@x=-\pgf@x
18727 }
18728 \anchor{bout +}{
18729 \outline
18730 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
18731 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
18732 {\pgfpoint{\pgf@xa}{0pt}}
18733 {\pgfpoint{0pt}{\pgf@ya}}
18734 }
18735 \anchor{bout -}{
18736 \outline
18737 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
18738 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
18739 {\pgfpoint{\pgf@xa}{0pt}}
18740 {\pgfpoint{0pt}{\pgf@ya}}
18741 \pgf@y=-\pgf@y
18742 }
18743 \anchor{bout up}{
18744 \northwest
18745 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
18746 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
18747 {\pgfpoint{\pgf@xa}{0pt}}
18748 {\pgfpoint{0pt}{\pgf@ya}}
18749 }
18750 \anchor{bout down}{
18751 \northwest
18752 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
18753 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
18754 {\pgfpoint{\pgf@xa}{0pt}}
18755 {\pgfpoint{0pt}{\pgf@ya}}
18756 \pgf@y=-\pgf@y
18757 }
18758 % end border anchors
18759 \anchor{west}{
18760 \left
18761 }
18762 \anchor{east}{
18763 \left
18764 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18765 }
18766 \anchor{out}{% should not be used
18767 \left
18768 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18769 }
18770 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18771 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
18772 \anchor{north west}{ \northwest }
18773 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
18774 \anchor{text}{
18775 \ifpgf@circ@center@text
18776 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18777 \else
18778 \leftedge
18779 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18780 \fi
18781 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18782 }
18783 \pgf@circ@draw@component{
18784 \pgf@circ@setcolor
18785
18786 \northwest
18787 \pgf@circ@res@up = \pgf@y
18788 \pgf@circ@res@down = -\pgf@y
18789 \pgf@circ@res@right = -\pgf@x
18790 \pgf@circ@res@left = \pgf@x
18791 \pgf@circ@scaled@Rlen=\scaledRlen
18792
18793 % Triangle
18794 % Includes output terminals in the traingular shape
18795 % to ensure that diagonal joins are properly displayed
18796 % we first draw the main triangle and the leads with normal thickness,
18797 % and the redraw the main triangle with the component shape
18798 \pgfscope
18799 % shift origin a bit to ease calculations
18800 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
18801 \pgf@circ@res@step=\pgf@circ@res@right
18802 \advance\pgf@circ@res@step by -\pgf@circ@res@left
18803 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
18804
18805 % Initial point (right vertex)
18806 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18807
18808 % Negative output terminal
18809 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
18810 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
18811 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
18812
18813 % Top vertex
18814 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18815
18816 % Bottom vertex
18817 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18818
18819 % Positive output terminal
18820 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
18821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
18822 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
18823
18824 % Right vertex
18825 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18826
18827 \pgfpathclose
18828 \pgfusepath{stroke}
18829
18830 % ok, now we'll redraw the triangle with the class specific
18831 % thickness and optionally fill
18832
18833 \pgfscope
18834 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
18835
18836 % Initial point (right vertex)
18837 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18838 % Top vertex
18839 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18840 % Bottom vertex
18841 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18842
18843 \pgfpathclose
18844 \pgf@circ@draworfill
18845 \endpgfscope % thick and fill
18846 \endpgfscope % shift
18847
18848 % Negative input terminal
18849 \pgfpathmoveto{\pgfpoint
18850 {\pgf@circ@res@left}
18851 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
18852 \pgfpathlineto{\pgfpoint
18853 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
18854 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
18855
18856 % Positive input terminal
18857 \pgfpathmoveto{\pgfpoint
18858 {\pgf@circ@res@left}
18859 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
18860 \pgfpathlineto{\pgfpoint
18861 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
18862 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
18863 \pgfsetrectcap
18864 \pgfusepath{draw}
18865 \pgf@circ@text@strokecolor
18866 \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}
18867 \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}
18868 % Negative output terminal label
18869 \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}
18870 % Positive output terminal label
18871 \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}
18872 }
18873 }
18874
18875
18876 % Instrumentation amplifier with differential output
18877 \pgfdeclareshape{fd inst amp}
18878 {
18879 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18880 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18881 % when tikz calls the anchor it wants the relative position in the lengths
18882 % \pgf@x \pgf@y
18883 % \pgfpoint* functions set that variables
18884 % anchors are visible outside and run on use
18885 \anchor{center}{\pgfpointorigin}
18886 % savedanchors are internals and run on node creation (not use)
18887 % bounding-box top left
18888 \savedanchor\northwest{%
18889 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18890 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18891 \pgf@y=.5\pgf@y
18892 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18893 \pgf@x=.5\pgf@x
18894 }
18895 \anchor{nw}{
18896 \northwest
18897 }
18898 \anchor{south}{
18899 \northwest
18900 \pgf@y=-\pgf@y\pgf@x=0pt\relax
18901 }
18902 \anchor{north}{
18903 \northwest\pgf@x=0pt\relax
18904 }
18905 \savedanchor\left{%
18906 \pgf@y=0pt
18907 }
18908 \anchor{leftedge}
18909 {\left
18910 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
18911 }
18912 \savedanchor\inOneFixed{%
18913 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18914 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18915 \pgf@y=.5\pgf@y
18916 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
18917 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18918 \pgf@x=.5\pgf@x
18919 }
18920 \anchor{in up}{
18921 \inOneFixed
18922 }
18923 \anchor{in down}{
18924 \inOneFixed
18925 \pgf@y=-\pgf@y
18926 }
18927 \savedanchor\inOne{%
18928 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18929 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18930 \pgf@y=.5\pgf@y
18931 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
18932 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18933 \pgf@x=.5\pgf@x
18934 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18935 }
18936 \anchor{-}{
18937 \inOne
18938 }
18939 \anchor{+}{
18940 \inOne
18941 \pgf@y=-\pgf@y
18942 }
18943 \savedanchor\up{%
18944 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18945 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18946 \pgf@y=.5\pgf@y
18947 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18948 \pgf@x=.5\pgf@x
18949 \pgf@circ@res@up = \pgf@y
18950 \pgf@circ@res@right = -\pgf@x
18951 \pgf@circ@res@left = \pgf@x
18952 \pgfpointlineattime{
18953 \ctikzvalof{tripoles/fd inst amp/up pos}}{
18954 \pgfpoint{
18955 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
18956 {\pgf@circ@res@up}}
18957 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
18958 }
18959 \anchor{up}{
18960 \up
18961 }
18962 \anchor{down}{
18963 \up
18964 \pgf@y=-\pgf@y
18965 }
18966 % reference voltage input anchors.
18967 \savedanchor\refv{%
18968 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18969 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18970 \pgf@y=.5\pgf@y
18971 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18972 \pgf@x=.5\pgf@x
18973 \pgf@circ@res@up = \pgf@y
18974 \pgf@circ@res@right = -\pgf@x
18975 \pgf@circ@res@left = \pgf@x
18976 \pgfpointlineattime{
18977 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
18978 \pgfpoint{
18979 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
18980 {\pgf@circ@res@up}}
18981 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
18982 }
18983 % we need both because they are normally drawn under the amp, and if you
18984 % mirror it vertically you need them
18985 \anchor{refv up}{
18986 \refv
18987 }
18988 \anchor{refv down}{
18989 \refv
18990 \pgf@y=-\pgf@y
18991 }
18992 \savedanchor\outport{
18993 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18994 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
18995 \pgf@y=.5\pgf@y
18996 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
18997 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
18998 \pgf@x=-.5\pgf@x
18999 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
19000 }
19001 \anchor{out}{
19002 \outport
19003 \pgf@y=0pt
19004 }
19005 \anchor{out +}{
19006 \outport
19007 }
19008 \anchor{out -}{
19009 \outport
19010 \pgf@y=-\pgf@y
19011 }
19012 \savedanchor\outportfixed{
19013 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19014 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19015 \pgf@y=.5\pgf@y
19016 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
19017 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19018 \pgf@x=-.5\pgf@x
19019 }
19020 \anchor{out up}{
19021 \outportfixed
19022 }
19023 \anchor{out down}{
19024 \outportfixed
19025 \pgf@y=-\pgf@y
19026 }
19027 % support for border anchors
19028 \savedanchor\leftedge{%
19029 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19030 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19031 \pgf@x=.5\pgf@x
19032 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
19033 \pgf@y=0pt
19034 }
19035 \anchor{leftedge}{\leftedge}
19036 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19037 \anchor{bin up}{
19038 \inOneFixed
19039 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19040 }
19041 \anchor{bin down}{
19042 \inOneFixed
19043 \pgf@y=-\pgf@y
19044 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19045 }
19046 \anchor{b-}{
19047 \inOne
19048 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19049 }
19050 \anchor{b+}{
19051 \inOne
19052 \pgf@y=-\pgf@y
19053 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19054 }
19055 \anchor{bout}{
19056 \leftedge
19057 \pgf@x=-\pgf@x \pgf@y=0pt
19058 }
19059 \anchor{bout +}{
19060 \outport
19061 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19062 }
19063 \anchor{bout -}{
19064 \outport
19065 \pgf@y=-\pgf@y
19066 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19067 }
19068 \anchor{bout up}{
19069 \outportfixed
19070 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19071 }
19072 \anchor{bout down}{
19073 \outportfixed
19074 \pgf@y=-\pgf@y
19075 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19076 }
19077 % end border anchors
19078 %
19079 \anchor{west}{
19080 \left
19081 }
19082 \anchor{east}{
19083 \left
19084 \pgf@x=-\pgf@x
19085 }
19086 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19087 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19088 \anchor{north west}{ \northwest }
19089 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19090 \anchor{text}{
19091 \ifpgf@circ@center@text
19092 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19093 \else
19094 \leftedge
19095 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19096 \fi
19097 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19098 }
19099
19100 % let's start drawing the component
19101 \pgf@circ@draw@component{
19102 \pgf@circ@setcolor
19103 %
19104 \northwest
19105 \pgf@circ@res@up = \pgf@y
19106 \pgf@circ@res@down = -\pgf@y
19107 \pgf@circ@res@right = -\pgf@x
19108 \pgf@circ@res@left = \pgf@x
19109 \pgf@circ@scaled@Rlen=\scaledRlen
19110 % main component, normally in thicker lines
19111 \pgfscope
19112 \newdimen\pgf@circ@res@right@double
19113 \pgf@circ@res@right@double=2\pgf@circ@res@right
19114 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19115 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19116 \pgf@circ@res@step=\pgf@circ@res@right
19117 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19118 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
19119 %first point (near output)
19120 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
19121 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
19122 \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}}
19123 % and then to the input "front up", "down", to the output short side "down"
19124 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19125 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19126 \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}}
19127 % ...and close
19128 \pgfpathclose
19129 \pgf@circ@draworfill
19130 \endpgfscope
19131
19132 % input terminal up
19133 \pgfpathmoveto{\pgfpoint
19134 {\pgf@circ@res@left}
19135 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
19136 %
19137 \pgfpathlineto{\pgfpoint
19138 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19139 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
19140 %
19141
19142 % input terminal down
19143 \pgfpathmoveto{\pgfpoint
19144 {\pgf@circ@res@left}
19145 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
19146 %
19147 \pgfpathlineto{\pgfpoint
19148 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19149 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
19150
19151 % output leads down and up
19152 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
19153 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
19154
19155 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
19156 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
19157 %
19158 \pgfsetrectcap
19159 \pgfusepath{draw}
19160 \pgf@circ@text@strokecolor
19161 \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}
19162 \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}
19163 \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\pgf@circ@ampli@minus\space\else\pgf@circ@ampli@plus\space\fi}
19164 \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\pgf@circ@ampli@plus\space\else\pgf@circ@ampli@minus\space\fi}
19165 }
19166 }
19167
19168 % Transconductance amplifier (Transkonduktanzverstärker)
19169 \pgfdeclareshape{gm amp}
19170 {
19171 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19172 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19173 \anchor{center}{\pgfpointorigin}
19174 \savedanchor\northwest{%
19175 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19176 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19177 \pgf@y=.5\pgf@y
19178 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19179 \pgf@x=.5\pgf@x
19180 }
19181 \anchor{south}{
19182 \northwest
19183 \pgf@y=-\pgf@y
19184 }
19185 \anchor{north}{
19186 \northwest
19187 }
19188 \savedanchor\left{%
19189 \pgf@y=0pt
19190 }
19191 \anchor{leftedge}
19192 {\left
19193 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19194 }
19195 \savedanchor\inOneFixed{%
19196 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19197 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19198 \pgf@y=.5\pgf@y
19199 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
19200 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19201 \pgf@x=.5\pgf@x
19202 }
19203 \anchor{in up}{
19204 \inOneFixed
19205 }
19206 \anchor{in down}{
19207 \inOneFixed
19208 \pgf@y=-\pgf@y
19209 }
19210 \savedanchor\inOne{%
19211 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19212 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19213 \pgf@y=.5\pgf@y
19214 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
19215 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19216 \pgf@x=.5\pgf@x
19217 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19218 }
19219 \anchor{-}{
19220 \inOne
19221 }
19222 \anchor{+}{
19223 \inOne
19224 \pgf@y=-\pgf@y
19225 }
19226 \savedanchor\up{%
19227 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19228 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19229 \pgf@y=.5\pgf@y
19230 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19231 \pgf@x=.5\pgf@x
19232 \pgf@circ@res@up = \pgf@y
19233 \pgf@circ@res@right = -\pgf@x
19234 \pgf@circ@res@left = \pgf@x
19235 \pgfpointlineattime{
19236 \ctikzvalof{tripoles/gm amp/up pos}}{
19237 \pgfpoint{
19238 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19239 {\pgf@circ@res@up}}
19240 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
19241 }
19242 \anchor{up}{
19243 \up
19244 }
19245 \anchor{down}{
19246 \up
19247 \pgf@y=-\pgf@y
19248 }
19249 \anchor{out}{
19250 \northwest
19251 \pgf@y=0pt
19252 \pgf@x=-\pgf@x
19253 }
19254 % support for border anchors
19255 \savedanchor\leftedge{%
19256 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19257 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19258 \pgf@x=.5\pgf@x
19259 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
19260 \pgf@y=0pt
19261 }
19262 \anchor{leftedge}{\leftedge}
19263 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19264 \anchor{bin up}{
19265 \inOneFixed
19266 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19267 }
19268 \anchor{bin down}{
19269 \inOneFixed
19270 \pgf@y=-\pgf@y
19271 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19272 }
19273 \anchor{b-}{
19274 \inOne
19275 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19276 }
19277 \anchor{b+}{
19278 \inOne
19279 \pgf@y=-\pgf@y
19280 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19281 }
19282 \anchor{bout}{
19283 \leftedge
19284 \pgf@y=0pt
19285 \pgf@x=-\pgf@x
19286 }
19287 % end border anchors
19288 \anchor{west}{
19289 \left
19290 }
19291 \anchor{east}{
19292 \left
19293 \pgf@x=-\pgf@x
19294 }
19295 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19296 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19297 \anchor{north west}{ \northwest }
19298 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19299
19300 \anchor{text}{
19301 \ifpgf@circ@center@text
19302 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19303 \else
19304 \leftedge
19305 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19306 \fi
19307 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19308 }
19309 \pgf@circ@draw@component{
19310 \pgf@circ@setcolor
19311
19312 \northwest
19313 \pgf@circ@res@up = \pgf@y
19314 \pgf@circ@res@down = -\pgf@y
19315 \pgf@circ@res@right = -\pgf@x
19316 \pgf@circ@res@left = \pgf@x
19317 \pgf@circ@scaled@Rlen=\scaledRlen
19318
19319 \pgfscope
19320 \newdimen\pgf@circ@res@right@double
19321 \pgf@circ@res@right@double=2\pgf@circ@res@right
19322
19323 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19324 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19325 \pgf@circ@res@step=\pgf@circ@res@right
19326 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19327 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
19328 %Umrandung:
19329 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
19330 \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
19331 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
19332 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
19333 \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
19334 \pgfpathclose
19335 \pgf@circ@draworfill
19336 \endpgfscope
19337
19338 \pgfpathmoveto{\pgfpoint
19339 {\pgf@circ@res@left}
19340 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
19341 \pgfpathlineto{\pgfpoint
19342 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19343 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
19344 \pgfpathmoveto{\pgfpoint
19345 {\pgf@circ@res@left}
19346 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
19347 \pgfpathlineto{\pgfpoint
19348 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19349 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
19350 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19351 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
19352 \pgfsetrectcap
19353 \pgfusepath{draw}
19354 \pgf@circ@text@strokecolor
19355 \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}
19356 \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}
19357 }
19358 }
19359
19360 % Instrumentation amplifier
19361 \pgfdeclareshape{inst amp}
19362 {
19363 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19364 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19365 % when tikz calls the anchor it wants the relative position in the lengths
19366 % \pgf@x \pgf@y
19367 % \pgfpoint* functions set that variables
19368 % anchors are visible outside and run on use
19369 \anchor{center}{\pgfpointorigin}
19370 % savedanchors are internals and run on node creation (not use)
19371 % bounding-box top left
19372 \savedanchor\northwest{%
19373 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19374 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19375 \pgf@y=.5\pgf@y
19376 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19377 \pgf@x=.5\pgf@x
19378 }
19379 \anchor{nw}{
19380 \northwest
19381 }
19382 \anchor{south}{
19383 \northwest
19384 \pgf@y=-\pgf@y
19385 }
19386 \anchor{north}{
19387 \northwest
19388 }
19389 \savedanchor\left{%
19390 \pgf@y=0pt
19391 }
19392 \anchor{leftedge}
19393 {\left
19394 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19395 }
19396 \savedanchor\inOneFixed{%
19397 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19398 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19399 \pgf@y=.5\pgf@y
19400 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
19401 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19402 \pgf@x=.5\pgf@x
19403 }
19404 \anchor{in up}{
19405 \inOneFixed
19406 }
19407 \anchor{in down}{
19408 \inOneFixed
19409 \pgf@y=-\pgf@y
19410 }
19411 \savedanchor\inOne{%
19412 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19413 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19414 \pgf@y=.5\pgf@y
19415 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
19416 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19417 \pgf@x=.5\pgf@x
19418 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19419 }
19420 \anchor{-}{
19421 \inOne
19422 }
19423 \anchor{+}{
19424 \inOne
19425 \pgf@y=-\pgf@y
19426 }
19427 \savedanchor\up{%
19428 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19429 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19430 \pgf@y=.5\pgf@y
19431 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19432 \pgf@x=.5\pgf@x
19433 \pgf@circ@res@up = \pgf@y
19434 \pgf@circ@res@right = -\pgf@x
19435 \pgf@circ@res@left = \pgf@x
19436 \pgfpointlineattime{
19437 \ctikzvalof{tripoles/inst amp/up pos}}{
19438 \pgfpoint{
19439 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19440 {\pgf@circ@res@up}}
19441 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19442 }
19443 \anchor{up}{
19444 \up
19445 }
19446 \anchor{down}{
19447 \up
19448 \pgf@y=-\pgf@y
19449 }
19450 % reference voltage input anchors.
19451 \savedanchor\refv{%
19452 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19453 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19454 \pgf@y=.5\pgf@y
19455 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19456 \pgf@x=.5\pgf@x
19457 \pgf@circ@res@up = \pgf@y
19458 \pgf@circ@res@right = -\pgf@x
19459 \pgf@circ@res@left = \pgf@x
19460 \pgfpointlineattime{
19461 \ctikzvalof{tripoles/inst amp/refv pos}}{
19462 \pgfpoint{
19463 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19464 {\pgf@circ@res@up}}
19465 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19466 }
19467 % we need both because they are normally drawn under the amp, and if you
19468 % mirror it vertically you need them
19469 \anchor{refv up}{
19470 \refv
19471 }
19472 \anchor{refv down}{
19473 \refv
19474 \pgf@y=-\pgf@y
19475 }
19476 \anchor{out}{
19477 \northwest
19478 \pgf@y=0pt
19479 \pgf@x=-\pgf@x
19480 }
19481 % support for border anchors
19482 \savedanchor\leftedge{%
19483 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19484 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19485 \pgf@x=.5\pgf@x
19486 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
19487 \pgf@y=0pt
19488 }
19489 \anchor{leftedge}{\leftedge}
19490 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19491 \anchor{bin up}{
19492 \inOneFixed
19493 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19494 }
19495 \anchor{bin down}{
19496 \inOneFixed
19497 \pgf@y=-\pgf@y
19498 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19499 }
19500 \anchor{b-}{
19501 \inOne
19502 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19503 }
19504 \anchor{b+}{
19505 \inOne
19506 \pgf@y=-\pgf@y
19507 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19508 }
19509 \anchor{bout}{
19510 \leftedge
19511 \pgf@y=0pt
19512 \pgf@x=-\pgf@x
19513 }
19514 % end border anchors
19515 \anchor{west}{
19516 \left
19517 }
19518 \anchor{east}{
19519 \left
19520 \pgf@x=-\pgf@x
19521 }
19522 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19523 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19524 \anchor{north west}{ \northwest }
19525 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19526
19527 \anchor{text}{
19528 \ifpgf@circ@center@text
19529 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19530 \else
19531 \leftedge
19532 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19533 \fi
19534 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19535 }
19536
19537 % let's start drawing the component
19538 \pgf@circ@draw@component{
19539 \pgf@circ@setcolor
19540 %
19541 \northwest
19542 \pgf@circ@res@up = \pgf@y
19543 \pgf@circ@res@down = -\pgf@y
19544 \pgf@circ@res@right = -\pgf@x
19545 \pgf@circ@res@left = \pgf@x
19546 \pgf@circ@scaled@Rlen=\scaledRlen
19547
19548 % main component, normally in thicker lines
19549 \pgfscope
19550 \newdimen\pgf@circ@res@right@double
19551 \pgf@circ@res@right@double=2\pgf@circ@res@right
19552
19553 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19554 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19555 \pgf@circ@res@step=\pgf@circ@res@right
19556 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19557 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
19558 %first point (near output)
19559 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
19560 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
19561 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19562 % and then to the input "front up", "down", to the output short side "down"
19563 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19564 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19565 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
19566 % ...and close
19567 \pgfpathclose
19568 \pgf@circ@draworfill
19569 \endpgfscope
19570
19571 % Negative input terminal
19572 \pgfpathmoveto{\pgfpoint
19573 {\pgf@circ@res@left}
19574 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
19575 %
19576 \pgfpathlineto{\pgfpoint
19577 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19578 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
19579 %
19580
19581 % Positive input terminal
19582 \pgfpathmoveto{\pgfpoint
19583 {\pgf@circ@res@left}
19584 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
19585 %
19586 \pgfpathlineto{\pgfpoint
19587 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19588 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
19589
19590 % Output terminal
19591 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19592 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
19593 %
19594 \pgfsetrectcap
19595 \pgfusepath{draw}
19596 \pgf@circ@text@strokecolor
19597 \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}
19598 \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}
19599 }
19600 }
19601
19602 % Instrumentation amplifier with terminals for gain resistance between inputs
19603 \pgfdeclareshape{inst amp ra}
19604 {
19605 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19606 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19607 \anchor{center}{\pgfpointorigin}
19608 % bounding-box top left
19609 \savedanchor\northwest{%
19610 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19611 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19612 \pgf@y=.5\pgf@y
19613 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19614 \pgf@x=.5\pgf@x
19615 }
19616 \anchor{nw}{
19617 \northwest
19618 }
19619 \anchor{south}{
19620 \northwest
19621 \pgf@y=-\pgf@y\pgf@x=0pt\relax
19622 }
19623 \anchor{north}{
19624 \northwest\pgf@x=0pt\relax
19625 }
19626 \savedanchor\left{%
19627 \pgf@y=0pt
19628 }
19629 \anchor{leftedge}
19630 {\left
19631 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19632 }
19633 % inputs (+-)
19634 \savedanchor\inOneFixed{%
19635 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19636 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19637 \pgf@y=.5\pgf@y
19638 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
19639 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19640 \pgf@x=.5\pgf@x
19641 }
19642 \anchor{in up}{
19643 \inOneFixed
19644 }
19645 \anchor{in down}{
19646 \inOneFixed
19647 \pgf@y=-\pgf@y
19648 }
19649 \savedanchor\inOne{%
19650 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19651 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19652 \pgf@y=.5\pgf@y
19653 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
19654 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19655 \pgf@x=.5\pgf@x
19656 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19657 }
19658 \anchor{-}{
19659 \inOne
19660 }
19661 \anchor{+}{
19662 \inOne
19663 \pgf@y=-\pgf@y
19664 }
19665 % R ampli anchors. They are by default at 20% more than R-length distance
19666 % you can change that with the `ra pos` key (use 0.5 for one-R).
19667 \savedanchor\raOneFixed{%
19668 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19669 \pgf@y=\pgf@circ@scaled@Rlen
19670 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
19671 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19672 \pgf@x=.5\pgf@x
19673 }
19674 \anchor{ra up}{
19675 \raOneFixed
19676 }
19677 \anchor{ra down}{
19678 \raOneFixed
19679 \pgf@y=-\pgf@y
19680 }
19681 \savedanchor\raOne{%
19682 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19683 \pgf@y=\pgf@circ@scaled@Rlen
19684 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
19685 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19686 \pgf@x=.5\pgf@x
19687 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19688 }
19689 \anchor{ra-}{
19690 \raOne
19691 }
19692 \anchor{ra+}{
19693 \raOne
19694 \pgf@y=-\pgf@y
19695 }
19696 % power supplies
19697 \savedanchor\up{%
19698 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19699 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19700 \pgf@y=.5\pgf@y
19701 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19702 \pgf@x=.5\pgf@x
19703 \pgf@circ@res@up = \pgf@y
19704 \pgf@circ@res@right = -\pgf@x
19705 \pgf@circ@res@left = \pgf@x
19706 \pgfpointlineattime{
19707 \ctikzvalof{tripoles/inst amp ra/up pos}}{
19708 \pgfpoint{
19709 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19710 {\pgf@circ@res@up}}
19711 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
19712 }
19713 \anchor{up}{
19714 \up
19715 }
19716 \anchor{down}{
19717 \up
19718 \pgf@y=-\pgf@y
19719 }
19720 % reference voltage input anchors.
19721 \savedanchor\refv{%
19722 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19723 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19724 \pgf@y=0.5\pgf@y
19725 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19726 \pgf@x=0.5\pgf@x
19727 \pgf@circ@res@up = \pgf@y
19728 \pgf@circ@res@right = -\pgf@x
19729 \pgf@circ@res@left = \pgf@x
19730 \pgfpointlineattime{
19731 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
19732 \pgfpoint{
19733 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19734 {\pgf@circ@res@up}}
19735 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
19736 }
19737 % we need both because they are normally drawn under the amp, and if you
19738 % mirror it vertically you need them
19739 \anchor{refv up}{
19740 \refv
19741 }
19742 \anchor{refv down}{
19743 \refv
19744 \pgf@y=-\pgf@y
19745 }
19746 \anchor{out}{
19747 \northwest
19748 \pgf@y=0pt
19749 \pgf@x=-\pgf@x
19750 }
19751 % support for border anchors
19752 \savedanchor\leftedge{%
19753 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19754 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19755 \pgf@x=.5\pgf@x
19756 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
19757 \pgf@y=0pt
19758 }
19759 \anchor{leftedge}{\leftedge}
19760 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19761 \anchor{bin up}{
19762 \inOneFixed
19763 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19764 }
19765 \anchor{bin down}{
19766 \inOneFixed
19767 \pgf@y=-\pgf@y
19768 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19769 }
19770 \anchor{b-}{
19771 \inOne
19772 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19773 }
19774 \anchor{b+}{
19775 \inOne
19776 \pgf@y=-\pgf@y
19777 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19778 }
19779 \anchor{bra up}{
19780 \raOneFixed
19781 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19782 }
19783 \anchor{bra down}{
19784 \raOneFixed
19785 \pgf@y=-\pgf@y
19786 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19787 }
19788 \anchor{bra-}{
19789 \raOne
19790 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19791 }
19792 \anchor{bra+}{
19793 \raOne
19794 \pgf@y=-\pgf@y
19795 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19796 }
19797 \anchor{bout}{
19798 \leftedge
19799 \pgf@y=0pt
19800 \pgf@x=-\pgf@x
19801 }
19802 % end border anchors
19803 \anchor{west}{
19804 \left
19805 }
19806 \anchor{east}{
19807 \left
19808 \pgf@x=-\pgf@x
19809 }
19810 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19811 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19812 \anchor{north west}{ \northwest }
19813 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19814
19815 \anchor{text}{
19816 \ifpgf@circ@center@text
19817 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19818 \else
19819 \leftedge
19820 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19821 \fi
19822 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19823 }
19824
19825 % drawing of the component
19826 \pgf@circ@draw@component{
19827 \pgf@circ@setcolor
19828
19829 \northwest
19830 \pgf@circ@res@up = \pgf@y
19831 \pgf@circ@res@down = -\pgf@y
19832 \pgf@circ@res@right = -\pgf@x
19833 \pgf@circ@res@left = \pgf@x
19834 \pgf@circ@scaled@Rlen=\scaledRlen
19835
19836 \newdimen\pgf@circ@res@right@double
19837 \pgf@circ@res@right@double=2\pgf@circ@res@right
19838
19839 % main component, normally in thicker lines
19840 \pgfscope
19841 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19842 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19843 \pgf@circ@res@step=\pgf@circ@res@right
19844 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19845 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
19846 %primer punto: la linea de salida (lado componente)
19847 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
19848 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
19849 \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}}
19850 % and then to the input "front up", "down", to the output short side "down"
19851 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19852 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19853 \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}}
19854 % ...and close
19855 \pgfpathclose
19856 \pgf@circ@draworfill
19857 \endpgfscope
19858
19859 % ra terminal -
19860 \pgfpathmoveto{\pgfpoint
19861 {\pgf@circ@res@left}
19862 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
19863 %
19864 \pgfpathlineto{\pgfpoint
19865 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19866 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
19867 % ra terminal +
19868 \pgfpathmoveto{\pgfpoint
19869 {\pgf@circ@res@left}
19870 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
19871 %
19872 \pgfpathlineto{\pgfpoint
19873 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19874 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
19875
19876 % Negative input terminal
19877 \pgfpathmoveto{\pgfpoint
19878 {\pgf@circ@res@left}
19879 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
19880 %
19881 \pgfpathlineto{\pgfpoint
19882 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19883 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
19884 %
19885
19886 % Positive input terminal
19887 \pgfpathmoveto{\pgfpoint
19888 {\pgf@circ@res@left}
19889 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
19890 %
19891 \pgfpathlineto{\pgfpoint
19892 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
19893 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
19894
19895 % Output terminal
19896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19897 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
19898 %
19899 \pgfsetrectcap
19900 \pgfusepath{draw}
19901 \pgf@circ@text@strokecolor
19902 \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}
19903 \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}
19904 }
19905 }
19906
19907 % Buffer
19908 % Contributed by Danilo Piazzalunga
19909 \pgfdeclareshape{buffer}
19910 {
19911 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19912 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19913 \anchor{center}{\pgfpointorigin}
19914 \savedanchor\northwest{%
19915 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19916 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
19917 \pgf@y=.5\pgf@y
19918 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
19919 \pgf@x=.5\pgf@x
19920 }
19921 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
19922 \anchor{west}{ \northwest \pgf@y=0pt }
19923 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
19924 \anchor{north}{ \northwest \pgf@x=0pt }
19925 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19926 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19927 \anchor{north west}{ \northwest }
19928 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19929 \savedanchor\left{%
19930 \pgf@y=0pt
19931 }
19932 \anchor{in}{
19933 \northwest
19934 \pgf@y=0pt
19935 }
19936 \anchor{out}{
19937 \northwest
19938 \pgf@y=0pt
19939 \pgf@x=-\pgf@x
19940 }
19941 \anchor{bin}{
19942 \northwest
19943 \pgf@y=0pt
19944 \pgf@x=0.7\pgf@x
19945 }
19946 \anchor{bout}{
19947 \northwest
19948 \pgf@y=0pt
19949 \pgf@x=-0.7\pgf@x
19950 }
19951
19952 \anchor{text}{
19953 \ifpgf@circ@center@text
19954 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19955 \else
19956 \northwest
19957 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
19958 \fi
19959 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19960 }
19961
19962 \pgf@circ@draw@component{
19963 \pgf@circ@setcolor
19964
19965 \northwest
19966 \pgf@circ@res@up = \pgf@y
19967 \pgf@circ@res@down = -\pgf@y
19968 \pgf@circ@res@right = -\pgf@x
19969 \pgf@circ@res@left = \pgf@x
19970 \pgf@circ@scaled@Rlen=\scaledRlen
19971 \pgfscope
19972 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19973 \pgftransformxshift{.7\pgf@circ@res@left}
19974 \pgf@circ@res@step=\pgf@circ@res@right
19975 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19976 \pgf@circ@res@step=.7\pgf@circ@res@step
19977
19978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
19979 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19980 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19981 \pgfpathclose
19982 \pgf@circ@draworfill
19983 \endpgfscope
19984
19985 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
19986 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
19987
19988 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19989 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
19990
19991 \pgfusepath{draw}
19992 }
19993 }
19994
19995 % plain amplifier, no symbols
19996 \pgfdeclareshape{plain amp}
19997 {
19998 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19999 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20000 \anchor{center}{\pgfpointorigin}
20001 \savedanchor\northwest{%
20002 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20003 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20004 \pgf@y=.5\pgf@y
20005 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20006 \pgf@x=.5\pgf@x
20007 }
20008 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
20009 \anchor{west}{ \northwest \pgf@y=0pt }
20010 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
20011 \anchor{north}{ \northwest \pgf@x=0pt }
20012 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20013 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20014 \anchor{north west}{ \northwest }
20015 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20016 \savedanchor\left{%
20017 \pgf@y=0pt
20018 }
20019 \savedanchor\inOne{%
20020 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20021 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20022 \pgf@y=.5\pgf@y
20023 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
20024 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20025 \pgf@x=.5\pgf@x
20026 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
20027 }
20028 \savedanchor\inOneFixed{%
20029 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20030 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20031 \pgf@y=.5\pgf@y
20032 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
20033 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20034 \pgf@x=.5\pgf@x
20035 }
20036 \anchor{-}{
20037 \inOne
20038 }
20039 \anchor{+}{
20040 \inOne
20041 \pgf@y=-\pgf@y
20042 }
20043 \anchor{in up}{
20044 \inOneFixed
20045 }
20046 \anchor{in down}{
20047 \inOneFixed
20048 \pgf@y=-\pgf@y
20049 }
20050 % support for border anchors
20051 \savedanchor\leftedge{%
20052 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20053 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20054 \pgf@x=.5\pgf@x
20055 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
20056 \pgf@y=0pt
20057 }
20058 \anchor{leftedge}{\leftedge}
20059 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
20060 \anchor{bin up}{
20061 \inOneFixed
20062 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20063 }
20064 \anchor{bin down}{
20065 \inOneFixed
20066 \pgf@y=-\pgf@y
20067 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20068 }
20069 \anchor{b-}{
20070 \inOne
20071 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20072 }
20073 \anchor{b+}{
20074 \inOne
20075 \pgf@y=-\pgf@y
20076 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20077 }
20078 \anchor{bout}{
20079 \leftedge
20080 \pgf@y=0pt
20081 \pgf@x=-\pgf@x
20082 }
20083 % end border anchors
20084 \savedanchor\up{%
20085 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20086 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20087 \pgf@y=.5\pgf@y
20088 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20089 \pgf@x=.5\pgf@x
20090 \pgf@circ@res@up = \pgf@y
20091 \pgf@circ@res@right = -\pgf@x
20092 \pgf@circ@res@left = \pgf@x
20093 \pgfpointlineattime{
20094 \ctikzvalof{tripoles/plain amp/up pos}}{
20095 \pgfpoint{
20096 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20097 {\pgf@circ@res@up}}
20098 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20099 }
20100 \anchor{up}{
20101 \up
20102 }
20103 \anchor{down}{
20104 \up
20105 \pgf@y=-\pgf@y
20106 }
20107 \anchor{out}{
20108 \northwest
20109 \pgf@y=0pt
20110 \pgf@x=-\pgf@x
20111 }
20112
20113 \anchor{text}{
20114 \ifpgf@circ@center@text
20115 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20116 \else
20117 \leftedge
20118 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
20119 \fi
20120 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20121 }
20122
20123 \pgf@circ@draw@component{
20124 \pgf@circ@setcolor
20125
20126 \northwest
20127 \pgf@circ@res@up = \pgf@y
20128 \pgf@circ@res@down = -\pgf@y
20129 \pgf@circ@res@right = -\pgf@x
20130 \pgf@circ@res@left = \pgf@x
20131
20132 \pgfscope
20133 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20134 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20135 \pgf@circ@res@step=\pgf@circ@res@right
20136 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20137 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
20138
20139 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
20140 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20141 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20142 \pgfpathclose
20143 \pgf@circ@draworfill
20144 \endpgfscope
20145 \pgfpathmoveto{\pgfpoint
20146 {\pgf@circ@res@left}
20147 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
20148 \pgfpathlineto{\pgfpoint
20149 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20150 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
20151
20152
20153 \pgfpathmoveto{\pgfpoint
20154 {\pgf@circ@res@left}
20155 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
20156 \pgfpathlineto{\pgfpoint
20157 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20158 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
20159
20160 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20161 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20162
20163 \pgfusepath{draw}
20164 }
20165 }
20166
20167 % plain amplifier, no symbols, one input
20168 \pgfdeclareshape{plain mono amp}
20169 {
20170 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
20171 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20172 \anchor{center}{\pgfpointorigin}
20173 \savedanchor\northwest{%
20174 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20175 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20176 \pgf@y=.5\pgf@y
20177 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20178 \pgf@x=.5\pgf@x
20179 }
20180 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
20181 \anchor{west}{ \northwest \pgf@y=0pt }
20182 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
20183 \anchor{north}{ \northwest \pgf@x=0pt }
20184 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20185 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20186 \anchor{north west}{ \northwest }
20187 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20188 \savedanchor\left{%
20189 \pgf@y=0pt
20190 }
20191 \savedanchor\inOne{%
20192 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20193 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20194 \pgf@x=.5\pgf@x
20195 \pgf@y=0pt\relax
20196 }
20197 \anchor{in}{
20198 \inOne
20199 }
20200 % support for border anchors
20201 \savedanchor\leftedge{%
20202 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20203 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20204 \pgf@x=.5\pgf@x
20205 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
20206 \pgf@y=0pt
20207 }
20208 \anchor{leftedge}{\leftedge}
20209 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
20210 \anchor{bin}{
20211 \inOne
20212 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20213 }
20214 \anchor{bout}{
20215 \leftedge
20216 \pgf@y=0pt
20217 \pgf@x=-\pgf@x
20218 }
20219 % end border anchors
20220 \savedanchor\up{%
20221 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20222 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20223 \pgf@y=.5\pgf@y
20224 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20225 \pgf@x=.5\pgf@x
20226 \pgf@circ@res@up = \pgf@y
20227 \pgf@circ@res@right = -\pgf@x
20228 \pgf@circ@res@left = \pgf@x
20229 \pgfpointlineattime{
20230 \ctikzvalof{tripoles/plain amp/up pos}}{
20231 \pgfpoint{
20232 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20233 {\pgf@circ@res@up}}
20234 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20235 }
20236 \anchor{up}{
20237 \up
20238 }
20239 \anchor{down}{
20240 \up
20241 \pgf@y=-\pgf@y
20242 }
20243 \anchor{out}{
20244 \northwest
20245 \pgf@y=0pt
20246 \pgf@x=-\pgf@x
20247 }
20248
20249 \anchor{text}{
20250 \ifpgf@circ@center@text
20251 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20252 \else
20253 \leftedge
20254 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
20255 \fi
20256 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20257 }
20258 \pgf@circ@draw@component{
20259 \pgf@circ@setcolor
20260
20261 \northwest
20262 \pgf@circ@res@up = \pgf@y
20263 \pgf@circ@res@down = -\pgf@y
20264 \pgf@circ@res@right = -\pgf@x
20265 \pgf@circ@res@left = \pgf@x
20266
20267 \pgfscope
20268 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20269 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20270 \pgf@circ@res@step=\pgf@circ@res@right
20271 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20272 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
20273
20274 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
20275 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20276 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20277 \pgfpathclose
20278 \pgf@circ@draworfill
20279 \endpgfscope
20280 \pgfpathmoveto{\pgfpoint
20281 {\pgf@circ@res@left}
20282 {0pt}}
20283 \pgfpathlineto{\pgfpoint
20284 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20285 {0pt}}
20286
20287 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20288 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20289
20290 \pgfusepath{draw}
20291 }
20292 }% %>>>
20293
20294 %%%%%%%%%%%%%%%%%%%%%%%%%%%
20295 %% Tubes and magnetron
20296 %%%%%%%%%%%%%%%%%%%%%%%%
20297
20298 % Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
20299 \ctikzset{tubes/width/.initial=1} % relative width
20300 \ctikzset{tubes/height/.initial=1.4} % relative height
20301 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
20302 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
20303 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
20304 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
20305 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
20306 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
20307 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
20308 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
20309 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
20310 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
20311 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
20312 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
20313 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
20314 % partial borders styles
20315 % this can be "none" or 6 numbers saying the style for each part:
20316 % 0 --- nothing, 1 --- solid, 2 --- dashed
20317 \ctikzset{tubes/partial borders/.initial=none} % Value none for normal borders
20318 \ctikzset{tubes/partial border dash/.initial={{2pt}{2pt}}}
20319
20320 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
20321
20322 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
20323 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
20324 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
20325 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
20326 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
20327 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
20328 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
20329 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
20330 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
20331 %>>>
20332
20333 %% Node shapes for tubes & co%<<<
20334
20335 %%%%%%%%%%%%%%%%%%%
20336 %% Magnetron
20337 %%%%%%%%%%%%%%%%%%%
20338
20339 \pgfdeclareshape{magnetron}
20340 {
20341 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
20342 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20343 \savedanchor\northwest{
20344 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20345 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20346 \pgf@y=.5\pgf@y
20347 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20348 \pgf@x=.5\pgf@x
20349 }
20350 \anchor{center}{
20351 \pgfpointorigin
20352 }
20353 \anchor{anode}{
20354 \northwest
20355 \pgf@x=0pt
20356 \pgf@y=-\pgf@y
20357 }
20358 \anchor{cathode1}{
20359 \northwest
20360 \pgf@circ@res@step=\pgf@y
20361 \pgfmathparse{cos(105)}
20362 \pgf@x=\pgfmathresult\pgf@circ@res@step
20363 \pgfmathparse{sin(105)}
20364 \pgf@y=\pgfmathresult\pgf@circ@res@step
20365 %\pgfpointorigin
20366 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
20367 }
20368 \anchor{cathode2}{
20369 \northwest
20370 \pgf@circ@res@step=\pgf@y
20371 \pgfmathparse{cos(75)}
20372 \pgf@x=\pgfmathresult\pgf@circ@res@step
20373 \pgfmathparse{sin(75)}
20374 \pgf@y=\pgfmathresult\pgf@circ@res@step
20375 %\pgfpointorigin
20376 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
20377 }
20378 \anchor{text}{
20379 \pgfpointorigin
20380 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
20381 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
20382 }
20383 \anchor{left}{%
20384 \northwest
20385 \pgf@y=0pt
20386 }
20387 \anchor{right}{%
20388 \northwest
20389 \pgf@y=0pt
20390 \pgf@x=-\pgf@x
20391 }
20392 \anchor{top}{
20393 \northwest
20394 \pgf@x=0pt
20395 }
20396 \anchor{pathstart}{
20397 \northwest
20398 \pgf@x=0pt
20399 }
20400 \anchor{pathend}{
20401 \northwest
20402 \pgf@x=0pt
20403 \pgf@y=-\pgf@y
20404 }
20405 \anchor{bottom}{
20406 \northwest
20407 \pgf@x=0pt
20408 \pgf@y=-\pgf@y
20409 }
20410 \anchor{center}{
20411 \pgf@y=0pt
20412 \pgf@x=0pt
20413 }
20414 \anchor{east}{
20415 \northwest
20416 \pgf@y=0pt
20417 \pgf@x=-\pgf@x
20418 }
20419 \anchor{west}{
20420 \northwest
20421 \pgf@y=0pt
20422 }
20423 \anchor{south}{
20424 \northwest
20425 \pgf@x=0pt
20426 \pgf@y=-\pgf@y
20427 }
20428 \anchor{north}{
20429 \northwest
20430 \pgf@x=0pt
20431 }
20432 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20433 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20434 \anchor{north west}{ \northwest }
20435 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20436 \pgf@circ@draw@component{
20437 \pgf@circ@setcolor
20438 \pgf@circ@scaled@Rlen=\scaledRlen
20439 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20440 \northwest
20441 \pgf@circ@res@up = \pgf@y
20442 \pgf@circ@res@down = -\pgf@y
20443 \pgf@circ@res@right = -\pgf@x
20444 \pgf@circ@res@left = \pgf@x
20445 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
20446
20447 \pgfscope
20448 \pgfstartlinewidth=\pgflinewidth
20449 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20450 %create outer circle
20451 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
20452 \pgf@circ@draworfill
20453 %create chambers
20454 \foreach \angle in {45,135,225,315}{
20455 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
20456 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
20457 }
20458 \pgfsetroundcap
20459 \pgfusepath{draw}
20460 \pgfscope
20461 %draw connection from outside
20462 %anode
20463 \pgfsetlinewidth{\pgfstartlinewidth}
20464 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
20465 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
20466 %cathodes
20467 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
20468 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20469 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
20470 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20471 \pgfsetbuttcap
20472 \pgfusepath{draw}
20473 \endpgfscope
20474 %create cathode
20475 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20476 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
20477 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20478 \pgfusepath{draw}
20479 %create anode
20480 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
20481 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
20482
20483 \pgfsetbuttcap
20484 \pgfusepath{draw}
20485 \endpgfscope
20486 }
20487 }
20488
20489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20490 % Electronic tubes, submitted by J. op den Brouw
20491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20492 %
20493 % draw partial tube outline
20494 %
20495 \def\pgf@circ@tubes@split#1#2#3#4#5#6\relax{%split the six numbers
20496 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}%
20497 }
20498 \def\pgf@circ@tubes@setdash{%
20499 \edef\@@dash{\ctikzvalof{tubes/partial border dash}}%
20500 % \typeout{DASH:\@@dash}%
20501 \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}%
20502 }
20503 % this is the same as the transistor circles' one, but let's keep it separated
20504 \def\pgf@circ@tubes@draw@style#1{%
20505 \ifcase#1
20506 \pgfusepath{discard}% case 0, will discard the path
20507 \or
20508 \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid
20509 \or
20510 \pgf@circ@tubes@setdash\pgfusepath{draw}% case 2, dashed
20511 \else
20512 \pgfutil@packagewarning{circuitikz}{Tube border draw style not known!}%
20513 \pgfusepath{draw}%
20514 \fi
20515 }
20516 \def\pgf@circ@tubes@draw@partial#1{%
20517 \expandafter\pgf@circ@tubes@split#1\relax
20518 % \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d:\@@e:\@@f}
20519 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20520 % horizontal tube
20521 \pgfutil@tempdima=\pgf@circ@res@right
20522 \advance\pgfutil@tempdima by -\pgf@circ@res@up
20523 \pgfscope % left side upper arc
20524 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
20525 \pgfpatharc{180}{90}{\pgf@circ@res@up}
20526 \pgf@circ@tubes@draw@style{\@@a}
20527 \endpgfscope
20528 \pgfscope % upper horizontal part
20529 \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{\pgf@circ@res@up}}
20530 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20531 \pgf@circ@tubes@draw@style{\@@b}
20532 \endpgfscope
20533 \pgfscope % right side upper arc
20534 \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20535 \pgfpatharc{90}{0}{\pgf@circ@res@up}
20536 \pgf@circ@tubes@draw@style{\@@c}
20537 \endpgfscope
20538 \pgfscope % right side lower arc
20539 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20540 \pgfpatharc{0}{-90}{\pgf@circ@res@up}
20541 \pgf@circ@tubes@draw@style{\@@d}
20542 \endpgfscope
20543 \pgfscope % lower horizontal part
20544 \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{-\pgf@circ@res@up}}
20545 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20546 \pgf@circ@tubes@draw@style{\@@e}
20547 \endpgfscope
20548 \pgfscope % left side lower arc
20549 \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20550 \pgfpatharc{270}{180}{\pgf@circ@res@up}
20551 \pgf@circ@tubes@draw@style{\@@f}
20552 \endpgfscope
20553 \else
20554 % vertical tube
20555 \pgfutil@tempdima=\pgf@circ@res@up
20556 \advance\pgfutil@tempdima by -\pgf@circ@res@right
20557 \pgfscope % left side upper arc
20558 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20559 \pgfpatharc{90}{0}{\pgf@circ@res@right}
20560 \pgf@circ@tubes@draw@style{\@@a}
20561 \endpgfscope
20562 \pgfscope % right vertical part
20563 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfutil@tempdima}}
20564 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20565 \pgf@circ@tubes@draw@style{\@@b}
20566 \endpgfscope
20567 \pgfscope % right side lower arc
20568 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20569 \pgfpatharc{0}{-90}{\pgf@circ@res@right}
20570 \pgf@circ@tubes@draw@style{\@@c}
20571 \endpgfscope
20572 \pgfscope % right side lower arc
20573 \pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
20574 \pgfpatharc{-90}{-180}{\pgf@circ@res@right}
20575 \pgf@circ@tubes@draw@style{\@@d}
20576 \endpgfscope
20577 \pgfscope % left vertical part
20578 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgfutil@tempdima}}
20579 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20580 \pgf@circ@tubes@draw@style{\@@e}
20581 \endpgfscope
20582 \pgfscope % left side upper arc
20583 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20584 \pgfpatharc{180}{90}{\pgf@circ@res@right}
20585 \pgf@circ@tubes@draw@style{\@@f}
20586 \endpgfscope
20587 \fi
20588 }
20589 % Draw tube outline
20590 \def\pgf@circ@tubes@drawtube{%
20591 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20592 % horizontal tube
20593 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20594 \pgfutil@tempdima=\pgf@circ@res@right
20595 \advance\pgfutil@tempdima by -\pgf@circ@res@up
20596 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20597 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
20598 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20599 \pgfpatharc{270}{90}{\pgf@circ@res@up}
20600 \else
20601 % vertical tube
20602 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
20603 \pgfutil@tempdima=\pgf@circ@res@up
20604 \advance\pgfutil@tempdima by -\pgf@circ@res@right
20605 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20606 \pgfpatharc{180}{0}{\pgf@circ@res@right}
20607 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20608 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
20609 \fi
20610 \pgfpathclose
20611 \edef\@@partial{\ctikzvalof{tubes/partial borders}}
20612 \ifx\@@partial\pgf@nonetext
20613 % Tube fill and draw if it's not partial... for speed
20614 \pgf@circ@draworfill
20615 \else
20616 % otherwise, just fill and do the partial fill
20617 \pgf@circ@maybefill
20618 \pgf@circ@tubes@draw@partial{\@@partial}
20619 %
20620 \fi
20621 }
20622
20623 \long\def\pgfcirctubedrawanodestd{% Standard anode code (one anode)
20624 % Anode (or plate)
20625 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
20626 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20627 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20628 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20629 }
20630 \long\def\pgfcirctubedrawcathodestd{% Standard cathode code (one cathode)
20631 % Cathode
20632 \ifpgf@circuit@tubes@nocathode
20633 \pgf@circuit@tubes@nocathodefalse
20634 \else
20635 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
20636 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
20637 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
20638 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
20639 \ifpgf@circuit@tubes@fullcathode
20640 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
20641 \pgf@circuit@tubes@fullcathodefalse
20642 \else
20643 \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}}
20644 \fi
20645 \fi
20646 }
20647
20648 %% generic macro to create a tube. Most of them will use the standard macro for
20649 %% anode and cathode (see above)
20650 \long\def\pgfcircdeclaretubegeneric#1#2#3#4#5#6{% name, anchors, grid, anode, cathode variable anchors
20651 \pgfdeclareshape{#1}{
20652 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
20653 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20654 \savedanchor\northwest{%
20655 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20656 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20657 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20658 % x and y should be half the Rlen
20659 \pgf@y=\pgf@circ@res@up
20660 \pgf@y=.5\pgf@y
20661 \pgf@x=-\pgf@circ@res@right
20662 \pgf@x=.5\pgf@x
20663 }
20664 \savedanchor\tubene{%
20665 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20666 \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20667 \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20668 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp
20669 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other
20670 \pgf@y=\pgf@circ@res@up
20671 \pgf@x=\pgf@circ@res@right
20672 }
20673 \savedanchor\tubesquarene{%
20674 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20675 \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20676 \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20677 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp
20678 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other
20679 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20680 % horizontal
20681 \pgf@y=\pgf@circ@res@up
20682 \pgf@x=\pgf@circ@res@right\advance\pgf@x by -\pgf@circ@res@up
20683 \else
20684 % vertical
20685 \pgf@x=\pgf@circ@res@right
20686 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -\pgf@circ@res@right
20687 \fi
20688 }
20689 \savedmacro{\tubes@filament@angle}{\edef\tubes@filament@angle{\ctikzvalof{tubes/filament angle}}}
20690 \savedmacro{\tubes@filament@distance}{\edef\tubes@filament@distance{\ctikzvalof{tubes/filament distance}}}
20691 \savedmacro{\tubes@tube@radius}{\edef\tubes@tube@radius{\ctikzvalof{tubes/tube radius}}}
20692 \savedmacro{\tubes@cathode@width}{\edef\tubes@cathode@width{\ctikzvalof{tubes/cathode width}}}
20693 \savedmacro{\tubes@cathode@distance}{\edef\tubes@cathode@distance{\ctikzvalof{tubes/cathode distance}}}
20694 \anchor{tube ne}{\tubene}
20695 \anchor{tubesq ne}{\tubesquarene}
20696 % tube shape anchors: geo
20697 \anchor{tube top}{\tubene\pgf@x=0pt\relax}
20698 \anchor{tube bottom}{\tubene\pgf@x=0pt\pgf@y=-\pgf@y}
20699 \anchor{tube right}{\tubene\pgf@y=0pt\relax}
20700 \anchor{tube left}{\tubene\pgf@y=0pt\pgf@x=-\pgf@x}
20701 % tube shape straight part anchors
20702 \anchor{tube top right}{\tubesquarene}
20703 \anchor{tube bottom right}{\tubesquarene\pgf@y=-\pgf@y}
20704 \anchor{tube top left}{\tubesquarene\pgf@x=-\pgf@x}
20705 \anchor{tube bottom left}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
20706 % tube shape centers
20707 \anchor{tube top center}{\tubesquarene\pgf@x=0pt\relax}
20708 \anchor{tube bottom center}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=0pt\relax}
20709 \anchor{tube right center}{\tubesquarene\pgf@y=0pt\relax}
20710 \anchor{tube left center}{\tubesquarene\pgf@x=-\pgf@x\pgf@y=0pt\relax}
20711 % rest of anchors
20712 \anchor{center}{\pgfpointorigin}
20713 % geo anchors based on north-west
20714 \pgfcirc@northwest@symmetric@geoanchors
20715 % text anchor
20716 \anchor{text}{%
20717 \northwest\pgf@x=-\pgf@x
20718 \pgf@y=-.5\ht\pgfnodeparttextbox
20719 }
20720 % specific anchors
20721 \anchor{anode} {%
20722 \northwest
20723 \pgf@x=0pt
20724 }
20725 \anchor{cathode}{%
20726 \northwest
20727 \pgf@y=-\pgf@y
20728 \pgf@x=\tubes@cathode@width\pgf@x
20729 }
20730 \anchor{cathode 1}{%
20731 \northwest
20732 \pgf@y=-\pgf@y
20733 \pgf@x=\tubes@cathode@width\pgf@x
20734 }
20735 \anchor{cathode 2}{%
20736 \northwest
20737 \pgf@y=-\pgf@y
20738 \pgf@x=-\tubes@cathode@width\pgf@x
20739 }
20740 \anchor{filament 1}{%
20741 \northwest
20742 \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)}
20743 \pgf@x=\pgfmathresult\pgf@x
20744 \pgf@y=-\pgf@y
20745 }
20746 \anchor{filament 2}{%
20747 \northwest
20748 \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)}
20749 \pgf@x=-\pgfmathresult\pgf@x
20750 \pgf@y=-\pgf@y
20751 }
20752 \anchor{filament center}{%
20753 \northwest
20754 \pgf@ya=0.5\pgf@y
20755 \pgf@ya=-\tubes@cathode@distance\pgf@y
20756 \advance\pgf@ya by -\tubes@filament@distance\pgf@y
20757 \pgf@x=0pt\pgf@y=\pgf@ya
20758 }
20759
20760 % Extra anchors
20761 #2%
20762
20763 \pgf@circ@draw@component{
20764 % Line width for tripoles
20765 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20766 \pgf@circ@scaled@Rlen=\scaledRlen
20767
20768 % Setup to draw tube
20769 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20770 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20771 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
20772 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
20773
20774 % Tube outline
20775 \pgf@circ@tubes@drawtube
20776
20777 % Setup to draw grid, filament, anode and cathode
20778 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20779 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20780 \pgf@circ@res@up=0.5\pgf@circ@res@up
20781 \pgf@circ@res@right=0.5\pgf@circ@res@right
20782
20783 % Grid drawing
20784 #3%
20785
20786 % Filament (is not drawn by default)
20787 \ifpgf@circuit@tubes@filament
20788 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
20789 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
20790 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
20791 \pgf@xa=\pgfmathresult\pgf@circ@res@right
20792 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
20793 \pgf@ya=\pgfmathresult\pgf@circ@res@up
20794 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
20795 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
20796 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
20797 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
20798 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
20799 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
20800 \pgf@circuit@tubes@filamentfalse
20801 \fi
20802
20803 % Anode (or plate)
20804 #4
20805 % Cathode
20806 #5
20807 % Draw the background
20808 \pgfusepath{draw}
20809 }
20810 #6
20811 }
20812 }
20813
20814 %% The diode (tube), triode, tetrode and pentode only differ in the
20815 %% number of grids. So we construct a generic declare function in
20816 %% which we can put code for the grid anchors and grid drawing code
20817 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
20818 \long\def\pgfcircdeclaretube#1#2#3{% name, anchors, grid
20819 \pgfcircdeclaretubegeneric{#1}{#2}{#3}{\pgfcirctubedrawanodestd}{\pgfcirctubedrawcathodestd}{}
20820 }
20821
20822 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
20823
20824 \pgfcircdeclaretube{triode}
20825 {
20826 \anchor{grid} {% should not be used
20827 \northwest
20828 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
20829 }
20830 \anchor{control} {%
20831 \northwest
20832 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
20833 }
20834 }
20835 {
20836 % Grid protrusion
20837 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
20838 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
20839 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
20840 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
20841 % Grid dashes: calculations
20842 \pgf@xb=2\pgf@circ@res@right
20843 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
20844 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
20845 \multiply\pgf@circ@count@a by 2\relax
20846 \advance\pgf@circ@count@a by 1\relax
20847 \advance\pgf@circ@res@step by -\pgf@xa
20848 \divide\pgf@circ@res@step by \pgf@circ@count@a
20849 % Grid dashes: draw
20850 \pgf@circ@res@temp=\pgf@xa
20851 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
20852 \loop
20853 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
20855 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20856 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
20857 \advance\pgf@circ@count@a by-1
20858 \ifnum\pgf@circ@count@a>0\relax
20859 \repeat
20860 }
20861
20862 \pgfcircdeclaretube{tetrode}
20863 {
20864 \anchor{grid} {% should not be used
20865 \northwest
20866 \pgfutil@tempdima=\pgf@y
20867 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
20868 \pgf@y=0.5\pgf@y
20869 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20870 }
20871 \anchor{control} {%
20872 \northwest
20873 \pgfutil@tempdima=\pgf@y
20874 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
20875 \pgf@y=0.5\pgf@y
20876 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20877 }
20878 \anchor{screen} {%
20879 \northwest
20880 \pgfutil@tempdima=\pgf@y
20881 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
20882 \pgf@y=0.5\pgf@y
20883 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20884 }
20885 }
20886 {
20887 % Grid x/y points
20888 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
20889 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
20890 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
20891 \pgfutil@tempdimb=-\pgfutil@tempdima
20892 \pgfutil@tempdima=0.5\pgfutil@tempdima
20893 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
20894 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
20895 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
20896 % Grid protrusion
20897 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
20898 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
20899 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20900 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
20901 % Grid dashes: calculations
20902 \pgf@xb=2\pgf@circ@res@right
20903 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
20904 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
20905 \multiply\pgf@circ@count@a by 2\relax
20906 \advance\pgf@circ@count@a by 1\relax
20907 \advance\pgf@circ@res@step by -\pgf@xa
20908 \divide\pgf@circ@res@step by \pgf@circ@count@a
20909 % Grid dashes: draw
20910 \pgf@circ@res@temp=\pgf@xa
20911 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
20912 \loop
20913 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20914 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
20915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
20916 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
20917 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
20918 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20919 \advance\pgf@circ@count@a by-1
20920 \ifnum\pgf@circ@count@a>0\relax
20921 \repeat
20922 }
20923
20924 \pgfcircdeclaretube{pentode}
20925 {
20926 \anchor{grid} {% should not be used
20927 \northwest
20928 \pgfutil@tempdima=\pgf@y
20929 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
20930 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20931 }
20932 \anchor{control} {%
20933 \northwest
20934 \pgfutil@tempdima=\pgf@y
20935 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
20936 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20937 }
20938 \anchor{screen} {%
20939 \northwest
20940 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
20941 }
20942 \anchor{suppressor} {%
20943 \northwest
20944 \pgfutil@tempdima=\pgf@y
20945 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
20946 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20947 }
20948 }
20949 {
20950 % Grid x/y points
20951 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
20952 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
20953 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
20954 \pgfutil@tempdimb=-\pgfutil@tempdima
20955 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
20956 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
20957 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
20958 % Grid protrusion
20959 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
20960 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
20961 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20962 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
20963 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
20964 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
20965 % Grid dashes: calculations
20966 \pgf@xb=2\pgf@circ@res@right
20967 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
20968 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
20969 \multiply\pgf@circ@count@a by 2\relax
20970 \advance\pgf@circ@count@a by 1\relax
20971 \advance\pgf@circ@res@step by -\pgf@xa
20972 \divide\pgf@circ@res@step by \pgf@circ@count@a
20973 % Grid dashes: draw
20974 \pgf@circ@res@temp=\pgf@xa
20975 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
20976 \loop
20977 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
20979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
20980 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
20981 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
20982 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
20983 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
20984 \advance\pgf@circ@res@temp by\pgf@circ@res@step
20985 \advance\pgf@circ@count@a by-1
20986 \ifnum\pgf@circ@count@a>0\relax
20987 \repeat
20988 }
20989
20990 \pgfcircdeclaretube{pentode suppressor to cathode}
20991 {
20992 \anchor{grid} {% should not be used
20993 \northwest
20994 \pgfutil@tempdima=\pgf@y
20995 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
20996 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
20997 }
20998 \anchor{control} {%
20999 \northwest
21000 \pgfutil@tempdima=\pgf@y
21001 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21002 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21003 }
21004 \anchor{screen} {%
21005 \northwest
21006 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21007 }
21008 }
21009 {
21010 % Grid x/y points
21011 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21012 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21013 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
21014 \pgfutil@tempdimb=-\pgfutil@tempdima
21015 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21016 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21017 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21018 % Grid protrusion
21019 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
21020 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
21021 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
21022 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
21023 % Grid dashes: calculations
21024 \pgf@xb=2\pgf@circ@res@right
21025 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21026 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21027 \multiply\pgf@circ@count@a by 2\relax
21028 \advance\pgf@circ@count@a by 1\relax
21029 \advance\pgf@circ@res@step by -\pgf@xa
21030 \divide\pgf@circ@res@step by \pgf@circ@count@a
21031 % Grid dashes: draw
21032 \pgf@circ@res@temp=\pgf@xa
21033 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21034 \loop
21035 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21036 \ifnum\pgf@circ@count@a>1\relax
21037 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
21038 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
21039 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
21040 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
21041 \fi
21042 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
21043 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
21044 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21045 \advance\pgf@circ@count@a by-1
21046 \ifnum\pgf@circ@count@a>0\relax
21047 \repeat
21048 % Grid: connection from suppressor to cathode
21049 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
21050 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
21051 \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}}
21052
21053 }%
21054 %
21055 % multi-anode tube, added by Romano for version 1.6.8, suggested by @bogger33 on GitHub
21056 % see https://github.com/circuitikz/circuitikz/issues/785
21057 %
21058 \ctikzset{tubes/anodes/.initial=3} % number of anodes. Ignored in most tubes.
21059 \newif\ifpgf@circuit@tubes@anodedot\pgf@circuit@tubes@anodedotfalse
21060 \pgfkeys{/tikz/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}}
21061 \ctikzset{tubes/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}}
21062 \newif\ifpgf@circuit@tubes@nogrid\pgf@circuit@tubes@nogridfalse
21063 \pgfkeys{/tikz/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}}
21064 \ctikzset{tubes/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}}
21065 \newif\ifpgf@circuit@tubes@nixieanode\pgf@circuit@tubes@nixieanodefalse
21066 \pgfkeys{/tikz/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}}
21067 \ctikzset{tubes/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}}
21068 \long\def\pgfcirctubedraw@multi@anode{% Separate to override in matubes
21069 % Anodes (or plates)
21070 % Use saved len/anchors to find the first drawn position.
21071 \pgf@circ@res@temp=\anodelen\divide\pgf@circ@res@temp by 2 % half the anode length
21072 \firstanodepos\pgf@circ@res@other=\pgf@x
21073 \advance\pgf@circ@res@other by \pgf@circ@res@temp
21074 \pgf@circ@count@a=0
21075 \loop
21076 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} % north
21077 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21078 \ifpgf@circuit@tubes@anodedot
21079 \pgfpathcircle{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@[email protected]*\circlelen}}{\circlelen}
21080 \else
21081 % this is the horizontal line of the anode
21082 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21083 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21084 \fi
21085 \advance\pgf@circ@res@other by 4\pgf@circ@res@temp
21086 \advance\pgf@circ@count@a by 1
21087 \ifnum\pgf@circ@count@a<\Nanodes\relax
21088 \repeat
21089 }
21090 \long\def\pgfcirctubedraw@cathode@or@nixie{%
21091 \ifpgf@circuit@tubes@nixieanode
21092 \pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
21093 \pgfpathlineto{\pgfpoint{0pt}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21094 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21095 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21096 \else
21097 \pgfcirctubedrawcathodestd
21098 \fi
21099 }
21100 \pgfcircdeclaretubegeneric{matube}
21101 {% anchors
21102 \savedmacro{\Nanodes}{\edef\Nanodes{\ctikzvalof{tubes/anodes}}}
21103 \savedanchor\firstanodepos{%
21104 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21105 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
21106 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
21107 \pgf@circ@res@right=\ctikzvalof{tubes/anode width}\pgf@circ@res@right
21108 % x and y are one half
21109 \pgf@y=\pgf@circ@res@up
21110 \pgf@y=.5\pgf@y
21111 \pgf@x=-\pgf@circ@res@right
21112 \pgf@x=.5\pgf@x
21113 }
21114 \saveddimen\anodelen{%
21115 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21116 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen % full width, left to right
21117 % the length of one of the N anodes is the full width divided by 2*N+1
21118 \pgfmathsetlength\pgf@x{\ctikzvalof{tubes/anode width}*\pgf@circ@res@right/(2*\Nanodes-1)}
21119 }
21120 \saveddimen\circlelen{%
21121 \pgf@x=\ctikzvalof{nodes width}\pgf@circ@Rlen
21122 }
21123 \anchor{grid} {% should not be used
21124 \northwest
21125 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21126 }
21127 \anchor{control} {%
21128 \northwest
21129 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21130 }
21131 \anchor{nixie a}{%
21132 \northwest\pgf@x=0pt\pgf@y=-\pgf@y
21133 }
21134 }
21135 {% grid
21136 \ifpgf@circuit@tubes@nogrid\else
21137 % Grid protrusion
21138 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21139 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21140 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21141 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21142 % Grid dashes: calculations
21143 \pgf@xb=2\pgf@circ@res@right
21144 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21145 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21146 \multiply\pgf@circ@count@a by 2\relax
21147 \advance\pgf@circ@count@a by 1\relax
21148 \advance\pgf@circ@res@step by -\pgf@xa
21149 \divide\pgf@circ@res@step by \pgf@circ@count@a
21150 % Grid dashes: draw
21151 \pgf@circ@res@temp=\pgf@xa
21152 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21153 \loop
21154 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21155 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21156 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21158 \advance\pgf@circ@count@a by-1
21159 \ifnum\pgf@circ@count@a>0\relax
21160 \repeat
21161 \fi
21162 }
21163 {\pgfcirctubedraw@multi@anode}% anodes
21164 {\pgfcirctubedraw@cathode@or@nixie}% cathode
21165 {% extra dynamics anchors
21166 \pgfutil@g@addto@macro\pgf@sh@s@matube{%
21167 % Start with the maximum pin number and go backwards.
21168 \pgf@circ@count@a=\Nanodes\relax
21169 \pgfmathloop%
21170 \ifnum\pgf@circ@count@a>0
21171 \expandafter\xdef\csname pgf@anchor@matube@anode\space\the\pgf@circ@count@a\endcsname{%
21172 \noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}%
21173 }
21174 \expandafter\xdef\csname pgf@anchor@matube@nixie\space k\the\pgf@circ@count@a\endcsname{%
21175 \noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}%
21176 }
21177 \advance\pgf@circ@count@a by -1\relax%
21178 \repeatpgfmathloop%
21179 }%
21180 }
21181 \def\pgf@circ@ma@anode@anchor#1{
21182 \firstanodepos
21183 \pgf@circ@res@temp=\pgf@x
21184 \pgfmathsetlength\pgf@x{\pgf@circ@res@temp + (0.5 + 2*(#1 -1))*\anodelen}
21185 }
21186
21187
21188
21189 %>>>
21190
21191 % vim: set fdm=marker fmr=%<<<,%>>>:
21192 %%%---------- close: tex/pgfcirctripoles
21193 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
21194 %%%---------- open: tex/pgfcircquadpoles.tex
21195 % Copyright 2018-2026 by Romano Giannetti
21196 % Copyright 2015-2026 by Stefan Lindner
21197 % Copyright 2013-2026 by Stefan Erhardt
21198 % Copyright 2007-2026 by Massimo Redaelli
21199 %
21200 % This file may be distributed and/or modified
21201 %
21202 % 1. under the LaTeX Project Public License and/or
21203 % 2. under the GNU Public License.
21204 %
21205 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21206
21207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21208 %% Quadripoles
21209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21210
21211
21212 % Setting for Transformers and similar quadpoles%<<<1
21213
21214 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
21215 \ctikzset{quadpoles/transformer/width/.initial=1.5}
21216 \ctikzset{quadpoles/transformer/width1/.initial=.4}
21217 \ctikzset{quadpoles/transformer/height/.initial=1.5}
21218 \ctikzset{quadpoles/transformer/height1/.initial=.8}
21219 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
21220 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
21221 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
21222 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
21223 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
21224 \ctikzset{transformer core/relative thickness/.initial=1}
21225 \ctikzset{transformer core/color/.initial=default}
21226 \ctikzset{transformer core/dash/.initial=default}
21227 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
21228 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
21229 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
21230 \ctikzset{quadpoles/fourport/width/.initial=1.3}
21231 \ctikzset{quadpoles/fourport/height/.initial=1.3}
21232 \ctikzset{quadpoles/coupler/width/.initial=1.3}
21233 \ctikzset{quadpoles/coupler/height/.initial=1.3}
21234 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
21235 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
21236 \ctikzset{quadpoles/double bipole/inner/.initial=0.4}
21237 \ctikzset{quadpoles/double bipole/width/.initial=1.5}
21238 \ctikzset{quadpoles/double bipole/width1/.initial=.4}
21239 \ctikzset{quadpoles/double bipole/height/.initial=1.5}
21240 \ctikzset{quadpoles/double bipole/height1/.initial=.8}
21241
21242 \ctikzset{quadpoles style/.is choice}
21243 \ctikzset{quadpoles style/inward/.code={% default value
21244 \ctikzset{quadpoles/transformer/inner=0.4}%
21245 \ctikzset{quadpoles/transformer/width=1.5}%
21246 \ctikzset{quadpoles/transformer core/inner=0.4}%
21247 \ctikzset{quadpoles/transformer core/width=1.5}%
21248 \ctikzset{quadpoles/gyrator/inner=0.4}%
21249 \ctikzset{quadpoles/gyrator/width=1.5}%
21250 \ctikzset{quadpoles/double bipole/inner=0.4}%
21251 \ctikzset{quadpoles/double bipole/width=1.5}%
21252 }%
21253 }
21254 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
21255 \ctikzset{quadpoles/transformer/inner=1}%
21256 \ctikzset{quadpoles/transformer/width=0.6}%
21257 \ctikzset{quadpoles/transformer core/inner=1}%
21258 \ctikzset{quadpoles/transformer core/width=0.6}%
21259 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
21260 \ctikzset{quadpoles/gyrator/width=0.6}%
21261 \ctikzset{quadpoles/double bipole/inner=1}%
21262 \ctikzset{quadpoles/double bipole/width=0.6}%
21263 }%
21264 }
21265 %%>>>
21266
21267 %% Node shapes for quadpoles (basically transformers)%<<<
21268
21269 \long\def\pgfcircdeclarequadpole#1#2#3{
21270 \pgfdeclareshape{#1}
21271 {
21272 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
21273 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21274 % shapename
21275 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21276 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
21277 \savedanchor\northwest{%
21278 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21279 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
21280 \pgf@y=.5\pgf@y
21281 \pgf@x=.5\pgf@circ@scaled@Rlen
21282 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
21283 }
21284 %% we define the upper right (positive coord) inner and outer dots (on the side of B1)
21285 \savedanchor{\innerdot}{%
21286 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21287 \pgf@xa=.5\pgf@circ@scaled@Rlen
21288 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21289 % by default use the cute inductor size
21290 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
21291 % check if it's american
21292 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
21293 \edef\pgf@temp{american}
21294 \ifx\pgf@circ@temp\pgf@temp
21295 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
21296 \fi
21297 % check if it's european
21298 \edef\pgf@temp{european}
21299 \ifx\pgf@circ@temp\pgf@temp
21300 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
21301 \fi
21302 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21303 }
21304 \savedanchor{\outerdot}{%
21305 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21306 \pgf@xa=.5\pgf@circ@scaled@Rlen
21307 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21308 % by default use the cute inductor size
21309 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
21310 % check if it's american
21311 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
21312 \edef\pgf@temp{american}
21313 \ifx\pgf@circ@temp\pgf@temp
21314 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
21315 \fi
21316 % check if it's european
21317 \edef\pgf@temp{european}
21318 \ifx\pgf@circ@temp\pgf@temp
21319 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
21320 \fi
21321 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21322 }
21323 % geographical
21324 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
21325 \pgfcirc@northwest@symmetric@geoanchors
21326 \anchor{base}{\northwest\pgf@x=0pt}
21327 % external wires
21328 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
21329 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
21330 \anchor{A1}{\northwest}
21331 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
21332 %% dot's anchors
21333 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
21334 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
21335 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21336 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21337 \anchor{inner dot B1}{\innerdot}
21338 \anchor{outer dot B1}{\outerdot}
21339 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
21340 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
21341 % text above
21342 \anchor{text}{
21343 \northwest
21344 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
21345 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
21346 }
21347 #3%
21348 \pgf@circ@draw@component{
21349 \pgf@circ@setcolor
21350
21351 \northwest
21352 \pgf@circ@res@up = \pgf@y
21353 \pgf@circ@res@down = -\pgf@y
21354 \pgf@circ@res@right = -\pgf@x
21355 \pgf@circ@res@left = \pgf@x
21356 #2%
21357 }
21358 }
21359 }
21360
21361
21362 % these are deprecated anchors (really I do not know what they are --- Romano.)
21363 % They are here for compatibility, I suppose. Don't use.
21364 \def\pgf@circ@drawtransformerbasicanchor{
21365 % \ctikzvalof{quadpoles/trans/height}
21366 \anchor{AA2}{
21367 \northwest
21368 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21369 \pgf@x=.7\pgf@x
21370 \pgf@y=-\pgf@y
21371 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21372 }
21373 \anchor{BB1}{
21374 \northwest
21375 \pgf@x=-\pgf@x
21376 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21377 \pgf@x=.7\pgf@x
21378 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21379 }
21380 \anchor{AA1}{
21381 \northwest
21382 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21383 \pgf@x=.7\pgf@x
21384 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21385 }
21386 \anchor{BB2}{
21387 \northwest
21388 \pgf@x=-\pgf@x
21389 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21390 \pgf@x=.7\pgf@x
21391 \pgf@y=-\pgf@y
21392 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21393 }
21394 }
21395
21396 %% Null styles that can be used to change individually the L1 and L2
21397 %% inductors of the transformer.
21398
21399 \ctikzset{transformer L1/.style={}}
21400 \ctikzset{transformer L2/.style={}}
21401
21402 \def\pgf@circ@drawtransformerbasicbody{
21403 \pgfscope
21404 \pgfslopedattimetrue
21405 \pgfallowupsidedownattimetrue
21406 \pgftransformlineattime{.5}{%
21407 \pgfpoint%
21408 {\stretto\pgf@circ@res@left}%
21409 {\pgf@circ@res@up}%
21410 }{%
21411 \pgfpoint
21412 {\stretto\pgf@circ@res@left}%
21413 {\pgf@circ@res@down}%
21414 }
21415
21416 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
21417 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21418 \def\pgf@temp{european}%
21419 \ifx\pgf@temp\pgf@circ@temp%
21420 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21421 \else%
21422 \def\pgf@temp{cute}
21423 \ifx\pgf@temp\pgf@circ@temp%
21424 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21425 \else%
21426 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21427 \fi%
21428 \fi%
21429
21430
21431 \endpgfscope
21432 \pgfscope
21433 \pgfslopedattimetrue
21434 \pgfallowupsidedownattimetrue
21435 \pgftransformlineattime{.5}{%
21436 \pgfpoint%
21437 {\stretto\pgf@circ@res@right}%
21438 {\pgf@circ@res@down}%
21439 }{%
21440 \pgfpoint
21441 {\stretto\pgf@circ@res@right}%
21442 {\pgf@circ@res@up}%
21443 }
21444
21445 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
21446 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21447 \def\pgf@temp{european}%
21448 \ifx\pgf@temp\pgf@circ@temp%
21449 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21450 \else%
21451 \def\pgf@temp{cute}
21452 \ifx\pgf@temp\pgf@circ@temp%
21453 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21454 \else%
21455 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21456 \fi%
21457 \fi%
21458
21459 \endpgfscope
21460
21461 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21462 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21463 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
21464
21465 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
21466 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21467 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21468
21469 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21470 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21471 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
21472
21473 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
21474 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21475 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21476
21477 \pgfusepath{draw}
21478
21479 }
21480
21481
21482 \pgfcircdeclarequadpole{transformer}{
21483 \pgf@circ@drawtransformerbasicbody
21484 }{\pgf@circ@drawtransformerbasicanchor}
21485
21486 \pgfcircdeclarequadpole{transformer core}{
21487
21488 \pgf@circ@drawtransformerbasicbody
21489
21490 % use the chocke line thickness
21491 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}*\ctikzvalof{transformer core/relative thickness}*\pgflinewidth}
21492 \pgf@circ@subset@color@dash{transformer core}
21493
21494 % Find the distance from center for the lines representing the core
21495 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
21496 % of the whole component, now as a fraction of the distance between coils, to be
21497 % compatible with the quadpoles "inner" style.
21498 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
21499
21500 \pgfpathmoveto{\pgfpoint%
21501 {\pgf@circ@res@other}%
21502 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
21503 }
21504 \pgfpathlineto{
21505 \pgfpoint%
21506 {\pgf@circ@res@other}%
21507 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
21508 }
21509
21510 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
21511 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
21512 \pgfpathmoveto{\pgfpoint%
21513 {\pgf@circ@res@other}%
21514 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
21515 }
21516 \pgfpathlineto{
21517 \pgfpoint%
21518 {\pgf@circ@res@other}%
21519 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
21520 }
21521
21522 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
21523 \pgfusepath{draw}
21524 }{\pgf@circ@drawtransformerbasicanchor}
21525
21526
21527 \pgfcircdeclarequadpole{gyrator}{
21528
21529 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21530 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21531 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21533
21534 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21535 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21536 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21537 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21538
21539 \pgfusepath{draw}
21540
21541 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
21542 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
21543 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
21544 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
21545 \pgfpathclose
21546 \pgf@circ@draworfill
21547
21548 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
21549 \pgfpatharc{90}{270}{\pgf@circ@res@other}
21550 \pgfpathclose
21551 \pgf@circ@draworfill
21552 }{}
21553 % %>>>
21554
21555 % Node shapes for generic double bipoles %<<<
21556 %
21557 \long\def\pgfcircdeclaredbipole#1#2#3{
21558 \pgfdeclareshape{#1}
21559 {
21560 \savedmacro{\ctikzclass}{\edef\ctikzclass{misc}}
21561 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21562 % shapename
21563 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21564 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
21565 \savedanchor\northwest{%
21566 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21567 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
21568 \pgf@y=.5\pgf@y
21569 \pgf@x=.5\pgf@circ@scaled@Rlen
21570 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
21571 }
21572 %% we define the upper right (positive coord) inner and outer dot (near B1)
21573 %% in the generic case, we just place the dot position in a fixed spot
21574 %% we do not know the width of the component there...
21575 \savedanchor{\innerdot}{%
21576 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21577 \pgf@xa=.5\pgf@circ@scaled@Rlen
21578 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21579 \pgfmathsetlength\pgf@x{-0.5*\stretto*\pgf@xa}
21580 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21581 }
21582 \savedanchor{\outerdot}{%
21583 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21584 \pgf@xa=.5\pgf@circ@scaled@Rlen
21585 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21586 \pgfmathsetlength\pgf@x{-1.5*\stretto*\pgf@xa}
21587 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21588 }
21589 % geographical
21590 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
21591 \pgfcirc@northwest@symmetric@geoanchors
21592 \anchor{base}{\northwest\pgf@x=0pt}
21593 % external wires
21594 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
21595 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
21596 \anchor{A1}{\northwest}
21597 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
21598 %% dot's anchors
21599 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
21600 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
21601 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21602 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21603 \anchor{inner dot B1}{\innerdot}
21604 \anchor{outer dot B1}{\outerdot}
21605 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
21606 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
21607 % text above
21608 \anchor{text}{
21609 \northwest
21610 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
21611 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
21612 }
21613 #3%
21614 \pgf@circ@draw@component{
21615 \pgf@circ@setcolor
21616 \northwest
21617 \pgf@circ@res@up = \pgf@y
21618 \pgf@circ@res@down = -\pgf@y
21619 \pgf@circ@res@right = -\pgf@x
21620 \pgf@circ@res@left = \pgf@x
21621 #2%
21622 }
21623 }
21624 }
21625
21626 \ctikzset{every double bipole L/.style={}}
21627 \ctikzset{every double bipole R/.style={}}
21628 \ctikzset{double bipole L/.initial=genericshape}
21629 \ctikzset{double bipole R/.initial=vsourceAMshape}
21630 \newif\ifpgf@circ@dbipoleL@invert\pgf@circ@dbipoleL@invertfalse
21631 \newif\ifpgf@circ@dbipoleR@invert\pgf@circ@dbipoleR@invertfalse
21632 \ctikzset{double bipole L invert/.is if=pgf@circ@dbipoleL@invert}
21633 \ctikzset{double bipole R invert/.is if=pgf@circ@dbipoleR@invert}
21634
21635 \def\pgf@circ@drawdbipolebasicbody{
21636 \pgfscope
21637 \ifpgf@circ@dbipoleL@invert
21638 \pgf@circ@res@temp=\pgf@circ@res@down
21639 \pgf@circ@res@other=\pgf@circ@res@up
21640 \else
21641 \pgf@circ@res@temp=\pgf@circ@res@up
21642 \pgf@circ@res@other=\pgf@circ@res@down
21643 \fi
21644 \pgfslopedattimetrue
21645 \pgfallowupsidedownattimetrue
21646 \pgftransformlineattime{.5}{%
21647 \pgfpoint%
21648 {\stretto\pgf@circ@res@left}%
21649 {\pgf@circ@res@temp}%
21650 }{%
21651 \pgfpoint
21652 {\stretto\pgf@circ@res@left}%
21653 {\pgf@circ@res@other}%
21654 }
21655 \pgfkeys{\circuitikzbasekey/.cd, every double bipole L}
21656 \edef\pgf@circ@temp{\ctikzvalof{double bipole L}}%
21657 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-L}{\pgfusepath{stroke}}
21658 \endpgfscope
21659 \pgfscope
21660 \ifpgf@circ@dbipoleR@invert
21661 \pgf@circ@res@temp=\pgf@circ@res@down
21662 \pgf@circ@res@other=\pgf@circ@res@up
21663 \else
21664 \pgf@circ@res@temp=\pgf@circ@res@up
21665 \pgf@circ@res@other=\pgf@circ@res@down
21666 \fi
21667 \pgfslopedattimetrue
21668 \pgfallowupsidedownattimetrue
21669 \pgftransformlineattime{.5}{%
21670 \pgfpoint%
21671 {\stretto\pgf@circ@res@right}%
21672 {\pgf@circ@res@other}%
21673 }{%
21674 \pgfpoint
21675 {\stretto\pgf@circ@res@right}%
21676 {\pgf@circ@res@temp}%
21677 }
21678 %
21679 \pgfkeys{\circuitikzbasekey/.cd, every double bipole R}
21680 \edef\pgf@circ@temp{\ctikzvalof{double bipole R}}%
21681 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-R}{\pgfusepath{stroke}}
21682 \endpgfscope
21683 %
21684 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21685 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21686 \pgfpathlineto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert a\else b\fi}}
21687 %
21688 \pgfpathmoveto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert b\else a\fi}}
21689 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21690 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21691 %
21692 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21693 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21694 \pgfpathlineto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert b\else a\fi}}
21695 %
21696 \pgfpathmoveto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert a\else b\fi}}
21697 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21699 \pgfusepath{draw}
21700 }
21701 \pgfcircdeclaredbipole{double bipole}{
21702 \pgf@circ@drawdbipolebasicbody
21703 }{}
21704
21705
21706 % %>>>
21707
21708 %%%%%%%%%%%%%%%%%%%
21709 %% Block diagrams
21710 %%%%%%%%%%%%%%%%%%%
21711
21712 % Definitions and options for blocks (twoports and so)%<<<1
21713
21714 \ctikzset{bipoles/twoport/width/.initial=.7}
21715 \ctikzset{bipoles/twoport/height/.initial=.7}
21716 \ctikzset{bipoles/twoport/text/.initial=}
21717 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
21718 \ctikzset{bipoles/twoportsplit/height/.initial=.7}
21719 \ctikzset{bipoles/twoport/text in/.initial=}
21720 \ctikzset{bipoles/twoport/text out/.initial=}
21721 \ctikzset{text/.style={t=#1}}
21722 \ctikzset{t/.code={%
21723 \ctikzsetvalof{bipoles/twoport/text}{#1}%
21724 }}
21725 \ctikzset{text in/.style={t1=#1}}
21726 \ctikzset{t1/.code={%
21727 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
21728 }}
21729 \ctikzset{text out/.style={t2=#1}}
21730 \ctikzset{t2/.code={%
21731 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
21732 }}
21733 \ctikzset{bipoles/vco/width/.initial=.7}
21734 \ctikzset{bipoles/bandpass/width/.initial=.7}
21735 \ctikzset{bipoles/bandstop/width/.initial=.7}
21736 \ctikzset{bipoles/highpass/width/.initial=.7}
21737 \ctikzset{bipoles/highpass2/width/.initial=.7}
21738 \ctikzset{bipoles/lowpass/width/.initial=.7}
21739 \ctikzset{bipoles/lowpass2/width/.initial=.7}
21740 \ctikzset{bipoles/allpass/width/.initial=.7}
21741 \ctikzset{bipoles/vallpass/width/.initial=.7}
21742 \ctikzset{bipoles/bgenerator/width/.initial=.7}
21743 \ctikzset{bipoles/qgenerator/width/.initial=.7}
21744 \ctikzset{bipoles/cgenerator/width/.initial=.7}
21745 \ctikzset{bipoles/ngenerator/width/.initial=.7}
21746 \ctikzset{bipoles/adc/width/.initial=.7}
21747 \ctikzset{bipoles/dac/width/.initial=.7}
21748 \ctikzset{bipoles/dsp/width/.initial=.7}
21749 \ctikzset{bipoles/fft/width/.initial=.7}
21750 \ctikzset{bipoles/amp/width/.initial=.7}
21751 \ctikzset{bipoles/iamp/width/.initial=.7}
21752 \ctikzset{bipoles/vamp/width/.initial=.7}
21753 \ctikzset{bipoles/piattenuator/width/.initial=.7}
21754 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
21755 \ctikzset{bipoles/tattenuator/width/.initial=.7}
21756 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
21757 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
21758 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
21759 \ctikzset{bipoles/biast/width/.initial=.7}
21760 \ctikzset{bipoles/sinetable/width/.initial=.7}
21761 \ctikzset{bipoles/register/width/.initial=.7}
21762 \ctikzset{bipoles/detector/width/.initial=.7}
21763 \ctikzset{bipoles/saturation/width/.initial=.7}
21764 \ctikzset{bipoles/sigmoid/width/.initial=.7}
21765 \ctikzset{bipoles/allornothing/width/.initial=.7}
21766
21767 \ctikzset{bipoles/camera/height/.initial=1.2}
21768 \ctikzset{bipoles/camera/depth/.initial=.3}
21769 \ctikzset{bipoles/camera/width/.initial=.4}
21770 \ctikzset{bipoles/tvset/width/.initial=0.6}
21771 \ctikzset{bipoles/tvset/height/.initial=.4}
21772 \ctikzset{bipoles/trx/width/.initial=1}
21773 \ctikzset{bipoles/trx/height/.initial=.4}
21774 \ctikzset{bipoles/swr/width/.initial=0.6}
21775 \ctikzset{bipoles/swr/height/.initial=.4}
21776 \ctikzset{bipoles/power/width/.initial=1}
21777 \ctikzset{bipoles/power/height/.initial=.4}
21778
21779 \ctikzset{tripoles/mixer/width/.initial=0.7}
21780 \ctikzset{tripoles/adder/width/.initial=0.7}
21781 \ctikzset{tripoles/circulator/width/.initial=.7}
21782 \ctikzset{tripoles/oscillator/width/.initial=.7}
21783 \ctikzset{bipoles/fiber/width/.initial=.7}
21784
21785 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
21786 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
21787
21788 \ctikzset{tripoles/splitter/height/.initial=1.3}
21789 \ctikzset{tripoles/splitter/width/.initial=1.3}
21790
21791 \ctikzset{tripoles/genericsplitter/height/.initial=1.3}
21792 \ctikzset{tripoles/genericsplitter/width/.initial=1.3}
21793
21794 \ctikzset{tripoles/mzm/height/.initial=1.3}
21795 \ctikzset{tripoles/mzm/width/.initial=1.3}
21796
21797 % Option ">" for twoports
21798 \newif\ifpgf@circuit@inputarrow
21799 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
21800 \ctikzset{inputarrow/.is choice}
21801 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
21802 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
21803
21804 % Option "boxed" for nodes and twoports
21805 \newif\ifpgf@circuit@boxed
21806 \newif\ifpgf@circuit@boxedcircled\pgf@circuit@boxedcircledtrue
21807 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
21808 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
21809 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
21810 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
21811 % boxed, no circle
21812 \pgfkeys{/tikz/boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
21813 \ctikzset{boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
21814 \pgfkeys{/tikz/box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
21815 \ctikzset{box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
21816
21817 % Option "dashed" for nodes and twoports
21818 \newif\ifpgf@circuit@dashed
21819 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
21820 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
21821 % Also draw internal things dashed
21822 \newif\ifpgf@circuit@full@dashed
21823 \ctikzset{inner blocks dashed/.is if=pgf@circuit@full@dashed}%
21824 % Default block dash
21825 \ctikzset{dashed blocks pattern/.initial={{0.1cm}{0.1cm}}}
21826 %
21827 % powerelectronic blocks
21828 \ctikzset{bipoles/sacdc/width/.initial=.7}
21829 \ctikzset{bipoles/sdcac/width/.initial=.7}
21830 \ctikzset{bipoles/sdcdc/width/.initial=.7}
21831 \ctikzset{bipoles/tacdc/width/.initial=.7}
21832 \ctikzset{bipoles/tdcac/width/.initial=.7}
21833 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
21834
21835 %>>>
21836
21837 %% Node shapes definition for path-style block diagrams%<<<
21838
21839 %% Draw the two-port fillable box
21840 \def\pgf@circ@twoportbox{%
21841 \pgfscope
21842 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}%
21843 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}%
21844 \pgf@circ@draworfill
21845 \endpgfscope
21846 }
21847 \def\pgf@circ@inputarrow{%
21848 \ifpgf@circuit@inputarrow
21849 {%
21850 % Remove this: the line will overrun the tip, resulting in bad look. See issue #613, thanks to Laurenz Preindl
21851 % \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
21852 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}%
21853 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}%
21854 }%
21855 \fi
21856 }
21857 %%% blocks additional anchors
21858 \ctikzset{block left anchors pos/.initial=0.5}
21859 \ctikzset{block right anchors pos/.initial=0.5}
21860 \ctikzset{block lateral anchors pos/.code={
21861 \ctikzset{block left anchors pos=#1}%
21862 \ctikzset{block right anchors pos=#1}%
21863 }}
21864 \def\pgcirc@twoport@additional@anchors{%
21865 \savedmacro{\blockleftanchorpos}{\edef\blockleftanchorpos{\ctikzvalof{block left anchors pos}}}
21866 \savedmacro{\blockrightanchorpos}{\edef\blockrightanchorpos{\ctikzvalof{block right anchors pos}}}
21867 \anchor{right down}{\northeast\pgf@y=-\blockrightanchorpos\pgf@y}
21868 \anchor{left down}{\northeast\pgf@x=-\pgf@x\pgf@y=-\blockleftanchorpos\pgf@y}
21869 \anchor{left up}{\northeast\pgf@x=-\pgf@x\pgf@y=\blockleftanchorpos\pgf@y}
21870 \anchor{right up}{\northeast\pgf@y=\blockrightanchorpos\pgf@y}
21871 \anchor{up}{\northeast\pgf@x=0pt\relax}
21872 \anchor{down}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt\relax}
21873 }
21874
21875 %%% definition to help define the blocks. Notice that the height, width, etc are different, so we can't
21876 %%% simplify more...
21877 \def\pfgcirc@twoport@get@symbol@rotation{
21878 %%% put the needed rotation in \@@rotation
21879 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
21880 \def\@@rotation{0}
21881 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
21882 \def\@@rotation{270}
21883 \fi\fi
21884 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225
21885 \def\@@rotation{180}
21886 \fi\fi
21887 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
21888 \def\@@rotation{90}
21889 \fi\fi
21890 }
21891 %
21892 \def\pfgcirc@twoport@rotate@inner@symbol{%
21893 % rotate inner symbol
21894 \pfgcirc@twoport@get@symbol@rotation
21895 \pgftransformrotate{\@@rotation}
21896 }
21897 % enact dashing if needed
21898 \def\pgfcirc@twoport@maybedash{%
21899 \ifpgf@circuit@dashed
21900 \edef\@@tmp{\ctikzvalof{dashed blocks pattern}}
21901 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
21902 \fi
21903 }
21904 % debug
21905 \def\@@printrot{%
21906 \pgfsetcolor{red}
21907 \pgftext[center,x=0,y=0,]{\tiny\ttfamily\pgf@circ@direction > \@@rotation}
21908 }
21909 %
21910 \def\pgfcirc@twoport@setup#1{%
21911 \pgf@circ@res@step = #1\pgf@circ@scaled@Rlen%6 is the real width parameter
21912 \divide \pgf@circ@res@step by 2
21913 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21914 \pgfsetarrows{-}
21915 % let set the dash for the next operations
21916 \pgfcirc@twoport@maybedash
21917 }
21918 %
21919 \def\pgfcirc@twoport@draw@sine#1#2{% #1 -> y shift; #2 -> crossed out if != 0
21920 % draw inner sine waves; ...res@step must be defined
21921 \pgfscope
21922 \pgfsetlinewidth{\pgfstartlinewidth}
21923 \pgftransformyshift{#1\pgf@circ@res@step}
21924 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
21925 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
21926 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
21927 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
21928 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
21929 \ifnum #2=0\else
21930 \pgfpathmoveto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
21931 \pgfpathlineto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
21932 \fi
21933 \pgfusepath{draw}
21934 \endpgfscope
21935 }
21936 %
21937 \def\pgfcirc@twoport@draw@narrowsine#1{% #1 -> y shift
21938 \pgfscope
21939 \pgfsetlinewidth{\pgfstartlinewidth}
21940 \pgftransformyshift{#1\pgf@circ@res@step}
21941 \pgfpathmoveto{\pgfpoint{.125\pgf@circ@res@step}{0\pgf@circ@res@step}}
21942 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
21943 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
21944 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
21945 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
21946 \pgfusepath{draw}
21947 \endpgfscope
21948 }
21949 %
21950 \def\pgfcirc@twoport@draw@splitline{%
21951 \pgfscope
21952 \pgfcirc@twoport@maybedash
21953 \pgfsetlinewidth{\pgfstartlinewidth}
21954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21955 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21956 \pgfusepath{draw}
21957 \endpgfscope
21958 }
21959 %
21960 \long\def\pgfcirc@define@twoports#1#2#3#4#5#6#7{
21961 \pgfcircdeclarebipolescaled{#1}
21962 {
21963 \pgcirc@twoport@additional@anchors
21964 #2
21965 }
21966 {#3}
21967 {#4}
21968 {#5}
21969 {#6}
21970 {
21971 \pgfcirc@twoport@setup{#6}
21972 % draw outer box
21973 \pgf@circ@twoportbox
21974 % draw solid line for inner symbol if no box is drawn and not fully dashed
21975 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
21976 \pgf@circ@inputarrow
21977 \pfgcirc@twoport@rotate@inner@symbol
21978 #7
21979 }
21980 }
21981 %
21982 \long\def\pgfcirc@define@twoports@norotate#1#2#3#4#5#6#7{
21983 \pgfcircdeclarebipolescaled{#1}
21984 {
21985 \pgcirc@twoport@additional@anchors
21986 #2
21987 }
21988 {#3}
21989 {#4}
21990 {#5}
21991 {#6}
21992 {
21993 \pgfcirc@twoport@setup{#6}
21994 % draw outer box
21995 \pgf@circ@twoportbox
21996 % draw solid line for inner symbol if no box is drawn and not fully dashed
21997 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
21998 \pgf@circ@inputarrow
21999 #7
22000 }
22001 }
22002 %% Generic two port box
22003 \pgfcirc@define@twoports{blocks}
22004 {}
22005 {\ctikzvalof{bipoles/twoport/height}}
22006 {twoport}
22007 {\ctikzvalof{bipoles/twoport/height}}
22008 {\ctikzvalof{bipoles/twoport/width}}
22009 {
22010 % draw inner symbol
22011 \pgf@circ@text@strokecolor
22012 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
22013
22014 }
22015 %% twoport split
22016 \pgfcirc@define@twoports{blocks}
22017 {}
22018 {\ctikzvalof{bipoles/twoportsplit/height}}
22019 {twoportsplit}
22020 {\ctikzvalof{bipoles/twoportsplit/height}}
22021 {\ctikzvalof{bipoles/twoportsplit/width}}
22022 {
22023 %get texts
22024 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
22025 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
22026 % shuffle text depending on rotation
22027 \pgfcirc@twoport@draw@splitline
22028 %
22029 \pgf@circ@text@strokecolor
22030 \ifnum\@@rotation<145
22031 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tin}
22032 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tout}
22033 \else
22034 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tout}
22035 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tin}
22036 \fi
22037 }
22038 %% bandpass filter
22039 \pgfcirc@define@twoports{blocks}
22040 {}
22041 {\ctikzvalof{bipoles/bandpass/width}}
22042 {bandpass}
22043 {\ctikzvalof{bipoles/bandpass/width}}
22044 {\ctikzvalof{bipoles/bandpass/width}}
22045 {
22046 \pgfcirc@twoport@draw@sine{0.5}{1}
22047 \pgfcirc@twoport@draw@sine{0.0}{0}
22048 \pgfcirc@twoport@draw@sine{-0.5}{1}
22049 }
22050 %% bandstop filter
22051 \pgfcirc@define@twoports{blocks}
22052 {}
22053 {\ctikzvalof{bipoles/bandstop/width}}
22054 {bandstop}
22055 {\ctikzvalof{bipoles/bandstop/width}}
22056 {\ctikzvalof{bipoles/bandstop/width}}
22057 {
22058 \pgfcirc@twoport@draw@sine{0.5}{0}
22059 \pgfcirc@twoport@draw@sine{0.0}{1}
22060 \pgfcirc@twoport@draw@sine{-0.5}{0}
22061 }
22062 %% highpass filter
22063 \pgfcirc@define@twoports{blocks}
22064 {}
22065 {\ctikzvalof{bipoles/highpass/width}}
22066 {highpass}
22067 {\ctikzvalof{bipoles/highpass/width}}
22068 {\ctikzvalof{bipoles/highpass/width}}
22069 {
22070 \pgfcirc@twoport@draw@sine{0.5}{0}
22071 \pgfcirc@twoport@draw@sine{0.0}{1}
22072 \pgfcirc@twoport@draw@sine{-0.5}{1}
22073 }
22074 %% highpass2 filter ---simplyfied with just two waves
22075 \pgfcirc@define@twoports{blocks}
22076 {}
22077 {\ctikzvalof{bipoles/highpass2/width}}
22078 {highpass2}
22079 {\ctikzvalof{bipoles/highpass2/width}}
22080 {\ctikzvalof{bipoles/highpass2/width}}
22081 {
22082 \pgfcirc@twoport@draw@sine{0.25}{0}
22083 \pgfcirc@twoport@draw@sine{-0.25}{1}
22084 }
22085 %% lowpass filter
22086 \pgfcirc@define@twoports{blocks}
22087 {}
22088 {\ctikzvalof{bipoles/lowpass/width}}
22089 {lowpass}
22090 {\ctikzvalof{bipoles/lowpass/width}}
22091 {\ctikzvalof{bipoles/lowpass/width}}
22092 {
22093 \pgfcirc@twoport@draw@sine{0.5}{1}
22094 \pgfcirc@twoport@draw@sine{0.0}{1}
22095 \pgfcirc@twoport@draw@sine{-0.5}{0}
22096 }
22097 %% lowpass2 filter: simplyfied with just two waves
22098 \pgfcirc@define@twoports{blocks}
22099 {}
22100 {\ctikzvalof{bipoles/lowpass2/width}}
22101 {lowpass2}
22102 {\ctikzvalof{bipoles/lowpass2/width}}
22103 {\ctikzvalof{bipoles/lowpass2/width}}
22104 {
22105 \pgfcirc@twoport@draw@sine{0.25}{1}
22106 \pgfcirc@twoport@draw@sine{-0.25}{0}
22107 }
22108 %% allpass filter
22109 \pgfcirc@define@twoports{blocks}
22110 {}
22111 {\ctikzvalof{bipoles/allpass/width}}
22112 {allpass}
22113 {\ctikzvalof{bipoles/allpass/width}}
22114 {\ctikzvalof{bipoles/allpass/width}}
22115 {
22116 \pgfcirc@twoport@draw@sine{0.5}{0}
22117 \pgfcirc@twoport@draw@sine{0.0}{0}
22118 \pgfcirc@twoport@draw@sine{-0.5}{0}
22119 }
22120 %% variable allpass filter
22121 \pgfcirc@define@twoports{blocks}
22122 {}
22123 {\ctikzvalof{bipoles/vallpass/width}}
22124 {vallpass}
22125 {\ctikzvalof{bipoles/vallpass/width}}
22126 {\ctikzvalof{bipoles/vallpass/width}}
22127 {
22128 \pgfcirc@twoport@draw@sine{0.5}{0}
22129 \pgfcirc@twoport@draw@sine{0.0}{0}
22130 \pgfcirc@twoport@draw@sine{-0.5}{0}
22131 \pgfcirc@set@arrows{tunable}{}{latex}
22132 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22133 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22134 \pgfusepath{draw}
22135 }
22136 %% Block Generator
22137 \pgfcirc@define@twoports{blocks}
22138 {}
22139 {\ctikzvalof{bipoles/bgenerator/width}}
22140 {bgenerator}
22141 {\ctikzvalof{bipoles/bgenerator/width}}
22142 {\ctikzvalof{bipoles/bgenerator/width}}
22143 {
22144 \pgfcirc@twoport@draw@narrowsine{0.25}
22145 \pgfcirc@twoport@draw@narrowsine{0.0}
22146 \pgfcirc@twoport@draw@narrowsine{-0.25}
22147 \pgftext[x=0.45\pgf@circ@res@left]{\ctikzvalof{bipoles/twoport/text}}
22148 }
22149 %% Crystal Generator
22150 \pgfcirc@define@twoports{blocks}
22151 {}
22152 {\ctikzvalof{bipoles/qgenerator/width}}
22153 {qgenerator}
22154 {\ctikzvalof{bipoles/qgenerator/width}}
22155 {\ctikzvalof{bipoles/qgenerator/width}}
22156 {
22157 \pgfcirc@twoport@draw@narrowsine{0.45}
22158 \pgfcirc@twoport@draw@narrowsine{0.20}
22159 \pgfcirc@twoport@draw@narrowsine{-0.05}
22160 \pgftext[x=0.45\pgf@circ@res@left,y=0.25\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
22161 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22162 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22163 \pgfusepath{draw}
22164 \pgfpathrectangle{\pgfpoint{-0.7\pgf@circ@res@step}{-0.7\pgf@circ@res@step}}
22165 {\pgfpoint{1.4\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
22166 \pgfusepath{draw}
22167 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
22168 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
22169 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22170 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22171 \pgfusepath{draw}
22172 }
22173 %% Clock generator
22174 \pgfcirc@define@twoports{blocks}
22175 {}
22176 {\ctikzvalof{bipoles/cgenerator/width}}
22177 {cgenerator}
22178 {\ctikzvalof{bipoles/cgenerator/width}}
22179 {\ctikzvalof{bipoles/cgenerator/width}}
22180 {
22181 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22182 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22183 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22184 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22185 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22186 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22187 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22188 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22189 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22190 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22191 \pgfusepath{draw}
22192 }
22193 %% Generic generator
22194 \pgfcirc@define@twoports{blocks}
22195 {}
22196 {\ctikzvalof{bipoles/ngenerator/width}}
22197 {ngenerator}
22198 {\ctikzvalof{bipoles/ngenerator/width}}
22199 {\ctikzvalof{bipoles/ngenerator/width}}
22200 {
22201 \pgfcirc@twoport@draw@sine{0.5}{0}
22202 \pgftext[y=-0.35\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
22203 }
22204 %% ADC
22205 \pgfcirc@define@twoports{blocks}
22206 {}
22207 {\ctikzvalof{bipoles/adc/width}}
22208 {adc}
22209 {\ctikzvalof{bipoles/adc/width}}
22210 {\ctikzvalof{bipoles/adc/width}}
22211 {
22212 \pgfcirc@twoport@draw@splitline
22213 %
22214 \pgf@circ@text@strokecolor
22215 \ifnum\@@rotation<145
22216 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
22217 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
22218 \else
22219 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
22220 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
22221 \fi
22222 }
22223
22224 %% DAC
22225 \pgfcirc@define@twoports{blocks}
22226 {}
22227 {\ctikzvalof{bipoles/dac/width}}
22228 {dac}
22229 {\ctikzvalof{bipoles/dac/width}}
22230 {\ctikzvalof{bipoles/dac/width}}
22231 {
22232 \pgfcirc@twoport@draw@splitline
22233 %
22234 \pgf@circ@text@strokecolor
22235 \ifnum\@@rotation<145
22236 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
22237 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
22238 \else
22239 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
22240 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
22241 \fi
22242 }
22243
22244 %% DSP
22245 \pgfcirc@define@twoports{blocks}
22246 {}
22247 {\ctikzvalof{bipoles/dsp/width}}
22248 {dsp}
22249 {\ctikzvalof{bipoles/dsp/width}}
22250 {\ctikzvalof{bipoles/dsp/width}}
22251 {
22252 \pgf@circ@text@strokecolor
22253 \pgftext[center,x=0,y=0]{\textsf{DSP}}
22254 }
22255 %% FFT
22256 \pgfcirc@define@twoports{blocks}
22257 {}
22258 {\ctikzvalof{bipoles/fft/width}}
22259 {fft}
22260 {\ctikzvalof{bipoles/fft/width}}
22261 {\ctikzvalof{bipoles/fft/width}}
22262 {
22263 \pgf@circ@text@strokecolor
22264 \pgftext[center,x=0,y=0]{\textsf{FFT}}
22265 }
22266 %% pi attenuator
22267 \pgfcirc@define@twoports{blocks}
22268 {}
22269 {\ctikzvalof{bipoles/piattenuator/width}}
22270 {piattenuator}
22271 {\ctikzvalof{bipoles/piattenuator/width}}
22272 {\ctikzvalof{bipoles/piattenuator/width}}
22273 {
22274 % draw inner symbol
22275 \pgfsetlinewidth{\pgfstartlinewidth}
22276 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22277 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22278 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22279 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22280 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22281 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22282 \pgfusepath{draw}
22283 }
22284 %% variable pi attenuator
22285 \pgfcirc@define@twoports{blocks}
22286 {}
22287 {\ctikzvalof{bipoles/vpiattenuator/width}}
22288 {vpiattenuator}
22289 {\ctikzvalof{bipoles/vpiattenuator/width}}
22290 {\ctikzvalof{bipoles/vpiattenuator/width}}
22291 {
22292 % draw inner symbol
22293 \pgfsetlinewidth{\pgfstartlinewidth}
22294 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22295 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22296 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22297 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22298 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22299 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22300 \pgfusepath{draw}
22301 \pgfcirc@set@arrows{tunable}{}{latex}
22302 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22303 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22304 \pgfusepath{draw}
22305 }
22306 %% T attenuator
22307 \pgfcirc@define@twoports{blocks}
22308 {}
22309 {\ctikzvalof{bipoles/tattenuator/width}}
22310 {tattenuator}
22311 {\ctikzvalof{bipoles/tattenuator/width}}
22312 {\ctikzvalof{bipoles/tattenuator/width}}
22313 {
22314 % draw inner symbol
22315 \pgfsetlinewidth{\pgfstartlinewidth}
22316 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
22317 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
22318 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22319 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22320 \pgfusepath{draw}
22321 }
22322 %% variable T attenuator
22323 \pgfcirc@define@twoports{blocks}
22324 {}
22325 {\ctikzvalof{bipoles/vtattenuator/width}}
22326 {vtattenuator}
22327 {\ctikzvalof{bipoles/vtattenuator/width}}
22328 {\ctikzvalof{bipoles/vtattenuator/width}}
22329 {
22330 % draw inner symbol
22331 \pgfsetlinewidth{\pgfstartlinewidth}
22332 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
22333 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
22334 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22335 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22336 \pgfusepath{draw}
22337 \pgfcirc@set@arrows{tunable}{}{latex}
22338 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22339 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22340 \pgfusepath{draw}
22341 }
22342 %% phase shifter
22343 \pgfcirc@define@twoports{blocks}
22344 {}
22345 {\ctikzvalof{bipoles/phaseshifter/width}}
22346 {phaseshifter}
22347 {\ctikzvalof{bipoles/phaseshifter/width}}
22348 {\ctikzvalof{bipoles/phaseshifter/width}}
22349 {
22350 % inner symbol
22351 \pgf@circ@text@strokecolor
22352 \pgftext[center,x=0,y=0]{\Large$\varphi$}
22353 }
22354 %% variable phase shifter
22355 \pgfcirc@define@twoports{blocks}
22356 {}
22357 {\ctikzvalof{bipoles/phaseshifter/width}}
22358 {vphaseshifter}
22359 {\ctikzvalof{bipoles/vphaseshifter/width}}
22360 {\ctikzvalof{bipoles/vphaseshifter/width}}
22361 {
22362 \pgfsetlinewidth{\pgfstartlinewidth}
22363 \pgfcirc@set@arrows{tunable}{}{latex}
22364 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
22365 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
22366 \pgfusepath{draw}
22367 % inner symbol
22368 \pgf@circ@text@strokecolor
22369 \pgftext[center,x=0,y=0]{\Large$\varphi$}
22370 }
22371 %% BIAS-T
22372 \pgfcirc@define@twoports{blocks}
22373 {}
22374 {\ctikzvalof{bipoles/biast/width}}
22375 {biast}
22376 {\ctikzvalof{bipoles/biast/width}}
22377 {\ctikzvalof{bipoles/biast/width}}
22378 {
22379 \pgfpathmoveto{\pgfpoint{-0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Plate 1
22380 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22381 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
22382 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22383 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22384 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
22385 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
22386 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22387 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22388 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
22389 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Center
22390 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22391 \pgfusepath{draw}
22392 \pgfpathcircle{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}{0.075\pgf@circ@res@step}
22393 \pgfusepath{fill}
22394 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Right
22395 \pgfpathlineto{\pgfpoint{ 0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22396 \pgfusepath{draw}
22397 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Coils
22398 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22399 \pgfusepath{draw}
22400 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}} % Arc1
22401 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22402 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.02\pgf@circ@res@step}} % Arc2
22403 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22404 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.16\pgf@circ@res@step}} % Arc3
22405 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22406 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.36\pgf@circ@res@step}} % Arc4
22407 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22408 \pgfusepath{draw}
22409 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.52\pgf@circ@res@step}} % Line to Coils
22410 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.80\pgf@circ@res@step}}
22411 \pgfusepath{draw}
22412 }
22413 %% Sine table
22414 \pgfcirc@define@twoports{blocks}
22415 {}
22416 {\ctikzvalof{bipoles/sinetable/width}}
22417 {sinetable}
22418 {\ctikzvalof{bipoles/sinetable/width}}
22419 {\ctikzvalof{bipoles/sinetable/width}}
22420 {
22421 \pgfcirc@twoport@draw@sine{0.0}{0}
22422 \pgfcirc@set@arrows{tunable}{}{latex}
22423 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22424 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22425 \pgfusepath{draw}
22426 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22427 \pgfpathlineto{\pgfpoint{-0.70\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
22428 \pgfusepath{draw}
22429 }
22430 %% Register
22431 \pgfcirc@define@twoports{blocks}
22432 {
22433 \savedanchor\northwest{
22434 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22435 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
22436 \pgf@y=.5\pgf@y
22437 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
22438 \pgf@x=.5\pgf@x
22439 }
22440 \anchor{clk}{\northwest\pgf@y=0.5\pgf@y}
22441 }
22442 {\ctikzvalof{bipoles/register/width}}
22443 {register}
22444 {\ctikzvalof{bipoles/register/width}}
22445 {\ctikzvalof{bipoles/register/width}}
22446 {
22447 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
22448 \pgfpathlineto{\pgfpoint{-0.60\pgf@circ@res@step}{+0.50\pgf@circ@res@step}}
22449 \pgfpathlineto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.30\pgf@circ@res@step}}
22450 \pgfusepath{draw}
22451 \pgf@circ@text@strokecolor
22452 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
22453 }
22454 %% detector
22455 \pgfcirc@define@twoports@norotate{blocks}
22456 {}
22457 {\ctikzvalof{bipoles/detector/width}}
22458 {detector}
22459 {\ctikzvalof{bipoles/detector/width}}
22460 {\ctikzvalof{bipoles/detector/width}}
22461 {
22462 % draw inner stuff
22463 \pgfsetlinewidth{0.8\pgfstartlinewidth}
22464 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
22465 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
22466 \pgfusepath{draw}
22467 \ifpgf@circuit@fulldiode
22468 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
22469 \pgftransformscale{\pgfmathresult}
22470 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
22471 \else
22472 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
22473 \pgftransformscale{\pgfmathresult}
22474 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
22475 \fi
22476 }
22477 %% saturation block, contributed by P.Sacco <paul.sacco@estaca,eu>
22478 \pgfcirc@define@twoports{blocks}
22479 {}
22480 {\ctikzvalof{bipoles/saturation/width}}
22481 {saturation}
22482 {\ctikzvalof{bipoles/saturation/width}}
22483 {\ctikzvalof{bipoles/saturation/width}}
22484 {
22485 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22486 \pgfpathmoveto{\pgfpointorigin}
22487 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22488 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22489 %
22490 \pgfpathmoveto{\pgfpointorigin}
22491 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22492 \pgfpathlineto{\pgfpoint{-0.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22493 \pgfusepath{draw}
22494 }
22495 %% sigmoid
22496 \pgfcirc@define@twoports{blocks}
22497 {}
22498 {\ctikzvalof{bipoles/sigmoid/width}}
22499 {sigmoid}
22500 {\ctikzvalof{bipoles/sigmoid/width}}
22501 {\ctikzvalof{bipoles/sigmoid/width}}
22502 {
22503 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22504 \pgfpathmoveto{\pgfpoint{-.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22505 \pgfpathlineto{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22506 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22507 %
22508 \pgfpathmoveto{\pgfpoint{.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22509 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22510 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22511 \pgfusepath{draw}
22512 }
22513 %% all-or-nothing (comparator) block
22514 \pgfcirc@define@twoports{blocks}
22515 {}
22516 {\ctikzvalof{bipoles/allornothing/width}}
22517 {allornothing}
22518 {\ctikzvalof{bipoles/allornothing/width}}
22519 {\ctikzvalof{bipoles/allornothing/width}}
22520 {
22521 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22522 \pgfpathmoveto{\pgfpoint{-0.55\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22523 \pgfpathlineto{\pgfpoint{+0pt}{-.4\pgf@circ@res@step}}
22524 \pgfpathlineto{\pgfpoint{+0pt}{.4\pgf@circ@res@step}}
22525 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22526 \pgfusepath{draw}
22527 }
22528
22529 %% Camera:
22530 \pgfcircdeclarebipolescaled{misc}
22531 {}
22532 {\ctikzvalof{bipoles/camera/depth}}
22533 {camera}
22534 {\ctikzvalof{bipoles/camera/height}}
22535 {\ctikzvalof{bipoles/camera/width}}{
22536 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.7\pgf@circ@res@up}}
22537 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
22538 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.7\pgf@circ@res@up}}
22539 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
22540 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
22541 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.7\pgf@circ@res@up}}
22542 \pgfpathclose
22543 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22544 \pgf@circ@draworfill
22545 }
22546
22547 % TV:
22548 \pgfcirc@define@twoports{blocks}
22549 {}
22550 {\ctikzvalof{bipoles/tvset/height}}
22551 {tvset}
22552 {\ctikzvalof{bipoles/tvset/height}}
22553 {\ctikzvalof{bipoles/tvset/width}}
22554 {
22555 \pgfsetlinewidth{2\pgflinewidth} % double in size
22556 % Legs
22557 \pgfpathmoveto{\pgfpoint{+0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
22558 \pgfpathlineto{\pgfpoint{+0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22559 \pgfusepath{draw}
22560 %
22561 \pgfpathmoveto{\pgfpoint{-0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
22562 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22563 \pgfusepath{draw}
22564 }
22565
22566 % Transceiver (TRX)
22567 \pgfcirc@define@twoports{blocks}
22568 {
22569 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
22570 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22571 }
22572 {\ctikzvalof{bipoles/trx/height}}
22573 {trx}
22574 {\ctikzvalof{bipoles/trx/height}}
22575 {\ctikzvalof{bipoles/trx/width}}
22576 {
22577 % VFO-Wheel:
22578 \pgfpathcircle{\pgfpoint{0.60\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{0.25\pgf@circ@res@step}
22579 \pgfpathcircle{\pgfpoint{0.68\pgf@circ@res@step}{0.10\pgf@circ@res@step}}{0.06\pgf@circ@res@step}
22580 % Volume and Squelch:
22581 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{+0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
22582 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
22583 % Display:
22584 \pgfpathrectangle{\pgfpoint{-0.55\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22585 {\pgfpoint{+0.75\pgf@circ@res@step}{+0.5\pgf@circ@res@step}}%
22586 \pgfusepath{draw}
22587 }
22588 % Standing Wave Ratio (SWR) Meter
22589 \pgfcirc@define@twoports{blocks}
22590 {}
22591 {\ctikzvalof{bipoles/swr/height}}
22592 {swr}
22593 {\ctikzvalof{bipoles/swr/height}}
22594 {\ctikzvalof{bipoles/swr/width}}
22595 {
22596 % Screen:
22597 \pgfscope
22598 \pgfsetstrokecolor{gray}\pgfsetdash{{1.5pt}{1pt}}{0pt}
22599 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22600 \pgfpatharc{160}{110}{1.1\pgf@circ@res@step}
22601 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22602 \pgfpatharc{-160}{-110}{-1.1\pgf@circ@res@step}
22603 \pgfusepath{draw}
22604 \endpgfscope
22605 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
22606 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
22607 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
22608 \pgfpathlineto{\pgfpoint{0pt}{-0.4\pgf@circ@res@step}}
22609 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
22610 \pgfpathclose
22611 \pgfpathmoveto{\pgfpoint{-0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
22612 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
22613 \pgfpathmoveto{\pgfpoint{0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
22614 \pgfpathlineto{\pgfpoint{-0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
22615 \pgfusepath{draw}
22616 }
22617 % Power supply
22618 \pgfcirc@define@twoports{blocks}
22619 {
22620 \anchor{u1}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
22621 \anchor{u2}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22622 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x \advance\pgf@x by -0.25\pgf@x}
22623 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@y=-\pgf@y \advance\pgf@x by -0.25\pgf@x}
22624 }
22625 {\ctikzvalof{bipoles/power/height}}
22626 {power}
22627 {\ctikzvalof{bipoles/power/height}}
22628 {\ctikzvalof{bipoles/power/width}}
22629 {
22630 % Plus:
22631 \color{red}
22632 \pgfsetstrokecolor{red}
22633 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22634 \pgfusepath{fill}
22635 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
22636 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
22637 \pgfpathmoveto{\pgfpoint{0.55\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
22638 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
22639 \pgfusepath{stroke}
22640 % Minus:
22641 \color{black}
22642 \pgfsetstrokecolor{black}
22643 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22644 \pgfusepath{fill}
22645 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22646 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22647 \pgfusepath{stroke}
22648 % Displays:
22649 \pgfpathrectangle{\pgfpoint{-0.5\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22650 \pgfpathrectangle{\pgfpoint{-0.0\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22651 % Poti:
22652 \pgfpathcircle{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22653 \pgfusepath{draw}
22654 % Switch:
22655 \pgfpathrectangle{\pgfpoint{-0.9\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.15\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22656 \pgfpathmoveto{\pgfpoint{-0.90\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22657 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22658 \pgfusepath{draw}
22659 }
22660
22661 %% converters help function
22662 %% definition for styling the DC symbols (GitHub issue #680)
22663 \ctikzset{blocks dc in segments/.initial=1}
22664 \ctikzset{blocks dc out segments/.initial=1}
22665 \ctikzset{blocks dc segments/.code={%
22666 \ctikzset{blocks dc in segments=#1}%
22667 \ctikzset{blocks dc out segments=#1}%
22668 }
22669 }
22670 \def\pgf@circ@twoport@converter@dc#1#2{%
22671 \pgfscope
22672 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
22673 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22674 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22675 \pgfusepath{draw}
22676 \ifpgf@circuit@full@dashed\else % do not apply the specific dash if fully dashing
22677 \edef\@@up{\ctikzvalof{blocks dc in segments}}
22678 \edef\@@down{\ctikzvalof{blocks dc out segments}}
22679 \ifdim\dimexpr#1\pgf@circ@res@step\relax<0pt
22680 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@step/(4*\@@up-2)}
22681 \else
22682 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@step/(4*\@@down-2)}
22683 \fi
22684 \pgfsetdash{{\pgf@circ@res@other}{\pgf@circ@res@other}}{0pt}
22685 \fi
22686 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
22687 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
22688 \pgfusepath{draw}
22689 \endpgfscope
22690 }
22691 \def\pgf@circ@twoport@converter@dc@up{%
22692 \pgf@circ@twoport@converter@dc{-0.5}{0.5}
22693 }
22694 \def\pgf@circ@twoport@converter@dc@down{%
22695 \pgf@circ@twoport@converter@dc{0.5}{-0.5}
22696 }
22697 \def\pgf@circ@twoport@converter@ac#1#2{%
22698 \pgfscope
22699 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
22700 \pgfpathmoveto{\pgfpoint{-.31\pgf@circ@res@step}{0\pgf@circ@res@step}}
22701 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
22702 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
22703 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
22704 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
22705 \pgfusepath{draw}
22706 \endpgfscope
22707 }
22708 \def\pgf@circ@twoport@converter@ac@up{%
22709 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
22710 }
22711 \def\pgf@circ@twoport@converter@ac@down{%
22712 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
22713 }
22714 \def\pgf@circ@twoport@converter@tac@up{%
22715 \pgf@circ@twoport@converter@ac{-0.45}{0.65}
22716 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
22717 \pgf@circ@twoport@converter@ac{-0.45}{0.35}
22718 }
22719 \def\pgf@circ@twoport@converter@tac@down{%
22720 \pgf@circ@twoport@converter@ac{0.45}{-0.65}
22721 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
22722 \pgf@circ@twoport@converter@ac{0.45}{-0.35}
22723 }
22724 %% single phase ac/dc converter
22725 \pgfcirc@define@twoports{blocks}
22726 {
22727 % these two are left for backward compatibiliyt
22728 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
22729 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
22730 % better
22731 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22732 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22733 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
22734 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
22735 }
22736 {\ctikzvalof{bipoles/sacdc/width}}
22737 {sacdc}
22738 {\ctikzvalof{bipoles/sacdc/width}}
22739 {\ctikzvalof{bipoles/sacdc/width}}
22740 {
22741 \pgfcirc@twoport@draw@splitline
22742 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
22743 \pgf@circ@twoport@converter@ac@up
22744 \pgf@circ@twoport@converter@dc@down
22745 \else
22746 \pgf@circ@twoport@converter@dc@up
22747 \pgf@circ@twoport@converter@ac@down
22748 \fi
22749 }
22750 %% dc/dc converter
22751 \pgfcirc@define@twoports{blocks}
22752 {
22753 % these two are left for backward compatibiliyt
22754 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22755 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22756 % better
22757 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22758 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22759 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
22760 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
22761 }
22762 {\ctikzvalof{bipoles/sdcdc/width}}
22763 {sdcdc}
22764 {\ctikzvalof{bipoles/sdcdc/width}}
22765 {\ctikzvalof{bipoles/sdcdc/width}}
22766 {
22767 \pgfcirc@twoport@draw@splitline
22768 % No need to switch here
22769 \pgf@circ@twoport@converter@dc@up
22770 \pgf@circ@twoport@converter@dc@down
22771 }
22772 %% single phase dc/ac converter
22773 \pgfcirc@define@twoports{blocks}
22774 {
22775 % these two are left for backward compatibiliyt
22776 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22777 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22778 % better
22779 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22780 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22781 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
22782 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
22783 }
22784 {\ctikzvalof{bipoles/sdcac/width}}
22785 {sdcac}
22786 {\ctikzvalof{bipoles/sdcac/width}}
22787 {\ctikzvalof{bipoles/sdcac/width}}
22788 {
22789 \pgfcirc@twoport@draw@splitline
22790 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
22791 \pgf@circ@twoport@converter@dc@up
22792 \pgf@circ@twoport@converter@ac@down
22793 \else
22794 \pgf@circ@twoport@converter@ac@up
22795 \pgf@circ@twoport@converter@dc@down
22796 \fi
22797 }
22798 %% single phase ac/ac converter
22799 \pgfcirc@define@twoports{blocks}
22800 {
22801 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22802 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22803 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
22804 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
22805 }
22806 {\ctikzvalof{bipoles/sdcac/width}}
22807 {sacac}
22808 {\ctikzvalof{bipoles/sdcac/width}}
22809 {\ctikzvalof{bipoles/sdcac/width}}
22810 {
22811 \pgfcirc@twoport@draw@splitline
22812 \pgf@circ@twoport@converter@ac@up
22813 \pgf@circ@twoport@converter@ac@down
22814 }
22815 %% threephase ac/dc converter
22816 \pgfcirc@define@twoports{blocks}
22817 {
22818 % legacy, let for compatibility
22819 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
22820 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
22821 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
22822 \anchor{ac2}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
22823 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
22824 %better
22825 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
22826 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
22827 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
22828 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
22829 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
22830 }
22831 {\ctikzvalof{bipoles/tacdc/width}}
22832 {tacdc}
22833 {\ctikzvalof{bipoles/tacdc/width}}
22834 {\ctikzvalof{bipoles/tacdc/width}}
22835 {
22836 \pgfcirc@twoport@draw@splitline
22837 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
22838 \pgf@circ@twoport@converter@tac@up
22839 \pgf@circ@twoport@converter@dc@down
22840 \else
22841 \pgf@circ@twoport@converter@dc@up
22842 \pgf@circ@twoport@converter@tac@down
22843 \fi
22844 }
22845 %% threephase dc/ac converter
22846 \pgfcirc@define@twoports{blocks}
22847 {
22848 % legacy, let for compatibility
22849 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22850 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22851 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y}
22852 \anchor{ac2}{\northeast\pgf@y=0\pgf@y}
22853 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y}
22854 %better
22855 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
22856 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
22857 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
22858 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
22859 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
22860 }
22861 {\ctikzvalof{bipoles/tdcac/width}}
22862 {tdcac}
22863 {\ctikzvalof{bipoles/tdcac/width}}
22864 {\ctikzvalof{bipoles/tdcac/width}}
22865 {
22866 \pgfcirc@twoport@draw@splitline
22867 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
22868 \pgf@circ@twoport@converter@dc@up
22869 \pgf@circ@twoport@converter@tac@down
22870 \else
22871 \pgf@circ@twoport@converter@tac@up
22872 \pgf@circ@twoport@converter@dc@down
22873 \fi
22874 }
22875 %% threephase ac/ac converter
22876 \pgfcirc@define@twoports{blocks}
22877 {
22878 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
22879 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
22880 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
22881 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
22882 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
22883 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
22884 }
22885 {\ctikzvalof{bipoles/tdcac/width}}
22886 {tacac}
22887 {\ctikzvalof{bipoles/tdcac/width}}
22888 {\ctikzvalof{bipoles/tdcac/width}}
22889 {
22890 \pgfcirc@twoport@draw@splitline
22891 \pgf@circ@twoport@converter@tac@down
22892 \pgf@circ@twoport@converter@tac@up
22893 }
22894 %%%% Non-square blocks. We do not use the standard macros
22895 %%%% this one is adapted to do the boxed thing
22896 %
22897 \long\def\pgfcirc@define@twoports@boxed#1#2#3#4#5#6#7{
22898 \pgfcircdeclarebipolescaled{#1}
22899 {
22900 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
22901 \pgcirc@twoport@additional@anchors
22902 #2
22903 }
22904 {#3}
22905 {#4}
22906 {#5}
22907 {#6}
22908 {
22909 \pgf@circ@res@step=#6\pgf@circ@scaled@Rlen %6 is the real width parameter
22910 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22911 \pgfsetarrows{-}
22912 \pgfcirc@twoport@maybedash
22913 % draw outer box
22914 \ifpgf@circuit@boxed
22915 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22916 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
22917 \pgf@circ@draworfill
22918 \fi
22919 \pgf@circ@inputarrow
22920 \ifpgf@circuit@boxed
22921 \pgfsetlinewidth{\pgfstartlinewidth}
22922 % draw solid line for inner symbol if no box is drawn and not fully dashed
22923 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
22924 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
22925 \else
22926 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22927 \fi
22928 #7
22929 }
22930 }
22931 %% voltage controled oscillator
22932 \pgfcirc@define@twoports@boxed{blocks}
22933 {}
22934 {\ctikzvalof{bipoles/vco/width}}
22935 {vco}
22936 {\ctikzvalof{bipoles/twoport/width}}
22937 {\ctikzvalof{bipoles/vco/width}}
22938 {
22939 % ok, this is a bit of incoherence
22940 \divide \pgf@circ@res@step by 2
22941 % draw circle
22942 \pgfscope
22943 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22944 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
22945 \pgf@circ@draworfill
22946 \endpgfscope
22947 \pfgcirc@twoport@rotate@inner@symbol
22948 \pgfcirc@twoport@draw@sine{0}{0}
22949 }
22950 %% amplifier, iamplifier, and vamplifier
22951 %% Amplifier %% Beware, not using the generic twoport(s) macros.
22952 \pgfcirc@define@twoports@boxed{blocks}
22953 {
22954 \anchor{up}{%
22955 \northeast\pgf@x=0pt\relax
22956 \ifnum\componentisboxed=0
22957 \pgf@y=0.55\pgf@y
22958 \fi
22959 }
22960 \anchor{down}{%
22961 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
22962 \ifnum\componentisboxed=0
22963 \pgf@y=0.55\pgf@y
22964 \fi
22965 }
22966 }
22967 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
22968 {amp}
22969 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
22970 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
22971 {
22972 % draw triangle
22973 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
22974 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
22975 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
22976 \pgfpathclose
22977 \pgf@circ@draworfill
22978 \pfgcirc@twoport@get@symbol@rotation
22979 % draw inner text
22980 \pgf@circ@text@strokecolor
22981 \ifnum\@@rotation=180
22982 \pgftransformrotate{180}
22983 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
22984 \else
22985 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
22986 \fi
22987 }
22988 %% Instrumentation amplifier %% Beware, not using the generic twoport(s) macros.
22989 \pgfcirc@define@twoports@boxed{blocks}
22990 {
22991 \anchor{up}{%
22992 \northeast\pgf@x=0pt\relax
22993 \ifnum\componentisboxed=0
22994 \pgf@y=0.75\pgf@y
22995 \fi
22996 }
22997 \anchor{down}{%
22998 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
22999 \ifnum\componentisboxed=0
23000 \pgf@y=0.75\pgf@y
23001 \fi
23002 }
23003 }
23004 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23005 {iamp}
23006 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23007 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23008 {
23009 % draw blunt triangle
23010 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
23011 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
23012 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
23013 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
23014 \pgfpathclose
23015 \pgf@circ@draworfill
23016 \pfgcirc@twoport@get@symbol@rotation
23017 % draw inner text
23018 \pgf@circ@text@strokecolor
23019 \ifnum\@@rotation=180
23020 \pgftransformrotate{180}
23021 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23022 \else
23023 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23024 \fi
23025 }
23026 %% variable amplifier %% Beware, not using the generic twoport(s) macros.
23027 \pgfcirc@define@twoports@boxed{blocks}
23028 {
23029 \anchor{up}{%
23030 \northeast\pgf@x=0pt\relax
23031 \ifnum\componentisboxed=0
23032 \pgf@y=0.55\pgf@y
23033 \fi
23034 }
23035 \anchor{down}{%
23036 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
23037 \ifnum\componentisboxed=0
23038 \pgf@y=0.55\pgf@y
23039 \fi
23040 }
23041 }
23042 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23043 {vamp}
23044 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23045 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23046 {
23047 % draw triangle
23048 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
23049 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
23050 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
23051 \pgfpathclose
23052 \pgf@circ@draworfill
23053 \pfgcirc@twoport@get@symbol@rotation
23054 % draw arrow
23055 \pgfsetlinewidth{\pgfstartlinewidth}
23056 \pgfcirc@set@arrows{tunable}{}{latex}
23057 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
23058 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
23059 \pgfusepath{draw}
23060 % draw inner text
23061 \pgf@circ@text@strokecolor
23062 \ifnum\@@rotation=180
23063 \pgftransformrotate{180}
23064 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23065 \else
23066 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23067 \fi
23068 }
23069
23070 %% optical fiber
23071 \pgfcirc@define@twoports@norotate{blocks}
23072 {}
23073 {\ctikzvalof{bipoles/fiber/width}}
23074 {fiber}
23075 {\ctikzvalof{bipoles/fiber/width}}
23076 {\ctikzvalof{bipoles/fiber/width}}
23077 {
23078 \pgfpathcircle{\pgfpoint{0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23079 \pgfpathcircle{\pgfpoint{0\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23080 \pgfpathcircle{\pgfpoint{-0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23081 \pgfusepath{draw}
23082 % always use basic line width for this
23083 \pgfsetlinewidth{\pgfstartlinewidth}
23084 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
23085 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
23086 \pgfusepath{draw}
23087 }
23088
23089 \pgfcirc@activate@bipole@simple{l}{fiber}
23090 %
23091 % %>>>
23092
23093 %% Path definitions for Blocks%<<<
23094
23095 \pgfcirc@activate@bipole@simple{l}{twoport}
23096 \pgfcirc@activate@bipole@simple{l}{twoportsplit}
23097 \pgfcirc@activate@bipole@simple{l}{vco}
23098 \pgfcirc@activate@bipole@simple{l}{bandpass}
23099 \pgfcirc@activate@bipole@simple{l}{bandstop}
23100 \pgfcirc@activate@bipole@simple{l}{highpass}
23101 \pgfcirc@activate@bipole@simple{l}{highpass2}
23102 \pgfcirc@activate@bipole@simple{l}{lowpass}
23103 \pgfcirc@activate@bipole@simple{l}{lowpass2}
23104 \pgfcirc@activate@bipole@simple{l}{allpass}
23105 \pgfcirc@activate@bipole@simple{l}{vallpass}
23106 \pgfcirc@activate@bipole@simple{l}{bgenerator}
23107 \pgfcirc@activate@bipole@simple{l}{qgenerator}
23108 \pgfcirc@activate@bipole@simple{l}{cgenerator}
23109 \pgfcirc@activate@bipole@simple{l}{ngenerator}
23110 \pgfcirc@activate@bipole@simple{l}{adc}
23111 \pgfcirc@activate@bipole@simple{l}{dac}
23112 \pgfcirc@activate@bipole@simple{l}{dsp}
23113 \pgfcirc@activate@bipole@simple{l}{fft}
23114 \pgfcirc@activate@bipole@simple{l}{amp}
23115 \pgfcirc@activate@bipole@simple{l}{iamp}
23116 \pgfcirc@activate@bipole@simple{l}{vamp}
23117 \pgfcirc@activate@bipole@simple{l}{piattenuator}
23118 \pgfcirc@activate@bipole@simple{l}{vpiattenuator}
23119 \pgfcirc@activate@bipole@simple{l}{tattenuator}
23120 \pgfcirc@activate@bipole@simple{l}{vtattenuator}
23121 \pgfcirc@activate@bipole@simple{l}{phaseshifter}
23122 \pgfcirc@activate@bipole@simple{l}{vphaseshifter}
23123 \pgfcirc@activate@bipole@simple{l}{biast}
23124 \pgfcirc@activate@bipole@simple{l}{sinetable}
23125 \pgfcirc@activate@bipole@simple{l}{register}
23126 \pgfcirc@activate@bipole@simple{l}{detector}
23127 \pgfcirc@activate@bipole@simple{l}{saturation}
23128 \pgfcirc@activate@bipole@simple{l}{sigmoid}
23129 \pgfcirc@activate@bipole@simple{l}{allornothing}
23130 \pgfcirc@activate@bipole@simple{l}{camera}
23131 \pgfcirc@activate@bipole@simple{l}{tvset}
23132 \pgfcirc@activate@bipole@simple{l}{trx}
23133 \pgfcirc@activate@bipole@simple{l}{swr}
23134 \pgfcirc@activate@bipole@simple{l}{power}
23135 \pgfcirc@activate@bipole@simple{l}{fiber}
23136 \pgfcirc@activate@bipole@simple{l}{sacdc}
23137 \pgfcirc@activate@bipole@simple{l}{sdcac}
23138 \pgfcirc@activate@bipole@simple{l}{sdcdc}
23139 \pgfcirc@activate@bipole@simple{l}{sacac}
23140 \pgfcirc@activate@bipole@simple{l}{tacdc}
23141 \pgfcirc@activate@bipole@simple{l}{tdcac}
23142 \pgfcirc@activate@bipole@simple{l}{tacac}
23143 % %>>>
23144
23145 %% Node shapes for Block elements %<<<
23146 %
23147 % utility macro for the anchors
23148 \def\pgf@circ@circular@rf@anchors#1{%
23149 \savedanchor\northwest{
23150 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23151 \ifpgf@circuit@boxed
23152 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
23153 \pgf@y=.5\pgf@y
23154 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
23155 \pgf@x=.5\pgf@x
23156 \else
23157 \pgf@y=\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
23158 \pgf@y=.5\pgf@y
23159 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
23160 \pgf@x=.5\pgf@x
23161 \fi
23162 }
23163 % border anchors
23164 \anchorborder{
23165 \pgf@circ@res@left=\pgf@x
23166 \pgf@circ@res@up=\pgf@y
23167 \ifnum\componentisboxed=0
23168 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
23169 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
23170 \else
23171 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
23172 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
23173 \fi
23174 }
23175 \pgfcirc@northwest@symmetric@geoanchors
23176 \anchor{geocenter}{\pgfpointorigin}
23177 \anchor{up}{\northwest\pgf@x=0pt}
23178 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23179 % Deprecated number anchors
23180 \anchor{1}{\northwest\pgf@y=0pt}
23181 \anchor{2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23182 \anchor{3}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23183 \anchor{4}{\northwest\pgf@y=\pgf@y\pgf@x=0pt}
23184 % input output anchors (also quite bad)
23185 \anchor{in 1}{\northwest\pgf@y=0pt}
23186 \anchor{in1}{\northwest\pgf@y=0pt}
23187 \anchor{in}{\northwest\pgf@y=0pt}
23188 \anchor{in 2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23189 \anchor{in2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23190 \anchor{out}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23191 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23192 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23193 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23194 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23195 \anchor{text}{\northwest
23196 \advance\pgf@y\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox\relax
23197 \pgf@x=-.5\wd\pgfnodeparttextbox\relax}
23198 }
23199 % draw the body rectangle and circle if and when needed
23200 \def\pgf@circ@circular@rf@box@circle{%
23201 \pgfstartlinewidth=\pgflinewidth
23202 % draw outer box
23203 \ifpgf@circuit@boxed
23204 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
23205 \fi
23206 % draw outer circle
23207 \ifpgf@circuit@boxed
23208 \pgf@circ@res@step=.7\pgf@circ@res@step
23209 % draw solid line for inner symbol if no box is drawn and not fully dashed
23210 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23211 \else
23212 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23213 \fi
23214 \ifpgf@circuit@boxedcircled
23215 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
23216 \fi
23217 \pgf@circ@draworfill
23218 }
23219 %
23220 \pgfdeclareshape{mixer}
23221 {
23222 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23223 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23224 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23225 % build the anchor set
23226 \anchor{center}{\pgfpointorigin}
23227 \pgf@circ@circular@rf@anchors{mixer}
23228 \pgf@circ@draw@component{
23229 \pgf@circ@setcolor
23230 \pgf@circ@scaled@Rlen=\scaledRlen
23231 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
23232 \pgfscope
23233 \pgf@circ@circular@rf@box@circle
23234 % draw inner stuff
23235 % draw solid line for inner symbol if no box is drawn and not fully dashed
23236 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23237 \pgfsetlinewidth{\pgfstartlinewidth}
23238 \pgfpathmoveto{\pgfpointorigin}
23239 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
23240 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
23241 \pgfpathmoveto{\pgfpointorigin}
23242 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
23243 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
23244 \pgfusepath{draw}
23245 \endpgfscope
23246 }
23247 }
23248
23249 \pgfdeclareshape{adder}
23250 {
23251 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23252 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23253 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23254 % build the anchor set
23255 \anchor{center}{\pgfpointorigin}
23256 \pgf@circ@circular@rf@anchors{adder}
23257 \pgf@circ@draw@component{
23258 \pgf@circ@setcolor
23259 \pgf@circ@scaled@Rlen=\scaledRlen
23260 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
23261 \pgfscope
23262 \pgf@circ@circular@rf@box@circle
23263 % draw inner stuff
23264 % draw solid line for inner symbol if no box is drawn and not fully dashed
23265 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23266 \pgfsetlinewidth{\pgfstartlinewidth}
23267 \pgfpathmoveto{\pgfpointorigin}
23268 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
23269 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
23270 \pgfpathmoveto{\pgfpointorigin}
23271 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
23272 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
23273 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
23274 \pgfusepath{draw}
23275 \endpgfscope
23276 }
23277 }
23278
23279 \pgfdeclareshape{oscillator}
23280 {
23281 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23282 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23283 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23284 % build the anchor set --- the center of an oscillator is on the right
23285 \anchor{center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23286 \pgf@circ@circular@rf@anchors{oscillator}
23287 % border anchors
23288 \anchor{text}{
23289 \pgf@x=-2\pgf@x
23290 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
23291 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
23292 }
23293 \pgf@circ@draw@component{
23294 \pgf@circ@setcolor
23295 \pgf@circ@scaled@Rlen=\scaledRlen
23296 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
23297 \pgfscope
23298 \pgf@circ@circular@rf@box@circle
23299 % draw inner sine waves
23300 % draw solid line for inner symbol if no box is drawn and not fully dashed
23301 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23302 \pgfsetlinewidth{\pgfstartlinewidth}
23303 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
23304 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
23305 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
23306 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
23307 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
23308 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
23309 \pgfusepath{draw}
23310 \endpgfscope
23311 }
23312 }
23313
23314 \pgfdeclareshape{circulator}
23315 {
23316 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23317 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23318 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23319 % build the anchor set
23320 \anchor{center}{\pgfpointorigin}
23321 \pgf@circ@circular@rf@anchors{circulator}
23322 \pgf@circ@draw@component{
23323 \pgf@circ@setcolor
23324 \pgf@circ@scaled@Rlen=\scaledRlen
23325 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
23326 \pgfscope
23327 \pgf@circ@circular@rf@box@circle
23328 % inner arrow
23329 % draw solid line for inner symbol if no box is drawn and not fully dashed
23330 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23331 \pgfsetlinewidth{\pgfstartlinewidth}
23332 \pgfsetarrowsend{latex}
23333 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
23334 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
23335 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
23336 \pgfusepath{draw}
23337 \endpgfscope
23338 }
23339 }
23340
23341 %% gridnode
23342 \pgfdeclareshape{gridnode}
23343 {
23344 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23345 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23346 \savedanchor\northwest{
23347 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23348 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23349 \pgf@y=.5\pgf@y
23350 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23351 \pgf@x=.5\pgf@x
23352 }
23353 \pgfcirc@northwest@symmetric@geoanchors
23354 \anchor{center}{\pgfpointorigin}
23355 \anchor{up}{\northwest\pgf@x=0pt}
23356 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23357 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23358 \anchor{left}{\northwest\pgf@y=0pt}
23359 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23360 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23361 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23362 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23363 \anchor{text}{
23364 \pgf@x=-2\pgf@x
23365 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
23366 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
23367 }
23368 \pgf@circ@draw@component{
23369 \pgf@circ@setcolor
23370 \pgf@circ@scaled@Rlen=\scaledRlen
23371 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23372 \northwest
23373 \pgf@circ@res@up = \pgf@y
23374 \pgf@circ@res@down = -\pgf@y
23375 \pgf@circ@res@right = -\pgf@x
23376 \pgf@circ@res@left = \pgf@x
23377 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23378 \divide \pgf@circ@res@step by 2
23379 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
23380 \pgf@circ@res@other = \pgf@circ@res@left
23381 \advance\pgf@circ@res@other by \pgf@circ@res@step
23382 \pgfcirc@twoport@maybedash
23383 % draw outer box
23384 \pgf@circ@twoportbox
23385 \pgf@circ@inputarrow
23386 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23387 \pgfsetarrows{-} %never draw arrows
23388 \pgfsetlinewidth{0.05mm}
23389 % draw grid
23390 \foreach \line in {-1,-.5,...,1}
23391 {
23392 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
23393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
23394 %
23395 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
23396 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
23397 }
23398 %prevent from draw the inner cross twice
23399 \foreach \line in {-.5,0,...,.5}
23400 {
23401 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
23402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
23403 %
23404 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
23405 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
23406 }
23407 \pgfusepath{draw}
23408 }
23409 }
23410
23411
23412 % Wilkinson divider
23413 \pgfdeclareshape{wilkinson}{
23414 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23415 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23416 \savedanchor\northwest{%
23417 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23418 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
23419 \pgf@y=.5\pgf@y
23420 \pgf@x= \pgf@circ@scaled@Rlen
23421 \pgf@x=.5\pgf@x
23422 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
23423 }
23424 \pgfcirc@northwest@symmetric@geoanchors
23425 \anchor{up}{\northwest\pgf@x=0pt}
23426 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23427 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23428 \anchor{left}{\northwest\pgf@y=0pt}
23429 \anchor{center}{\pgfpointorigin}
23430 \anchor{in}{\northwest\pgf@y=0pt}
23431 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23432 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23433 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23434 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23435 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23436 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23437 \anchor{text}{
23438 \northwest
23439 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23440 \pgf@x=-.5\wd\pgfnodeparttextbox
23441 }
23442 \pgf@circ@draw@component{
23443 \pgf@circ@setcolor
23444 \pgf@circ@scaled@Rlen=\scaledRlen
23445 %
23446 \northwest
23447 \pgf@circ@res@up = \pgf@y
23448 \pgf@circ@res@down = -\pgf@y
23449 \pgf@circ@res@right = -\pgf@x
23450 \pgf@circ@res@left = \pgf@x
23451 %
23452 \pgfstartlinewidth=\pgflinewidth
23453 % draw outer box
23454 \pgf@circ@twoportbox
23455 \pgf@circ@inputarrow
23456 % draw inner stuff
23457 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23458 \pgfsetarrows{-} %never draw arrows
23459 \pgfsetlinewidth{\pgfstartlinewidth}
23460 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23461 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23462 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23463 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23464 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23465 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23466 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23467 \pgfusepath{draw}
23468 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23469 % draw inner resisitor - european or american style is recognised
23470 {
23471 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
23472 \pgftransformrotate{90}
23473 % calculate size of resistor
23474 \ifpgf@circuit@europeanresistor
23475 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
23476 \pgftransformscale{\pgfmathresult}
23477 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23478 \else
23479 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
23480 \pgftransformscale{\pgfmathresult}
23481 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23482 \fi
23483 }
23484 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23485 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
23486 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
23487 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23488 \pgfusepath{draw}
23489 }
23490 }
23491
23492 %% resistive splitter
23493 \pgfdeclareshape{splitter}{
23494 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23495 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23496 \savedanchor\northwest{%
23497 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23498 \pgf@y=\ctikzvalof{tripoles/splitter/height}\pgf@circ@scaled@Rlen
23499 \pgf@y=.5\pgf@y
23500 \pgf@x= \pgf@circ@scaled@Rlen
23501 \pgf@x=.5\pgf@x
23502 \pgf@x=-\ctikzvalof{tripoles/splitter/width}\pgf@x
23503 }
23504 \pgfcirc@northwest@symmetric@geoanchors
23505 \anchor{center}{\pgfpointorigin}
23506 \anchor{up}{\northwest\pgf@x=0pt}
23507 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23508 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23509 \anchor{left}{\northwest\pgf@y=0pt}
23510 \anchor{in}{\northwest\pgf@y=0pt}
23511 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23512 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23513 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23514 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23515 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23516 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23517 \anchor{text}{
23518 \northwest
23519 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23520 \pgf@x=-.5\wd\pgfnodeparttextbox
23521 }
23522 \pgf@circ@draw@component{
23523 \pgf@circ@setcolor
23524 \pgf@circ@scaled@Rlen=\scaledRlen
23525 %
23526 \northwest
23527 \pgf@circ@res@up = \pgf@y
23528 \pgf@circ@res@down = -\pgf@y
23529 \pgf@circ@res@right = -\pgf@x
23530 \pgf@circ@res@left = \pgf@x
23531 %
23532 \pgfstartlinewidth=\pgflinewidth
23533 % draw outer box
23534 \pgf@circ@twoportbox
23535 \pgf@circ@inputarrow
23536 % draw inner stuff
23537 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23538 \pgfsetarrows{-} %never draw arrows
23539 \pgfsetlinewidth{\pgfstartlinewidth}
23540 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23541 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23542 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23543 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23544 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23545 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23546 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23547 \pgfusepath{draw}
23548 %
23549 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23550 % draw inner resisitors - european or american style is recognised
23551 \foreach \respt/\resang/\linepta/\lineptb in %
23552 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
23553 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},%
23554 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
23555 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
23556 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
23557 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
23558 {
23559 {
23560 \pgftransformshift{\respt}
23561 \pgftransformrotate{\resang}
23562 % calculate size of resistor
23563 \ifpgf@circuit@europeanresistor
23564 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
23565 \pgftransformscale{\pgfmathresult}
23566 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23567 \else
23568 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
23569 \pgftransformscale{\pgfmathresult}
23570 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23571 \fi
23572 }
23573 \pgfpathmoveto{\linepta}
23574 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
23575 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
23576 \pgfpathlineto{\lineptb}
23577 \pgfusepath{draw}
23578 }
23579 }
23580 }
23581
23582 %% generic splitter
23583 \pgfdeclareshape{genericsplitter}{
23584 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23585 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23586 \savedanchor\northwest{%
23587 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23588 \pgf@y=\ctikzvalof{tripoles/genericsplitter/height}\pgf@circ@scaled@Rlen
23589 \pgf@y=.5\pgf@y
23590 \pgf@x= \pgf@circ@scaled@Rlen
23591 \pgf@x=.5\pgf@x
23592 \pgf@x=-\ctikzvalof{tripoles/genericsplitter/width}\pgf@x
23593 }
23594 \pgfcirc@northwest@symmetric@geoanchors
23595 \anchor{center}{\pgfpointorigin}
23596 \anchor{up}{\northwest\pgf@x=0pt}
23597 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23598 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23599 \anchor{left}{\northwest\pgf@y=0pt}
23600 \anchor{in}{\northwest\pgf@y=0pt}
23601 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23602 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23603 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23604 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23605 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23606 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23607 \anchor{text}{
23608 \northwest
23609 \pgf@y=-.5\ht\pgfnodeparttextbox
23610 \pgf@x=-.2\wd\pgfnodeparttextbox
23611 }
23612 \pgf@circ@draw@component{
23613 \pgf@circ@setcolor
23614 \pgf@circ@scaled@Rlen=\scaledRlen
23615 %
23616 \northwest
23617 \pgf@circ@res@up = \pgf@y
23618 \pgf@circ@res@down = -\pgf@y
23619 \pgf@circ@res@right = -\pgf@x
23620 \pgf@circ@res@left = \pgf@x
23621 %
23622 \pgfstartlinewidth=\pgflinewidth
23623 % draw outer box
23624 \pgf@circ@twoportbox
23625 \pgf@circ@inputarrow
23626 % draw inner stuff
23627 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23628 \pgfsetarrows{-} %never draw arrows
23629 \pgfsetlinewidth{\pgfstartlinewidth}
23630 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23631 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23632 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23633 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23634 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23635 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23636 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23637 \pgfusepath{draw}
23638 %
23639 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23640 % draw inner resisitors - european or american style is recognised
23641 \foreach \linepta/\lineptb in %
23642 { \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
23643 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
23644 {
23645 \pgfpathmoveto{\linepta}
23646 \pgfpathlineto{\lineptb}
23647 \pgfusepath{draw}
23648 }
23649 }
23650 }
23651
23652 %% couplers generics
23653 \long\def\pgfcircdeclarefourport#1#2{
23654 \pgfdeclareshape{#1}{
23655 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23656 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23657 \savedanchor\northwest{%
23658 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23659 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
23660 \pgf@y=.5\pgf@y
23661 \pgf@x=.5\pgf@circ@scaled@Rlen
23662 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
23663 }
23664 \pgfcirc@northwest@symmetric@geoanchors
23665 \anchor{center}{\pgfpointorigin}
23666 \anchor{up}{\northwest\pgf@x=0pt}
23667 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23668 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23669 \anchor{left}{\northwest\pgf@y=0pt}
23670 \anchor{port1}{\northwest\pgf@y=-0.5\pgf@y}
23671 \anchor{port2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23672 \anchor{port3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23673 \anchor{port4}{\northwest\pgf@y=0.5\pgf@y}
23674 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23675 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23676 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23677 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23678 %1,2,3,4 are deprecated
23679 \anchor{1}{\northwest\pgf@y=-0.5\pgf@y}
23680 \anchor{2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23681 \anchor{3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23682 \anchor{4}{\northwest\pgf@y=0.5\pgf@y}
23683 \anchor{text}{
23684 \northwest
23685 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23686 \pgf@x=-.5\wd\pgfnodeparttextbox
23687 }
23688 \pgf@circ@draw@component{
23689 \pgf@circ@setcolor
23690 \northwest
23691 \pgf@circ@res@up = \pgf@y
23692 \pgf@circ@res@down = -\pgf@y
23693 \pgf@circ@res@right = -\pgf@x
23694 \pgf@circ@res@left = \pgf@x
23695 \pgf@circ@scaled@Rlen=\scaledRlen
23696 %
23697 \pgfstartlinewidth=\pgflinewidth
23698 % draw outer box
23699 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23700 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
23701 \pgf@circ@draworfill
23702 % draw inner stuff
23703 #2%
23704 % draw inner text
23705 \pgf@circ@text@strokecolor
23706 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23707 }
23708 }
23709 }
23710
23711 % four-port
23712 \pgfcircdeclarefourport{fourport}{}
23713
23714 % straight coupler
23715 \pgfcircdeclarefourport{coupler}{
23716 \pgfsetlinewidth{\pgfstartlinewidth}
23717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
23718 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23719 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
23720 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23721 \pgfusepath{draw}
23722
23723 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
23724 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
23725 \pgfsetarrows{latex-latex}
23726 \pgfusepath{draw}
23727 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
23728 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
23729 \pgfsetarrows{latex-latex}
23730 \pgfusepath{draw}
23731 }
23732
23733 % "bended" coupler
23734 \pgfcircdeclarefourport{coupler2}{
23735 \pgfsetlinewidth{\pgfstartlinewidth}
23736 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
23737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23738 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
23739 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23740 \pgfusepath{draw}
23741
23742 \pgfscope
23743 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
23744 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
23745 \pgfsetarrowsend{latex}
23746 \pgfusepath{draw}
23747 \endpgfscope
23748 \pgfscope
23749 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
23750 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
23751 \pgfsetarrowsend{latex}
23752 \pgfusepath{draw}
23753 \endpgfscope
23754 \pgfscope
23755 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
23756 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
23757 \pgfsetarrowsend{latex}
23758 \pgfusepath{draw}
23759 \endpgfscope
23760 \pgfscope
23761 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
23762 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
23763 \pgfsetarrowsend{latex}
23764 \pgfusepath{draw}
23765 \endpgfscope
23766 }
23767
23768 % mach zehnder modulator
23769 \pgfdeclareshape{mzm}{
23770 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23771 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23772 \savedanchor\northwest{%
23773 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23774 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
23775 \pgf@y=.5\pgf@y
23776 \pgf@x= \pgf@circ@scaled@Rlen
23777 \pgf@x=.5\pgf@x
23778 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
23779 }
23780 \pgfcirc@northwest@symmetric@geoanchors
23781 \anchor{center}{\pgfpointorigin}
23782 \anchor{in}{ \northwest \pgf@y=0pt }
23783 \anchor{mod}{ \northwest \pgf@x=0pt }
23784 \anchor{out}{ \northwest \pgf@x=-\pgf@x \pgf@y=0pt }
23785 \anchor{text}{
23786 \northwest
23787 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23788 \pgf@x=-.5\wd\pgfnodeparttextbox
23789 }
23790 \pgf@circ@draw@component{
23791 \pgf@circ@setcolor
23792 \pgf@circ@scaled@Rlen=\scaledRlen
23793 \northwest
23794 \pgf@circ@res@up = \pgf@y
23795 \pgf@circ@res@down = -\pgf@y
23796 \pgf@circ@res@right = -\pgf@x
23797 \pgf@circ@res@left = \pgf@x
23798 \pgfstartlinewidth=\pgflinewidth
23799 % draw outer box
23800 \pgf@circ@twoportbox
23801 \pgf@circ@inputarrow
23802 % draw inner stuff
23803 \pfgcirc@twoport@rotate@inner@symbol
23804 % draw inner symbol
23805 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23806 \pgfsetarrows{-} %never draw arrows
23807 \pgfsetlinewidth{\pgfstartlinewidth}
23808 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
23809 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
23810 %
23811 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
23812 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
23813 %
23814 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
23815 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
23816 %
23817 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
23818 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
23819 %
23820 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
23821 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
23822 %
23823 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
23824 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
23825 %
23826 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
23827 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
23828 %
23829 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
23830 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
23831 %
23832 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
23833 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
23834 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
23835 \pgfusepath{draw}
23836 }
23837 }
23838 % %>>>
23839
23840 % vim: set fdm=marker fmr=%<<<,%>>>:
23841 %%%---------- close: tex/pgfcircquadpoles
23842 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
23843 %%%---------- open: tex/pgfcircmultipoles.tex
23844 % Copyright 2018-2026 by Romano Giannetti
23845 % Copyright 2015-2026 by Stefan Lindner
23846 % Copyright 2013-2026 by Stefan Erhardt
23847 % Copyright 2007-2026 by Massimo Redaelli
23848 %
23849 % This file may be distributed and/or modified
23850 %
23851 % 1. under the LaTeX Project Public License and/or
23852 % 2. under the GNU Public License.
23853 %
23854 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
23855
23856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23857 %% Chips and Rotary Switches
23858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23859
23860 % Definitions for Chips and Rotary switches (multipoles) %<<<1
23861 %
23862 \ctikzset{multipoles/thickness/.initial=2}
23863 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
23864 \ctikzset{multipoles/draw only pins/.initial={all}}
23865 \ctikzset{multipoles/draw only left pins/.initial={all}}
23866 \ctikzset{multipoles/draw only right pins/.initial={all}}
23867 \ctikzset{multipoles/draw only top pins/.initial={all}}
23868 \ctikzset{multipoles/draw only bottom pins/.initial={all}}
23869 \pgfqkeys{/tikz}{draw only pins/.add code={}{\ctikzset{multipoles/draw only pins={#1}}}}
23870 \pgfqkeys{/tikz}{draw only left pins/.add code={}{\ctikzset{multipoles/draw only left pins={#1}}}}
23871 \pgfqkeys{/tikz}{draw only right pins/.add code={}{\ctikzset{multipoles/draw only right pins={#1}}}}
23872 \pgfqkeys{/tikz}{draw only top pins/.add code={}{\ctikzset{multipoles/draw only top pins={#1}}}}
23873 \pgfqkeys{/tikz}{draw only bottom pins/.add code={}{\ctikzset{multipoles/draw only bottom pins={#1}}}}
23874 % DIP (dual in line package) chips
23875 \ctikzset{multipoles/dipchip/width/.initial=1.2}
23876 \ctikzset{multipoles/dipchip/num pins/.initial=8}
23877 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
23878 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
23879 % QFP (quad flat package) chips
23880 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
23881 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
23882 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
23883 % chip numbers
23884 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
23885 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
23886 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
23887 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
23888 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
23889 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
23890 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
23891 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
23892 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
23893 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
23894 % external chip pins
23895 \ctikzset{multipoles/external pins thickness/.initial=1}
23896 \ctikzset{multipoles/external pins width/.initial=0.2}
23897 \ctikzset{multipoles/external pad fraction/.initial=0}
23898 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
23899 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
23900 % topmarks
23901 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
23902 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
23903 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
23904 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
23905 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
23906
23907 % rotary switch by Romano
23908 \ctikzset{multipoles/rotary/thickness/.initial=1}
23909 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
23910 \ctikzset{multipoles/rotary/channels/.initial=5}
23911 \ctikzset{multipoles/rotary/angle/.initial=60}
23912 \ctikzset{multipoles/rotary/wiper/.initial=20}
23913 \ctikzset{multipoles/rotary/arrow/.is choice}
23914 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
23915 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
23916 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
23917 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
23918 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
23919 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
23920 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
23921
23922 \tikzset{%
23923 rotary switch/.style args={#1in#2wiper#3}{%
23924 shape=rotaryswitch,
23925 /tikz/circuitikz/multipoles/rotary/channels=#1,
23926 /tikz/circuitikz/multipoles/rotary/angle=#2,
23927 /tikz/circuitikz/multipoles/rotary/wiper=#3,
23928 },
23929 rotary switch -/.style args={#1in#2wiper#3}{
23930 rotary switch=#1 in #2 wiper #3,
23931 /tikz/circuitikz/multipoles/rotary/arrow=none,
23932 },
23933 rotary switch <-/.style args={#1in#2wiper#3}{
23934 rotary switch=#1 in #2 wiper #3,
23935 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
23936 },
23937 rotary switch ->/.style args={#1in#2wiper#3}{
23938 rotary switch=#1 in #2 wiper #3,
23939 /tikz/circuitikz/multipoles/rotary/arrow=cw,
23940 },
23941 rotary switch <->/.style args={#1in#2wiper#3}{
23942 rotary switch=#1 in #2 wiper #3,
23943 /tikz/circuitikz/multipoles/rotary/arrow=both,
23944 },
23945 % Notice that these should be the same as the initial values of the keys
23946 rotary switch/.default={5 in 60 wiper 20},
23947 rotary switch -/.default={5 in 60 wiper 20},
23948 rotary switch <-/.default={5 in 60 wiper 20},
23949 rotary switch ->/.default={5 in 60 wiper 20},
23950 rotary switch <->/.default={5 in 60 wiper 20},
23951 }
23952 %%>>>
23953
23954 %% Nodes definitions for chips%<<<
23955
23956 %%%%%%%%%
23957 %% Chips
23958 %%%%%%%%%
23959
23960 % let's use the same shifts everywhere, no magic numbers
23961 \def\pgf@circ@dip@pin@shift{0.5}
23962 \def\pgf@circ@qfp@pin@shift{0.25}
23963
23964 % derived from https://tex.stackexchange.com/a/146753/38080
23965 % original author Mark Wibrow
23966 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
23967 % a lot of thanks to @marmot for the un-rotation hint
23968 % https://tex.stackexchange.com/a/473571/38080
23969 % modifications for 'draw only pins' by Jonathan P. Spratte
23970
23971 % DIP (dual in line package) chips
23972
23973 % helper macro to set the anchors inside a loop (to expand the current count)
23974 \pgfutil@protected\def\pgf@circ@make@dippin@anchor#1%
23975 {%
23976 \expandafter\gdef\csname pgf@anchor@dipchip@pin #1\endcsname
23977 {%
23978 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
23979 {\pgf@circ@dippinanchor{#1}{1}}
23980 {\pgf@circ@dippinanchor{#1}{0}}%
23981 }%
23982 \expandafter\gdef\csname pgf@anchor@dipchip@bpin #1\endcsname
23983 {\pgf@circ@dippinanchor{#1}{0}}%
23984 }
23985
23986 \pgfdeclareshape{dipchip}{
23987 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
23988 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23989 \savedmacro\numpins{%
23990 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
23991 \def\numpins{\the\pgf@circ@count@a}
23992 }
23993 \savedmacro\pgf@circ@pins@list
23994 {%
23995 \pgfkeysgetvalue
23996 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
23997 \expandafter\pgf@circ@set@list
23998 \expandafter\pgf@circ@pins@list
23999 \expandafter{\pgf@circ@temp}%
24000 }%
24001 \savedanchor\centerpoint{%
24002 \pgf@x=-.5\wd\pgfnodeparttextbox%
24003 \pgf@y=-.5\ht\pgfnodeparttextbox%
24004 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24005 }%
24006 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
24007 \anchor{center}{\origin}
24008 \anchor{text}{\centerpoint}% to adjust text
24009 \saveddimen\height{%
24010 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24011 \pgfmathsetlength\pgf@x{((\numpins)
24012 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
24013 }%
24014 \saveddimen{\chipspacing}{
24015 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24016 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
24017 \saveddimen{\width}{
24018 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24019 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
24020 \saveddimen{\extshift}{
24021 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24022 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24023 % standard anchors
24024 \savedanchor\northwest{%
24025 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24026 \pgfmathsetlength\pgf@y{0.5*((\numpins)
24027 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
24028 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
24029 }
24030 \anchor{dot}{\northwest
24031 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
24032 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
24033 }
24034 \anchor{nw}{\northwest}
24035 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24036 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24037 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24038 \anchor{north west}{\northwest}
24039 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24040 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24041 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24042 \anchor{n}{\northwest\pgf@x=0pt }
24043 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24044 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24045 \anchor{w}{\northwest\pgf@y=0pt }
24046 \anchor{north}{\northwest\pgf@x=0pt }
24047 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24048 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24049 \anchor{west}{\northwest\pgf@y=0pt }
24050 % start drawing
24051 \pgf@circ@draw@component{%
24052 \northwest
24053 \pgf@circ@res@up = \pgf@y
24054 \pgf@circ@res@down = -\pgf@y
24055 \pgf@circ@res@right = -\pgf@x
24056 \pgf@circ@res@left = \pgf@x
24057 \pgf@circ@scaled@Rlen=\scaledRlen
24058 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
24059 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
24060 \pgfscope% (for the line width)
24061 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24062 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
24063 \pgf@circ@draworfill
24064 %% upside mark
24065 \ifpgf@circuit@chip@topmark
24066 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
24067 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
24068 \fi
24069 \pgfusepath{stroke}%
24070 \pgf@circ@setcolor
24071 % Adding the pin number
24072 \ifpgf@circuit@chip@shownumbers
24073 \pgf@circ@count@a=\numpins\relax
24074 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24075 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
24076 \ifpgf@circuit@chip@straightnumbers
24077 \pgfgettransformentries\a\b\temp\temp\temp\temp
24078 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
24079 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
24080 \else
24081 \pgfmathsetmacro{\rot}{0}
24082 \pgfmathsetmacro{\quadrant}{0}
24083 \fi
24084 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
24085 \pgfscope\pgf@circ@text@strokecolor
24086 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
24087 \pgfmathloop%
24088 \ifnum\pgf@circ@count@a>0
24089 \ifcase\quadrant % rotation 0
24090 % left
24091 \pgf@circ@count@c=\pgf@circ@count@a
24092 \pgftext[left,
24093 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24094 rotate=\rot]{\mytext}
24095 % right
24096 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24097 \pgftext[right,
24098 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24099 rotate=\rot]{\mytext}
24100 \or % rotation -90
24101 % left
24102 \pgf@circ@count@c=\pgf@circ@count@a
24103 \pgftext[top,
24104 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24105 rotate=\rot]{\mytext}
24106 % right
24107 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24108 \pgftext[bottom,
24109 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24110 rotate=\rot]{\mytext}
24111 \or %rotation 180
24112 % left
24113 \pgf@circ@count@c=\pgf@circ@count@a
24114 \pgftext[right,
24115 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24116 rotate=\rot]{\mytext}
24117 % right
24118 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24119 \pgftext[left,
24120 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24121 rotate=\rot]{\mytext}
24122 \or % rotation +90
24123 % left
24124 \pgf@circ@count@c=\pgf@circ@count@a
24125 \pgftext[bottom,
24126 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24127 rotate=\rot]{\mytext}
24128 % right
24129 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24130 \pgftext[top,
24131 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24132 rotate=\rot]{\mytext}
24133 \fi
24134 \advance\pgf@circ@count@a-1\relax%
24135 \repeatpgfmathloop
24136 \endpgfscope % for color of text
24137 \fi
24138 \endpgfscope
24139 % draw external pins or pads
24140 \ifdim\pgf@circ@res@other>0pt
24141 \ifpgfcirc@draw@input@leads
24142 \pgfscope
24143 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24144 \pgf@circ@count@a=\numpins\relax
24145 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24146 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
24147 \ifnum\padfrac>0
24148 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
24149 \fi
24150 \pgfmathloop%
24151 \ifnum\pgf@circ@count@a>0
24152 % left side
24153 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24154 {%
24155 \ifnum\padfrac>0
24156 % pads
24157 \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}}
24158 \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}}
24159 \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}}
24160 \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}}
24161 \else
24162 % pins
24163 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24164 \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}}
24165 \fi
24166 }
24167 {}%
24168 % right side
24169 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins+1-\pgf@circ@count@a}
24170 {%
24171 \ifnum\padfrac>0
24172 % pads
24173 \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}}
24174 \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}}
24175 \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}}
24176 \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}}
24177 \else
24178 % pins
24179 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24180 \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}}
24181 \fi
24182 }
24183 {}%
24184 \advance\pgf@circ@count@a by -1\relax%
24185 \repeatpgfmathloop
24186 \pgfusepath{stroke}
24187 \endpgfscope
24188 \fi
24189 \fi
24190 }%
24191 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
24192 \pgf@circ@count@a=\numpins
24193 \pgfmathloop
24194 \ifnum\pgf@circ@count@a>0
24195 % we will create two anchors per pin: the "normal one" like `pin 1` for the
24196 % electrical contact, and the "border one" like `bpin 1` for labels.
24197 % they will coincide if `external pins width` is set to 0.
24198 % see the helper function above the start of the shape definition (by Jonathan P. Spratte)
24199 \expandafter\pgf@circ@make@dippin@anchor\expandafter{\the\pgf@circ@count@a}%
24200 \advance\pgf@circ@count@a by -1\relax
24201 \repeatpgfmathloop
24202 }%
24203 }
24204
24205 % QFP (quad flat package) chips
24206 % helper macro to set the anchors inside a loop (to expand the current count)
24207 \pgfutil@protected\def\pgf@circ@make@qfppin@anchor#1%
24208 {%
24209 \expandafter\gdef\csname pgf@anchor@qfpchip@pin #1\endcsname
24210 {%
24211 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
24212 {\pgf@circ@qfppinanchor{#1}{1}}
24213 {\pgf@circ@qfppinanchor{#1}{0}}%
24214 }%
24215 \expandafter\gdef\csname pgf@anchor@qfpchip@bpin #1\endcsname
24216 {\pgf@circ@qfppinanchor{#1}{0}}%
24217 }
24218
24219 \pgfdeclareshape{qfpchip}{
24220 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
24221 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24222 \savedmacro\numpins{%
24223 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
24224 \def\numpins{\the\pgf@circ@count@a}
24225 }
24226 \savedmacro\pgf@circ@pins@list
24227 {% some magic here, thanks to Jonathan P. Spratte
24228 \pgfkeysgetvalue
24229 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
24230 \expandafter\pgf@circ@set@list
24231 \expandafter\pgf@circ@pins@list
24232 \expandafter{\pgf@circ@temp}%
24233 }%
24234 \savedanchor\centerpoint{%
24235 \pgf@x=-.5\wd\pgfnodeparttextbox%
24236 \pgf@y=-.5\ht\pgfnodeparttextbox%
24237 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24238 }%
24239 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
24240 \anchor{center}{\origin}
24241 \anchor{text}{\centerpoint}% to adjust text
24242 \saveddimen\height{%
24243 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24244 \pgfmathsetlength\pgf@x{((\numpins+2)
24245 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24246 }%
24247 \saveddimen\width{%
24248 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24249 \pgfmathsetlength\pgf@x{((\numpins+2)
24250 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24251 }%
24252 \saveddimen{\chipspacing}{
24253 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24254 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
24255 \saveddimen{\extshift}{
24256 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24257 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24258 % standard anchors
24259 \savedanchor\northwest{%
24260 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24261 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
24262 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24263 \pgf@x=-\pgf@y
24264 }
24265 \anchor{dot}{\northwest
24266 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
24267 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
24268 }
24269 \anchor{nw}{\northwest}
24270 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24271 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24272 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24273 \anchor{north west}{\northwest}
24274 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24275 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24276 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24277 \anchor{n}{\northwest\pgf@x=0pt }
24278 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24279 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24280 \anchor{w}{\northwest\pgf@y=0pt }
24281 \anchor{north}{\northwest\pgf@x=0pt }
24282 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24283 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24284 \anchor{west}{\northwest\pgf@y=0pt }
24285 % start drawing
24286 \pgf@circ@draw@component{%
24287 \northwest
24288 \pgf@circ@res@up = \pgf@y
24289 \pgf@circ@res@down = -\pgf@y
24290 \pgf@circ@res@right = -\pgf@x
24291 \pgf@circ@res@left = \pgf@x
24292 \pgf@circ@scaled@Rlen=\scaledRlen
24293 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
24294 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
24295 \pgfscope% (for the line width)
24296 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24297 %% upside mark
24298 \ifpgf@circuit@chip@topmark
24299 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
24300 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
24301 \else
24302 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
24303 \fi
24304 %% rest of the shape
24305 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
24306 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
24307 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
24308 \pgfpathclose
24309 \pgf@circ@draworfill
24310 % Adding the pin number
24311 \pgf@circ@setcolor
24312 \ifpgf@circuit@chip@shownumbers
24313 \pgf@circ@count@a=\numpins%
24314 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
24315 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
24316 \ifpgf@circuit@chip@straightnumbers
24317 \pgfgettransformentries\a\b\temp\temp\temp\temp
24318 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
24319 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
24320 \else
24321 \pgfmathsetmacro{\rot}{0}
24322 \pgfmathsetmacro{\quadrant}{0}
24323 \fi
24324 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
24325 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
24326 \pgfscope\pgf@circ@text@strokecolor
24327 \pgfmathloop%
24328 \ifnum\pgf@circ@count@a>0
24329 \ifcase\quadrant % rotation 0
24330 % left
24331 \pgf@circ@count@c=\pgf@circ@count@a
24332 \pgftext[left,
24333 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24334 rotate=\rot]{\mytext}
24335 % bottom
24336 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24337 \pgftext[bottom,
24338 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24339 rotate=\rot]{\mytext}
24340 % right
24341 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24342 \pgftext[right,
24343 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24344 rotate=\rot]{\mytext}
24345 % top
24346 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24347 \pgftext[top,
24348 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24349 rotate=\rot]{\mytext}
24350 \or % rotation -90
24351 % left
24352 \pgf@circ@count@c=\pgf@circ@count@a
24353 \pgftext[top,
24354 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24355 rotate=\rot]{\mytext}
24356 % bottom
24357 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24358 \pgftext[left,
24359 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24360 rotate=\rot]{\mytext}
24361 % right
24362 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24363 \pgftext[bottom,
24364 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24365 rotate=\rot]{\mytext}
24366 % top
24367 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24368 \pgftext[right,
24369 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24370 rotate=\rot]{\mytext}
24371 \or %rotation 180
24372 % left
24373 \pgf@circ@count@c=\pgf@circ@count@a
24374 \pgftext[right,
24375 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24376 rotate=\rot]{\mytext}
24377 % bottom
24378 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24379 \pgftext[top,
24380 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24381 rotate=\rot]{\mytext}
24382 % right
24383 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24384 \pgftext[left,
24385 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24386 rotate=\rot]{\mytext}
24387 % top
24388 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24389 \pgftext[bottom,
24390 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24391 rotate=\rot]{\mytext}
24392 \or % rotation +90
24393 % left
24394 \pgf@circ@count@c=\pgf@circ@count@a
24395 \pgftext[bottom,
24396 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24397 rotate=\rot]{\mytext}
24398 % bottom
24399 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24400 \pgftext[right,
24401 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24402 rotate=\rot]{\mytext}
24403 % right
24404 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24405 \pgftext[top,
24406 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24407 rotate=\rot]{\mytext}
24408 % top
24409 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24410 \pgftext[left,
24411 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24412 rotate=\rot]{\mytext}
24413 \fi
24414 \advance\pgf@circ@count@a-1\relax%
24415 \repeatpgfmathloop
24416 \endpgfscope % for the text labels
24417 \fi
24418 \endpgfscope
24419 \ifdim\pgf@circ@res@other>0pt
24420 \ifpgfcirc@draw@input@leads
24421 \pgfscope
24422 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24423 \pgf@circ@count@a=\numpins%
24424 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
24425 \pgfmathloop%
24426 \ifnum\pgf@circ@count@a>0
24427 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
24428 \ifnum\padfrac>0
24429 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
24430 % left side pads
24431 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24432 {%
24433 \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}}
24434 \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}}
24435 \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}}
24436 \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}}
24437 }{}%
24438 % bottom side pads
24439 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
24440 {%
24441 \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}}
24442 \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}}
24443 \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}}
24444 \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}}
24445 }{}%
24446 % right side pads
24447 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
24448 {%
24449 \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}}
24450 \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}}
24451 \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}}
24452 \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}}
24453 }{}%
24454 % top side pads
24455 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
24456 {%
24457 \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}}
24458 \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}}
24459 \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}}
24460 \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}}
24461 }{}%
24462 \else
24463 % left side pins
24464 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24465 {%
24466 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24467 \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}}
24468 }{}%
24469 % bottom side pins
24470 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
24471 {%
24472 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
24473 \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}}
24474 }{}%
24475 % right side pins
24476 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
24477 {%
24478 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24479 \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}}
24480 }{}%
24481 % top side pins
24482 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
24483 {%
24484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
24485 \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}}
24486 }{}%
24487 \fi
24488 \advance\pgf@circ@count@a-1\relax%
24489 \repeatpgfmathloop
24490 \pgfusepath{stroke}
24491 \endpgfscope
24492 \fi
24493 \fi
24494 }%
24495 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
24496 % and is executed just before a node is drawn.
24497 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
24498 % Start with the maximum pin number and go backwards.
24499 \pgf@circ@count@a=\numpins%
24500 \pgfmathloop%
24501 \ifnum\pgf@circ@count@a>0
24502 \expandafter\pgf@circ@make@qfppin@anchor\expandafter{\the\pgf@circ@count@a}%
24503 \advance\pgf@circ@count@a-1\relax%
24504 \repeatpgfmathloop%
24505 }%
24506 }
24507
24508 %% anchors for DIP
24509 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24510 \c@pgf@countc=\numpins\relax
24511 \divide\c@pgf@countc by 2
24512 \ifnum #1 > \the\c@pgf@countc
24513 % right side
24514 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
24515 \else
24516 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
24517 \fi
24518 }
24519
24520 %% anchors for QFP
24521 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24522 \c@pgf@countc=\numpins\relax
24523 \divide\c@pgf@countc by 4
24524 \ifnum #1 > \the\c@pgf@countc
24525 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
24526 \ifnum #1 > \the\c@pgf@countb
24527 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
24528 \ifnum #1 > \the\c@pgf@countb
24529 % 3*npins/4 < pin, top side
24530 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
24531 \else
24532 % 2*npins/4 < pin <= 3*npins/4, right side
24533 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
24534 \fi
24535 \else
24536 % npins/4 < pin <= 2*npins/4, bottom side
24537 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
24538 \fi
24539 \else
24540 % <= npins/4, left side
24541 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
24542 \fi
24543 }% %>>>
24544
24545 %% Nodes definition for rotaryswitch%<<<
24546
24547 %%%%%%%%%%%%%%%%%
24548 %% Rotary Switch
24549 %%%%%%%%%%%%%%%%%
24550
24551 \pgfdeclareshape{rotaryswitch}
24552 {
24553 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
24554 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24555 \savedanchor\northeast{%
24556 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24557 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24558 % the magic number is 0.25/cos(35)
24559 % try to recalculate it for the actual switch
24560 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24561 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24562 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24563 \edef\r{\ctikzvalof{nodes width}}
24564 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24565 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
24566 }
24567 \savedanchor\northwest{%
24568 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24569 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24570 % the magic number is 0.25/cos(35)
24571 % try to recalculate it for the actual switch
24572 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24573 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24574 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24575 \edef\r{\ctikzvalof{nodes width}}
24576 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24577 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
24578 }
24579 \savedanchor\central{%
24580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24581 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24582 % the magic number is 0.25/cos(35)
24583 % try to recalculate it for the actual switch
24584 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24585 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24586 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24587 \edef\r{\ctikzvalof{nodes width}}
24588 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24589 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
24590 }
24591 % external square limits
24592 \savedanchor\extnorthwest{%
24593 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24594 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24595 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24596 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
24597 \pgf@x=2.5\pgf@x % external square size
24598 \pgf@y=-\pgf@x %square thing when angle=180?
24599 }
24600 \saveddimen{\width}{
24601 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24602 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
24603 % radius of the connector
24604 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
24605 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
24606 % shapename
24607 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
24608 % shape type
24609 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
24610 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
24611 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
24612 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
24613 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
24614 % mid of the lever, to stack switches
24615 %\anchor{mid}{\midlever}
24616 \anchor{mid}{\northwest
24617 \pgf@circ@res@temp=-\pgf@x
24618 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
24619 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
24620 }
24621 %
24622 % Notice that the "in" anchors must mimic "ext center", otherwise they are
24623 % wrong for angles > 90 degrees!
24624 %
24625 % center anchors
24626 \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
24627 % horizontal angles
24628 \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
24629 \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
24630
24631 \anchor{center}{ \central \pgf@y=0pt }
24632 \anchor{east}{ \northeast \pgf@y=0pt }
24633 \anchor{west}{ \northwest \pgf@y=0pt }
24634 \anchor{south}{ \central \pgf@y=-\pgf@y }
24635 \anchor{north}{ \central }
24636 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
24637 \anchor{north east}{ \northeast }
24638 \anchor{north west}{ \northwest }
24639 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
24640
24641 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
24642 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
24643 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
24644 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24645 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
24646 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24647 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
24648 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
24649 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24650
24651 \pgf@circ@draw@component{
24652 \pgf@circ@setcolor
24653 \pgf@circ@res@right = \width
24654 \pgf@circ@res@left = -\width
24655
24656 \pgfscope %wiper
24657 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
24658 \pgf@circ@res@temp=\radius\relax
24659 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
24660 \pgfsetlinewidth{2\pgf@circ@res@temp}
24661 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
24662 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
24663 \pgfsetroundcap\pgfusepath{draw}
24664 \endpgfscope
24665
24666 \ifpgf@circ@rotaryarrow
24667 \pgfscope % arrow
24668 \pgfcirc@set@arrows{switch}{\ifpgf@circ@rotaryarrow@ccw latexslim\fi}{\ifpgf@circ@rotaryarrow@cw latexslim\fi}
24669 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
24670 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
24671 \pgftransformrotate{\wiper}
24672 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
24673 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
24674 \ifpgf@circ@rotaryarrow@ccw
24675 \ifpgf@circ@rotaryarrow@cw
24676 % both here, maintain values
24677 \relax
24678 \else
24679 % only ccw: remove end arrow
24680 \pgfsetarrowsend{}
24681 \fi
24682 \else
24683 \ifpgf@circ@rotaryarrow@cw
24684 % only cw: remove start arrow
24685 \pgfsetarrowsstart{}
24686 \else
24687 % none: shouldn't happen
24688 \relax
24689 \fi
24690 \fi
24691 \pgfusepath{draw}
24692 \endpgfscope
24693 \fi
24694
24695 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
24696 \pgf@circ@count@a=\channels\relax
24697 \pgfmathsetmacro{\currenta}{-\angle}
24698 \pgfmathloop%
24699 \ifnum\pgf@circ@count@a>0
24700 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
24701 \pgfscope
24702 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
24703 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
24704 \endpgfscope
24705 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
24706 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
24707 \advance\pgf@circ@count@a by -1\relax%
24708 \repeatpgfmathloop
24709
24710 \pgfscope % input
24711 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
24712 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
24713 \endpgfscope
24714 }
24715 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
24716 % and is executed just before a node is drawn.
24717 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
24718 % Start with the maximum pin number and go backwards.
24719 \pgf@circ@count@a=\channels\relax
24720 \pgfmathloop%
24721 \ifnum\pgf@circ@count@a>0
24722 % we will create two anchors per pin: the "normal one" like `pin 1` for the
24723 % electrical contact, and the "border one" like `bpin 1` for labels.
24724 % they will coincide if `external pins width` is set to 0.
24725 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
24726 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
24727 }
24728 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
24729 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
24730 }
24731 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
24732 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
24733 }
24734 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
24735 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}%
24736 }
24737 \advance\pgf@circ@count@a by -1\relax%
24738 \repeatpgfmathloop%
24739 }%
24740 }
24741
24742 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
24743 \pgf@circ@res@temp=\width
24744 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
24745 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
24746 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
24747 \advance\pgf@x by -\pgf@circ@res@temp
24748 }
24749
24750 \def\pgf@circ@rotarysqanchor#1{% external square anchors
24751 \pgf@circ@res@temp=\width
24752 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
24753 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
24754 \advance\pgf@x by -\pgf@circ@res@temp
24755 }% %>>>
24756
24757 %%%%%%%%%%%%%%%%%%%%%%%%%%
24758 % Seven segments displays
24759 %%%%%%%%%%%%%%%%%%%%%%%%%%
24760
24761 % Definitions for seven segment displays by RGtti%<<<1
24762
24763 \newif\ifpgf@circ@sevenseg@dot
24764 \newif\ifpgf@circ@sevenseg@box
24765 \def\pgf@circ@sevenseg@dotstate{empty}
24766 \ctikzset{seven seg/.is family}
24767 \ctikzset{seven seg/dot/.is choice}
24768 % none means no dot, not space for it. Empty means no dot, but space
24769 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
24770 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
24771 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
24772 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
24773 %
24774 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
24775 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
24776 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
24777 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
24778 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
24779 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
24780 \ctikzset{seven seg/box/.is choice}
24781 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
24782 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
24783
24784 \ctikzset{seven seg/bits/.initial=0000000}
24785
24786 \ctikzset{seven seg/value/.code={%
24787 \edef\@@tmp{#1}%
24788 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
24789 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
24790 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
24791 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
24792 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
24793 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
24794 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
24795 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
24796 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
24797 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
24798 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
24799 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
24800 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
24801 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
24802 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
24803 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
24804 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
24805 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
24806 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
24807 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
24808 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
24809 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
24810 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
24811 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
24812 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
24813 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
24814 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
24815 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
24816 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
24817 }}
24818
24819 \tikzset{%
24820 seven segment val/.style args={#1dot#2box#3}{%
24821 shape=bare7seg,
24822 /tikz/circuitikz/seven seg/value=#1,
24823 /tikz/circuitikz/seven seg/dot=#2,
24824 /tikz/circuitikz/seven seg/box=#3,
24825 },
24826 seven segment bits/.style args={#1dot#2box#3}{%
24827 shape=bare7seg,
24828 /tikz/circuitikz/seven seg/bits=#1,
24829 /tikz/circuitikz/seven seg/dot=#2,
24830 /tikz/circuitikz/seven seg/box=#3,
24831 },
24832 }
24833 %%>>>
24834
24835 %% Nodes definitions for 7-segment display%<<<
24836 \pgfdeclareshape{bare7seg}{
24837 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
24838 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24839 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
24840 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
24841 \ifpgf@circ@sevenseg@dot
24842 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
24843 \else
24844 \pgf@x=0pt
24845 \fi
24846 }
24847 % The object extension is more or less (-width/2,-width) to (width/2,width)
24848 % and adjusted for line thickness (both sides) and eventually the dot
24849 \saveddimen{\width}{
24850 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24851 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
24852 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
24853 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
24854 \savedanchor{\southwest}{% both negative
24855 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24856 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
24857 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
24858 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
24859 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
24860 }
24861 \savedanchor{\northeast}{% both positive
24862 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24863 \ifpgf@circ@sevenseg@dot
24864 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
24865 \else
24866 \pgf@circ@res@other=0pt
24867 \fi
24868 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
24869 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
24870 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
24871 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
24872 }
24873 \savedanchor{\topright}{% anchor without the box sep and the thickness
24874 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24875 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
24876 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
24877 }
24878 \anchor{center}{\pgfpointorigin}
24879 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
24880 \anchor{north east}{\northeast}
24881 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
24882 \anchor{south west}{\southwest}
24883 \anchor{north}{\northeast\pgf@x=0pt}
24884 \anchor{east}{\northeast\pgf@y=0pt}
24885 \anchor{south}{\southwest\pgf@x=0pt}
24886 \anchor{west}{\southwest\pgf@y=0pt}
24887 \anchor{a}{\topright\pgf@x=0pt}
24888 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
24889 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
24890 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
24891 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
24892 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
24893 \anchor{g}{\pgfpointorigin}
24894 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
24895 \pgf@circ@draw@component{%
24896 \southwest % I do not want the dot here, it will stick out
24897 \pgf@circ@res@up = -\pgf@y
24898 \pgf@circ@res@down = \pgf@y
24899 \pgf@circ@res@right = \pgf@x
24900 \pgf@circ@res@left = -\pgf@x
24901 \pgfscope
24902 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24903 \pgf@circ@setcolor
24904 \pgfpathrectanglecorners%
24905 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
24906 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
24907 \ifpgf@circ@sevenseg@box
24908 \pgf@circ@draworfill
24909 \else
24910 \pgf@circ@maybefill
24911 \fi
24912 \endpgfscope
24913 \edef\bits{\ctikzvalof{seven seg/bits}}
24914 \pgfscope
24915 \pfg@circ@sseg@drawbits{\bits}
24916 \endpgfscope
24917 \pgfscope
24918 \ifpgf@circ@sevenseg@dot
24919 \pgf@circ@sseg@drawdots
24920 \fi
24921 \endpgfscope
24922 }
24923 }
24924
24925 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
24926 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
24927 }
24928 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
24929 \ifnum #1 > 0\relax
24930 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
24931 \else
24932 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
24933 \fi
24934 \pgfpathmoveto{\pgfpoint{#2}{#3}}
24935 \pgfpathlineto{\pgfpoint{#4}{#5}}
24936 \pgfusepath{draw}
24937 }
24938 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
24939 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
24940 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
24941 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
24942 % \pgfsetroundcap
24943 \pgfsetarrowsstart{Triangle Cap[]}
24944 \pgfsetarrowsend{Triangle Cap[]}
24945 % segments
24946 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
24947 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
24948 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
24949 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
24950 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
24951 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
24952 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
24953 }
24954 \def\pgf@circ@sseg@drawdots{% dots
24955 \edef\what{empty}
24956 \ifx\what\pgf@circ@sevenseg@dotstate
24957 % do nothing
24958 \else
24959 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
24960 \edef\what{off}
24961 \ifx\what\pgf@circ@sevenseg@dotstate
24962 % dot off
24963 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
24964 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
24965 \else
24966 % dot on
24967 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
24968 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
24969 \fi
24970 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
24971 \pgfusepath{draw,fill}
24972 \fi
24973 }
24974 % %>>>
24975
24976 %%%%%%%%%%%%%%%%%%%%%%%%
24977 %% Flip-flops and muxdemuxes
24978 %%%%%%%%%%%%%%%%%%%%%%%%
24979
24980 % Settings for flip flops and muxdemxes%<<<1
24981
24982 %% flip-flop specific keys (most others are the same as chips)
24983
24984 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
24985 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
24986 \ctikzset{multipoles/flipflop/width/.initial=1.2}
24987 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
24988 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
24989
24990 %% muxdemuxes internal keys
24991
24992 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
24993 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
24994 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
24995 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
24996 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
24997 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
24998 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
24999 \ctikzset{multipoles/muxdemux/NL/.initial=8}
25000 \ctikzset{multipoles/muxdemux/NR/.initial=1}
25001 \ctikzset{multipoles/muxdemux/NB/.initial=3}
25002 \ctikzset{multipoles/muxdemux/NT/.initial=0}
25003 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
25004 \ctikzset{multipoles/muxdemux/bgpicture/.code={}}%
25005
25006 % Thanks to @marmot
25007 % this should automatically create a key in this subfamily
25008 \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/label/.is family,
25009 \circuitikzbasekey/multipoles/muxdemux/label,
25010 .unknown/.code = {
25011 \pgfkeyssetvalue{\pgfkeyscurrentpath/\pgfkeyscurrentname}{#1}
25012 }
25013 }
25014 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
25015 \tikzset{muxdemux label/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux/label}{#1}}
25016 % external (class-like) muxdemux settings for labels
25017 \ctikzset{muxdemux/inner label font/.initial=\pgf@circ@font@tiny}
25018 \ctikzset{muxdemux/outer label font/.initial=\pgf@circ@font@tiny}
25019 \ctikzset{muxdemux/border label font/.initial=\pgf@circ@font@tiny}
25020 \ctikzset{muxdemux/inner label xsep/.initial=2pt}
25021 \ctikzset{muxdemux/inner label ysep/.initial=2pt}
25022 \ctikzset{muxdemux/outer label xsep/.initial=2pt}
25023 \ctikzset{muxdemux/outer label ysep/.initial=2pt}
25024 \ctikzset{muxdemux/border label xsep/.initial=2pt}
25025 \ctikzset{muxdemux/border label ysep/.initial=2pt}
25026 \ctikzset{muxdemux/inner label sep/.code={%
25027 \ctikzset{muxdemux/inner label xsep=#1}%
25028 \ctikzset{muxdemux/inner label ysep=#1}%
25029 }}
25030 \ctikzset{muxdemux/outer label sep/.code={%
25031 \ctikzset{muxdemux/outer label xsep=#1}%
25032 \ctikzset{muxdemux/outer label ysep=#1}%
25033 }}
25034 \ctikzset{muxdemux/border label sep/.code={%
25035 \ctikzset{muxdemux/border label xsep=#1}%
25036 \ctikzset{muxdemux/border label ysep=#1}%
25037 }}
25038 \ctikzset{muxdemux/clock wedge size/.initial=0.2}
25039 %>>>
25040
25041 %% Node shapes definitions for flip flops%<<<
25042
25043 % Flip flops are a specialized kind of dipchip.
25044 % they have a class by themselves
25045
25046 %% flip flop definitions --- by default empty
25047 %% pin texts
25048 \ctikzset{multipoles/flipflop/t1/.initial={}}
25049 \ctikzset{multipoles/flipflop/t2/.initial={}}
25050 \ctikzset{multipoles/flipflop/t3/.initial={}}
25051 \ctikzset{multipoles/flipflop/t4/.initial={}}
25052 \ctikzset{multipoles/flipflop/t5/.initial={}}
25053 \ctikzset{multipoles/flipflop/t6/.initial={}}
25054 \ctikzset{multipoles/flipflop/tu/.initial={}}
25055 \ctikzset{multipoles/flipflop/td/.initial={}}
25056 % pin clock wedge flags
25057 \ctikzset{multipoles/flipflop/c1/.initial={0}}
25058 \ctikzset{multipoles/flipflop/c2/.initial={0}}
25059 \ctikzset{multipoles/flipflop/c3/.initial={0}}
25060 \ctikzset{multipoles/flipflop/c4/.initial={0}}
25061 \ctikzset{multipoles/flipflop/c5/.initial={0}}
25062 \ctikzset{multipoles/flipflop/c6/.initial={0}}
25063 \ctikzset{multipoles/flipflop/cu/.initial={0}}
25064 \ctikzset{multipoles/flipflop/cd/.initial={0}}
25065 % pin negation circle flags
25066 \ctikzset{multipoles/flipflop/n1/.initial={0}}
25067 \ctikzset{multipoles/flipflop/n2/.initial={0}}
25068 \ctikzset{multipoles/flipflop/n3/.initial={0}}
25069 \ctikzset{multipoles/flipflop/n4/.initial={0}}
25070 \ctikzset{multipoles/flipflop/n5/.initial={0}}
25071 \ctikzset{multipoles/flipflop/n6/.initial={0}}
25072 \ctikzset{multipoles/flipflop/nu/.initial={0}}
25073 \ctikzset{multipoles/flipflop/nd/.initial={0}}
25074
25075
25076 % Thanks to @marmot
25077 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
25078
25079 % default set of flip flops
25080 \tikzset{
25081 % async
25082 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
25083 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
25084 % sync
25085 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
25086 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
25087 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
25088 % additional features
25089 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
25090 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
25091 }
25092
25093 %
25094 % commodity macro to draw the clock wedges. They leave the size of the
25095 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
25096 %
25097 \def\pgf@circ@do@wedge@left{
25098 \pgf@circ@res@temp=0pt\relax
25099 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
25100 \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}}
25101 \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}}
25102 \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}}
25103 \pgfusepath{stroke}
25104 \pgf@circ@res@temp=\wedge
25105 \fi
25106 }
25107 \def\pgf@circ@do@wedge@right{
25108 \pgf@circ@res@temp=0pt\relax
25109 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
25110 \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}}
25111 \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}}
25112 \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}}
25113 \pgfusepath{stroke}
25114 \pgf@circ@res@temp=-\wedge
25115 \fi
25116 }
25117 \def\pgf@circ@do@wedge@up{
25118 \pgf@circ@res@temp=0pt\relax
25119 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
25120 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
25121 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
25122 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
25123 \pgfusepath{stroke}
25124 \pgf@circ@res@temp=-\wedge
25125 \fi
25126 }
25127 \def\pgf@circ@do@wedge@down{
25128 \pgf@circ@res@temp=0pt\relax
25129 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
25130 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
25131 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
25132 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
25133 \pgfusepath{stroke}
25134 \pgf@circ@res@temp=\wedge
25135 \fi
25136 }
25137 % generic flip-flop shape
25138 \pgfdeclareshape{flipflop}{
25139 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
25140 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25141 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
25142 \savedmacro\numpins{\def\numpins{6}}
25143 \savedanchor\centerpoint{%
25144 \pgf@x=-.5\wd\pgfnodeparttextbox%
25145 \pgf@y=-.5\ht\pgfnodeparttextbox%
25146 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
25147 }%
25148 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
25149 \anchor{center}{\origin}
25150 \anchor{text}{\centerpoint}% to adjust text
25151 \saveddimen\height{%
25152 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25153 \pgfmathsetlength\pgf@x{((\numpins)
25154 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
25155 }%
25156 \saveddimen{\chipspacing}{
25157 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25158 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
25159 \saveddimen{\width}{
25160 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25161 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
25162 \saveddimen{\extshift}{
25163 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25164 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
25165 % standard anchors
25166 \savedanchor\northwest{%
25167 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25168 \pgfmathsetlength\pgf@y{0.5*((\numpins)
25169 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
25170 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
25171 }
25172 \anchor{dot}{\northwest
25173 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
25174 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
25175 }
25176 \anchor{nw}{\northwest}
25177 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
25178 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
25179 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
25180 \anchor{north west}{\northwest}
25181 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
25182 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
25183 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
25184 \anchor{n}{\northwest\pgf@x=0pt }
25185 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25186 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25187 \anchor{w}{\northwest\pgf@y=0pt }
25188 \anchor{north}{\northwest\pgf@x=0pt }
25189 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25190 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25191 \anchor{west}{\northwest\pgf@y=0pt }
25192 % upper and lower pin
25193 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
25194 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
25195 \anchor{bup}{\northwest\pgf@x=0pt }
25196 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25197 % start drawing
25198 \pgf@circ@draw@component{%
25199 \northwest
25200 \pgf@circ@res@up = \pgf@y
25201 \pgf@circ@res@down = -\pgf@y
25202 \pgf@circ@res@right = -\pgf@x
25203 \pgf@circ@res@left = \pgf@x
25204 \pgf@circ@scaled@Rlen=\scaledRlen
25205 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
25206 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
25207 \pgf@circ@setcolor
25208 \pgfscope% (for the line width)
25209 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
25210 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
25211 \pgf@circ@draworfill
25212 \pgfusepath{stroke}%
25213 \endpgfscope
25214 % Adding the pin number
25215 \pgf@circ@count@a=\numpins\relax
25216 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25217 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
25218 \ifpgf@circuit@chip@straightnumbers
25219 \pgfgettransformentries\a\b\temp\temp\temp\temp
25220 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
25221 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
25222 \else
25223 \pgfmathsetmacro{\rot}{0}
25224 \pgfmathsetmacro{\quadrant}{0}
25225 \fi
25226 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
25227 \pgfscope\pgf@circ@text@strokecolor
25228 % text
25229 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
25230 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
25231 \pgf@circ@strut\space}
25232 % \typeout{TEXT\space\mytext}
25233 \pgfmathloop%
25234 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
25235 \pgf@circ@res@temp=0pt\relax
25236 \ifnum\pgf@circ@count@a>0
25237 \ifcase\quadrant % rotation 0
25238 % left
25239 \pgf@circ@count@c=\pgf@circ@count@a
25240 \pgf@circ@do@wedge@left
25241 % \typeout{TEXT Left Q1\space\mytext}
25242 \pgftext[left,
25243 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},
25244 rotate=\rot]{\mytext}
25245 % right
25246 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25247 \pgf@circ@do@wedge@right
25248 \pgftext[right,
25249 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},
25250 rotate=\rot]{\mytext}
25251 \or % rotation -90
25252 % left
25253 \pgf@circ@count@c=\pgf@circ@count@a
25254 \pgf@circ@do@wedge@left
25255 \pgftext[top,
25256 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},
25257 rotate=\rot]{\mytext}
25258 % right
25259 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25260 \pgf@circ@do@wedge@right
25261 \pgftext[bottom,
25262 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},
25263 rotate=\rot]{\mytext}
25264 \or %rotation 180
25265 % left
25266 \pgf@circ@count@c=\pgf@circ@count@a
25267 \pgf@circ@do@wedge@left
25268 \pgftext[right,
25269 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},
25270 rotate=\rot]{\mytext}
25271 % right
25272 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25273 \pgf@circ@do@wedge@right
25274 \pgftext[left,
25275 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},
25276 rotate=\rot]{\mytext}
25277 \or % rotation +90
25278 % left
25279 \pgf@circ@count@c=\pgf@circ@count@a
25280 \pgf@circ@do@wedge@left
25281 \pgftext[bottom,
25282 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},
25283 rotate=\rot]{\mytext}
25284 % right
25285 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25286 \pgf@circ@do@wedge@right
25287 \pgftext[top,
25288 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},
25289 rotate=\rot]{\mytext}
25290 \fi
25291 \advance\pgf@circ@count@a-1\relax%
25292 \repeatpgfmathloop
25293 % Now the up and down text
25294 % up
25295 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
25296 \pgf@circ@do@wedge@up
25297 \ifcase\quadrant % rotation 0
25298 \pgftext[top,
25299 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25300 rotate=\rot]{\mytext}
25301 \or % rotation -90
25302 \pgftext[right,
25303 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25304 rotate=\rot]{\mytext}
25305 \or %rotation 180
25306 \pgftext[bottom,
25307 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25308 rotate=\rot]{\mytext}
25309 \or % rotation +90
25310 \pgftext[left,
25311 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25312 rotate=\rot]{\mytext}
25313 \fi
25314 % down
25315 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
25316 \pgf@circ@do@wedge@down
25317 \ifcase\quadrant % rotation 0
25318 \pgftext[bottom,
25319 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25320 rotate=\rot]{\mytext}
25321 \or % rotation -90
25322 \pgftext[left,
25323 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25324 rotate=\rot]{\mytext}
25325 \or %rotation 180
25326 \pgftext[top,
25327 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25328 rotate=\rot]{\mytext}
25329 \or % rotation +90
25330 \pgftext[right,
25331 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25332 rotate=\rot]{\mytext}
25333 \fi
25334 \endpgfscope % for text labels
25335 % external pins
25336 \ifdim\pgf@circ@res@other>0pt
25337 \pgfscope
25338 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
25339 \pgf@circ@count@a=\numpins\relax
25340 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25341 \pgfmathloop%
25342 \ifnum\pgf@circ@count@a>0
25343 % left side pins
25344 \pgf@circ@count@c=\pgf@circ@count@a
25345 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
25346 %% Or'ing tests in core TeX is tough
25347 \edef\@@or{0}
25348 % Just expand the key the minimum needed
25349 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
25350 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25351 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
25352 \ifnum\@@tmp>0\edef\@@or{1}\fi
25353 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25354 \ifnum\@@tmp>0\edef\@@or{1}\fi
25355 \ifnum\@@or>0
25356 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25357 \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}}
25358 \pgfusepath{stroke}
25359 \fi
25360 % right side pins
25361 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25362 \edef\@@or{0}
25363 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
25364 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25365 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
25366 \ifnum\@@tmp>0\edef\@@or{1}\fi
25367 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25368 \ifnum\@@tmp>0\edef\@@or{1}\fi
25369 % \typeout{TEST\space\@@tmp\space\@@x}
25370 \ifnum\@@or>0
25371 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25372 \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}}
25373 \pgfusepath{stroke}
25374 \fi
25375 \advance\pgf@circ@count@a by -1\relax%
25376 \repeatpgfmathloop
25377 % up side
25378 \edef\@@or{0}
25379 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
25380 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25381 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
25382 \ifnum\@@tmp>0\edef\@@or{1}\fi
25383 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
25384 \ifnum\@@tmp>0\edef\@@or{1}\fi
25385 % \typeout{TEST\space\@@tmp\space\@@x}
25386 \ifnum\@@or>0
25387 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
25388 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
25389 \pgfusepath{stroke}
25390 \fi
25391 % down side
25392 \edef\@@or{0}
25393 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
25394 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25395 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
25396 \ifnum\@@tmp>0\edef\@@or{1}\fi
25397 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
25398 \ifnum\@@tmp>0\edef\@@or{1}\fi
25399 % \typeout{TEST\space\@@tmp\space\@@x}
25400 \ifnum\@@or>0
25401 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
25402 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
25403 \pgfusepath{stroke}
25404 \fi
25405 \endpgfscope
25406 \fi % external pin width >0
25407 %
25408 % draw "inverting" circles on outputs, they must be last
25409 %
25410 \pgfscope
25411 \ifpgf@circuit@ieeelogicport
25412 \def\@@notcirc{notcirc}
25413 \else
25414 \ifpgf@circ@european@port@circle@ieee
25415 \def\@@notcirc{notcirc}
25416 \else
25417 \def\@@notcirc{ocirc}
25418 \fi
25419 \fi
25420 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
25421 \pgf@circ@count@a=\numpins\relax
25422 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25423 \pgfmathloop%
25424 \ifnum\pgf@circ@count@a>0
25425 % left side pins
25426 \pgf@circ@count@c=\pgf@circ@count@a
25427 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25428 \ifnum\@@tmp>0\pgfscope
25429 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25430 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
25431 \endpgfscope\fi
25432 % right side pins
25433 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25434 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25435 \ifnum\@@tmp>0\pgfscope
25436 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25437 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
25438 \endpgfscope\fi
25439 \advance\pgf@circ@count@a by -1\relax%
25440 \repeatpgfmathloop
25441 % up side
25442 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
25443 \ifnum\@@tmp>0\pgfscope
25444 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
25445 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
25446 \endpgfscope\fi
25447 % down side
25448 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
25449 \ifnum\@@tmp>0\pgfscope
25450 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
25451 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
25452 \endpgfscope\fi
25453 \endpgfscope
25454 }%
25455 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
25456 % and is executed just before a node is drawn.
25457 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
25458 % Start with the maximum pin number and go backwards.
25459 \pgf@circ@count@a=\numpins\relax
25460 \pgfmathloop%
25461 \ifnum\pgf@circ@count@a>0
25462 % we will create two anchors per pin: the "normal one" like `pin 1` for the
25463 % electrical contact, and the "border one" like `bpin 1` for labels.
25464 % they will coincide if `external pins width` is set to 0.
25465 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
25466 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
25467 }
25468 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
25469 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
25470 }
25471 \advance\pgf@circ@count@a by -1\relax%
25472 \repeatpgfmathloop%
25473 }%
25474 }
25475
25476 % clock wedge shape, for using in other shapes like muxdemuxes
25477 \pgfdeclareshape{clockwedge}{
25478 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
25479 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25480 \savedanchor{\northeast}{
25481 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25482 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{multipoles/flipflop/clock wedge size}*\ctikzvalof{multipoles/flipflop/pin spacing}*\pgf@circ@scaled@Rlen}
25483 \pgf@y=\pgf@circ@res@step
25484 \pgf@x=\pgf@circ@res@step
25485 }
25486 \anchor{center}{\pgfpointorigin}
25487 \anchor{north west}{\northeast\pgf@x=0pt }
25488 \anchor{north east}{\northeast}
25489 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
25490 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt }
25491 \anchor{north}{\northeast\pgf@x=0.5\pgf@x }
25492 \anchor{east}{\northeast\pgf@y=0pt }
25493 \anchor{south}{\northeast\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
25494 \anchor{west}{\pgfpointorigin}
25495 \anchor{nw}{\northeast\pgf@x=0pt }
25496 \anchor{ne}{\northeast}
25497 \anchor{se}{\northeast\pgf@y=-\pgf@y}
25498 \anchor{sw}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt }
25499 \anchor{n}{\northeast\pgf@x=0.5\pgf@x }
25500 \anchor{e}{\northeast\pgf@y=0pt }
25501 \anchor{s}{\northeast\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
25502 \anchor{w}{\pgfpointorigin}
25503 \anchor{left}{\pgfpointorigin}
25504 \anchor{right}{\northeast\pgf@y=0pt }
25505 \anchor{text}{\northeast\advance \pgf@x by 2pt
25506 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}% to adjust text
25507 \pgf@circ@draw@component{%
25508 \northeast
25509 \pgf@circ@res@up=\pgf@y
25510 \pgf@circ@res@right=\pgf@x
25511 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
25512 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
25513 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
25514 \pgfusepath{stroke}
25515 }
25516 }
25517
25518 % %>>>
25519
25520 %% Node shapes for mux-demuxes%<<<
25521
25522 %
25523 % MUX-DEMUXES
25524 %
25525 % predefined muxdemux shapes (see manual)
25526 %
25527 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
25528 \tikzset{one bit adder/.style={muxdemux,
25529 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
25530 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
25531 \tikzset{ALU/.style={muxdemux,
25532 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
25533 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
25534 %generic mux-demux shape
25535 % helper macros to set the anchors inside a loop (to expand the current count)
25536 % left
25537 \pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
25538 {%
25539 \expandafter\gdef\csname pgf@anchor@muxdemux@lpin #1\endcsname
25540 {%
25541 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list{#1}
25542 {\pgf@circ@muxdemux@L@anchor{#1}{1}}
25543 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
25544 }%
25545 \expandafter\gdef\csname pgf@anchor@muxdemux@blpin #1\endcsname
25546 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
25547 }
25548 % right
25549 \pgfutil@protected\def\pgf@circ@make@muxdemux@R@anchor#1%
25550 {%
25551 \expandafter\gdef\csname pgf@anchor@muxdemux@rpin #1\endcsname
25552 {%
25553 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list{#1}
25554 {\pgf@circ@muxdemux@R@anchor{#1}{1}}
25555 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
25556 }%
25557 \expandafter\gdef\csname pgf@anchor@muxdemux@brpin #1\endcsname
25558 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
25559 }
25560 % bottom
25561 \pgfutil@protected\def\pgf@circ@make@muxdemux@B@anchor#1%
25562 {%
25563 \expandafter\gdef\csname pgf@anchor@muxdemux@bpin #1\endcsname
25564 {%
25565 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list{#1}
25566 {\pgf@circ@muxdemux@B@anchor{#1}{1}}
25567 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
25568 }%
25569 \expandafter\gdef\csname pgf@anchor@muxdemux@bbpin #1\endcsname
25570 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
25571 }
25572 % top
25573 \pgfutil@protected\def\pgf@circ@make@muxdemux@T@anchor#1%
25574 {%
25575 \expandafter\gdef\csname pgf@anchor@muxdemux@tpin #1\endcsname
25576 {%
25577 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list{#1}
25578 {\pgf@circ@muxdemux@T@anchor{#1}{1}}
25579 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
25580 }%
25581 \expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
25582 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
25583 }
25584 %% put some label somewhere
25585 \def\pgf@circ@muxdemux@label@xy#1#2#3#4#5#6#7{%
25586 % #1: which label: L,R,T,B or the outer ones with U/D/R/L
25587 % #2: rotation
25588 % #3: scale pad x
25589 % #4: scale pad y
25590 % #5: text position
25591 % #6: operation on label text
25592 % #7: type: inner, outer, border
25593 % uses external variables \pgf@circ@count@a unless it's zero, in which case omit it
25594 \ifnum\pgf@circ@count@a=0
25595 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1}
25596 \else
25597 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25598 \fi
25599 \pgfkeysifdefined{\@@thislabel}{%
25600 \pgfscope
25601 \pgftransformrotate{#2}
25602 \pgfmathsetlength\pgf@circ@res@zero{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label xsep}}
25603 \pgfmathsetlength\pgf@circ@res@other{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label ysep}}
25604 %%% temp is added when we have wedges; it's a bit of a hack but it works if #3,#4 are -1,0,+1
25605 \pgftransformxshift{(#3)*(\pgf@circ@res@zero+\pgf@circ@res@temp)}
25606 \pgftransformyshift{(#4)*(\pgf@circ@res@other+\pgf@circ@res@temp)}
25607 % Ok, now we have the point in the correct position, we add the label
25608 \pgftext[#5]{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label font}%
25609 \expandafter\csname#6\endcsname{\pgfkeysvalueof{\@@thislabel}}}
25610 \endpgfscope
25611 }{}
25612 }
25613 %% put a clock wedge here
25614 \def\pgf@circ@muxdemux@clockwedge#1#2{%
25615 % #1: which label: cL,cR,cT,cB
25616 % #2: rotation
25617 % uses external variables \pgf@circ@count@a
25618 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25619 \pgfkeysifdefined{\@@thislabel}{%
25620 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25621 \ifnum\value=0
25622 \pgf@circ@res@temp=0pt
25623 \else\pgfscope
25624 \pgftransformrotate{#2}
25625 \pgfpathmoveto{\pgfpoint{+0pt}{-\clockwedge}}
25626 \pgfpathlineto{\pgfpoint{\clockwedge}{+0pt}}
25627 \pgfpathlineto{\pgfpoint{+0pt}{\clockwedge}}
25628 \pgfusepath{draw}
25629 \endpgfscope
25630 \pgf@circ@res@temp=\clockwedge
25631 \fi
25632 }{}
25633 }
25634 %% put a negation here
25635 \def\pgf@circ@muxdemux@not@ball#1#2{%
25636 % #1: which label: nL,nR,nT,nB
25637 % #2: anchor
25638 % uses external variables \pgf@circ@count@a
25639 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25640 \pgfkeysifdefined{\@@thislabel}{%
25641 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25642 \ifnum\value=0
25643 \else
25644 \pgfnode{\@@notcirc}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
25645 \fi
25646 }{}
25647 }
25648 %% put a negation wedge here
25649 \def\pgf@circ@muxdemux@not@wedge#1#2#3#4#5{%
25650 % #1: which label: wi/wp with L,R,T,B
25651 % #2: anchor
25652 % #3: xscale
25653 % #4: yscale
25654 % #5: rotation
25655 % uses external variables \pgf@circ@count@a
25656 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25657 \pgfkeysifdefined{\@@thislabel}{%
25658 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25659 \ifnum\value=0
25660 \else\pgfscope
25661 \pgftransformrotate{#5}
25662 \pgftransformxscale{#3}
25663 \pgftransformyscale{#4}
25664 \pgftransformyscale{\value}% to flip
25665 \pgfnode{wedgeinv}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
25666 \endpgfscope\fi
25667 }{}
25668 }
25669 %
25670 \pgfdeclareshape{muxdemux}{
25671 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
25672 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25673 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
25674 % pins on the four sides
25675 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
25676 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
25677 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
25678 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
25679 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
25680 % pin lists
25681 \savedmacro\pgf@circ@Lpins@list
25682 {%
25683 \pgfkeysgetvalue
25684 {\circuitikzbasekey/multipoles/draw only left pins}\pgf@circ@temp
25685 \expandafter\pgf@circ@set@list
25686 \expandafter\pgf@circ@Lpins@list
25687 \expandafter{\pgf@circ@temp}%
25688 }%
25689 \savedmacro\pgf@circ@Rpins@list
25690 {%
25691 \pgfkeysgetvalue
25692 {\circuitikzbasekey/multipoles/draw only right pins}\pgf@circ@temp
25693 \expandafter\pgf@circ@set@list
25694 \expandafter\pgf@circ@Rpins@list
25695 \expandafter{\pgf@circ@temp}%
25696 }%
25697 \savedmacro\pgf@circ@Tpins@list
25698 {%
25699 \pgfkeysgetvalue
25700 {\circuitikzbasekey/multipoles/draw only top pins}\pgf@circ@temp
25701 \expandafter\pgf@circ@set@list
25702 \expandafter\pgf@circ@Tpins@list
25703 \expandafter{\pgf@circ@temp}%
25704 }%
25705 \savedmacro\pgf@circ@Bpins@list
25706 {%
25707 \pgfkeysgetvalue
25708 {\circuitikzbasekey/multipoles/draw only bottom pins}\pgf@circ@temp
25709 \expandafter\pgf@circ@set@list
25710 \expandafter\pgf@circ@Bpins@list
25711 \expandafter{\pgf@circ@temp}%
25712 }%
25713 % topleft and topright sizes
25714 \savedanchor{\topleft}{%
25715 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25716 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
25717 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
25718 }
25719 \savedanchor{\topright}{%
25720 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25721 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
25722 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
25723 }
25724 \savedanchor{\insetnortheast}{%
25725 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25726 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
25727 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
25728 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
25729 }
25730 \saveddimen{\insethright}{
25731 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25732 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
25733 \saveddimen{\extshift}{
25734 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25735 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
25736 \savedanchor{\northwest}{%
25737 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25738 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
25739 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
25740 }
25741 \anchor{nw}{\northwest}
25742 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
25743 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
25744 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
25745 \anchor{north west}{\northwest}
25746 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
25747 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
25748 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
25749 \anchor{n}{\northwest\pgf@x=0pt }
25750 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25751 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25752 \anchor{w}{\northwest\pgf@y=0pt }
25753 \anchor{north}{\northwest\pgf@x=0pt }
25754 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25755 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25756 \anchor{west}{\northwest\pgf@y=0pt }
25757 \anchor{center}{\pgfpointorigin}
25758 \anchor{top right}{\topright}
25759 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
25760 \anchor{right}{\topright\pgf@y=0pt\relax}
25761 \anchor{top left}{\topleft}
25762 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
25763 \anchor{left}{\topleft\pgf@y=0pt\relax}
25764 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
25765 \divide\pgf@y by 2 \pgf@x=0pt\relax}
25766 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
25767 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
25768 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
25769 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
25770 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
25771 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
25772 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
25773 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
25774 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
25775 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
25776 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
25777 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
25778 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
25779 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
25780 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
25781 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
25782 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
25783 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
25784 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
25785 \divide\pgf@y by 2
25786 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
25787 \divide\pgf@y by 2 \pgf@x=0pt\relax}
25788 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
25789 \divide\pgf@y by 2
25790 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
25791 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
25792 \anchor{text}{%
25793 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25794 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
25795 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
25796 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
25797 \pgf@y=-.5\ht\pgfnodeparttextbox%
25798 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
25799 }%
25800 \pgf@circ@draw@component{%
25801 \topleft
25802 \pgf@circ@res@up = \pgf@y
25803 \pgf@circ@res@down = -\pgf@y
25804 \pgf@circ@res@left = \pgf@x
25805 \topright
25806 \pgf@circ@res@other = \pgf@y
25807 \pgf@circ@res@right = \pgf@x
25808 \insetnortheast
25809 \pgf@circ@res@step = \pgf@x
25810 \pgf@circ@res@temp = \pgf@y
25811 %
25812 % draw the (user-selectable) background
25813 %
25814 \pgfscope
25815 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
25816 % It's better not to change the scale in an asymmetric way
25817 % \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
25818 \pgftransformxscale{\@@scalex}
25819 \pgftransformyscale{\@@scalex}
25820 \pgf@circ@setlinewidth{multipoles}{\pgfstartlinewidth}
25821 \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/bgpicture}
25822 \endpgfscope
25823 %
25824 % external block
25825 %
25826 \pgfscope% (for the line width)
25827 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
25828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
25829 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
25830 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
25831 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
25832 % inset, starting down
25833 \ifdim\pgf@circ@res@temp>0pt % inset
25834 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
25835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
25836 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
25837 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
25838 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
25839 \fi
25840 \pgfpathclose
25841 \pgf@circ@draworfill
25842 \endpgfscope
25843 % now we have to draw the pins, if needed
25844 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
25845 % Ok, we have to draw the leads (a.k.a. pins)
25846 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
25847 % We mimic the anchors here --- probably there is a better way
25848 % left pins
25849 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
25850 \pgf@circ@count@a=\NL\relax
25851 \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
25852 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
25853 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
25854 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
25855 % we have to check oddity
25856 \ifodd\NL
25857 \ifnum\NL=1
25858 % only centerpin, step should not be used, but anyway...
25859 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
25860 \else
25861 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
25862 \fi
25863 \else
25864 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
25865 \fi
25866 \else % no inset
25867 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
25868 \fi
25869 \pgfmathloop%
25870 \ifnum\pgf@circ@count@a>0
25871 %%%%% check if we want to draw this pin
25872 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list\pgf@circ@count@a{%
25873 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
25874 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
25875 % for lower pins we have to shift them down
25876 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
25877 \ifodd\NL
25878 % odd number of pins
25879 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
25880 % centerpin!
25881 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
25882 \ifnum\squarepins>0
25883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
25884 \else
25885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
25886 \fi
25887 \else
25888 \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}}
25889 \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}}
25890 \fi
25891 \else
25892 % even numer of pins: just go down
25893 \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}}
25894 \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}}
25895 \fi
25896 \else
25897 % nothing need for #1<=NL/2
25898 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25899 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25900 \fi
25901 \else
25902 % no inset
25903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25904 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25905 \fi
25906 %%%%%
25907 }{}% close the pin list check
25908 \advance\pgf@circ@count@a by -1\relax%
25909 \repeatpgfmathloop\fi%
25910 % right pins
25911 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
25912 \pgfmathloop%
25913 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
25914 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
25915 \ifnum\pgf@circ@count@a>0
25916 %%%%% check if we want to draw this pin
25917 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list\pgf@circ@count@a{%
25918 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25919 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
25920 }{}%
25921 \advance\pgf@circ@count@a by -1\relax%
25922 \repeatpgfmathloop\fi%
25923 % bottom pins
25924 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
25925 \pgfmathloop%
25926 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
25927 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
25928 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
25929 \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}
25930 \ifnum\pgf@circ@count@a>0
25931 %%%%% check if we want to draw this pin
25932 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list\pgf@circ@count@a{%
25933 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25934 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
25935 \ifnum\squarepins>0
25936 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25937 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
25938 \else
25939 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25940 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
25941 \fi
25942 }{}%
25943 \advance\pgf@circ@count@a by -1\relax%
25944 \repeatpgfmathloop\fi%
25945 % top pins
25946 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
25947 \pgfmathloop%
25948 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
25949 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
25950 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
25951 \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}
25952 \ifnum\pgf@circ@count@a>0
25953 %%%%% check if we want to draw this pin
25954 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list\pgf@circ@count@a{%
25955 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25956 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
25957 \ifnum\squarepins>0
25958 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25959 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
25960 \else
25961 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
25962 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
25963 \fi
25964 }{}%
25965 \advance\pgf@circ@count@a by -1\relax%
25966 \repeatpgfmathloop\fi%
25967 % end drawing pins; stroke them
25968 \pgfusepath{stroke}
25969 \endpgfscope\fi\fi
25970 %%%% Labels. Added by Romano 14/10/2023.
25971 % manage labels. This is independent from the drawing of pins; redo the loops. Surely
25972 % there is a better way; but it's complex to factor out code. Let's go the KISS way.
25973 \ifpgf@circuit@chip@straightnumbers
25974 \pgfgettransformentries\a\b\temp\temp\temp\temp
25975 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
25976 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
25977 \else
25978 \pgfmathsetmacro{\rot}{0}
25979 \pgfmathsetmacro{\quadrant}{0}
25980 \fi
25981 % clockwedge size
25982 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{muxdemux/clock wedge size}*\ctikzvalof{multipoles/muxdemux/base len}*\scaledRlen}
25983 \edef\clockwedge{\the\pgf@circ@res@temp}
25984 % select which negation ball to use
25985 \ifpgf@circuit@ieeelogicport
25986 \def\@@notcirc{circleinv}
25987 \else
25988 \ifpgf@circ@european@port@circle@ieee
25989 \def\@@notcirc{circleinv}
25990 \else
25991 \def\@@notcirc{ocirc}
25992 \fi
25993 \fi
25994 %% border labels
25995 \pgf@circ@res@temp=0pt
25996 \pgf@circ@count@a=0
25997 % go to north
25998 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
25999 \pgfscope
26000 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
26001 \ifnum\quadrant=2
26002 \pgf@circ@muxdemux@label@xy{N}{180}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26003 \pgf@circ@muxdemux@label@xy{Ni}{180}{0}{1}{bottom}{pgfcirc@nop}{border}%
26004 \else
26005 \pgf@circ@muxdemux@label@xy{N}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
26006 \pgf@circ@muxdemux@label@xy{Ni}{0}{0}{-1}{top}{pgfcirc@nop}{border}%
26007 \fi
26008 \endpgfscope
26009 % go south!
26010 \pgfscope
26011 \pgftransformshift{\pgfpoint{0pt}{-\pgf@circ@res@up}}
26012 \ifnum\quadrant=2
26013 \pgf@circ@muxdemux@label@xy{S}{180}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26014 \pgf@circ@muxdemux@label@xy{Si}{180}{0}{-1}{top}{pgfcirc@nop}{border}%
26015 \else
26016 \pgf@circ@muxdemux@label@xy{S}{0}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26017 \pgf@circ@muxdemux@label@xy{Si}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
26018 \fi
26019 \endpgfscope
26020 % go west!
26021 \pgfscope
26022 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
26023 \ifnum\quadrant=3
26024 \pgf@circ@muxdemux@label@xy{W}{-90}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26025 \pgf@circ@muxdemux@label@xy{Wi}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26026 \else
26027 \pgf@circ@muxdemux@label@xy{W}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26028 \pgf@circ@muxdemux@label@xy{Wi}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
26029 \fi
26030 \endpgfscope
26031 % go east!
26032 \pgfscope
26033 \pgftransformshift{\pgfpoint{-\pgf@circ@res@left}{0pt}}
26034 \ifnum\quadrant=3
26035 \pgf@circ@muxdemux@label@xy{E}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26036 \pgf@circ@muxdemux@label@xy{Ei}{-90}{0}{-1}{top}{pgfcirc@nop}{border}%
26037 \else
26038 \pgf@circ@muxdemux@label@xy{E}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
26039 \pgf@circ@muxdemux@label@xy{Ei}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26040 \fi
26041 \endpgfscope
26042 % start exploring all the pins. We repeat the steps to position the coordinate on every pin.
26043 % left pins
26044 \ifnum\NL>0\relax
26045 \pgf@circ@count@a=\NL\relax
26046 \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
26047 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26048 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26049 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26050 % we have to check oddity
26051 \ifodd\NL
26052 \ifnum\NL=1
26053 % only centerpin, step should not be used, but anyway...
26054 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
26055 \else
26056 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
26057 \fi
26058 \else
26059 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
26060 \fi
26061 \else % no inset
26062 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
26063 \fi
26064 \pgfmathloop%
26065 \ifnum\pgf@circ@count@a>0
26066 \pgfscope
26067 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26068 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
26069 % for lower pins we have to shift them down
26070 \ifodd\NL
26071 % odd number of pins
26072 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
26073 % centerpin!
26074 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
26075 \else
26076 \pgftransformshift{\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}}
26077 \fi
26078 \else
26079 % even numer of pins: just go down
26080 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
26081 \fi
26082 \else
26083 % nothing need for #1<=NL/2
26084 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26085 \fi
26086 \else
26087 % no inset
26088 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26089 \fi
26090 % put the not ball/wedges if needed
26091 \pgf@circ@muxdemux@not@ball{nL}{east}
26092 \pgf@circ@muxdemux@not@wedge{wiL}{east}{1}{1}{0}
26093 \pgf@circ@muxdemux@not@wedge{woL}{west}{-1}{1}{0}
26094 % \fi
26095 \pgf@circ@muxdemux@clockwedge{cL}{0}
26096 %% put the labels
26097 \ifcase\quadrant % rotation 0; left label are at the left
26098 \pgf@circ@muxdemux@label@xy{L}{0}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26099 \pgf@circ@res@temp=0pt
26100 \pgf@circ@muxdemux@label@xy{LU}{0}{-1}{1}{bottom}{llap}{outer}%
26101 \pgf@circ@muxdemux@label@xy{LD}{0}{-1}{-1}{top}{llap}{outer}%
26102 \or %rotation -90; left labels are at the top
26103 \pgf@circ@muxdemux@label@xy{L}{90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26104 \pgf@circ@res@temp=0pt
26105 \pgf@circ@muxdemux@label@xy{LU}{90}{-1}{1}{bottom}{llap}{outer}%
26106 \pgf@circ@muxdemux@label@xy{LD}{90}{1}{1}{bottom}{rlap}{outer}%
26107 \or %rotation 180; left labels are at the right
26108 \pgf@circ@muxdemux@label@xy{L}{180}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26109 \pgf@circ@res@temp=0pt
26110 \pgf@circ@muxdemux@label@xy{LU}{180}{1}{1}{bottom}{rlap}{outer}%
26111 \pgf@circ@muxdemux@label@xy{LD}{180}{1}{-1}{top}{rlap}{outer}%
26112 \or %rotation +90; left labels are at the bottom
26113 \pgf@circ@muxdemux@label@xy{L}{-90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26114 \pgf@circ@res@temp=0pt
26115 \pgf@circ@muxdemux@label@xy{LU}{-90}{-1}{-1}{top}{llap}{outer}%
26116 \pgf@circ@muxdemux@label@xy{LD}{-90}{1}{-1}{top}{rlap}{outer}%
26117 \fi
26118 \endpgfscope
26119 \advance\pgf@circ@count@a by -1\relax%
26120 \repeatpgfmathloop
26121 \fi
26122 %% right pins
26123 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
26124 \pgfmathloop%
26125 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
26126 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
26127 \ifnum\pgf@circ@count@a>0
26128 \pgfscope
26129 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26130 % put the not ball/wedge if needed
26131 \pgf@circ@muxdemux@not@ball{nR}{west}
26132 \pgf@circ@muxdemux@not@wedge{wiR}{east}{-1}{1}{0}
26133 \pgf@circ@muxdemux@not@wedge{woR}{west}{1}{1}{0}
26134 % put the clock wedge if needed
26135 \pgf@circ@muxdemux@clockwedge{cR}{180}
26136 \ifcase\quadrant % rotation 0; right label are at the right
26137 \pgf@circ@muxdemux@label@xy{R}{0}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26138 \pgf@circ@res@temp=0pt
26139 \pgf@circ@muxdemux@label@xy{RU}{0}{1}{1}{bottom}{rlap}{outer}%
26140 \pgf@circ@muxdemux@label@xy{RD}{0}{1}{-1}{top}{rlap}{outer}%
26141 \or %rotation -90; right labels are at the bottom
26142 \pgf@circ@muxdemux@label@xy{R}{90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26143 \pgf@circ@res@temp=0pt
26144 \pgf@circ@muxdemux@label@xy{RU}{90}{-1}{-1}{top}{llap}{outer}%
26145 \pgf@circ@muxdemux@label@xy{RD}{90}{1}{-1}{top}{rlap}{outer}%
26146 \or %rotation 180; right labels are at the left
26147 \pgf@circ@muxdemux@label@xy{R}{180}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26148 \pgf@circ@res@temp=0pt
26149 \pgf@circ@muxdemux@label@xy{RU}{180}{-1}{1}{bottom}{llap}{outer}%
26150 \pgf@circ@muxdemux@label@xy{RD}{180}{-1}{-1}{top}{llap}{outer}%
26151 \or %rotation +90; right labels are at the top
26152 \pgf@circ@muxdemux@label@xy{R}{-90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26153 \pgf@circ@res@temp=0pt
26154 \pgf@circ@muxdemux@label@xy{RU}{-90}{-1}{1}{bottom}{llap}{outer}%
26155 \pgf@circ@muxdemux@label@xy{RD}{-90}{1}{1}{bottom}{rlap}{outer}%
26156 \fi
26157 \endpgfscope
26158 \advance\pgf@circ@count@a by -1\relax%
26159 \repeatpgfmathloop
26160 \fi
26161 %% bottom pins
26162 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
26163 \pgfmathloop%
26164 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26165 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26166 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
26167 \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}
26168 \ifnum\pgf@circ@count@a>0
26169 \pgfscope
26170 \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26171 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26172 % put the not ball/wedge if needed
26173 \pgf@circ@muxdemux@not@ball{nB}{north}
26174 \pgf@circ@muxdemux@not@wedge{wiB}{east}{1}{1}{90}
26175 \pgf@circ@muxdemux@not@wedge{woB}{west}{-1}{1}{90}
26176 % put the clock wedge if needed
26177 \pgf@circ@muxdemux@clockwedge{cB}{90}
26178 \ifcase\quadrant % rotation 0; bottom label are at the bottom
26179 \pgf@circ@muxdemux@label@xy{B}{0}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26180 \pgf@circ@res@temp=0pt
26181 \pgf@circ@muxdemux@label@xy{BL}{0}{-1}{-1}{top}{llap}{outer}%
26182 \pgf@circ@muxdemux@label@xy{BR}{0}{1}{-1}{top}{rlap}{outer}%
26183 \or %rotation -90; bottom labels are at the left
26184 \pgf@circ@muxdemux@label@xy{B}{90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26185 \pgf@circ@res@temp=0pt
26186 \pgf@circ@muxdemux@label@xy{BL}{90}{-1}{1}{bottom}{llap}{outer}%
26187 \pgf@circ@muxdemux@label@xy{BR}{90}{-1}{-1}{top}{llap}{outer}%
26188 \or %rotation 180; bottom labels are at the top
26189 \pgf@circ@muxdemux@label@xy{B}{180}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26190 \pgf@circ@res@temp=0pt
26191 \pgf@circ@muxdemux@label@xy{BL}{180}{-1}{1}{bottom}{llap}{outer}%
26192 \pgf@circ@muxdemux@label@xy{BR}{180}{1}{1}{bottom}{rlap}{outer}%
26193 \or %rotation +90; bottom labels are at the right
26194 \pgf@circ@muxdemux@label@xy{B}{-90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26195 \pgf@circ@res@temp=0pt
26196 \pgf@circ@muxdemux@label@xy{BL}{-90}{1}{1}{bottom}{rlap}{outer}%
26197 \pgf@circ@muxdemux@label@xy{BR}{-90}{1}{-1}{top}{rlap}{outer}%
26198 \fi
26199 \endpgfscope
26200 \advance\pgf@circ@count@a by -1\relax%
26201 \repeatpgfmathloop
26202 \fi
26203 %% top pins
26204 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
26205 \pgfmathloop%
26206 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26207 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26208 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
26209 \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}
26210 \ifnum\pgf@circ@count@a>0
26211 \pgfscope
26212 \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26213 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26214 % put the not ball/wedge if needed
26215 \pgf@circ@muxdemux@not@ball{nT}{south}
26216 \pgf@circ@muxdemux@not@wedge{wiT}{east}{1}{-1}{-90}
26217 \pgf@circ@muxdemux@not@wedge{woT}{west}{-1}{-1}{-90}
26218 % put the clock wedge if needed
26219 \pgf@circ@muxdemux@clockwedge{cT}{-90}
26220 \ifcase\quadrant % rotation 0; top label are at the top
26221 \pgf@circ@muxdemux@label@xy{T}{0}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26222 \pgf@circ@res@temp=0pt
26223 \pgf@circ@muxdemux@label@xy{TL}{0}{-1}{1}{bottom}{llap}{outer}%
26224 \pgf@circ@muxdemux@label@xy{TR}{0}{1}{1}{bottom}{rlap}{outer}%
26225 \or %rotation -90; top labels are at the right
26226 \pgf@circ@muxdemux@label@xy{T}{90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26227 \pgf@circ@res@temp=0pt
26228 \pgf@circ@muxdemux@label@xy{TL}{90}{1}{1}{bottom}{rlap}{outer}%
26229 \pgf@circ@muxdemux@label@xy{TR}{90}{1}{-1}{top}{rlap}{outer}%
26230 \or %rotation 180; top labels are at the bottom
26231 \pgf@circ@muxdemux@label@xy{T}{180}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26232 \pgf@circ@res@temp=0pt
26233 \pgf@circ@muxdemux@label@xy{TL}{180}{-1}{-1}{top}{llap}{outer}%
26234 \pgf@circ@muxdemux@label@xy{TR}{180}{1}{-1}{top}{rlap}{outer}%
26235 \or %rotation +90; top labels are at the left
26236 \pgf@circ@muxdemux@label@xy{T}{-90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26237 \pgf@circ@res@temp=0pt
26238 \pgf@circ@muxdemux@label@xy{TL}{-90}{-1}{1}{bottom}{llap}{outer}%
26239 \pgf@circ@muxdemux@label@xy{TR}{-90}{-1}{-1}{top}{llap}{outer}%
26240 \fi
26241 \endpgfscope
26242 \advance\pgf@circ@count@a by -1\relax%
26243 \repeatpgfmathloop
26244 \fi
26245 }
26246 % let's start adding anchors
26247 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
26248 % left side anchors
26249 \pgf@circ@count@a=\NL\relax
26250 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
26251 \pgfmathloop%
26252 \ifnum\pgf@circ@count@a>0
26253 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
26254 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
26255 % external leads, and the "border one" like `blpin 1` for internal ones.
26256 % they will coincide if `external pins width` is set to 0.
26257 \expandafter\pgf@circ@make@muxdemux@L@anchor\expandafter{\the\pgf@circ@count@a}%
26258 \advance\pgf@circ@count@a by -1\relax%
26259 \repeatpgfmathloop%
26260 % right anchors
26261 \pgf@circ@count@a=\NR\relax
26262 \pgfmathloop%
26263 \ifnum\pgf@circ@count@a>0
26264 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
26265 % external leads, and the "border one" like `brpin 1` for internal ones.
26266 % they will coincide if `external pins width` is set to 0.
26267 \expandafter\pgf@circ@make@muxdemux@R@anchor\expandafter{\the\pgf@circ@count@a}%
26268 \advance\pgf@circ@count@a by -1\relax%
26269 \repeatpgfmathloop%
26270 % bottom anchors
26271 \pgf@circ@count@a=\NB\relax
26272 \pgfmathloop%
26273 \ifnum\pgf@circ@count@a>0
26274 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
26275 % external leads, and the "border one" like `bbpin 1` for internal ones.
26276 % they will coincide if `external pins width` is set to 0.
26277 \expandafter\pgf@circ@make@muxdemux@B@anchor\expandafter{\the\pgf@circ@count@a}%
26278 \advance\pgf@circ@count@a by -1\relax%
26279 \repeatpgfmathloop%
26280 % top anchors
26281 \pgf@circ@count@a=\NT\relax
26282 \pgfmathloop%
26283 \ifnum\pgf@circ@count@a>0
26284 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
26285 % external leads, and the "border one" like `btpin 1` for internal ones.
26286 % they will coincide if `external pins width` is set to 0.
26287 \expandafter\pgf@circ@make@muxdemux@T@anchor\expandafter{\the\pgf@circ@count@a}%
26288 \advance\pgf@circ@count@a by -1\relax%
26289 \repeatpgfmathloop%
26290 }%
26291 }
26292
26293 %% left anchors for muxdemux
26294
26295 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26296 \topleft
26297 \pgf@xa=\pgf@x
26298 \pgf@ya=\pgf@y
26299 \insetnortheast
26300 \pgf@xb=\pgf@x
26301 \pgf@yb=\pgf@y
26302 \ifnum#1>\NL
26303 \PackageError{circuitikz}{%
26304 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
26305 which has been defined with \NL\space left pins%
26306 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26307 \fi
26308 \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
26309 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
26310 \ifnum\NL>1
26311 \ifdim\pgf@yb>0pt % check if we have an inset
26312 % we have to check oddity
26313 \ifodd\NL
26314 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
26315 \else
26316 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
26317 \fi
26318 \else % no inset
26319 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
26320 \fi
26321 \ifdim\pgf@yb>0pt % check if we have an inset
26322 \ifnum#1>\pgf@circ@count@a\relax
26323 % for lower pins we have to shift them down
26324 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
26325 \ifodd\NL
26326 % odd number of pins
26327 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
26328 % centerpin!
26329 \ifnum#2=0\relax
26330 \pgfpoint{\pgf@xb}{0pt}
26331 \else
26332 \ifnum\squarepins>0
26333 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
26334 \else
26335 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
26336 \fi
26337 \fi
26338 \else
26339 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
26340 \fi
26341 \else
26342 % even numer of pins: just go down
26343 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
26344 \fi
26345 \else
26346 % nothing need for #1<=NL/2
26347 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26348 \fi
26349 \else
26350 % no inset
26351 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26352 \fi
26353 \else
26354 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
26355 \fi
26356 }
26357
26358 % right anchors
26359 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26360 \topright
26361 \pgf@xa=\pgf@x
26362 \pgf@ya=\pgf@y
26363 \ifnum#1>\NR
26364 \PackageError{circuitikz}{%
26365 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
26366 which has been defined with \NR\space right pins%
26367 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26368 \fi
26369 \ifnum\NR>1
26370 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
26371 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26372 \else
26373 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
26374 \fi
26375 }
26376
26377 % bottom anchors
26378 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26379 \topleft
26380 \pgf@xa=\pgf@x
26381 \pgf@ya=\pgf@y
26382 \topright
26383 \pgf@xb=\pgf@x
26384 \pgf@yb=\pgf@y
26385 \ifnum#1>\NB
26386 \PackageError{circuitikz}{%
26387 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
26388 which has been defined with \NB\space bottom pins%
26389 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26390 \fi
26391 \ifnum\NB>0
26392 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
26393 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
26394 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
26395 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
26396 \ifnum#2=0\relax
26397 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
26398 \else
26399 \ifnum\squarepins>0\relax
26400 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
26401 \else
26402 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
26403 \fi
26404 \fi
26405 \else
26406 % should not happen, give the same as pin 1 anyway
26407 \ifnum#2=0\relax
26408 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
26409 \else
26410 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
26411 \fi
26412 \fi
26413 }
26414
26415 % top anchors
26416 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26417 \topleft
26418 \pgf@xa=\pgf@x
26419 \pgf@ya=\pgf@y
26420 \topright
26421 \pgf@xb=\pgf@x
26422 \pgf@yb=\pgf@y
26423 \ifnum#1>\NT
26424 \PackageError{circuitikz}{%
26425 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
26426 which has been defined with \NT\space top pins%
26427 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26428 \fi
26429 \ifnum\NT>0
26430 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
26431 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
26432 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
26433 \ifnum#2=0\relax
26434 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
26435 \else
26436 \ifnum\squarepins>0
26437 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
26438 \else
26439 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
26440 \fi
26441 \fi
26442 \else
26443 % should not happen, give the same as pin 1 anyway
26444 \ifnum#2=0\relax
26445 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
26446 \else
26447 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
26448 \fi
26449 \fi
26450 }
26451 % %>>>
26452
26453 %% definitions and shape for wedgeinv and circleinv%<<<
26454
26455 \ctikzset{wedge inversion mark/width/.initial = 0.2}
26456 \ctikzset{wedge inversion mark/height/.initial = 0.1}
26457 \pgfdeclareshape{wedgeinv}{
26458 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
26459 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
26460 \savedanchor\northeast{%
26461 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26462 \pgf@y=\ctikzvalof{wedge inversion mark/height}\pgf@circ@scaled@Rlen
26463 \pgf@x=\ctikzvalof{wedge inversion mark/width}\pgf@circ@scaled@Rlen
26464 }
26465 \anchor{center}{\pgfpointorigin}
26466 \anchor{top}{\northeast\pgf@x=0pt\relax}
26467 \anchor{apex}{\northeast\pgf@y=0pt\relax}
26468 \anchor{base}{\pgfpointorigin}
26469 \anchor{mid}{\northeast\pgf@x=0.5\pgf@x\pgf@y=0.5\pgf@y}
26470 % not standard geoanchors, south west is the same as 0,0...
26471 \anchor{right}{\northeast\pgf@y=0pt\relax}
26472 \anchor{east}{\northeast\pgf@y=0pt\relax}
26473 \anchor{e}{\northeast\pgf@y=0pt\relax}
26474 \anchor{left}{\pgfpointorigin}
26475 \anchor{west}{\pgfpointorigin}
26476 \anchor{w}{\pgfpointorigin}
26477 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
26478 \anchor{s}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
26479 \anchor{north}{\northeast\pgf@x=0.5\pgf@x}
26480 \anchor{n}{\northeast\pgf@x=0.5\pgf@x}
26481 \anchor{south west}{\pgfpointorigin}
26482 \anchor{sw}{\pgfpointorigin}
26483 \anchor{north east}{\northeast}
26484 \anchor{ne}{\northeast}
26485 \anchor{north west}{\northeast\pgf@x=0pt\relax}
26486 \anchor{nw}{\northeast\pgf@x=0pt\relax}
26487 \anchor{south east}{\northeast\pgf@y=0pt\relax}
26488 \anchor{se}{\northeast\pgf@y=0pt\relax}
26489 %
26490 \pgf@circ@draw@component{
26491 \northeast\pgf@circ@res@up=\pgf@y\pgf@circ@res@right=\pgf@x
26492 \pgfsetbeveljoin % otherwise it sticks often "inside" the component
26493 \pgfpathmoveto{\pgfpointorigin}
26494 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
26495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
26496 \pgfpathclose
26497 \pgfusepath{draw}
26498 }
26499 }
26500 % this is *almost* the same as notcirc, but scales with muxdemuxes and
26501 % has the default anchor to the left side
26502 \pgfdeclareshape{circleinv}{
26503 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
26504 \savedanchor\northwest{%
26505 \pgf@circ@notradius
26506 \pgf@y=\pgf@circ@res@temp
26507 \pgf@x=-\pgf@y
26508 }
26509 \pgfcirc@northwest@symmetric@geoanchors
26510 %% use the left side as default anchor
26511 \anchor{center}{\northwest\pgf@y=0pt}
26512 \anchor{geocenter}{\pgfpointorigin}
26513 \anchor{base}{\northwest\pgf@y=0pt}
26514 \anchor{apex}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
26515 \anchor{mid}{\northwest\pgf@x=0pt}
26516 \anchor{top}{\northwest\pgf@x=0pt}
26517 \anchor{bottom}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
26518 \anchorborder{
26519 \pgf@circ@res@left=\pgf@x
26520 \pgf@circ@res@up=\pgf@y
26521 \northwest\pgf@circ@res@temp=\pgf@y
26522 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
26523 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
26524 }
26525 \pgf@circ@draw@component{
26526 \pgfscope
26527 \northwest\pgf@circ@res@temp=\pgf@y
26528 \pgf@circ@setcolor
26529 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
26530 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
26531 \ifx\tikz@fillcolor\pgfutil@empty
26532 % set the default fill color to white
26533 \pgfsetfillcolor{white}
26534 % ...but override it if the class is defined!
26535 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
26536 \else
26537 \pgfsetfillcolor{\tikz@fillcolor}
26538 \fi
26539 \pgfusepath{draw,fill}
26540 \endpgfscope
26541 }
26542 }
26543 %% %>>>
26544
26545 % vim: set fdm=marker fmr=%<<<,%>>>:
26546 %%%---------- close: tex/pgfcircmultipoles
26547
26548 %%%%%%%%%%% Springe nach tex/pgfcirclabel
26549 %%%---------- open: tex/pgfcirclabel.tex
26550 % Copyright 2018-2026 by Romano Giannetti
26551 % Copyright 2015-2026 by Stefan Lindner
26552 % Copyright 2013-2026 by Stefan Erhardt
26553 % Copyright 2007-2026 by Massimo Redaelli
26554 %
26555 % This file may be distributed and/or modified
26556 %
26557 % 1. under the LaTeX Project Public License and/or
26558 % 2. under the GNU Public License.
26559 %
26560 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
26561
26562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26563 %% Bipole label positioning
26564
26565 %% bipole labels and annotation extra style
26566
26567 \ctikzset{bipole label style/.style={}}
26568 \tikzset{bipole label style/.code={
26569 \ctikzset{bipole label style/.style={#1}}
26570 }}
26571 \tikzset{bipole label append style/.code={
26572 \ctikzset{bipole label style/.append style={#1}}
26573 }}
26574 \ctikzset{bipole annotation style/.style={}}
26575 \tikzset{bipole annotation style/.code={
26576 \ctikzset{bipole annotation style/.style={#1}}
26577 }}
26578 \tikzset{bipole annotation append style/.code={
26579 \ctikzset{bipole annotation style/.append style={#1}}
26580 }}
26581
26582 \ctikzset{label distance/.initial={0pt}}
26583 \ctikzset{annotation distance/.initial={0pt}}
26584
26585 %% Options
26586 \ctikzset{label/.style = { l={#1} } }
26587 \ctikzset{l/.code = {
26588 \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}}
26589 \ctikzsetvalof{bipole/label/unit}{}
26590 \ifpgf@circ@siunitx
26591 \pgf@circ@handleSI{#1}
26592 \ifpgf@circ@siunitx@res
26593 \edef\pgf@temp{\pgf@circ@handleSI@val}
26594 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
26595 \edef\pgf@temp{\pgf@circ@handleSI@unit}
26596 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
26597 \else
26598 \fi
26599 \else
26600 \fi
26601 }}
26602
26603 \ctikzset{label above/.code = {
26604 l={#1},
26605 \circuitikzbasekey/bipole/label/position=90 }
26606 }
26607
26608 \ctikzset{l^/.style = {
26609 l={#1},
26610 \circuitikzbasekey/bipole/label/position=90 }
26611 }
26612
26613 \ctikzset{label below/.code = {
26614 l={#1},
26615 \circuitikzbasekey/bipole/label/position=-90 }
26616 }
26617
26618 \ctikzset{l_/.style = {
26619 l={#1},
26620 \circuitikzbasekey/bipole/label/position=-90 }
26621 }
26622
26623 \ctikzset{annotation/.style = { a={#1} } }
26624 \ctikzset{a/.code = {
26625 \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}}
26626 \ctikzsetvalof{bipole/annotation/unit}{}
26627 \ifpgf@circ@siunitx
26628 \pgf@circ@handleSI{#1}
26629 \ifpgf@circ@siunitx@res
26630 \edef\pgf@temp{\pgf@circ@handleSI@val}
26631 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
26632 \edef\pgf@temp{\pgf@circ@handleSI@unit}
26633 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
26634 \else
26635 \fi
26636 \else
26637 \fi
26638 }}
26639
26640 \ctikzset{annotation above/.code = {
26641 a={#1},
26642 \circuitikzbasekey/bipole/annotation/position=90 }
26643 }
26644
26645 \ctikzset{a^/.style = {
26646 a={#1},
26647 \circuitikzbasekey/bipole/annotation/position=90 }
26648 }
26649
26650 \ctikzset{annotation below/.code = {
26651 a={#1},
26652 \circuitikzbasekey/bipole/annotation/position=-90 }
26653 }
26654 \ctikzset{a_/.style = {
26655 a={#1},
26656 \circuitikzbasekey/bipole/annotation/position=-90 }
26657 }
26658
26659 % This is to adjust spacing for the labels so that they are not cramped on components
26660 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
26661
26662 \def\pgf@circ@drawlabels#1{
26663 \pgfextra{
26664 % This function will be called with argument #1 equal
26665 % to "label" or "annotation" form pgfcircpath.tex.
26666 % pgf@circ@direction is the direction of the path,
26667 % its value is set in pgfcircpath.tex
26668 \pgfmathsubtract{\pgf@circ@direction}{90}
26669 \pgfmathround{\pgfmathresult} % avoid precision loss errors
26670 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26671
26672 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
26673 \ifnum \pgf@circ@temp < 0
26674 \pgfmathadd{\pgf@circ@labanc}{180}
26675 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26676 \fi
26677 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
26678 %
26679 % normalize the angle values
26680 %
26681 \pgfmathmod{\pgf@circ@labanc}{360}
26682 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26683 %
26684 \ifpgf@circuit@bipole@inverted
26685 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
26686 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26687 \fi
26688 %
26689 \ifnum \ctikzvalof{mirror value} = -1
26690 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
26691 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26692 \fi
26693 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
26694 }
26695 %Firstly, place a coordinate directly at the edge of the shape
26696 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
26697 %now decide, which labels should be drawn
26698 \pgfextra{
26699 \edef\pgf@temp{\ctikzvalof{label/align}}
26700 \def\pgf@circ@temp{straight}
26701 }
26702 \ifx\pgf@temp\pgf@circ@temp %straight
26703 \pgf@circ@drawreglabels{#1}
26704 \else
26705 \pgfextra{\def\pgf@circ@temp{rotate}}
26706 \ifx\pgf@temp\pgf@circ@temp %rotate
26707 \pgf@circ@drawrotlabels{#1}
26708 \else% smart
26709 \pgf@circ@drawsmartlabels{#1}
26710 \fi
26711 \fi
26712 }
26713
26714
26715 \def\pgf@circ@drawsmartlabels#1{
26716 \pgfextra{
26717 \pgfmathmod{\pgf@circ@direction}{90}
26718 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26719 }
26720 \ifnum \pgfcircmathresult > 20
26721 \ifnum \pgfcircmathresult < 70
26722 \pgf@circ@drawrotlabels{#1}
26723 \else
26724 \pgf@circ@drawreglabels{#1}
26725 \fi
26726 \else
26727 \pgf@circ@drawreglabels{#1}
26728 \fi
26729 }
26730
26731
26732 \def\pgf@circ@drawrotlabels#1{
26733 \pgfextra{
26734 % scale the distances in function of zoom, so that they are not
26735 % dependent on it but on font size. Thanks to @marmot
26736 % https://tex.stackexchange.com/a/476018/38080
26737 % the coefficient is adjusted so that the distance is more or less
26738 % the same for rotated labels and straight ones (although it will
26739 % depend on the font, so it's not exact).
26740 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
26741 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
26742 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
26743 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
26744 \ifnum \ctikzvalof{bipole/#1/position}>0
26745 %we need some more space for placement below, due to mid-anchor
26746 \else % we do not have <= in \ifnum...
26747 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
26748 \fi
26749 %Calculate rotation of the label from direction and strip decimals
26750 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
26751 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
26752 % rotate the label at second or third quadrant:
26753 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
26754 \pgfmathsubtract{\pgf@circ@direction}{180}
26755 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26756 %invert the space relationships due to rotated strings
26757 \ifnum \ctikzvalof{bipole/#1/position}>0
26758 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
26759 \fi
26760 \fi\fi
26761 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
26762 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
26763 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
26764 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
26765 }
26766 % reset cm is not working correctly here
26767 % relative ++ movement disrupt to[] +()
26768 ($(pgfcirc@labelcoor)+(\pgf@circ@labposangle:\the\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
26769 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
26770 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
26771 }
26772
26773 \def\pgf@circ@drawreglabels#1{
26774 %Now calculate all shape positions
26775 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
26776 %All points between will be addressed by angled-anchors:
26777 \pgfextra{
26778 % scale ex-distance to make it independent on scale
26779 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
26780 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
26781 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
26782 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
26783 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
26784 \pgfmathadd{\pgf@circ@labanc}{90}
26785 \pgfmathround{\pgfmathresult}
26786 \def\pgf@circ@labanctext{\pgf@circ@labanc}
26787 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26788 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
26789 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26790 }
26791 %Values around 90 are at both y-axis
26792 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
26793 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
26794 \ifnum \pgf@circ@labpos > 180
26795 \ifnum \ctikzvalof{bipole/#1/position} > 0
26796 \pgfextra{\def\pgf@circ@labanctext{mid west}}
26797 \else
26798 \pgfextra{\def\pgf@circ@labanctext{mid east}}
26799 \fi
26800 \else
26801 \ifnum \ctikzvalof{bipole/#1/position} > 0
26802 \pgfextra{\def\pgf@circ@labanctext{mid east}}
26803 \else
26804 \pgfextra{\def\pgf@circ@labanctext{mid west}}
26805 \fi
26806 \fi
26807 \fi\fi
26808 %Values between -5 and 5 are at pos /neg x-axis
26809 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
26810 \ifnum \ctikzvalof{bipole/#1/position} < 0
26811 \ifnum \pgf@circ@labanc > 90
26812 % using base coordinate instead of south to naturally align
26813 % symbols with descendants; but this invalidate the effect of
26814 % the inner sep, so recover it by shifting the anchor
26815 % reset cm is not working sometime, use @marmot solution
26816 % see https://tex.stackexchange.com/a/476018/38080
26817 % notice that relative ++ movement disrupt to[] +()
26818 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
26819 \pgfextra{\def\pgf@circ@labanctext{base}}%base
26820 \else
26821 \pgfextra{\def\pgf@circ@labanctext{north}}%north
26822 \fi
26823 \else
26824 \ifnum \pgf@circ@labanc < 90
26825 % shift, as above
26826 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
26827 \pgfextra{\def\pgf@circ@labanctext{base}}%base
26828 \else
26829 \ifnum \pgf@circ@labanc > 180
26830 % this shouldn't happen, but somehow it does (270 degree anchors)
26831 % shift, as above
26832 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
26833 \pgfextra{\def\pgf@circ@labanctext{base}}%base
26834 \else
26835 \pgfextra{\def\pgf@circ@labanctext{north}}%north
26836 \fi
26837 \fi
26838 \fi
26839 \fi\fi
26840 \pgfextra{%
26841 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
26842 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
26843 }
26844 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
26845 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
26846 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
26847 }
26848 }
26849
26850 \def\pgf@circ@finallabels#1{%
26851 \edef\pgf@temp{}%
26852 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
26853 \ifx\pgf@temp\pgf@circ@temp%
26854 \ctikzvalof{bipole/#1/name}%
26855 \else%
26856 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
26857 \fi%
26858 }
26859
26860
26861 %%%% Stacked labels
26862 %
26863 % stacked labels by Romano Giannetti [email protected]
26864 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
26865 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
26866 %
26867 % labels are in a tabular, globally aligned:
26868 % vertically with key l2 valign (default c)
26869 % c: center t: top b: bottom
26870 % horizontally with key l2 align (default l)
26871 % l: left c: centered r: right
26872 % you can switch sides using l2_=... and l2^=...
26873 % syntax is l2_ = line1 and line2 (same for l2^)
26874 %
26875 \ctikzset{%
26876 l2 valign/.store in=\pgfcirc@ltwo@valign, l2 valign=c,
26877 l2 halign/.store in=\pgfcirc@ltwo@halign, l2 halign=l,
26878 }
26879 \ctikzset{l2base/.code n args={2}{
26880 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
26881 \bgroup
26882 \setlength{\tabcolsep}{2pt}%
26883 \def\pgfcirc@ltwo@tabu{\tabular[\pgfcirc@ltwo@valign]}%
26884 \expandafter\pgfcirc@ltwo@tabu\expandafter{\pgfcirc@ltwo@halign}%
26885 #1\\ #2%
26886 \endtabular
26887 \egroup
26888 }%
26889 }}
26890 \ctikzset{l2/.style args={#1and#2}{
26891 l2base={#1}{#2},
26892 \circuitikzbasekey/bipole/label/position=90 }
26893 }
26894 \ctikzset{l2 above/.style args={#1and#2}{
26895 l2base={#1}{#2},
26896 \circuitikzbasekey/bipole/label/position=90 }
26897 }
26898 \ctikzset{l2^/.style args={#1and#2}{
26899 l2base={#1}{#2},
26900 \circuitikzbasekey/bipole/label/position=90 }
26901 }
26902 \ctikzset{l2 below/.style args={#1and#2}{
26903 l2base={#1}{#2},
26904 \circuitikzbasekey/bipole/label/position=-90 }
26905 }
26906 \ctikzset{l2_/.style args={#1and#2}{
26907 l2base={#1}{#2},
26908 \circuitikzbasekey/bipole/label/position=-90 }
26909 }
26910 %
26911 % the same for annotations
26912 %
26913 \ctikzset{%
26914 a2 valign/.store in=\pgfcirc@atwo@valign, a2 valign=c,
26915 a2 halign/.store in=\pgfcirc@atwo@halign, a2 halign=r,
26916 }
26917 \ctikzset{a2base/.code n args={2}{
26918 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=%
26919 \bgroup
26920 \setlength{\tabcolsep}{2pt}%
26921 \def\pgfcirc@atwo@tabu{\tabular[\pgfcirc@atwo@valign]}%
26922 \expandafter\pgfcirc@atwo@tabu\expandafter{\pgfcirc@atwo@halign}%
26923 #1\\ #2%
26924 \endtabular
26925 \egroup
26926 }%
26927 }}
26928 \ctikzset{a2/.style args={#1and#2}{
26929 a2base={#1}{#2},
26930 \circuitikzbasekey/bipole/annotation/position=-90 }
26931 }
26932 \ctikzset{a2 above/.style args={#1and#2}{
26933 a2base={#1}{#2},
26934 \circuitikzbasekey/bipole/annotation/position=-90 }
26935 }
26936 \ctikzset{a2^/.style args={#1and#2}{
26937 a2base={#1}{#2},
26938 \circuitikzbasekey/bipole/annotation/position=-90 }
26939 }
26940 \ctikzset{a2 below/.style args={#1and#2}{
26941 a2base={#1}{#2},
26942 \circuitikzbasekey/bipole/annotation/position=90 }
26943 }
26944 \ctikzset{a2_/.style args={#1and#2}{
26945 a2base={#1}{#2},
26946 \circuitikzbasekey/bipole/annotation/position=90 }
26947 }
26948
26949 %%%---------- close: tex/pgfcirclabel
26950 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
26951 %%%---------- open: tex/pgfcircvoltage.tex
26952 % Copyright 2018-2026 by Romano Giannetti
26953 % Copyright 2015-2026 by Stefan Lindner
26954 % Copyright 2013-2026 by Stefan Erhardt
26955 % Copyright 2007-2026 by Massimo Redaelli
26956 %
26957 % This file may be distributed and/or modified
26958 %
26959 % 1. under the LaTeX Project Public License and/or
26960 % 2. under the GNU Public License.
26961 %
26962 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
26963
26964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26965 %% Voltage management
26966
26967 %% styles%<<<
26968 \ctikzset{bipole voltage style/.style={}}
26969 \tikzset{bipole voltage style/.code={
26970 \ctikzset{bipole voltage style/.style={#1}}
26971 }}
26972 \tikzset{bipole voltage append style/.code={
26973 \ctikzset{bipole voltage style/.append style={#1}}
26974 }}
26975
26976 \ctikzset{v^>/.style = {
26977 v={#1},
26978 \circuitikzbasekey/bipole/voltage/direction = forward,
26979 \circuitikzbasekey/bipole/voltage/position = above
26980 }
26981 }
26982
26983 \ctikzset{v^</.style = {
26984 v={#1},
26985 \circuitikzbasekey/bipole/voltage/direction = backward,
26986 \circuitikzbasekey/bipole/voltage/position = above
26987 }
26988 }
26989
26990 \ctikzset{v_>/.style = {
26991 v={#1},
26992 \circuitikzbasekey/bipole/voltage/direction = forward,
26993 \circuitikzbasekey/bipole/voltage/position = below
26994 }
26995 }
26996
26997 \ctikzset{v_</.style = {
26998 v={#1},
26999 \circuitikzbasekey/bipole/voltage/direction = backward,
27000 \circuitikzbasekey/bipole/voltage/position = below
27001 }
27002 }
27003
27004 \ctikzset{v_/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = below} }
27005 \ctikzset{v^/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = above} }
27006 \ctikzset{v>/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} }
27007 \ctikzset{v</.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward} }%
27008
27009 \newif\ifpgfcirc@do@v@symbols\pgfcirc@do@v@symbolstrue
27010 \ctikzset{no v symbols/.code={\pgfcirc@do@v@symbolsfalse}}
27011 \ctikzset{v symbols/.code={\pgfcirc@do@v@symbolstrue}}
27012
27013 % Default position varies whether the component is a voltage source
27014 % or not
27015 \ctikzset{v/.code = {
27016 \pgfcirc@has@vtrue
27017 \ifpgf@circuit@bipole@override@source@vif
27018 \pgf@circuit@bipole@isvoltagefalse
27019 \pgf@circuit@bipole@iscurrentfalse
27020 \fi
27021 \ifpgf@circuit@bipole@isvoltage
27022 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
27023 \circuitikzbasekey/bipole/voltage/direction=forward}
27024 \else
27025 \ifpgf@circ@oldvoltagedirection
27026 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27027 \circuitikzbasekey/bipole/voltage/direction=backward}
27028 \else
27029 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27030 \circuitikzbasekey/bipole/voltage/direction=forward}
27031 \fi
27032 \fi
27033 \ifpgf@circ@oldvoltagedirection
27034 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
27035 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27036 \circuitikzbasekey/bipole/voltage/direction=forward}
27037 \fi\fi
27038 \else
27039 \ifpgf@circuit@bipole@iscurrent
27040 \ifpgf@circuit@bipole@current@backward
27041 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27042 \circuitikzbasekey/bipole/voltage/direction=forward}
27043 \else
27044 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27045 \circuitikzbasekey/bipole/voltage/direction=backward}
27046 \fi\fi\fi
27047 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name={#1}}
27048 \ctikzsetvalof{bipole/voltage/label/unit}{}
27049 \ifpgf@circ@siunitx
27050 \pgf@circ@handleSI{#1}
27051 \ifpgf@circ@siunitx@res
27052 \edef\pgf@temp{\pgf@circ@handleSI@val}
27053 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
27054 \edef\pgf@temp{\pgf@circ@handleSI@unit}
27055 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
27056 \else
27057 \fi
27058 \else
27059 \fi
27060 }
27061 }
27062 % %>>>
27063
27064 % american voltage font selection and symbol definition
27065 % the default font command is {} --- nothing
27066 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
27067 %
27068 % In the mayority of fonts, the size of - is smaller than +, so we have
27069 % unaligned signs when positioned independently.
27070 % See https://github.com/circuitikz/circuitikz/issues/721
27071 % plus and minus symbols (default is $+$ and $\vphantom{+}-$, see pgfcirc.defines.tex)
27072 %
27073 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
27074 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
27075
27076 %%
27077 \def\setscaledRlenforclass{%
27078 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
27079 \ifdefined\ctikzclass
27080 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
27081 \pgfkeysifdefined{\pgf@temp}
27082 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
27083 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
27084 \else
27085 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
27086 \fi
27087 }
27088
27089 %% Output routine for generic bipoles%<<<
27090 % put this to true to see the voltage label coordinate anchors
27091 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
27092
27093 \def\pgf@circ@drawvoltagegeneric{
27094 \pgfextra{
27095 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
27096 \ifnum \ctikzvalof{mirror value}=-1
27097 \ifpgf@circuit@bipole@inverted
27098 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27099 \else
27100 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27101 \fi
27102 \else
27103 \ifpgf@circuit@bipole@inverted
27104 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27105 \else
27106 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27107 \fi
27108 \fi
27109 \ifpgf@circuit@bipole@voltage@below
27110 \def\pgf@circ@voltage@angle{90}
27111 \else
27112 \def\pgf@circ@voltage@angle{-90}
27113 \fi
27114 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
27115 \pgfkeysifdefined{\pgf@temp}
27116 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
27117 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
27118 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
27119 \pgfkeysifdefined{\pgf@temp}
27120 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
27121 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
27122 \edef\shiftv{\ctikzvalof{voltage/shift}}
27123 % additional per-bipole voltage shift (internal)
27124 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
27125 \pgfkeysifdefined{\pgf@temp}
27126 {
27127 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
27128 }
27129 {
27130 \edef\addvshift{0}
27131 }
27132 \newdimen{\absvshift}
27133 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
27134 % reset anchor if american and open
27135 \ifpgf@circuit@europeanvoltage
27136 \else
27137 \ifx\@@kind\@@open
27138 \def\pgf@circ@bipole@voltage@label@anchor{center}
27139 \fi
27140 \fi
27141 \ifpgf@circuit@bipole@voltage@raised
27142 \def\pgf@circ@bipole@voltage@label@anchor{center}
27143 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
27144 \fi
27145 % apply the same shift to open "straight" voltage as raised
27146 % commented out due to https://github.com/circuitikz/circuitikz/issues/821
27147 % but I'm not sure if it's correct
27148 % \ifpgf@circuit@bipole@voltage@straight
27149 % \ifx\@@kind\@@open
27150 % \def\pgf@circ@bipole@voltage@label@anchor{center}
27151 % \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
27152 % \fi
27153 % \fi
27154 }
27155 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
27156 %absolute move, minimum space is length of arrowhead
27157 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
27158 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
27159 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
27160 %absolute move, minimum space is length of arrowhead
27161 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
27162 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
27163 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
27164 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
27165
27166 \ifpgf@circuit@bipole@voltage@below
27167 % see comments for the "above" part (similar)
27168 \ifpgf@circuit@europeanvoltage
27169 \ifpgf@circuit@bipole@voltage@straight
27170 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
27171 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
27172 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
27173 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
27174 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
27175 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27176 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27177 \else
27178 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
27179 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
27180 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
27181 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
27182 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
27183 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
27184 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
27185 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
27186 \fi
27187 \else
27188 % we are in case of american here
27189 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
27190 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
27191 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
27192 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
27193 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
27194 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
27195 \ifpgf@circuit@bipole@voltage@raised
27196 % move the from and to up to the level of Vlab
27197 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
27198 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
27199 \fi
27200 \fi
27201 \else
27202 \ifpgf@circuit@europeanvoltage
27203 \ifpgf@circuit@bipole@voltage@straight
27204 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
27205 % move parallel to the component line at pgfcirc@top distance
27206 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
27207 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
27208 % add the extra distance
27209 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
27210 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
27211 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27212 % direction line to shift the label later
27213 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27214 \else
27215 % european voltages here
27216 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
27217 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
27218 % identify the two control points for the "arc" of the voltage
27219 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
27220 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
27221 % and shift them a bit
27222 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
27223 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
27224 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
27225 % direction line to shift the label later
27226 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
27227 \fi
27228 \else
27229 % we are in case of american here
27230 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
27231 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
27232 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
27233 % move parallel to the component line
27234 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
27235 % and add the extra distance
27236 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
27237 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
27238 \ifpgf@circuit@bipole@voltage@raised
27239 % move the from and to up to the level of Vlab
27240 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
27241 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
27242 \fi
27243 \fi
27244 \fi
27245 \ifx\@@kind\@@open
27246 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
27247 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
27248 \fi
27249 \ifpgf@circ@debugv
27250 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
27251 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
27252 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
27253 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
27254 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
27255 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
27256 \ifpgf@circuit@europeanvoltage
27257 \ifpgf@circuit@bipole@voltage@straight
27258 \else
27259 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
27260 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
27261 \fi
27262 \fi
27263 \fi
27264
27265 %
27266 % Now we draw the voltage things (only if not empty --- in which case we have been
27267 % called just to set the anchors)
27268 %
27269 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27270 \ifpgfcirc@do@v@symbols
27271 \ifpgf@circuit@europeanvoltage
27272 \ifpgf@circuit@bipole@voltage@straight
27273 \ifpgf@circuit@bipole@voltage@backward
27274 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
27275 \else
27276 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
27277 \fi
27278 \else
27279 \ifpgf@circuit@bipole@voltage@backward
27280 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
27281 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
27282 (\pgfcirc@a@prefix-Vfrom)
27283 \else
27284 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
27285 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
27286 (\pgfcirc@a@prefix-Vto)
27287 \fi
27288 \fi
27289 \else % american
27290 \ifpgf@circuit@bipole@voltage@backward
27291 \ifpgf@circ@oldvoltagedirection
27292 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27293 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27294 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27295 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27296 \else
27297 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27298 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27299 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27300 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27301 \fi
27302 \else
27303 \ifpgf@circ@oldvoltagedirection
27304 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27305 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27306 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27307 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27308 \else
27309 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27310 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27311 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27312 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27313 \fi
27314 \fi
27315 \fi
27316 \fi % closing the ...symbol
27317 \fi % Closing the ...ifempty
27318 }
27319 % %>>>
27320
27321 %% Output routine for voltage sources%<<<
27322 % (ugly) workaround for https://github.com/circuitikz/circuitikz/issues/747
27323 \ctikzset{voltage shift sources adjust/.initial=0.5} % coefficient added "by feel". Sorry.
27324 \def\pgf@circ@drawvoltagegenerator{
27325 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
27326 % it's not perfect, but I can't find the way to do it correctly...
27327 \pgfextra{
27328 \edef\shiftv{\ctikzvalof{voltage/shift}}
27329 % distance along the 60-120 axis
27330 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
27331 \pgfkeysifdefined{\pgf@temp}
27332 {
27333 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
27334 }
27335 {
27336 \edef\bumpa{\ctikzvalof{voltage/bump a}}
27337 }
27338 % additional per-bipole voltage shift (internal)
27339 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
27340 \pgfkeysifdefined{\pgf@temp}
27341 {
27342 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
27343 }
27344 {
27345 \edef\addvshift{0}
27346 }
27347 \pgfmathsetmacro{\bumpaplus}{\bumpa + \ctikzvalof{voltage shift sources adjust}*\shiftv}
27348 }
27349 \ifpgf@circuit@bipole@voltage@below
27350 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
27351 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
27352 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
27353 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
27354 \else
27355 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
27356 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
27357 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
27358 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
27359 \fi
27360 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27361 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27362 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27363 \ifpgfcirc@do@v@symbols
27364 \ifpgf@circuit@europeanvoltage
27365 \ifpgf@circuit@bipole@voltage@backward
27366 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
27367 \else
27368 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
27369 \fi
27370 \else% american voltage
27371 \ifpgf@circuit@bipole@voltageoutsideofsymbol
27372 % if it is a battery, must put + and -
27373
27374 \ifpgf@circ@fixbatteries
27375 \ifpgf@circuit@bipole@voltage@backward
27376 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27377 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27378 \else
27379 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27380 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27381 \fi
27382 \else
27383 \ifpgf@circuit@bipole@voltage@backward
27384 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27385 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27386 \else
27387 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27388 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27389 \fi
27390 \fi
27391 \fi
27392 \fi
27393 \fi % closes ... ifsymbol
27394 \fi % closes ...ifempty
27395 }
27396 % %>>>
27397
27398 %% Output routine (main entry point) %<<<
27399 %% this is the entry point
27400 %%
27401 %% locally used dimensions
27402 \newdimen{\pgfcirc@labelshift}
27403 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
27404 \def\pgf@circ@drawvoltage{% node name
27405 \pgfextra{%
27406 % set the helper if...curved
27407 \ifpgf@circuit@europeanvoltage
27408 \ifpgf@circuit@bipole@voltage@straight
27409 \pgfcirc@v@curvedfalse
27410 \else
27411 \pgfcirc@v@curvedtrue
27412 \fi
27413 \else
27414 \pgfcirc@v@curvedfalse
27415 \fi
27416 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
27417 % Label anchors WARNING: indentation is probably wrong
27418 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
27419 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
27420 \ifpgf@circuit@bipole@voltage@below
27421 \def\pgf@circ@bipole@voltage@label@anchor{north west}
27422 \else
27423 \def\pgf@circ@bipole@voltage@label@anchor{south east}
27424 \fi
27425 \fi\fi
27426 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
27427 \ifpgf@circuit@bipole@voltage@below
27428 \def\pgf@circ@bipole@voltage@label@anchor{west}
27429 \else
27430 \def\pgf@circ@bipole@voltage@label@anchor{east}
27431 \fi
27432 \fi\fi
27433 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
27434 \ifpgf@circuit@bipole@voltage@below
27435 \def\pgf@circ@bipole@voltage@label@anchor{south west}
27436 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
27437 \fi
27438 \fi\fi
27439 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
27440 \ifpgf@circuit@bipole@voltage@below
27441 \def\pgf@circ@bipole@voltage@label@anchor{south}
27442 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
27443 \fi
27444 \fi\fi
27445 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
27446 \ifpgf@circuit@bipole@voltage@below
27447 \def\pgf@circ@bipole@voltage@label@anchor{south east}
27448 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
27449 \fi
27450 \fi\fi
27451 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
27452 \ifpgf@circuit@bipole@voltage@below
27453 \def\pgf@circ@bipole@voltage@label@anchor{east}
27454 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
27455 \fi
27456 \fi\fi
27457 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
27458 \ifpgf@circuit@bipole@voltage@below
27459 \def\pgf@circ@bipole@voltage@label@anchor{north east}
27460 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
27461 \fi
27462 \fi\fi
27463 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
27464 \ifpgf@circuit@bipole@voltage@below
27465 \def\pgf@circ@bipole@voltage@label@anchor{north}
27466 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
27467 \fi
27468 \fi\fi
27469 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
27470 \ifpgf@circuit@bipole@voltage@below
27471 \def\pgf@circ@bipole@voltage@label@anchor{north}
27472 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
27473 \fi
27474 \fi\fi
27475
27476 % export anchor position (if not needed, is always the same macro)
27477 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
27478 % this must be set *before* changing for mirroring and inverting; in that case
27479 % the xscale/yscale parameters take it into account
27480 \ifpgf@circuit@bipole@voltage@below
27481 \def\pgf@circ@bipole@voltage@label@where{-90}
27482 \else
27483 \def\pgf@circ@bipole@voltage@label@where{90}
27484 \fi
27485
27486 % magic to counteract the scale and yscale effects (there should be a better way...)
27487 \ifnum \ctikzvalof{mirror value}=-1
27488 \ifpgf@circuit@bipole@voltage@below
27489 \pgf@circuit@bipole@voltage@belowfalse
27490 \else
27491 \pgf@circuit@bipole@voltage@belowtrue
27492 \fi
27493 \fi
27494
27495 \ifpgf@circuit@bipole@inverted
27496 \ifpgf@circuit@bipole@voltage@below
27497 \pgf@circuit@bipole@voltage@belowfalse
27498 \else
27499 \pgf@circuit@bipole@voltage@belowtrue
27500 \fi
27501 \fi
27502
27503 % take into account scaling
27504 \setscaledRlenforclass
27505 % set the macro for detecting open
27506 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
27507 % start voltage label adjustment
27508 \ifpgf@circuit@europeanvoltage
27509 \ifpgf@circuit@bipole@voltage@straight
27510 % check for straight
27511 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
27512 \pgfkeysifdefined{\pgf@temp}{%
27513 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
27514 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
27515 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
27516 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
27517 % do not labelshift for legacy straight open; 1.4 makes the shift null
27518 \ifx\@@kind\@@open\ifpgf@adjust@open@voltage\else\edef\labeldist{1.4}\fi\fi
27519 \else
27520 % check for european
27521 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
27522 \pgfkeysifdefined{\pgf@temp}{%
27523 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
27524 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
27525 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
27526 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
27527 \fi
27528 \else
27529 % check for american
27530 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
27531 \pgfkeysifdefined{\pgf@temp}{%
27532 \ifpgf@circuit@bipole@voltage@raised
27533 % do not apply the shift if we are using raised american style
27534 \edef\labeldist{1.4}% default value
27535 \else
27536 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
27537 \fi
27538 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
27539 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
27540 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
27541 \fi
27542 % find the height of the bipole or use a default value
27543 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
27544 \pgfkeysifdefined{\pgf@temp}
27545 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
27546 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
27547 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
27548 \ifpgf@circuit@bipole@isvoltage
27549 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
27550 \else
27551 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
27552 \fi
27553 % the value for the european was by default 1.4
27554 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
27555 % stop the detection of open if I do not want special treatment
27556 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
27557 % \typeout{KIND\space\@@kind}
27558 }%end pgfextra
27559
27560 \ifpgf@circuit@bipole@isvoltage
27561 \pgf@circ@drawvoltagegenerator
27562 % add fake cont1 and cont2 anchors for export
27563 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27564 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27565 \else
27566 \pgf@circ@drawvoltagegeneric
27567 \fi
27568 % % debugging
27569 % \pgfextra{%
27570 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
27571 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
27572 % \pgf@circ@debugvtrue}
27573
27574 % move a bit if requested
27575 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
27576
27577 % check for the case of american AND open
27578 \ifpgf@circuit@europeanvoltage
27579 \else
27580 \ifx\@@kind\@@open
27581 % override pgfcirc@Vlab
27582 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
27583 \fi
27584 \fi
27585
27586 \ifpgf@circ@debugv
27587 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
27588 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
27589 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
27590 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
27591 \fi
27592
27593 % put the node only if it's not empty
27594 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27595 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
27596 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
27597 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
27598 \fi
27599
27600 \ifpgfcirc@v@curved\else
27601 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
27602 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27603 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27604 \fi
27605 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
27606 \ifpgf@circuit@bipole@voltage@backward
27607 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
27608 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
27609 \fi
27610
27611 }%end drawvoltages
27612
27613 % %>>>
27614
27615 %% these should be arguably moved to every component definition...
27616
27617 % special cases for voltage positions%<<<1
27618 % the KIND is the node name without SHAPE
27619 % See the definition above for meaning
27620 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
27621 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
27622 %
27623 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
27624 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
27625 %
27626 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
27627 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
27628 %
27629 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
27630 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
27631 %
27632 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
27633 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
27634 %
27635 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
27636 %
27637 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
27638 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
27639 %
27640 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
27641 %
27642 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
27643 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
27644 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
27645 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
27646 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
27647 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
27648 %
27649 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
27650 %
27651 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
27652 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
27653 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
27654 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
27655 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
27656 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
27657 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
27658 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
27659 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
27660 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
27661 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
27662 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
27663 %
27664 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
27665 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
27666 %
27667 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
27668 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
27669 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
27670 %%>>>
27671
27672 % vim: set fdm=marker fmr=%<<<,%>>>:
27673 %%%---------- close: tex/pgfcircvoltage
27674 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
27675 %%%---------- open: tex/pgfcirccurrent.tex
27676 % Copyright 2018-2026 by Romano Giannetti
27677 % Copyright 2015-2026 by Stefan Lindner
27678 % Copyright 2013-2026 by Stefan Erhardt
27679 % Copyright 2007-2026 by Massimo Redaelli
27680 %
27681 % This file may be distributed and/or modified
27682 %
27683 % 1. under the LaTeX Project Public License and/or
27684 % 2. under the GNU Public License.
27685 %
27686 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
27687
27688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27689 %% Current handling
27690
27691 %% styles
27692 \ctikzset{bipole current style/.style={}}
27693 \tikzset{bipole current style/.code={
27694 \ctikzset{bipole current style/.style={#1}}
27695 }}
27696 \tikzset{bipole current append style/.code={
27697 \ctikzset{bipole current style/.append style={#1}}
27698 }}
27699
27700 %% Options
27701 \ctikzset{i^>/.style = {
27702 i={#1},
27703 \circuitikzbasekey/bipole/current/direction = forward,
27704 \circuitikzbasekey/bipole/current/x position = after,
27705 \circuitikzbasekey/bipole/current/y position = above
27706 }
27707 }
27708
27709 \ctikzset{i_>/.style = {
27710 i={#1},
27711 \circuitikzbasekey/bipole/current/direction = forward,
27712 \circuitikzbasekey/bipole/current/x position = after,
27713 \circuitikzbasekey/bipole/current/y position = below
27714 }
27715 }
27716
27717 \ctikzset{i>^/.style = {
27718 i={#1},
27719 \circuitikzbasekey/bipole/current/direction = forward,
27720 \circuitikzbasekey/bipole/current/x position = before,
27721 \circuitikzbasekey/bipole/current/y position = above
27722 }
27723 }
27724
27725 \ctikzset{i>_/.style = {
27726 i={#1},
27727 \circuitikzbasekey/bipole/current/direction = forward,
27728 \circuitikzbasekey/bipole/current/x position = before,
27729 \circuitikzbasekey/bipole/current/y position = below
27730 }
27731 }
27732
27733 \ctikzset{i^</.style = {
27734 i={#1},
27735 \circuitikzbasekey/bipole/current/direction = backward,
27736 \circuitikzbasekey/bipole/current/x position = after,
27737 \circuitikzbasekey/bipole/current/y position = above
27738 }
27739 }
27740
27741 \ctikzset{i_</.style = {
27742 i={#1},
27743 \circuitikzbasekey/bipole/current/direction = backward,
27744 \circuitikzbasekey/bipole/current/x position = after,
27745 \circuitikzbasekey/bipole/current/y position = below
27746 }
27747 }
27748
27749 \ctikzset{i<^/.style = {
27750 i={#1},
27751 \circuitikzbasekey/bipole/current/direction = backward,
27752 \circuitikzbasekey/bipole/current/x position = before,
27753 \circuitikzbasekey/bipole/current/y position = above
27754 }
27755 }
27756
27757 \ctikzset{i<_/.style = {
27758 i={#1},
27759 \circuitikzbasekey/bipole/current/direction = backward,
27760 \circuitikzbasekey/bipole/current/x position = before,
27761 \circuitikzbasekey/bipole/current/y position = below
27762 }
27763 }
27764
27765 \newif\ifpgfcirc@do@i@symbols\pgfcirc@do@i@symbolstrue
27766 \ctikzset{no i symbols/.code={\pgfcirc@do@i@symbolsfalse}}
27767 \ctikzset{i symbols/.code={\pgfcirc@do@i@symbolstrue}}
27768
27769 \ctikzset{i/.code = {
27770 \pgfcirc@has@itrue
27771 \ifpgf@circuit@bipole@override@source@vif
27772 \pgf@circuit@bipole@isvoltagefalse
27773 \pgf@circuit@bipole@iscurrentfalse
27774 \fi
27775 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
27776 \circuitikzbasekey/bipole/current/x position = after,
27777 \circuitikzbasekey/bipole/current/y position = above }
27778 \pgfkeys{/tikz/circuitikz/bipole/current/label/name={#1}}
27779 \ctikzsetvalof{bipole/current/label/unit}{}
27780 \ifpgf@circ@siunitx
27781 \pgf@circ@handleSI{#1}
27782 \ifpgf@circ@siunitx@res
27783 \edef\pgf@temp{\pgf@circ@handleSI@val}
27784 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
27785 \edef\pgf@temp{\pgf@circ@handleSI@unit}
27786 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
27787 \else
27788 \fi
27789 \else
27790 \fi
27791 %reverse current direction for voltage sources
27792 \ifpgf@circ@oldvoltagedirection\else
27793 \ifpgf@circuit@bipole@isvoltage
27794 \ifpgf@circuit@bipole@voltage@backward
27795 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
27796 \circuitikzbasekey/bipole/current/x position = after,
27797 \circuitikzbasekey/bipole/current/y position = below }
27798 \else
27799 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
27800 \circuitikzbasekey/bipole/current/x position = before,
27801 \circuitikzbasekey/bipole/current/y position = above }
27802 \fi\fi\fi
27803 }
27804 }
27805
27806 \ifpgf@circ@oldvoltagedirection
27807 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward } }
27808 \else
27809 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
27810 \fi
27811 \ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } }
27812 \ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } }
27813 \ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } }
27814
27815 %% Output routine
27816 \def\pgf@circ@drawcurrent{
27817 \pgfextra{
27818 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
27819 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
27820
27821 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
27822 \ifpgf@circuit@bipole@current@below
27823 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
27824 \fi
27825 \fi\fi
27826 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
27827 \ifpgf@circuit@bipole@current@below
27828 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
27829 \fi
27830 \fi\fi
27831 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
27832 \ifpgf@circuit@bipole@current@below
27833 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
27834 \fi
27835 \fi\fi
27836 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
27837 \ifpgf@circuit@bipole@current@below
27838 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
27839 \fi
27840 \fi\fi
27841 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
27842 \ifpgf@circuit@bipole@current@below
27843 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
27844 \fi
27845 \fi\fi
27846 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
27847 \ifpgf@circuit@bipole@current@below
27848 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
27849 \fi
27850 \fi\fi
27851 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
27852 \ifpgf@circuit@bipole@current@below
27853 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
27854 \fi
27855 \fi\fi
27856 \ifnum\pgfcircmathresult <5
27857 \ifpgf@circuit@bipole@current@below
27858 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
27859 \fi
27860 \fi
27861 \ifnum\pgfcircmathresult >355
27862 \ifpgf@circuit@bipole@current@below
27863 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
27864 \fi
27865 \fi
27866 % export anchor position (if not needed, is always the same macro)
27867 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
27868
27869 \ifpgf@circuit@bipole@current@below
27870 \def\pgf@circ@bipole@current@label@where{-90}
27871 \else
27872 \def\pgf@circ@bipole@current@label@where{+90}
27873 \fi
27874 }
27875
27876 %
27877 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
27878 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
27879 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
27880 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
27881 \else% normal bipole or source
27882 \ifpgf@circuit@bipole@current@before
27883 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
27884 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
27885 \else
27886 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
27887 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
27888 \fi
27889 \fi
27890 \ifpgf@circuit@bipole@current@backward
27891 \pgfextra{
27892 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
27893 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
27894 }
27895 \fi
27896 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
27897 % export the current direction
27898 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Iarrow-direction\endcsname{\pgf@circ@rounded@dir}}
27899 % if the current label is not empty (in which case we have already all the anchors)
27900 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
27901 % put the arrow node
27902 % if we do not want the arrow, just put an empty node (needed to maintain the exact same distances)
27903 \ifpgfcirc@do@i@symbols
27904 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
27905 \else
27906 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
27907 circuitikz/phantom@currarrow](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
27908 \fi
27909 % put the label
27910 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
27911 (\ctikzvalof{bipole/name}current)
27912 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
27913 \fi % end ifempty
27914 \ifpgf@circuit@bipole@current@backward
27915 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
27916 \fi
27917 }
27918
27919 %%%---------- close: tex/pgfcirccurrent
27920 %%%%%%%%%%% Springe nach tex/pgfcircflow
27921 %%%---------- open: tex/pgfcircflow.tex
27922 % Copyright 2018-2026 by Romano Giannetti
27923 % Copyright 2015-2026 by Stefan Lindner
27924 % Copyright 2013-2026 by Stefan Erhardt
27925 % Copyright 2007-2026 by Massimo Redaelli
27926 %
27927 % This file may be distributed and/or modified
27928 %
27929 % 1. under the LaTeX Project Public License and/or
27930 % 2. under the GNU Public License.
27931 %
27932 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
27933
27934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27935 %% flow handling
27936
27937
27938 %% styles
27939 \ctikzset{bipole flow style/.style={}}
27940 \tikzset{bipole flow style/.code={
27941 \ctikzset{bipole flow style/.style={#1}}
27942 }}
27943 \tikzset{bipole flow append style/.code={
27944 \ctikzset{bipole flow style/.append style={#1}}
27945 }}
27946
27947 %% Options
27948 \ctikzset{f^>/.style = {
27949 f={#1},
27950 \circuitikzbasekey/bipole/flow/direction = forward,
27951 \circuitikzbasekey/bipole/flow/x position = after,
27952 \circuitikzbasekey/bipole/flow/y position = above
27953 }
27954 }
27955
27956 \ctikzset{f_>/.style = {
27957 f={#1},
27958 \circuitikzbasekey/bipole/flow/direction = forward,
27959 \circuitikzbasekey/bipole/flow/x position = after,
27960 \circuitikzbasekey/bipole/flow/y position = below
27961 }
27962 }
27963
27964 \ctikzset{f>^/.style = {
27965 f={#1},
27966 \circuitikzbasekey/bipole/flow/direction = forward,
27967 \circuitikzbasekey/bipole/flow/x position = before,
27968 \circuitikzbasekey/bipole/flow/y position = above
27969 }
27970 }
27971
27972 \ctikzset{f>_/.style = {
27973 f={#1},
27974 \circuitikzbasekey/bipole/flow/direction = forward,
27975 \circuitikzbasekey/bipole/flow/x position = before,
27976 \circuitikzbasekey/bipole/flow/y position = below
27977 }
27978 }
27979
27980 \ctikzset{f^</.style = {
27981 f={#1},
27982 \circuitikzbasekey/bipole/flow/direction = backward,
27983 \circuitikzbasekey/bipole/flow/x position = after,
27984 \circuitikzbasekey/bipole/flow/y position = above
27985 }
27986 }
27987
27988 \ctikzset{f_</.style = {
27989 f={#1},
27990 \circuitikzbasekey/bipole/flow/direction = backward,
27991 \circuitikzbasekey/bipole/flow/x position = after,
27992 \circuitikzbasekey/bipole/flow/y position = below
27993 }
27994 }
27995
27996 \ctikzset{f<^/.style = {
27997 f={#1},
27998 \circuitikzbasekey/bipole/flow/direction = backward,
27999 \circuitikzbasekey/bipole/flow/x position = before,
28000 \circuitikzbasekey/bipole/flow/y position = above
28001 }
28002 }
28003
28004 \ctikzset{f<_/.style = {
28005 f={#1},
28006 \circuitikzbasekey/bipole/flow/direction = backward,
28007 \circuitikzbasekey/bipole/flow/x position = before,
28008 \circuitikzbasekey/bipole/flow/y position = below
28009 }
28010 }
28011
28012 \ctikzset{f</.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = backward} }
28013 \ctikzset{f_/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = below } }
28014 \ctikzset{f>/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } }
28015 \ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } }
28016
28017 \newif\ifpgfcirc@do@f@symbols\pgfcirc@do@f@symbolstrue
28018 \ctikzset{no f symbols/.code={\pgfcirc@do@f@symbolsfalse}}
28019 \ctikzset{f symbols/.code={\pgfcirc@do@f@symbolstrue}}
28020
28021 \ctikzset{f/.code = {
28022 \pgfcirc@has@ftrue
28023 \ifpgf@circuit@bipole@override@source@vif
28024 \pgf@circuit@bipole@isvoltagefalse
28025 \pgf@circuit@bipole@iscurrentfalse
28026 \fi
28027 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
28028 \circuitikzbasekey/bipole/flow/x position = after,
28029 \circuitikzbasekey/bipole/flow/y position = above }
28030 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}}
28031 \ctikzsetvalof{bipole/flow/label/unit}{}
28032 \ifpgf@circ@siunitx
28033 \pgf@circ@handleSI{#1}
28034 \ifpgf@circ@siunitx@res
28035 \edef\pgf@temp{\pgf@circ@handleSI@val}
28036 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
28037 \edef\pgf@temp{\pgf@circ@handleSI@unit}
28038 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
28039 \else
28040 \fi
28041 \else
28042 \fi
28043 }
28044 }
28045
28046 %% Output routine
28047
28048 \def\pgf@circ@drawflow{
28049 \pgfextra{
28050 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
28051 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
28052
28053 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
28054 \ifpgf@circuit@bipole@flow@below
28055 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
28056 \fi
28057 \fi\fi
28058 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
28059 \ifpgf@circuit@bipole@flow@below
28060 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
28061 \fi
28062 \fi\fi
28063 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
28064 \ifpgf@circuit@bipole@flow@below
28065 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
28066 \fi
28067 \fi\fi
28068 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
28069 \ifpgf@circuit@bipole@flow@below
28070 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
28071 \fi
28072 \fi\fi
28073 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
28074 \ifpgf@circuit@bipole@flow@below
28075 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
28076 \fi
28077 \fi\fi
28078 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
28079 \ifpgf@circuit@bipole@flow@below
28080 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
28081 \fi
28082 \fi\fi
28083 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
28084 \ifpgf@circuit@bipole@flow@below
28085 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
28086 \fi
28087 \fi\fi
28088 \ifnum\pgfcircmathresult <5
28089 \ifpgf@circuit@bipole@flow@below
28090 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28091 \fi
28092 \fi
28093 \ifnum\pgfcircmathresult >355
28094 \ifpgf@circuit@bipole@flow@below
28095 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28096 \fi
28097 \fi
28098
28099 \ifpgf@circuit@bipole@flow@below
28100 \def\pgf@circ@bipole@flow@label@where{-90}
28101 \else
28102 \def\pgf@circ@bipole@flow@label@where{+90}
28103 \fi
28104 % export anchor position (if not needed, is always the same macro)
28105 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
28106 }
28107
28108 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
28109 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
28110 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
28111 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
28112 \else% normal bipole or source
28113 \ifpgf@circuit@bipole@flow@before
28114 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
28115 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
28116 \else
28117 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
28118 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
28119 \fi
28120 \fi
28121 \pgfextra{
28122 \newdimen{\absfshift}
28123 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
28124 \absfshift=\flow@offset
28125 \ifpgf@circuit@bipole@flow@backward
28126 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
28127 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
28128 \fi
28129 }
28130 \ifpgf@circuit@bipole@flow@below
28131 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
28132 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
28133 \else
28134 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
28135 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
28136 \fi
28137 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
28138 \pgfextra{
28139 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
28140 }
28141 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
28142 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
28143 %
28144 % coordinate (\pgfcirc@a@prefix-Fpos) at
28145 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
28146 % export the flow direction
28147 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Farrow-direction\endcsname{\pgf@circ@rounded@dir}}
28148 % if the flow label is not empty (in which case we have already all the anchors)
28149 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
28150 % the flow arrow is really a node "flowarrow", not a real arrow
28151 \ifpgfcirc@do@f@symbols
28152 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
28153 \else
28154 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
28155 circuitikz/phantom@flowarrow](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
28156 \fi
28157 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
28158 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
28159 \fi
28160 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
28161 \ifpgf@circuit@bipole@flow@backward
28162 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
28163 \fi
28164
28165 }
28166
28167 %%%---------- close: tex/pgfcircflow
28168
28169 % defaults
28170
28171 \setupmodule
28172 [current=european,
28173 voltage=european,
28174 resistor=american,
28175 inductor=cute,
28176 logic=american,
28177 siunitx=true,
28178 arrowmos=false]
28179
28180 \processaction
28181 [\currentmoduleparameter{voltage}]
28182 [european=>\ctikzset{voltage=european},
28183 american=>\ctikzset{voltage=american}]
28184
28185 \processaction
28186 [\currentmoduleparameter{current}]
28187 [european=>\ctikzset{ current=european},
28188 american=>\ctikzset{ current=american}]
28189
28190 \processaction
28191 [\currentmoduleparameter{label}]
28192 [straight=>\ctikzset{label/align = straight},
28193 align=>\ctikzset{label/align = rotate},
28194 smart=>\ctikzset{label/align = smart}]
28195
28196 \processaction
28197 [\currentmoduleparameter{resistor}]
28198 [european=>\ctikzset{ resistor=european},
28199 american=>\ctikzset{ resistor=american}]
28200
28201 \processaction
28202 [\currentmoduleparameter{inductor}]
28203 [european=>\ctikzset{ inductor=european},
28204 american=>\ctikzset{ inductor=american},
28205 cute=>\ctikzset{ inductor=cute}]
28206
28207 \processaction
28208 [\currentmoduleparameter{diode}]
28209 [full=>\ctikzset{ diode=full},
28210 empty=>\ctikzset{ diode=empty}]
28211
28212 \processaction
28213 [\currentmoduleparameter{logic}]
28214 [european=>\ctikzset{ logic ports=european},
28215 american=>\ctikzset{ logic ports=american}]
28216
28217 % This tiny siunitx emulation layer (REALLY tiny) is practically never
28218 % enabled because recent ConTeXt releases override this file with
28219 % m-circuitikz.tex and in that file it has been removed.
28220
28221 \processaction
28222 [\currentmoduleparameter{siunitx}]
28223 [true=>\def\SI#1#2{#1\,#2}
28224 \def\ampere{\rm{A}}
28225 \def\volt{\rm{V}}
28226 \def\ohm{\Omega}
28227 \def\siemens{\rm{S}}
28228 \def\farad{\rm{F}}
28229 \def\henry{\rm{H}}
28230 \def\second{\rm{s}}
28231 \def\coulomb{\rm{C}}
28232 \def\siemens{\rm{S}}
28233 \def\radians{\rm{rad}}
28234 \def\milli{\rm{m}}
28235 \def\micro{\mu}
28236 \def\nano{\rm{n}}
28237 \def\pico{\rm{p}}
28238 \def\kilo{\rm{k}}
28239 \def\mega{\rm{M}}
28240 \def\giga{\rm{G}}
28241 \def\tera{\rm{T}},
28242 false=>]
28243 % \s!default=>\pgf@circ@siunitxtrue,
28244
28245 \processaction
28246 [\currentmoduleparameter{arrowmos}]
28247 [true=>\pgf@circuit@mos@arrowstrue,
28248 false=>\pgf@circuit@mos@arrowsfalse]
28249 % \s!default=>\pgf@circuit@mos@arrowstrue,
28250
28251
28252 \ifpgf@circ@siunitx
28253 % nothing! siunitx and xstrings don't work in context
28254 \fi
28255
28256
28257 % Context specific
28258
28259 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
28260
28261
28262 \catcode`\@=\tikzatcode
28263 \catcode`\|=\tikzbarcode
28264 \catcode`\!=\tikzexclaimcode
28265
28266 % define the environment
28267 % thanks to Max Chernoff https://tex.stackexchange.com/a/705683/38080
28268 \let\startcircuitikz\starttikzpicture
28269 \let\stopcircuitikz\stoptikzpicture
28270
28271 \protect
28272
28273 \stopmodule
28274
28275 \endinput