| 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 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 |
%% Tripoles |
| 15 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 16 |
|
| 17 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 18 |
%% Logic Ports |
| 19 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 20 |
|
| 21 |
%% Settings for Logic ports%<<<1 |
| 22 |
%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex |
| 23 |
|
| 24 |
% switches for logic gates |
| 25 |
% |
| 26 |
\pgfkeys{/tikz/number inputs/.initial=0} |
| 27 |
\pgfkeys{/tikz/number inputs/.default=0} |
| 28 |
% by default, use the default font (and color, etc.) |
| 29 |
\ctikzset{european ports font/.initial={}} |
| 30 |
\newif\ifpgf@circuit@europeanlogicport |
| 31 |
\ctikzset{logic ports/.is choice} |
| 32 |
\ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue |
| 33 |
\tikzset{and port/.style={shape=european and port}}% |
| 34 |
\tikzset{or port/.style={shape=european or port}}% |
| 35 |
\tikzset{xor port/.style={shape=european xor port}}% |
| 36 |
\tikzset{buffer port/.style={shape=european buffer port}}% |
| 37 |
\tikzset{not port/.style={shape=european not port}}% |
| 38 |
\tikzset{nand port/.style={shape=european nand port}}% |
| 39 |
\tikzset{nor port/.style={shape=european nor port}}% |
| 40 |
\tikzset{xnor port/.style={shape=european xnor port}}% |
| 41 |
\tikzset{blank port/.style={shape=european blank port}}% |
| 42 |
\tikzset{blank not port/.style={shape=european blank not port}}% |
| 43 |
% there is no Schmitt ports in european style (yet) |
| 44 |
\tikzset{schmitt port/.style={shape=schmitt}}% |
| 45 |
\tikzset{invschmitt port/.style={shape=invschmitt}}% |
| 46 |
}} |
| 47 |
\ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse |
| 48 |
\tikzset{and port/.style={shape=american and port}}% |
| 49 |
\tikzset{or port/.style={shape=american or port}}% |
| 50 |
\tikzset{xor port/.style={shape=american xor port}}% |
| 51 |
\tikzset{buffer port/.style={shape=american buffer port}}% |
| 52 |
\tikzset{not port/.style={shape=american not port}}% |
| 53 |
\tikzset{nand port/.style={shape=american nand port}}% |
| 54 |
\tikzset{nor port/.style={shape=american nor port}}% |
| 55 |
\tikzset{xnor port/.style={shape=american xnor port}}% |
| 56 |
\tikzset{schmitt port/.style={shape=schmitt}}% |
| 57 |
\tikzset{invschmitt port/.style={shape=invschmitt}}% |
| 58 |
%%% there are no blank ports for american (no sense to have them) |
| 59 |
\tikzset{blank port/.style={shape=european blank port}}% |
| 60 |
\tikzset{blank not port/.style={shape=european blank not port}}% |
| 61 |
}} |
| 62 |
|
| 63 |
\ctikzset{logic ports origin/.is choice} |
| 64 |
\ctikzset{logic ports origin/legacy/.code={ |
| 65 |
\ctikzset{tripoles/american and port/origin/.initial=0.8}% |
| 66 |
\ctikzset{tripoles/american nand port/origin/.initial=0.8}% |
| 67 |
\ctikzset{tripoles/american nor port/origin/.initial=0.8}% |
| 68 |
\ctikzset{tripoles/american or port/origin/.initial=0.8}% |
| 69 |
\ctikzset{tripoles/american xor port/origin/.initial=0.8}% |
| 70 |
\ctikzset{tripoles/american xnor port/origin/.initial=0.8}% |
| 71 |
\ctikzset{tripoles/european and port/origin/.initial=0.8}% |
| 72 |
\ctikzset{tripoles/european nand port/origin/.initial=0.8}% |
| 73 |
\ctikzset{tripoles/european or port/origin/.initial=0.8}% |
| 74 |
\ctikzset{tripoles/european nor port/origin/.initial=0.8}% |
| 75 |
\ctikzset{tripoles/european xor port/origin/.initial=0.8}% |
| 76 |
\ctikzset{tripoles/european xnor port/origin/.initial=0.8}% |
| 77 |
\ctikzset{tripoles/european buffer port/origin/.initial=0.8}% |
| 78 |
\ctikzset{tripoles/european not port/origin/.initial=0.8}% |
| 79 |
\ctikzset{tripoles/european blank port/origin/.initial=0.8}% |
| 80 |
\ctikzset{tripoles/european blank not port/origin/.initial=0.8}% |
| 81 |
}% |
| 82 |
} |
| 83 |
\ctikzset{logic ports origin/center/.code={% |
| 84 |
\ctikzset{tripoles/american and port/origin/.initial=0}% |
| 85 |
\ctikzset{tripoles/american nand port/origin/.initial=0}% |
| 86 |
\ctikzset{tripoles/american nor port/origin/.initial=0}% |
| 87 |
\ctikzset{tripoles/american or port/origin/.initial=0}% |
| 88 |
\ctikzset{tripoles/american xor port/origin/.initial=0}% |
| 89 |
\ctikzset{tripoles/american xnor port/origin/.initial=0}% |
| 90 |
\ctikzset{tripoles/european and port/origin/.initial=0}% |
| 91 |
\ctikzset{tripoles/european nand port/origin/.initial=0}% |
| 92 |
\ctikzset{tripoles/european or port/origin/.initial=0}% |
| 93 |
\ctikzset{tripoles/european nor port/origin/.initial=0}% |
| 94 |
\ctikzset{tripoles/european xor port/origin/.initial=0}% |
| 95 |
\ctikzset{tripoles/european xnor port/origin/.initial=0}% |
| 96 |
\ctikzset{tripoles/european buffer port/origin/.initial=0}% |
| 97 |
\ctikzset{tripoles/european not port/origin/.initial=0}% |
| 98 |
\ctikzset{tripoles/european blank port/origin/.initial=0}% |
| 99 |
\ctikzset{tripoles/european blank not port/origin/.initial=0}% |
| 100 |
}% |
| 101 |
} |
| 102 |
|
| 103 |
\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse |
| 104 |
\ctikzset{american or shape/.is choice} |
| 105 |
\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} |
| 106 |
\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} |
| 107 |
|
| 108 |
\newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue |
| 109 |
\ctikzset{logic ports draw input leads/.is choice} |
| 110 |
\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}} |
| 111 |
\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}} |
| 112 |
\tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}} |
| 113 |
\tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}} |
| 114 |
|
| 115 |
\newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue |
| 116 |
\ctikzset{logic ports draw output leads/.is choice} |
| 117 |
\ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}} |
| 118 |
\ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}} |
| 119 |
\tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}} |
| 120 |
\tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}} |
| 121 |
|
| 122 |
\ctikzset{logic ports draw leads/.is choice} |
| 123 |
\ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} |
| 124 |
\ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} |
| 125 |
\tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}} |
| 126 |
\tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}} |
| 127 |
|
| 128 |
% adding a different style of xnor port |
| 129 |
% see https://github.com/circuitikz/circuitikz/issues/467 |
| 130 |
\ctikzset{european xnor style/.is choice} |
| 131 |
\ctikzset{european xnor style/default/.code={% |
| 132 |
\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}% |
| 133 |
} |
| 134 |
\ctikzset{european xnor style/direct/.code={% |
| 135 |
\pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}% |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
% old, legacy keys that should be killed over |
| 140 |
\ctikzset{bipoles/buffer/height/.initial=1} |
| 141 |
\ctikzset{bipoles/buffer/width/.initial=1} |
| 142 |
\ctikzset{bipoles/not port/width/.initial=1} |
| 143 |
\ctikzset{bipoles/not port/height/.initial=.8} |
| 144 |
\ctikzset{bipoles/not port/circle width/.initial=.15} |
| 145 |
|
| 146 |
\ctikzset{tripoles/american and port/width/.initial=1.1} |
| 147 |
\ctikzset{tripoles/american and port/height/.initial=.8} |
| 148 |
\ctikzset{tripoles/american and port/port width/.initial=.7} |
| 149 |
\ctikzset{tripoles/american and port/input height/.initial=.5} |
| 150 |
\ctikzset{tripoles/american nand port/width/.initial=1.1} |
| 151 |
\ctikzset{tripoles/american nand port/height/.initial=.8} |
| 152 |
\ctikzset{tripoles/american nand port/port width/.initial=.7} |
| 153 |
\ctikzset{tripoles/american nand port/circle width/.initial=.15} |
| 154 |
\ctikzset{tripoles/american nand port/input height/.initial=.5} |
| 155 |
\ctikzset{tripoles/american or port/width/.initial=1.1} |
| 156 |
\ctikzset{tripoles/american or port/height/.initial=.8} |
| 157 |
\ctikzset{tripoles/american or port/port width/.initial=.7} |
| 158 |
\ctikzset{tripoles/american or port/input height/.initial=.5} |
| 159 |
\ctikzset{tripoles/american or port/input skip/.initial=.25} |
| 160 |
\ctikzset{tripoles/american or port/aaa/.initial=.6} |
| 161 |
\ctikzset{tripoles/american or port/bbb/.initial=.4} |
| 162 |
\ctikzset{tripoles/american or port/ccc/.initial=.5} |
| 163 |
\ctikzset{tripoles/american or port/ddd/.initial=.0} |
| 164 |
\ctikzset{tripoles/american nor port/width/.initial=1.1} |
| 165 |
\ctikzset{tripoles/american nor port/height/.initial=.8} |
| 166 |
\ctikzset{tripoles/american nor port/port width/.initial=.7} |
| 167 |
\ctikzset{tripoles/american nor port/input height/.initial=.5} |
| 168 |
\ctikzset{tripoles/american nor port/input skip/.initial=.25} |
| 169 |
\ctikzset{tripoles/american nor port/circle width/.initial=.15} |
| 170 |
\ctikzset{tripoles/american nor port/aaa/.initial=.6} |
| 171 |
\ctikzset{tripoles/american nor port/bbb/.initial=.4} |
| 172 |
\ctikzset{tripoles/american nor port/ccc/.initial=.5} |
| 173 |
\ctikzset{tripoles/american nor port/ddd/.initial=.0} |
| 174 |
\ctikzset{tripoles/american xor port/width/.initial=1.1} |
| 175 |
\ctikzset{tripoles/american xor port/height/.initial=.8} |
| 176 |
\ctikzset{tripoles/american xor port/port width/.initial=.7} |
| 177 |
\ctikzset{tripoles/american xor port/input height/.initial=.5} |
| 178 |
\ctikzset{tripoles/american xor port/input skip/.initial=.15} |
| 179 |
\ctikzset{tripoles/american xor port/distance/.initial=.1} |
| 180 |
\ctikzset{tripoles/american xnor port/width/.initial=1.1} |
| 181 |
\ctikzset{tripoles/american xnor port/height/.initial=.8} |
| 182 |
\ctikzset{tripoles/american xnor port/port width/.initial=.7} |
| 183 |
\ctikzset{tripoles/american xnor port/input height/.initial=.5} |
| 184 |
\ctikzset{tripoles/american xnor port/input skip/.initial=.15} |
| 185 |
\ctikzset{tripoles/american xnor port/distance/.initial=.1} |
| 186 |
\ctikzset{tripoles/american xnor port/circle width/.initial=.15} |
| 187 |
\ctikzset{tripoles/american and port/origin/.initial=0.8} |
| 188 |
\ctikzset{tripoles/american and port/inputs/.initial=2} |
| 189 |
% variable number of inputs |
| 190 |
\ctikzset{tripoles/american nand port/origin/.initial=0.8} |
| 191 |
\ctikzset{tripoles/american nand port/inputs/.initial=2} |
| 192 |
\ctikzset{tripoles/american nor port/origin/.initial=0.8} |
| 193 |
\ctikzset{tripoles/american nor port/inputs/.initial=2} |
| 194 |
\ctikzset{tripoles/american nor port/angle/.initial=70} |
| 195 |
\ctikzset{tripoles/american nor port/inner/.initial=0.3} |
| 196 |
\ctikzset{tripoles/american or port/origin/.initial=0.8} |
| 197 |
\ctikzset{tripoles/american or port/inputs/.initial=2} |
| 198 |
\ctikzset{tripoles/american or port/angle/.initial=70} |
| 199 |
\ctikzset{tripoles/american or port/inner/.initial=0.3} |
| 200 |
\ctikzset{tripoles/american xor port/origin/.initial=0.8} |
| 201 |
\ctikzset{tripoles/american xor port/inputs/.initial=2} |
| 202 |
\ctikzset{tripoles/american xor port/angle/.initial=70} |
| 203 |
\ctikzset{tripoles/american xor port/inner/.initial=0.3} |
| 204 |
\ctikzset{tripoles/american xnor port/origin/.initial=0.8} |
| 205 |
\ctikzset{tripoles/american xnor port/inputs/.initial=2} |
| 206 |
\ctikzset{tripoles/american xnor port/angle/.initial=70} |
| 207 |
\ctikzset{tripoles/american xnor port/inner/.initial=0.3} |
| 208 |
% |
| 209 |
\ctikzset{tripoles/european and port/width/.initial=1.4} |
| 210 |
\ctikzset{tripoles/european and port/height/.initial=.65} |
| 211 |
\ctikzset{tripoles/european and port/reserved/.initial=.6} |
| 212 |
\ctikzset{tripoles/european and port/input height/.initial=.6} |
| 213 |
\ctikzset{tripoles/european or port/width/.initial=1.4} |
| 214 |
\ctikzset{tripoles/european or port/height/.initial=.65} |
| 215 |
\ctikzset{tripoles/european or port/reserved/.initial=.6} |
| 216 |
\ctikzset{tripoles/european or port/input height/.initial=.6} |
| 217 |
\ctikzset{tripoles/european xor port/width/.initial=1.4} |
| 218 |
\ctikzset{tripoles/european xor port/height/.initial=.65} |
| 219 |
\ctikzset{tripoles/european xor port/reserved/.initial=.6} |
| 220 |
\ctikzset{tripoles/european xor port/input height/.initial=.6} |
| 221 |
\ctikzset{tripoles/european nand port/width/.initial=1.4} |
| 222 |
\ctikzset{tripoles/european nand port/not height/.initial=.3} |
| 223 |
\ctikzset{tripoles/european nand port/not width/.initial=.9} |
| 224 |
\ctikzset{tripoles/european nand port/height/.initial=.65} |
| 225 |
\ctikzset{tripoles/european nand port/reserved/.initial=.6} |
| 226 |
\ctikzset{tripoles/european nand port/input height/.initial=.6} |
| 227 |
\ctikzset{tripoles/european buffer port/width/.initial=1.4} |
| 228 |
\ctikzset{tripoles/european buffer port/not height/.initial=.3} |
| 229 |
\ctikzset{tripoles/european buffer port/not width/.initial=.9} |
| 230 |
\ctikzset{tripoles/european buffer port/height/.initial=.65} |
| 231 |
\ctikzset{tripoles/european buffer port/reserved/.initial=.6} |
| 232 |
\ctikzset{tripoles/european buffer port/input height/.initial=0} |
| 233 |
\ctikzset{tripoles/european not port/width/.initial=1.4} |
| 234 |
\ctikzset{tripoles/european not port/not height/.initial=.3} |
| 235 |
\ctikzset{tripoles/european not port/not width/.initial=.9} |
| 236 |
\ctikzset{tripoles/european not port/height/.initial=.65} |
| 237 |
\ctikzset{tripoles/european not port/reserved/.initial=.6} |
| 238 |
\ctikzset{tripoles/european not port/input height/.initial=0} |
| 239 |
\ctikzset{tripoles/european xnor port/width/.initial=1.4} |
| 240 |
\ctikzset{tripoles/european xnor port/not height/.initial=.3} |
| 241 |
\ctikzset{tripoles/european xnor port/not width/.initial=.9} |
| 242 |
\ctikzset{tripoles/european xnor port/height/.initial=.65} |
| 243 |
\ctikzset{tripoles/european xnor port/reserved/.initial=.6} |
| 244 |
\ctikzset{tripoles/european xnor port/input height/.initial=.6} |
| 245 |
\ctikzset{tripoles/european nor port/width/.initial=1.4} |
| 246 |
\ctikzset{tripoles/european nor port/not height/.initial=.3} |
| 247 |
\ctikzset{tripoles/european nor port/not width/.initial=.9} |
| 248 |
\ctikzset{tripoles/european nor port/height/.initial=.65} |
| 249 |
\ctikzset{tripoles/european nor port/reserved/.initial=.6} |
| 250 |
\ctikzset{tripoles/european nor port/input height/.initial=.6} |
| 251 |
% variable number of inputs |
| 252 |
\ctikzset{tripoles/european and port/origin/.initial=0.8} |
| 253 |
\ctikzset{tripoles/european and port/inputs/.initial=2} |
| 254 |
\ctikzset{tripoles/european nand port/origin/.initial=0.8} |
| 255 |
\ctikzset{tripoles/european nand port/inputs/.initial=2} |
| 256 |
\ctikzset{tripoles/european or port/origin/.initial=0.8} |
| 257 |
\ctikzset{tripoles/european or port/inputs/.initial=2} |
| 258 |
\ctikzset{tripoles/european nor port/origin/.initial=0.8} |
| 259 |
\ctikzset{tripoles/european nor port/inputs/.initial=2} |
| 260 |
\ctikzset{tripoles/european xor port/origin/.initial=0.8} |
| 261 |
\ctikzset{tripoles/european xor port/inputs/.initial=2} |
| 262 |
\ctikzset{tripoles/european xnor port/origin/.initial=0.8} |
| 263 |
\ctikzset{tripoles/european xnor port/inputs/.initial=2} |
| 264 |
\ctikzset{tripoles/european buffer port/origin/.initial=0.8} |
| 265 |
\ctikzset{tripoles/european buffer port/inputs/.initial=1}% |
| 266 |
\ctikzset{tripoles/european not port/origin/.initial=0.8} |
| 267 |
\ctikzset{tripoles/european not port/inputs/.initial=1}% |
| 268 |
%% "blank" ports |
| 269 |
\ctikzset{tripoles/european blank port/width/.initial=1.4} |
| 270 |
\ctikzset{tripoles/european blank port/height/.initial=.65} |
| 271 |
\ctikzset{tripoles/european blank port/reserved/.initial=.6} |
| 272 |
\ctikzset{tripoles/european blank port/input height/.initial=.6} |
| 273 |
\ctikzset{tripoles/european blank not port/width/.initial=1.4} |
| 274 |
\ctikzset{tripoles/european blank not port/not height/.initial=.3} |
| 275 |
\ctikzset{tripoles/european blank not port/not width/.initial=.9} |
| 276 |
\ctikzset{tripoles/european blank not port/height/.initial=.65} |
| 277 |
\ctikzset{tripoles/european blank not port/reserved/.initial=.6} |
| 278 |
\ctikzset{tripoles/european blank not port/input height/.initial=.6} |
| 279 |
\ctikzset{tripoles/european blank port/origin/.initial=0.8} |
| 280 |
\ctikzset{tripoles/european blank port/inputs/.initial=2} |
| 281 |
\ctikzset{tripoles/european blank not port/origin/.initial=0.8} |
| 282 |
\ctikzset{tripoles/european blank not port/inputs/.initial=2} |
| 283 |
%%% parameters that are not used anymore after multi-input |
| 284 |
%%% gates --- left for compatibility of source code. |
| 285 |
\ctikzset{tripoles/american xor port/aaa/.initial=.6} |
| 286 |
\ctikzset{tripoles/american xor port/bbb/.initial=.4} |
| 287 |
\ctikzset{tripoles/american xor port/ccc/.initial=.5} |
| 288 |
\ctikzset{tripoles/american xor port/ddd/.initial=.0} |
| 289 |
\ctikzset{tripoles/american xnor port/aaa/.initial=.6} |
| 290 |
\ctikzset{tripoles/american xnor port/bbb/.initial=.4} |
| 291 |
\ctikzset{tripoles/american xnor port/ccc/.initial=.5} |
| 292 |
\ctikzset{tripoles/american xnor port/ddd/.initial=.0} |
| 293 |
%%>>> |
| 294 |
|
| 295 |
%% Node shapes for Logic ports%<<< |
| 296 |
%% |
| 297 |
%% Code from John Kormylo at tex.stackexchange.com |
| 298 |
%% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz |
| 299 |
%% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]> |
| 300 |
%% |
| 301 |
|
| 302 |
\newcount\pgf@circ@res@count% reserve global register |
| 303 |
|
| 304 |
\def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter |
| 305 |
{% |
| 306 |
\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 307 |
\step |
| 308 |
\pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax |
| 309 |
\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 310 |
}% |
| 311 |
|
| 312 |
% #1 = \pgfmathcounter #2=type #3 specificic port |
| 313 |
% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european. |
| 314 |
\def\pgf@circ@logicport@baseinput#1#2#3% |
| 315 |
{% |
| 316 |
% and and nand |
| 317 |
\ifnum #2=1\relax |
| 318 |
\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 319 |
\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 320 |
\step |
| 321 |
\pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax |
| 322 |
\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 323 |
\pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left |
| 324 |
\fi |
| 325 |
% or and nor |
| 326 |
\ifnum #2=2\relax |
| 327 |
\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 328 |
\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 329 |
\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 330 |
\step |
| 331 |
\pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax |
| 332 |
\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 333 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}% |
| 334 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right |
| 335 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 336 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% |
| 337 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right |
| 338 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 339 |
\pgf@circ@res@temp=\pgf@y |
| 340 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% |
| 341 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 342 |
\pgf@x=\pgf@circ@res@other |
| 343 |
\fi |
| 344 |
% xor and xnor |
| 345 |
\ifnum #2=3\relax |
| 346 |
\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 347 |
\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 348 |
\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 349 |
\pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}% |
| 350 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right |
| 351 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 352 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% |
| 353 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right |
| 354 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 355 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right |
| 356 |
\pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} |
| 357 |
% this compensates for the effect of the line width on the gap between the arcs |
| 358 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% |
| 359 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% |
| 360 |
|
| 361 |
\step |
| 362 |
\pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax |
| 363 |
\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 364 |
\pgf@circ@res@temp=\pgf@y |
| 365 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% |
| 366 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 367 |
\advance\pgf@circ@res@other by -\pgf@circ@math@distance |
| 368 |
\pgf@x=\pgf@circ@res@other |
| 369 |
\fi |
| 370 |
% european |
| 371 |
\ifnum #2=4\relax |
| 372 |
\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 373 |
\pgfextractx{\pgf@circ@res@other}{\left}% |
| 374 |
\step |
| 375 |
\pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax |
| 376 |
\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 377 |
\pgf@x=\pgf@circ@res@other |
| 378 |
\fi |
| 379 |
}% |
| 380 |
|
| 381 |
%%% american |
| 382 |
\long\def\pgfcircdeclarelogicport#1#2#3{% |
| 383 |
\pgfdeclareshape{american #1 port}% |
| 384 |
{% |
| 385 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 386 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 387 |
\savedmacro\resize{% automatic |
| 388 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 389 |
\pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen |
| 390 |
\pgf@circ@res@up = .5\pgf@circ@res@up |
| 391 |
\pgf@circ@res@down = -\pgf@circ@res@up |
| 392 |
\pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen |
| 393 |
\pgf@circ@res@right = .5\pgf@circ@res@right |
| 394 |
\pgf@circ@res@left = -\pgf@circ@res@right |
| 395 |
}% |
| 396 |
\savedmacro\inputs{% get number of inputs |
| 397 |
\pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% |
| 398 |
\ifnum\pgf@circ@res@count=0 |
| 399 |
\pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax% |
| 400 |
\fi |
| 401 |
\ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi |
| 402 |
\ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi |
| 403 |
\def\inputs{\the\pgf@circ@res@count}% |
| 404 |
}% |
| 405 |
\savedanchor\step{% 1/2 gap at edges |
| 406 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 407 |
\pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen |
| 408 |
\divide\pgf@circ@res@step by \pgf@circ@res@count |
| 409 |
\pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% |
| 410 |
}% |
| 411 |
\savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 412 |
\savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} |
| 413 |
\savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}} |
| 414 |
\savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}} |
| 415 |
\savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}} |
| 416 |
|
| 417 |
\anchor{center}{\origin}% for backwards compatibility |
| 418 |
\savedanchor{\textanchor}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} |
| 419 |
\anchor{text}{\textanchor} |
| 420 |
|
| 421 |
% create input anchors |
| 422 |
\expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{% |
| 423 |
\pgfmathloop% |
| 424 |
\ifnum\pgfmathcounter>\pgf@circ@res@count% |
| 425 |
\else% |
| 426 |
%\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% |
| 427 |
\expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{% |
| 428 |
\noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above |
| 429 |
}% |
| 430 |
\expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{% |
| 431 |
\noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above |
| 432 |
}% |
| 433 |
%}{}% |
| 434 |
\repeatpgfmathloop% |
| 435 |
} |
| 436 |
|
| 437 |
\anchor{out}{\northeast\pgf@y=0pt} |
| 438 |
\anchor{bout}{\right\pgf@y=0pt} |
| 439 |
|
| 440 |
|
| 441 |
\anchor{left}{\left}% edges of component minus leads |
| 442 |
\anchor{right}{\right} |
| 443 |
|
| 444 |
\anchor{north east}{\northeast}% see \Compass macro |
| 445 |
\anchor{south west}{\southwest} |
| 446 |
\anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 447 |
\pgfpoint{0cm}{\pgf@circ@res@up}} |
| 448 |
\anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 449 |
\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 450 |
\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 451 |
\anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 452 |
\pgfpoint{\pgf@circ@res@left}{0cm}} |
| 453 |
\anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% |
| 454 |
\pgfpoint{0cm}{\pgf@circ@res@down}} |
| 455 |
\anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% |
| 456 |
\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 457 |
\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 458 |
\anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 459 |
\pgfpoint{\pgf@circ@res@right}{0cm}} |
| 460 |
|
| 461 |
\pgf@circ@draw@component{ |
| 462 |
\pgf@circ@setcolor |
| 463 |
% \pgf@circ@debug@colors |
| 464 |
#3% |
| 465 |
} |
| 466 |
} |
| 467 |
} |
| 468 |
%%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 469 |
\pgfcircdeclarelogicport{and}{1}{ |
| 470 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 471 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 472 |
\pgf@circ@res@count = \inputs\relax |
| 473 |
\ifpgfcirc@draw@input@leads |
| 474 |
%input leads |
| 475 |
\loop\ifnum\pgf@circ@res@count>0 |
| 476 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 477 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 478 |
\pgfpathlineto{\pgfpoint |
| 479 |
{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} |
| 480 |
{\pgf@circ@res@temp}} |
| 481 |
\advance\pgf@circ@res@count by -1 |
| 482 |
\repeat |
| 483 |
\fi |
| 484 |
% output lead |
| 485 |
\ifpgfcirc@draw@output@leads |
| 486 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 487 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} |
| 488 |
\pgfusepath{draw} |
| 489 |
\fi |
| 490 |
|
| 491 |
|
| 492 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 493 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left |
| 494 |
|
| 495 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} |
| 496 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} |
| 497 |
\pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up} |
| 498 |
\pgfpathclose |
| 499 |
\pgf@circ@draworfill |
| 500 |
} |
| 501 |
%%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 502 |
\pgfcircdeclarelogicport{nand}{1}{ |
| 503 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 504 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 505 |
\pgf@circ@res@count = \inputs\relax |
| 506 |
\ifpgfcirc@draw@input@leads |
| 507 |
%input leads |
| 508 |
\loop\ifnum\pgf@circ@res@count>0 |
| 509 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 510 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 511 |
\pgfpathlineto{\pgfpoint |
| 512 |
{\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} |
| 513 |
{\pgf@circ@res@temp}} |
| 514 |
\advance\pgf@circ@res@count by -1 |
| 515 |
\repeat |
| 516 |
\fi |
| 517 |
|
| 518 |
\ifpgfcirc@draw@output@leads |
| 519 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 520 |
\pgfpathlineto{\pgfpoint |
| 521 |
{\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} |
| 522 |
\pgfusepath{draw} |
| 523 |
\fi |
| 524 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 525 |
\pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right |
| 526 |
\pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right |
| 527 |
\pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax |
| 528 |
|
| 529 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} |
| 530 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} |
| 531 |
\pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up} |
| 532 |
\pgfpathclose |
| 533 |
|
| 534 |
\pgfpathellipse |
| 535 |
{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}} |
| 536 |
{\pgfpoint{.5\pgf@circ@res@step}{0pt}} |
| 537 |
{\pgfpoint{0pt}{.5\pgf@circ@res@step}} |
| 538 |
|
| 539 |
\pgf@circ@draworfill |
| 540 |
} |
| 541 |
%%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 542 |
\pgfcircdeclarelogicport{nor}{2}{ |
| 543 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% |
| 544 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right |
| 545 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 546 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% |
| 547 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right |
| 548 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 549 |
|
| 550 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 551 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 552 |
\pgf@circ@res@count = \inputs\relax |
| 553 |
\ifpgfcirc@draw@input@leads |
| 554 |
%input leads |
| 555 |
\loop\ifnum\pgf@circ@res@count>0 |
| 556 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 557 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 558 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% |
| 559 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 560 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% |
| 561 |
\advance\pgf@circ@res@count by -1 |
| 562 |
\repeat |
| 563 |
\fi |
| 564 |
|
| 565 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right |
| 566 |
\ifpgfcirc@draw@output@leads |
| 567 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 568 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 569 |
\pgfusepath{draw} |
| 570 |
\fi |
| 571 |
|
| 572 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 573 |
|
| 574 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}% |
| 575 |
\pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right |
| 576 |
\pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax |
| 577 |
\advance\pgf@circ@res@other by -\pgf@circ@res@step |
| 578 |
|
| 579 |
% main shape |
| 580 |
\ifpgfcirc@roundy@or@shapes |
| 581 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry |
| 582 |
\pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% |
| 583 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 584 |
\pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% |
| 585 |
\pgfpathclose |
| 586 |
\else |
| 587 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 588 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} |
| 589 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 590 |
\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}} |
| 591 |
\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}} |
| 592 |
\pgfpathclose |
| 593 |
\fi |
| 594 |
|
| 595 |
% not dot |
| 596 |
\pgfpathellipse |
| 597 |
{\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} |
| 598 |
{\pgfpoint{.5\pgf@circ@res@step}{0pt}} |
| 599 |
{\pgfpoint{0pt}{.5\pgf@circ@res@step}} |
| 600 |
|
| 601 |
\pgf@circ@draworfill |
| 602 |
} |
| 603 |
%%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 604 |
\pgfcircdeclarelogicport{or}{2}{ |
| 605 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% |
| 606 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right |
| 607 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 608 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}% |
| 609 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right |
| 610 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 611 |
|
| 612 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 613 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 614 |
\pgf@circ@res@count = \inputs\relax |
| 615 |
\ifpgfcirc@draw@input@leads |
| 616 |
%input leads |
| 617 |
\loop\ifnum\pgf@circ@res@count>0 |
| 618 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 619 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 620 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% |
| 621 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 622 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% |
| 623 |
\advance\pgf@circ@res@count by -1 |
| 624 |
\repeat |
| 625 |
\fi |
| 626 |
|
| 627 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right |
| 628 |
\ifpgfcirc@draw@output@leads |
| 629 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 630 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 631 |
\pgfusepath{draw} |
| 632 |
\fi |
| 633 |
|
| 634 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 635 |
|
| 636 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% |
| 637 |
|
| 638 |
% main shape |
| 639 |
\ifpgfcirc@roundy@or@shapes |
| 640 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry |
| 641 |
\pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% |
| 642 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 643 |
\pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% |
| 644 |
\pgfpathclose |
| 645 |
\else |
| 646 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 647 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} |
| 648 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 649 |
\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}} |
| 650 |
\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}} |
| 651 |
\pgfpathclose |
| 652 |
\fi |
| 653 |
|
| 654 |
\pgf@circ@draworfill |
| 655 |
} |
| 656 |
%%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 657 |
\pgfcircdeclarelogicport{xor}{3}{ |
| 658 |
\pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}% |
| 659 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right |
| 660 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 661 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% |
| 662 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right |
| 663 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 664 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right |
| 665 |
\pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} |
| 666 |
% this compensates for the effect of the line width on the gap between the arcs |
| 667 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% |
| 668 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% |
| 669 |
|
| 670 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 671 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 672 |
\pgf@circ@res@count = \inputs\relax |
| 673 |
\ifpgfcirc@draw@input@leads |
| 674 |
%input leads |
| 675 |
\loop\ifnum\pgf@circ@res@count>0 |
| 676 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 677 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 678 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% |
| 679 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 680 |
\advance\pgf@circ@res@other by -\pgf@circ@math@distance |
| 681 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% |
| 682 |
\advance\pgf@circ@res@count by -1 |
| 683 |
\repeat |
| 684 |
\fi |
| 685 |
|
| 686 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right |
| 687 |
\ifpgfcirc@draw@output@leads |
| 688 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 689 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 690 |
\pgfusepath{draw} |
| 691 |
\fi |
| 692 |
|
| 693 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 694 |
|
| 695 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% |
| 696 |
|
| 697 |
% main shape |
| 698 |
\ifpgfcirc@roundy@or@shapes |
| 699 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry |
| 700 |
\pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% |
| 701 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 702 |
\pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% |
| 703 |
\pgfpathclose |
| 704 |
\else |
| 705 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 706 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} |
| 707 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 708 |
\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}} |
| 709 |
\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}} |
| 710 |
\pgfpathclose |
| 711 |
\fi |
| 712 |
\pgf@circ@draworfill |
| 713 |
|
| 714 |
\pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% |
| 715 |
|
| 716 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc |
| 717 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% |
| 718 |
|
| 719 |
\pgfusepath{draw} |
| 720 |
} |
| 721 |
%%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 722 |
\pgfcircdeclarelogicport{xnor}{3}{ |
| 723 |
\pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}% |
| 724 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right |
| 725 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}% |
| 726 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}% |
| 727 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right |
| 728 |
\pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}% |
| 729 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right |
| 730 |
\pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp} |
| 731 |
% this compensates for the effect of the line width on the gap between the arcs |
| 732 |
\pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}% |
| 733 |
\pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}% |
| 734 |
|
| 735 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 736 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 737 |
\pgf@circ@res@count = \inputs\relax |
| 738 |
\ifpgfcirc@draw@input@leads |
| 739 |
%input leads |
| 740 |
\loop\ifnum\pgf@circ@res@count>0 |
| 741 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 742 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 743 |
\pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% |
| 744 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 745 |
\advance\pgf@circ@res@other by -\pgf@circ@math@distance |
| 746 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% |
| 747 |
\advance\pgf@circ@res@count by -1 |
| 748 |
\repeat |
| 749 |
\fi |
| 750 |
|
| 751 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right |
| 752 |
\ifpgfcirc@draw@output@leads |
| 753 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 754 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 755 |
\pgfusepath{draw} |
| 756 |
\fi |
| 757 |
|
| 758 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 759 |
|
| 760 |
\edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}% |
| 761 |
\pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right |
| 762 |
\pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax |
| 763 |
\advance\pgf@circ@res@other by -\pgf@circ@res@step |
| 764 |
|
| 765 |
% main shape |
| 766 |
\ifpgfcirc@roundy@or@shapes |
| 767 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry |
| 768 |
\pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% |
| 769 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 770 |
\pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% |
| 771 |
\pgfpathclose |
| 772 |
\else |
| 773 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% |
| 774 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} |
| 775 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% |
| 776 |
\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}} |
| 777 |
\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}} |
| 778 |
\pgfpathclose |
| 779 |
\fi |
| 780 |
|
| 781 |
\pgfpathellipse |
| 782 |
{\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} |
| 783 |
{\pgfpoint{.5\pgf@circ@res@step}{0pt}} |
| 784 |
{\pgfpoint{0pt}{.5\pgf@circ@res@step}} |
| 785 |
\pgf@circ@draworfill |
| 786 |
|
| 787 |
\pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left |
| 788 |
\pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% |
| 789 |
|
| 790 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc |
| 791 |
\pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}% |
| 792 |
|
| 793 |
\pgfusepath{draw} |
| 794 |
} |
| 795 |
|
| 796 |
%%% Original one-input ports |
| 797 |
|
| 798 |
\pgfdeclareshape{american not port}{ |
| 799 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 800 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 801 |
\anchor{center}{\pgfpointorigin} |
| 802 |
\savedanchor\northwest{% |
| 803 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 804 |
\pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen |
| 805 |
\pgf@y=.5\pgf@y |
| 806 |
\pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen |
| 807 |
\pgf@x=.5\pgf@x |
| 808 |
} |
| 809 |
\anchor{in}{ |
| 810 |
\northwest |
| 811 |
\pgf@y=0pt |
| 812 |
} |
| 813 |
\anchor{in 1}{ |
| 814 |
\northwest |
| 815 |
\pgf@y=0pt |
| 816 |
} |
| 817 |
\anchor{left}{ |
| 818 |
\northwest |
| 819 |
\pgf@x=0.7\pgf@x |
| 820 |
\pgf@y=0pt |
| 821 |
} |
| 822 |
\anchor{bin}{ |
| 823 |
\northwest |
| 824 |
\pgf@x=0.7\pgf@x |
| 825 |
\pgf@y=0pt |
| 826 |
} |
| 827 |
\anchor{bin 1}{ |
| 828 |
\northwest |
| 829 |
\pgf@y=0pt |
| 830 |
\pgf@x=0.7\pgf@x |
| 831 |
} |
| 832 |
\anchor{out}{ |
| 833 |
\northwest |
| 834 |
\pgf@y=0pt |
| 835 |
\pgf@x=-\pgf@x |
| 836 |
} |
| 837 |
\anchor{right}{ |
| 838 |
\northwest |
| 839 |
\pgf@y=0pt |
| 840 |
\pgf@x=-0.7\pgf@x |
| 841 |
} |
| 842 |
\anchor{bout}{ |
| 843 |
\northwest |
| 844 |
\pgf@y=0pt |
| 845 |
\pgf@x=-0.7\pgf@x |
| 846 |
} |
| 847 |
\anchor{center}{ |
| 848 |
\pgfpointorigin |
| 849 |
} |
| 850 |
\anchor{east}{ |
| 851 |
\northwest |
| 852 |
\pgf@y=0pt |
| 853 |
\pgf@x=-\pgf@x |
| 854 |
} |
| 855 |
\anchor{west}{ |
| 856 |
\northwest |
| 857 |
\pgf@y=0pt |
| 858 |
} |
| 859 |
\anchor{south}{ |
| 860 |
\northwest |
| 861 |
\pgf@x=0pt |
| 862 |
\pgf@y=-\pgf@y |
| 863 |
} |
| 864 |
\anchor{north}{ |
| 865 |
\northwest |
| 866 |
\pgf@x=0pt |
| 867 |
} |
| 868 |
\anchor{south west}{ |
| 869 |
\northwest |
| 870 |
\pgf@y=-\pgf@y |
| 871 |
} |
| 872 |
\anchor{north east}{ |
| 873 |
\northwest |
| 874 |
\pgf@x=-\pgf@x |
| 875 |
} |
| 876 |
\anchor{north west}{ |
| 877 |
\northwest |
| 878 |
} |
| 879 |
\anchor{south east}{ |
| 880 |
\northwest |
| 881 |
\pgf@x=-\pgf@x |
| 882 |
\pgf@y=-\pgf@y |
| 883 |
} |
| 884 |
\anchorborder{% this is used when the node is used as a path element |
| 885 |
\pgf@xa=\pgf@x |
| 886 |
\pgf@ya=\pgf@y |
| 887 |
\pgfextracty{\pgf@circ@res@up}{\northwest} |
| 888 |
\pgfextractx{\pgf@circ@res@left}{\northwest} |
| 889 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 890 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 891 |
} |
| 892 |
\savedanchor{\textanchor}{% |
| 893 |
% centered and a bit to the left (it's a triangle)! |
| 894 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 895 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 896 |
} |
| 897 |
\anchor{text}{\textanchor} |
| 898 |
\pgf@circ@draw@component{ |
| 899 |
\pgf@circ@setcolor |
| 900 |
|
| 901 |
\northwest |
| 902 |
\pgf@circ@res@up = \pgf@y |
| 903 |
\pgf@circ@res@down = -\pgf@y |
| 904 |
\pgf@circ@res@right = -\pgf@x |
| 905 |
\pgf@circ@res@left = \pgf@x |
| 906 |
|
| 907 |
\pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right |
| 908 |
|
| 909 |
\pgfscope |
| 910 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 911 |
\pgftransformxshift{.7\pgf@circ@res@left} |
| 912 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 913 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 914 |
\pgf@circ@res@step=.7\pgf@circ@res@step |
| 915 |
|
| 916 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} |
| 917 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 918 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 919 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} |
| 920 |
\pgf@circ@draworfill |
| 921 |
\pgfpathellipse |
| 922 |
{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}} |
| 923 |
{\pgfpoint{.5\pgf@circ@res@other}{0pt}} |
| 924 |
{\pgfpoint{0pt}{.5\pgf@circ@res@other}} |
| 925 |
\pgf@circ@draworfill |
| 926 |
\endpgfscope |
| 927 |
|
| 928 |
\ifpgfcirc@draw@input@leads |
| 929 |
%input leads |
| 930 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 931 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} |
| 932 |
\fi |
| 933 |
|
| 934 |
\ifpgfcirc@draw@output@leads |
| 935 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 936 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} |
| 937 |
\fi |
| 938 |
|
| 939 |
\pgfusepath{draw} |
| 940 |
} |
| 941 |
} |
| 942 |
|
| 943 |
\pgfdeclareshape{american buffer port}{ |
| 944 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 945 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 946 |
\anchor{center}{\pgfpointorigin} |
| 947 |
\savedanchor\northwest{% |
| 948 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 949 |
\pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen |
| 950 |
\pgf@y=.5\pgf@y |
| 951 |
\pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen |
| 952 |
\pgf@x=.5\pgf@x |
| 953 |
} |
| 954 |
\anchor{in}{ |
| 955 |
\northwest |
| 956 |
\pgf@y=0pt |
| 957 |
} |
| 958 |
\anchor{in 1}{ |
| 959 |
\northwest |
| 960 |
\pgf@y=0pt |
| 961 |
} |
| 962 |
\anchor{left}{ |
| 963 |
\northwest |
| 964 |
\pgf@x=0.7\pgf@x |
| 965 |
\pgf@y=0pt |
| 966 |
} |
| 967 |
\anchor{bin}{ |
| 968 |
\northwest |
| 969 |
\pgf@x=0.7\pgf@x |
| 970 |
\pgf@y=0pt |
| 971 |
} |
| 972 |
\anchor{bin 1}{ |
| 973 |
\northwest |
| 974 |
\pgf@y=0pt |
| 975 |
\pgf@x=0.7\pgf@x |
| 976 |
} |
| 977 |
\anchor{out}{ |
| 978 |
\northwest |
| 979 |
\pgf@y=0pt |
| 980 |
\pgf@x=-\pgf@x |
| 981 |
} |
| 982 |
\anchor{right}{ |
| 983 |
\northwest |
| 984 |
\pgf@y=0pt |
| 985 |
\pgf@x=-0.7\pgf@x |
| 986 |
} |
| 987 |
\anchor{bout}{ |
| 988 |
\northwest |
| 989 |
\pgf@y=0pt |
| 990 |
\pgf@x=-0.7\pgf@x |
| 991 |
} |
| 992 |
\anchor{center}{ |
| 993 |
\pgfpointorigin |
| 994 |
} |
| 995 |
\anchor{east}{ |
| 996 |
\northwest |
| 997 |
\pgf@y=0pt |
| 998 |
\pgf@x=-\pgf@x |
| 999 |
} |
| 1000 |
\anchor{west}{ |
| 1001 |
\northwest |
| 1002 |
\pgf@y=0pt |
| 1003 |
} |
| 1004 |
\anchor{south}{ |
| 1005 |
\northwest |
| 1006 |
\pgf@x=0pt |
| 1007 |
\pgf@y=-\pgf@y |
| 1008 |
} |
| 1009 |
\anchor{north}{ |
| 1010 |
\northwest |
| 1011 |
\pgf@x=0pt |
| 1012 |
} |
| 1013 |
\anchor{south west}{ |
| 1014 |
\northwest |
| 1015 |
\pgf@y=-\pgf@y |
| 1016 |
} |
| 1017 |
\anchor{north east}{ |
| 1018 |
\northwest |
| 1019 |
\pgf@x=-\pgf@x |
| 1020 |
} |
| 1021 |
\anchor{north west}{ |
| 1022 |
\northwest |
| 1023 |
} |
| 1024 |
\anchor{south east}{ |
| 1025 |
\northwest |
| 1026 |
\pgf@x=-\pgf@x |
| 1027 |
\pgf@y=-\pgf@y |
| 1028 |
} |
| 1029 |
\anchorborder{% this is used when the node is used as a path element |
| 1030 |
\pgf@xa=\pgf@x |
| 1031 |
\pgf@ya=\pgf@y |
| 1032 |
\pgfextracty{\pgf@circ@res@up}{\northwest} |
| 1033 |
\pgfextractx{\pgf@circ@res@left}{\northwest} |
| 1034 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 1035 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 1036 |
} |
| 1037 |
\savedanchor{\textanchor}{% |
| 1038 |
% centered and a bit to the left (it's a triangle)! |
| 1039 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 1040 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 1041 |
} |
| 1042 |
\anchor{text}{\textanchor} |
| 1043 |
\pgf@circ@draw@component{ |
| 1044 |
\pgf@circ@setcolor |
| 1045 |
|
| 1046 |
\northwest |
| 1047 |
\pgf@circ@res@up = \pgf@y |
| 1048 |
\pgf@circ@res@down = -\pgf@y |
| 1049 |
\pgf@circ@res@right = -\pgf@x |
| 1050 |
\pgf@circ@res@left = \pgf@x |
| 1051 |
|
| 1052 |
\pgfscope |
| 1053 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1054 |
\pgftransformxshift{.7\pgf@circ@res@left} |
| 1055 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 1056 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 1057 |
\pgf@circ@res@step=.7\pgf@circ@res@step |
| 1058 |
|
| 1059 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 1060 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 1061 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 1062 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 1063 |
\pgf@circ@draworfill |
| 1064 |
\endpgfscope |
| 1065 |
|
| 1066 |
\ifpgfcirc@draw@input@leads |
| 1067 |
%input leads |
| 1068 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 1069 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} |
| 1070 |
\fi |
| 1071 |
|
| 1072 |
\ifpgfcirc@draw@output@leads |
| 1073 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 1074 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} |
| 1075 |
\fi |
| 1076 |
|
| 1077 |
\pgfusepath{draw} |
| 1078 |
} |
| 1079 |
} |
| 1080 |
\pgfdeclareshape{invschmitt}{ |
| 1081 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 1082 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 1083 |
\anchor{center}{\pgfpointorigin} |
| 1084 |
\savedanchor\northwest{% |
| 1085 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 1086 |
\pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen |
| 1087 |
\pgf@y=.5\pgf@y |
| 1088 |
\pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen |
| 1089 |
\pgf@x=.5\pgf@x |
| 1090 |
} |
| 1091 |
\anchor{in}{ |
| 1092 |
\northwest |
| 1093 |
\pgf@y=0pt |
| 1094 |
} |
| 1095 |
\anchor{in 1}{ |
| 1096 |
\northwest |
| 1097 |
\pgf@y=0pt |
| 1098 |
} |
| 1099 |
\anchor{left}{ |
| 1100 |
\northwest |
| 1101 |
\pgf@y=0pt |
| 1102 |
\pgf@x=0.7\pgf@x |
| 1103 |
} |
| 1104 |
\anchor{bin}{ |
| 1105 |
\northwest |
| 1106 |
\pgf@y=0pt |
| 1107 |
\pgf@x=0.7\pgf@x |
| 1108 |
} |
| 1109 |
\anchor{bin 1}{ |
| 1110 |
\northwest |
| 1111 |
\pgf@y=0pt |
| 1112 |
\pgf@x=0.7\pgf@x |
| 1113 |
} |
| 1114 |
\anchor{out}{ |
| 1115 |
\northwest |
| 1116 |
\pgf@y=0pt |
| 1117 |
\pgf@x=-\pgf@x |
| 1118 |
} |
| 1119 |
\anchor{right}{ |
| 1120 |
\northwest |
| 1121 |
\pgf@y=0pt |
| 1122 |
\pgf@x=-0.7\pgf@x |
| 1123 |
} |
| 1124 |
\anchor{bout}{ |
| 1125 |
\northwest |
| 1126 |
\pgf@y=0pt |
| 1127 |
\pgf@x=-0.7\pgf@x |
| 1128 |
} |
| 1129 |
\anchor{center}{ |
| 1130 |
\pgfpointorigin |
| 1131 |
} |
| 1132 |
\anchor{east}{ |
| 1133 |
\northwest |
| 1134 |
\pgf@y=0pt |
| 1135 |
\pgf@x=-\pgf@x |
| 1136 |
} |
| 1137 |
\anchor{west}{ |
| 1138 |
\northwest |
| 1139 |
\pgf@y=0pt |
| 1140 |
} |
| 1141 |
\anchor{south}{ |
| 1142 |
\northwest |
| 1143 |
\pgf@x=0pt |
| 1144 |
\pgf@y=-\pgf@y |
| 1145 |
} |
| 1146 |
\anchor{north}{ |
| 1147 |
\northwest |
| 1148 |
\pgf@x=0pt |
| 1149 |
} |
| 1150 |
\anchor{south west}{ |
| 1151 |
\northwest |
| 1152 |
\pgf@y=-\pgf@y |
| 1153 |
} |
| 1154 |
\anchor{north east}{ |
| 1155 |
\northwest |
| 1156 |
\pgf@x=-\pgf@x |
| 1157 |
} |
| 1158 |
\anchor{north west}{ |
| 1159 |
\northwest |
| 1160 |
} |
| 1161 |
\anchor{south east}{ |
| 1162 |
\northwest |
| 1163 |
\pgf@x=-\pgf@x |
| 1164 |
\pgf@y=-\pgf@y |
| 1165 |
} |
| 1166 |
\anchorborder{% this is used when the node is used as a path element |
| 1167 |
\pgf@xa=\pgf@x |
| 1168 |
\pgf@ya=\pgf@y |
| 1169 |
\pgfextracty{\pgf@circ@res@up}{\northwest} |
| 1170 |
\pgfextractx{\pgf@circ@res@left}{\northwest} |
| 1171 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 1172 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 1173 |
} |
| 1174 |
\savedanchor{\textanchor}{% |
| 1175 |
% centered and a bit to the left (it's a triangle)! |
| 1176 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 1177 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 1178 |
} |
| 1179 |
\anchor{text}{\textanchor} |
| 1180 |
\pgf@circ@draw@component{ |
| 1181 |
\pgf@circ@setcolor |
| 1182 |
|
| 1183 |
\northwest |
| 1184 |
\pgf@circ@res@up = \pgf@y |
| 1185 |
\pgf@circ@res@down = -\pgf@y |
| 1186 |
\pgf@circ@res@right = -\pgf@x |
| 1187 |
\pgf@circ@res@left = \pgf@x |
| 1188 |
|
| 1189 |
\pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right |
| 1190 |
|
| 1191 |
\pgfscope |
| 1192 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1193 |
\pgftransformxshift{.7\pgf@circ@res@left} |
| 1194 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 1195 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 1196 |
\pgf@circ@res@step=.7\pgf@circ@res@step |
| 1197 |
|
| 1198 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} |
| 1199 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 1200 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 1201 |
\pgfpathclose |
| 1202 |
\pgf@circ@draworfill |
| 1203 |
\pgfpathellipse |
| 1204 |
{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}} |
| 1205 |
{\pgfpoint{.5\pgf@circ@res@other}{0pt}} |
| 1206 |
{\pgfpoint{0pt}{.5\pgf@circ@res@other}} |
| 1207 |
\pgf@circ@draworfill |
| 1208 |
\endpgfscope |
| 1209 |
|
| 1210 |
\ifpgfcirc@draw@input@leads |
| 1211 |
%input leads |
| 1212 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 1213 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} |
| 1214 |
\fi |
| 1215 |
|
| 1216 |
\ifpgfcirc@draw@output@leads |
| 1217 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 1218 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} |
| 1219 |
\fi |
| 1220 |
\pgfusepath{draw} |
| 1221 |
%draw inner shape |
| 1222 |
|
| 1223 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1224 |
|
| 1225 |
\pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1226 |
\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1227 |
\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1228 |
\pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1229 |
\pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1230 |
\pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1231 |
\pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1232 |
\pgfusepath{draw} |
| 1233 |
|
| 1234 |
} |
| 1235 |
} |
| 1236 |
|
| 1237 |
\pgfdeclareshape{schmitt}{ |
| 1238 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 1239 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 1240 |
\anchor{center}{\pgfpointorigin} |
| 1241 |
\savedanchor\northwest{% |
| 1242 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 1243 |
\pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen |
| 1244 |
\pgf@y=.5\pgf@y |
| 1245 |
\pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen |
| 1246 |
\pgf@x=.5\pgf@x |
| 1247 |
} |
| 1248 |
\anchor{in}{ |
| 1249 |
\northwest |
| 1250 |
\pgf@y=0pt |
| 1251 |
} |
| 1252 |
\anchor{in 1}{ |
| 1253 |
\northwest |
| 1254 |
\pgf@y=0pt |
| 1255 |
} |
| 1256 |
\anchor{left}{ |
| 1257 |
\northwest |
| 1258 |
\pgf@y=0pt |
| 1259 |
\pgf@x=0.7\pgf@x |
| 1260 |
} |
| 1261 |
\anchor{bin}{ |
| 1262 |
\northwest |
| 1263 |
\pgf@y=0pt |
| 1264 |
\pgf@x=0.7\pgf@x |
| 1265 |
} |
| 1266 |
\anchor{bin 1}{ |
| 1267 |
\northwest |
| 1268 |
\pgf@y=0pt |
| 1269 |
\pgf@x=0.7\pgf@x |
| 1270 |
} |
| 1271 |
\anchor{out}{ |
| 1272 |
\northwest |
| 1273 |
\pgf@y=0pt |
| 1274 |
\pgf@x=-\pgf@x |
| 1275 |
} |
| 1276 |
\anchor{right}{ |
| 1277 |
\northwest |
| 1278 |
\pgf@y=0pt |
| 1279 |
\pgf@x=-.7\pgf@x |
| 1280 |
} |
| 1281 |
\anchor{bout}{ |
| 1282 |
\northwest |
| 1283 |
\pgf@y=0pt |
| 1284 |
\pgf@x=-.7\pgf@x |
| 1285 |
} |
| 1286 |
\anchor{center}{ |
| 1287 |
\pgfpointorigin |
| 1288 |
} |
| 1289 |
\anchor{east}{ |
| 1290 |
\northwest |
| 1291 |
\pgf@y=0pt |
| 1292 |
\pgf@x=-\pgf@x |
| 1293 |
} |
| 1294 |
\anchor{west}{ |
| 1295 |
\northwest |
| 1296 |
\pgf@y=0pt |
| 1297 |
} |
| 1298 |
\anchor{south}{ |
| 1299 |
\northwest |
| 1300 |
\pgf@x=0pt |
| 1301 |
\pgf@y=-\pgf@y |
| 1302 |
} |
| 1303 |
\anchor{north}{ |
| 1304 |
\northwest |
| 1305 |
\pgf@x=0pt |
| 1306 |
} |
| 1307 |
\anchor{south west}{ |
| 1308 |
\northwest |
| 1309 |
\pgf@y=-\pgf@y |
| 1310 |
} |
| 1311 |
\anchor{north east}{ |
| 1312 |
\northwest |
| 1313 |
\pgf@x=-\pgf@x |
| 1314 |
} |
| 1315 |
\anchor{north west}{ |
| 1316 |
\northwest |
| 1317 |
} |
| 1318 |
\anchor{south east}{ |
| 1319 |
\northwest |
| 1320 |
\pgf@x=-\pgf@x |
| 1321 |
\pgf@y=-\pgf@y |
| 1322 |
} |
| 1323 |
\anchorborder{% this is used when the node is used as a path element |
| 1324 |
\pgf@xa=\pgf@x |
| 1325 |
\pgf@ya=\pgf@y |
| 1326 |
\pgfextracty{\pgf@circ@res@up}{\northwest} |
| 1327 |
\pgfextractx{\pgf@circ@res@left}{\northwest} |
| 1328 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 1329 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 1330 |
} |
| 1331 |
\savedanchor{\textanchor}{% |
| 1332 |
% centered and a bit to the left (it's a triangle)! |
| 1333 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 1334 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 1335 |
} |
| 1336 |
\anchor{text}{\textanchor} |
| 1337 |
\pgf@circ@draw@component{ |
| 1338 |
\pgf@circ@setcolor |
| 1339 |
|
| 1340 |
|
| 1341 |
\northwest |
| 1342 |
\pgf@circ@res@up = \pgf@y |
| 1343 |
\pgf@circ@res@down = -\pgf@y |
| 1344 |
\pgf@circ@res@right = -\pgf@x |
| 1345 |
\pgf@circ@res@left = \pgf@x |
| 1346 |
|
| 1347 |
\pgfscope |
| 1348 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1349 |
\pgftransformxshift{.7\pgf@circ@res@left} |
| 1350 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 1351 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 1352 |
\pgf@circ@res@step=.7\pgf@circ@res@step |
| 1353 |
|
| 1354 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 1355 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 1356 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 1357 |
\pgfpathclose |
| 1358 |
\pgf@circ@draworfill |
| 1359 |
\endpgfscope |
| 1360 |
|
| 1361 |
\ifpgfcirc@draw@input@leads |
| 1362 |
%input leads |
| 1363 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 1364 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} |
| 1365 |
\fi |
| 1366 |
|
| 1367 |
\ifpgfcirc@draw@output@leads |
| 1368 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 1369 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} |
| 1370 |
\fi |
| 1371 |
\pgfusepath{draw} |
| 1372 |
%draw inner shape |
| 1373 |
|
| 1374 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1375 |
|
| 1376 |
\pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1377 |
\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1378 |
\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1379 |
\pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1380 |
\pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1381 |
\pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} |
| 1382 |
\pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} |
| 1383 |
\pgfusepath{draw} |
| 1384 |
|
| 1385 |
} |
| 1386 |
} |
| 1387 |
|
| 1388 |
|
| 1389 |
%%% start european logic ports, from John Kormylo |
| 1390 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1391 |
%% |
| 1392 |
|
| 1393 |
% #1 - name |
| 1394 |
% #2 - text inside |
| 1395 |
% #3 - number of inputs |
| 1396 |
% #4 = is it a not? |
| 1397 |
% |
| 1398 |
% option to add a circle for not-output, see |
| 1399 |
% https://github.com/circuitikz/circuitikz/issues/385 |
| 1400 |
% |
| 1401 |
\newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse |
| 1402 |
\newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse |
| 1403 |
\ctikzset{tripoles/european not shape/.initial=ocirc} |
| 1404 |
\ctikzset{tripoles/european not symbol/.is choice} |
| 1405 |
\ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}} |
| 1406 |
\ctikzset{tripoles/european not symbol/circle/.code={% |
| 1407 |
\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}} |
| 1408 |
\ctikzset{tripoles/european not symbol/ieee circle/.code={% |
| 1409 |
\pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}} |
| 1410 |
|
| 1411 |
\long\def\pgfcircdeclareeurologicport#1#2#3#4{ |
| 1412 |
\pgfdeclareshape{european #1 port} |
| 1413 |
{ |
| 1414 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 1415 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 1416 |
\saveddimen{\boutshift}{% |
| 1417 |
\edef\pgf@temp{not} |
| 1418 |
\edef\pgf@circ@temp{#4} |
| 1419 |
\ifx\pgf@temp\pgf@circ@temp % is a not |
| 1420 |
\ifpgf@circ@european@port@circle |
| 1421 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 1422 |
\edef\pgf@temp{ocirc} |
| 1423 |
\edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}} |
| 1424 |
\ifx\pgf@temp\pgf@circ@temp % it's ocirc |
| 1425 |
\pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 1426 |
\else % it's ieee not circ |
| 1427 |
\pgf@circ@notradius % defined together with ieeestd ports |
| 1428 |
\pgf@x=2\pgf@circ@res@temp |
| 1429 |
\fi |
| 1430 |
\else |
| 1431 |
\pgf@x=0pt |
| 1432 |
\fi |
| 1433 |
\else |
| 1434 |
\pgf@x=0pt |
| 1435 |
\fi |
| 1436 |
} |
| 1437 |
\savedmacro\resize{% automatic |
| 1438 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 1439 |
\pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen |
| 1440 |
\pgf@circ@res@up = .5\pgf@circ@res@up |
| 1441 |
\pgf@circ@res@down = -\pgf@circ@res@up |
| 1442 |
\pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen |
| 1443 |
\pgf@circ@res@right = .5\pgf@circ@res@right |
| 1444 |
\pgf@circ@res@left = -\pgf@circ@res@right |
| 1445 |
}% |
| 1446 |
\savedmacro\inputs{% get number of inputs |
| 1447 |
\pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax% |
| 1448 |
\ifnum\pgf@circ@res@count=0 |
| 1449 |
\pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax% |
| 1450 |
\fi |
| 1451 |
\ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi |
| 1452 |
\ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi |
| 1453 |
\def\inputs{\the\pgf@circ@res@count}% |
| 1454 |
}% |
| 1455 |
\savedanchor\step{% 1/2 gap at edges |
| 1456 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 1457 |
\pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen |
| 1458 |
\divide\pgf@circ@res@step by #3 |
| 1459 |
\pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}% |
| 1460 |
}% |
| 1461 |
\savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}% |
| 1462 |
\savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}% |
| 1463 |
\savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% |
| 1464 |
\savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}% |
| 1465 |
\savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}% |
| 1466 |
|
| 1467 |
\anchor{center}{\origin}% for backwards compatibility |
| 1468 |
% the text anchor overlaps the logic symbol |
| 1469 |
\savedanchor{\textanchor}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}% |
| 1470 |
\anchor{text}{\textanchor} |
| 1471 |
% create input anchors |
| 1472 |
\ifnum#3=1\relax |
| 1473 |
\anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step |
| 1474 |
\anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step |
| 1475 |
\anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step |
| 1476 |
\anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step |
| 1477 |
\else |
| 1478 |
\expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{% |
| 1479 |
\pgfmathloop% |
| 1480 |
\ifnum\pgfmathcounter>#3 |
| 1481 |
\else% |
| 1482 |
%\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant |
| 1483 |
\expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{% |
| 1484 |
\noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above |
| 1485 |
}% |
| 1486 |
\expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{% |
| 1487 |
\noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above |
| 1488 |
}% |
| 1489 |
%}{}% |
| 1490 |
\repeatpgfmathloop% |
| 1491 |
} |
| 1492 |
\fi |
| 1493 |
\anchor{out}{\northeast\pgf@y=0pt} |
| 1494 |
\anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} |
| 1495 |
|
| 1496 |
\anchor{left}{\left}% edges of component minus leads |
| 1497 |
\anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} |
| 1498 |
|
| 1499 |
\anchor{north east}{\northeast}% see \Compass macro |
| 1500 |
\anchor{south west}{\southwest} |
| 1501 |
\anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 1502 |
\pgfpoint{0cm}{\pgf@circ@res@up}} |
| 1503 |
\anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}% |
| 1504 |
\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 1505 |
\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 1506 |
\anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}% |
| 1507 |
\pgfpoint{\pgf@circ@res@left}{0cm}} |
| 1508 |
\anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}% |
| 1509 |
\pgfpoint{0cm}{\pgf@circ@res@down}} |
| 1510 |
\anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}% |
| 1511 |
\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 1512 |
\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 1513 |
\anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}% |
| 1514 |
\pgfpoint{\pgf@circ@res@right}{0cm}} |
| 1515 |
|
| 1516 |
\anchorborder{% this is used when the node is used as a path element |
| 1517 |
\pgf@xa=\pgf@x |
| 1518 |
\pgf@ya=\pgf@y |
| 1519 |
\pgfextracty{\pgf@circ@res@up}{\northeast} |
| 1520 |
\pgfextractx{\pgf@circ@res@right}{\northeast} |
| 1521 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 1522 |
{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 1523 |
} |
| 1524 |
\pgf@circ@draw@component{ |
| 1525 |
\pgf@circ@setcolor |
| 1526 |
\pgfstartlinewidth=\pgflinewidth |
| 1527 |
\pgfscope |
| 1528 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1529 |
\pgfpathrectanglecorners |
| 1530 |
{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 1531 |
{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 1532 |
\pgf@circ@draworfill |
| 1533 |
\endpgfscope |
| 1534 |
\ifpgfcirc@draw@input@leads |
| 1535 |
%input leads |
| 1536 |
\ifnum#3=1\relax |
| 1537 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% |
| 1538 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% |
| 1539 |
\else |
| 1540 |
\pgfextracty{\pgf@circ@res@temp}{\step}% |
| 1541 |
\pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax |
| 1542 |
%\pgf@circ@res@count = #3\relax% redundant |
| 1543 |
\loop\ifnum\pgf@circ@res@count>0 |
| 1544 |
\advance\pgf@circ@res@temp by -\pgf@circ@res@step |
| 1545 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 1546 |
\pgfpathlineto{\pgfpoint |
| 1547 |
{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} |
| 1548 |
{\pgf@circ@res@temp}} |
| 1549 |
\advance\pgf@circ@res@count by -1 |
| 1550 |
\repeat |
| 1551 |
\fi |
| 1552 |
\pgfusepath{draw} |
| 1553 |
\fi |
| 1554 |
% |
| 1555 |
\ifpgfcirc@draw@output@leads |
| 1556 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 1557 |
\pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} |
| 1558 |
\pgfusepath{draw} |
| 1559 |
\fi |
| 1560 |
% |
| 1561 |
\edef\pgf@temp{not} |
| 1562 |
\edef\pgf@circ@temp{#4} |
| 1563 |
\ifx\pgf@temp\pgf@circ@temp % is a not |
| 1564 |
\ifpgf@circ@european@port@circle |
| 1565 |
\pgfscope |
| 1566 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 1567 |
\pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} |
| 1568 |
% reset linewidth for IEEE ports, otherwise they will multiply... |
| 1569 |
\ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi |
| 1570 |
\pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} |
| 1571 |
\endpgfscope |
| 1572 |
\else |
| 1573 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} |
| 1574 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% |
| 1575 |
{\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} |
| 1576 |
\pgfusepath{draw} |
| 1577 |
\fi |
| 1578 |
\fi |
| 1579 |
\pgf@circ@text@strokecolor |
| 1580 |
\pgfpathmoveto{\pgfpointorigin} |
| 1581 |
\pgfscope |
| 1582 |
% text is always in standard direction |
| 1583 |
\pgftransformresetnontranslations |
| 1584 |
\pgftext{\ctikzvalof{european ports font}#2}% |
| 1585 |
\endpgfscope |
| 1586 |
} |
| 1587 |
} |
| 1588 |
} |
| 1589 |
\pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{} |
| 1590 |
\pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{} |
| 1591 |
\pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{} |
| 1592 |
\pgfcircdeclareeurologicport{not}{$1$}{1}{not} |
| 1593 |
\pgfcircdeclareeurologicport{buffer}{$1$}{1}{} |
| 1594 |
\pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not} |
| 1595 |
\pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not} |
| 1596 |
\pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not} |
| 1597 |
\pgfcircdeclareeurologicport{blank}{}{\pgf@circ@res@count}{} |
| 1598 |
\pgfcircdeclareeurologicport{blank not}{}{\pgf@circ@res@count}{not} |
| 1599 |
%% end european logic ports |
| 1600 |
% %>>> |
| 1601 |
|
| 1602 |
%% IEEE standard logic ports module%<<< |
| 1603 |
|
| 1604 |
%% |
| 1605 |
%% Original multi-input code from John Kormylo at tex.stackexchange.com |
| 1606 |
%% Help by TheTeXnician <[email protected]> |
| 1607 |
%% Suggested idea and example code by Jason Sachs <[email protected]> |
| 1608 |
%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details |
| 1609 |
%% Most of the code, all errors and bugs by Romano Giannetti <[email protected]> |
| 1610 |
%% Everything is in the same place here --- more or less; first step to move towards |
| 1611 |
%% a module interface for circutikz |
| 1612 |
%% |
| 1613 |
|
| 1614 |
% base settings for ieeestd ports. |
| 1615 |
|
| 1616 |
\ctikzset{ieeestd ports/.is family} |
| 1617 |
% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so. |
| 1618 |
% the value of 0.4 is the standard pin distance for a port with height=num pins |
| 1619 |
% and matches the chip distance |
| 1620 |
\ctikzset{ieeestd ports/baselen/.initial=0.4} |
| 1621 |
% these are in term of baselen; width depends on height (fixed proportions) |
| 1622 |
\ctikzset{ieeestd ports/height/.initial=2} |
| 1623 |
\ctikzset{ieeestd ports/pin length/.initial=0.7} |
| 1624 |
% the standard "not" circle should be 1/6.5 of height (diameter); |
| 1625 |
% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole |
| 1626 |
\ctikzset{ieeestd ports/not radius/.initial=0.154} |
| 1627 |
\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why |
| 1628 |
% the suggested xnor distance is is 1.24, so 1.25/3.25/2 |
| 1629 |
% xor/xnor leads go full in in IEEE; let this be optional |
| 1630 |
\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}% |
| 1631 |
\ctikzset{ieeestd ports/xor leads in/.initial=1}% |
| 1632 |
% |
| 1633 |
% base size of a small external schmitt symbol |
| 1634 |
% |
| 1635 |
\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}% |
| 1636 |
% |
| 1637 |
% input management |
| 1638 |
% we are using the same /tikz/number inputs than the legacy ports |
| 1639 |
% |
| 1640 |
\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner |
| 1641 |
% |
| 1642 |
% integrate with the other logic ports |
| 1643 |
% |
| 1644 |
% |
| 1645 |
\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse |
| 1646 |
\ctikzset{logic ports/ieee/.code= {% |
| 1647 |
\pgf@circuit@ieeelogicporttrue |
| 1648 |
\pgf@circuit@europeanlogicportfalse |
| 1649 |
\tikzset{and port/.style={shape=ieeestd and port}}% |
| 1650 |
\tikzset{or port/.style={shape=ieeestd or port}}% |
| 1651 |
\tikzset{xor port/.style={shape=ieeestd xor port}}% |
| 1652 |
\tikzset{buffer port/.style={shape=ieeestd buffer port}}% |
| 1653 |
\tikzset{not port/.style={shape=ieeestd not port}}% |
| 1654 |
\tikzset{nand port/.style={shape=ieeestd nand port}}% |
| 1655 |
\tikzset{nor port/.style={shape=ieeestd nor port}}% |
| 1656 |
\tikzset{xnor port/.style={shape=ieeestd xnor port}}% |
| 1657 |
\tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% |
| 1658 |
\tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% |
| 1659 |
}} |
| 1660 |
% add code to be compatible with the other ports |
| 1661 |
\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} |
| 1662 |
\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} |
| 1663 |
\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} |
| 1664 |
% |
| 1665 |
% the base angle for the or port. See the drawings. This will not change with height |
| 1666 |
% |
| 1667 |
\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)} |
| 1668 |
% \typeout{ANGLE-IS\space\pgf@circ@orangle} |
| 1669 |
\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter |
| 1670 |
{% |
| 1671 |
\ifnum#1>\inputs |
| 1672 |
\PackageError{circuitikz}{% |
| 1673 |
You requested input pin #1 for logic port shape \thisshape\space \MessageBreak |
| 1674 |
which has been defined with \inputs\space pins% |
| 1675 |
}{Please check the manual about logic ports; if you press return I'll try to continue} |
| 1676 |
\fi |
| 1677 |
\pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port |
| 1678 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 1679 |
\pgf@circ@res@step=\pind |
| 1680 |
\pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax |
| 1681 |
\pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen |
| 1682 |
}% |
| 1683 |
|
| 1684 |
% #1 = \pgfmathcounter #2=type |
| 1685 |
% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor |
| 1686 |
\def\pgf@circ@ieeeport@baseinput#1#2% |
| 1687 |
{% |
| 1688 |
\ifnum#1>\inputs |
| 1689 |
\PackageError{circuitikz}{% |
| 1690 |
You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak |
| 1691 |
which has been defined with \inputs\space pins% |
| 1692 |
}{Please check the manual about logic ports; if you press return I'll try to continue} |
| 1693 |
\fi |
| 1694 |
% Find the vertical position (this is the same for any port) |
| 1695 |
\pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port |
| 1696 |
\pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax |
| 1697 |
% rack (extended) pins; they are the same for all the ports |
| 1698 |
% call K = (inputs-inner)/2, rounded up; pins on the rack are: |
| 1699 |
% above: 1..K (included) |
| 1700 |
% below: inputs-K..inputs |
| 1701 |
% Find the pins on the rack; they are 1... |
| 1702 |
\pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! |
| 1703 |
\pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 |
| 1704 |
% border anchors for rack should be ok |
| 1705 |
\pgfextractx{\pgf@circ@res@left}{\topleft} |
| 1706 |
\pgfextractx{\pgf@circ@res@right}{\bodyleft} |
| 1707 |
\pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left |
| 1708 |
% we have finished if we are in the rack |
| 1709 |
\ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b |
| 1710 |
% we are on the inner ports; we have to do the hard work here |
| 1711 |
% and and nand |
| 1712 |
\ifnum #2=1 |
| 1713 |
\relax % It's an and/nand, all border ports are on the rack line |
| 1714 |
\fi |
| 1715 |
% or and nor |
| 1716 |
\ifnum #2=2 |
| 1717 |
\pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} |
| 1718 |
\fi |
| 1719 |
% xor and xnor |
| 1720 |
\ifnum #2=3\relax |
| 1721 |
\pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} |
| 1722 |
\fi |
| 1723 |
\fi\fi |
| 1724 |
}% |
| 1725 |
% inner base ports for xor types port |
| 1726 |
% #1 = \pgfmathcounter #2=type |
| 1727 |
% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor |
| 1728 |
\def\pgf@circ@ieeeport@innerbaseinput#1% |
| 1729 |
{% |
| 1730 |
\ifnum#1>\inputs |
| 1731 |
\PackageError{circuitikz}{% |
| 1732 |
You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak |
| 1733 |
which has been defined with \inputs\space pins% |
| 1734 |
}{Please check the manual about logic ports; if you press return I'll try to continue} |
| 1735 |
\fi |
| 1736 |
% Find the vertical position (this is the same for any port) |
| 1737 |
\pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port |
| 1738 |
\pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax |
| 1739 |
% rack (extended) pins; they are the same for all the ports |
| 1740 |
% call K = (inputs-inner)/2, rounded up; pins on the rack are: |
| 1741 |
% above: 1..K (included) |
| 1742 |
% below: inputs-K..inputs |
| 1743 |
% Find the pins on the rack; they are 1... |
| 1744 |
\pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! |
| 1745 |
\pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1 |
| 1746 |
% border anchors for rack should be ok |
| 1747 |
\pgfextractx{\pgf@circ@res@left}{\topleft} |
| 1748 |
\pgfextractx{\pgf@circ@res@right}{\bodyleft} |
| 1749 |
\pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left |
| 1750 |
% we have finished if we are in the rack |
| 1751 |
\ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b |
| 1752 |
% we are on the inner ports; we have to do the hard work here |
| 1753 |
\pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))} |
| 1754 |
\fi\fi |
| 1755 |
}% |
| 1756 |
|
| 1757 |
%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp |
| 1758 |
\def\pgf@circ@ieeestd@baselen{% |
| 1759 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 1760 |
\pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen} |
| 1761 |
} |
| 1762 |
\def\pgf@circ@ieeestd@stdH{% |
| 1763 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 1764 |
\pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}* |
| 1765 |
\ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen} |
| 1766 |
} |
| 1767 |
\def\pgf@circ@ieeestd@pinlen{% |
| 1768 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 1769 |
\pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* |
| 1770 |
\ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen} |
| 1771 |
} |
| 1772 |
\def\pgf@circ@ieeestd@xorbar{% |
| 1773 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 1774 |
\pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}* |
| 1775 |
\ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen} |
| 1776 |
} |
| 1777 |
%% Not circle |
| 1778 |
\def\pgf@circ@notradius{ |
| 1779 |
\pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE |
| 1780 |
\pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp} |
| 1781 |
% \typeout{NOTRADIUS\space\the\pgf@circ@res@temp} |
| 1782 |
} |
| 1783 |
%% Find (in ...@other) the height of the rack |
| 1784 |
\def\pgf@circ@findrackH{% |
| 1785 |
\pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% |
| 1786 |
\pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% |
| 1787 |
\ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins |
| 1788 |
\ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % |
| 1789 |
\ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% |
| 1790 |
\pgf@circ@ieeestd@stdH |
| 1791 |
\multiply\pgf@circ@res@temp by 2\relax% full height |
| 1792 |
\divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing |
| 1793 |
\pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port |
| 1794 |
% \typeout{RACK-\thisshape\space\the\pgf@circ@res@other} |
| 1795 |
} |
| 1796 |
%% |
| 1797 |
\def\pgf@circ@find@ieeeport@up{% leave it in up |
| 1798 |
% Normal port limits |
| 1799 |
\pgf@circ@ieeestd@stdH |
| 1800 |
\pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp} |
| 1801 |
% rack top size |
| 1802 |
\pgf@circ@findrackH |
| 1803 |
\ifdim\pgf@circ@res@other > \pgf@circ@res@up |
| 1804 |
\pgf@circ@res@up=\pgf@circ@res@other |
| 1805 |
\else |
| 1806 |
\fi |
| 1807 |
} |
| 1808 |
\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type |
| 1809 |
% Normal port limits |
| 1810 |
\pgf@circ@ieeestd@stdH |
| 1811 |
\pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5} |
| 1812 |
\pgf@circ@res@right=\pgf@circ@res@left % save the border value |
| 1813 |
\pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value |
| 1814 |
\pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp |
| 1815 |
% \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} |
| 1816 |
% this is the normal left border |
| 1817 |
% For the or or xor port, the limit can be the pointy thing (in case the |
| 1818 |
% pinlen is zero or too small) |
| 1819 |
% add to the body margin the or/nor peak: |
| 1820 |
\ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates. |
| 1821 |
\pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))} |
| 1822 |
\advance\pgf@circ@res@right by \pgf@circ@res@other |
| 1823 |
% \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} |
| 1824 |
\fi |
| 1825 |
% add to the body margin the xor/xnor distance |
| 1826 |
\ifnum #1 = 3\relax% "xor" or "xnor" gates. |
| 1827 |
\pgf@circ@ieeestd@xorbar |
| 1828 |
\advance\pgf@circ@res@right by \pgf@circ@res@temp |
| 1829 |
% \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} |
| 1830 |
\fi |
| 1831 |
% and if this exceeds the normal margin, this is it |
| 1832 |
% \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} |
| 1833 |
\ifdim \pgf@circ@res@right > \pgf@circ@res@left |
| 1834 |
\pgf@circ@res@left=\pgf@circ@res@right |
| 1835 |
\fi |
| 1836 |
% \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right} |
| 1837 |
\pgf@circ@res@left=-\pgf@circ@res@left |
| 1838 |
} |
| 1839 |
\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated |
| 1840 |
% Normal port limits |
| 1841 |
\pgf@circ@ieeestd@stdH |
| 1842 |
\pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5} |
| 1843 |
\pgf@circ@notradius |
| 1844 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} |
| 1845 |
\pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp |
| 1846 |
\ifdim\pgf@circ@res@other > \pgf@circ@res@right |
| 1847 |
\pgf@circ@res@right=\pgf@circ@res@other |
| 1848 |
\fi |
| 1849 |
} |
| 1850 |
\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated |
| 1851 |
% Normal port limits |
| 1852 |
\pgf@circ@ieeestd@stdH |
| 1853 |
% notice 0.8660254 is cos(30) |
| 1854 |
\pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp} |
| 1855 |
\pgf@circ@notradius |
| 1856 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp} |
| 1857 |
\pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp |
| 1858 |
\ifdim\pgf@circ@res@other > \pgf@circ@res@right |
| 1859 |
\pgf@circ@res@right=\pgf@circ@res@other |
| 1860 |
\fi |
| 1861 |
} |
| 1862 |
|
| 1863 |
|
| 1864 |
%%% ieeestd multi-input ports |
| 1865 |
%%% #1: name |
| 1866 |
%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor |
| 1867 |
%%% #3: polarity: 0 for direct, 1 for inverted (not at the output) |
| 1868 |
%%% #4: drawing for the port |
| 1869 |
\long\def\pgfcircdeclareieeeport#1#2#3#4{% |
| 1870 |
\pgfdeclareshape{ieeestd #1 port}% |
| 1871 |
{% |
| 1872 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 1873 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 1874 |
\savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} |
| 1875 |
\saveddimen{\baselen}{% |
| 1876 |
\pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp |
| 1877 |
} |
| 1878 |
\saveddimen{\stdH}{% This is HALF the height of the inner port |
| 1879 |
\pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp |
| 1880 |
} |
| 1881 |
\saveddimen{\notdiameter}{ |
| 1882 |
\pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp |
| 1883 |
} |
| 1884 |
\saveddimen{\pind}{% pin distance; |
| 1885 |
\pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax% |
| 1886 |
\pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax% |
| 1887 |
\ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins |
| 1888 |
\ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % |
| 1889 |
\ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi% |
| 1890 |
\pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height |
| 1891 |
\divide\pgf@x by \pgf@circ@count@b |
| 1892 |
} |
| 1893 |
\saveddimen{\pinlen}{% |
| 1894 |
\pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp |
| 1895 |
} |
| 1896 |
\saveddimen{\xorbar}{% |
| 1897 |
\pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp |
| 1898 |
} |
| 1899 |
% anchors for the body (no pins included here) |
| 1900 |
\savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing |
| 1901 |
\pgf@circ@ieeestd@stdH |
| 1902 |
\pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5} |
| 1903 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 1904 |
} |
| 1905 |
\savedanchor{\topleft}{% |
| 1906 |
\pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar |
| 1907 |
\pgf@circ@ieeestd@stdH |
| 1908 |
\pgf@circ@res@other=0pt\relax |
| 1909 |
\ifnum #2 = 2\relax% "or" or "nor" gates. |
| 1910 |
\pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))} |
| 1911 |
\fi |
| 1912 |
\ifnum #2 = 3\relax% "xor" or "xnor" gates. |
| 1913 |
\pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle)) |
| 1914 |
+\pgf@circ@res@right} |
| 1915 |
\fi |
| 1916 |
\pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other} |
| 1917 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 1918 |
} |
| 1919 |
\savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle |
| 1920 |
\pgf@circ@ieeestd@stdH |
| 1921 |
\pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5} |
| 1922 |
\pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} |
| 1923 |
} |
| 1924 |
\savedanchor{\bottomright}{% This DOES take into account the "NOT" circle |
| 1925 |
\pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp |
| 1926 |
\pgf@circ@ieeestd@stdH |
| 1927 |
% #3 is =1 if the port is a negated output one |
| 1928 |
\pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other} |
| 1929 |
\pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} |
| 1930 |
} |
| 1931 |
% geographical anchors --- must be rectangulars! |
| 1932 |
\savedanchor{\northwest}{% |
| 1933 |
\pgf@circ@find@ieeeport@up |
| 1934 |
\pgf@circ@find@ieeeport@left{#2} |
| 1935 |
% \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up} |
| 1936 |
\pgf@x=\pgf@circ@res@left |
| 1937 |
\pgf@y=\pgf@circ@res@up |
| 1938 |
} |
| 1939 |
\savedanchor{\southwest}{% |
| 1940 |
\pgf@circ@find@ieeeport@up |
| 1941 |
\pgf@circ@find@ieeeport@left{#2} |
| 1942 |
\pgf@x=\pgf@circ@res@left |
| 1943 |
\pgf@y=-\pgf@circ@res@up |
| 1944 |
} |
| 1945 |
\savedanchor{\southeast}{% |
| 1946 |
\pgf@circ@find@ieeeport@up |
| 1947 |
\pgf@circ@find@ieeeport@right{#3} |
| 1948 |
\pgf@x=\pgf@circ@res@right |
| 1949 |
\pgf@y=-\pgf@circ@res@up |
| 1950 |
} |
| 1951 |
\savedanchor{\northeast}{% |
| 1952 |
\pgf@circ@find@ieeeport@up |
| 1953 |
\pgf@circ@find@ieeeport@right{#3} |
| 1954 |
\pgf@x=\pgf@circ@res@right |
| 1955 |
\pgf@y=\pgf@circ@res@up |
| 1956 |
} |
| 1957 |
\savedmacro\inputs{% get number of inputs |
| 1958 |
\pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax |
| 1959 |
\ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default |
| 1960 |
\ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins |
| 1961 |
% \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi |
| 1962 |
\def\inputs{\the\pgf@circ@count@a}% |
| 1963 |
}% |
| 1964 |
\savedmacro\inners{% get number of "inner" inputs (for racks) |
| 1965 |
\pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax |
| 1966 |
\pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax |
| 1967 |
\ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins |
| 1968 |
\ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins |
| 1969 |
\ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi |
| 1970 |
% \typeout{INNER is \the\pgf@circ@count@b}% |
| 1971 |
% \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi |
| 1972 |
\def\inners{\the\pgf@circ@count@b}% |
| 1973 |
}% |
| 1974 |
\anchor{center}{\pgfpointorigin} |
| 1975 |
\savedanchor{\textanchor}{% |
| 1976 |
\ifpgf@circ@center@text |
| 1977 |
\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 1978 |
\else |
| 1979 |
\pgf@circ@ieeestd@stdH |
| 1980 |
\pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border |
| 1981 |
\pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 1982 |
\fi |
| 1983 |
} |
| 1984 |
\anchor{text}{\textanchor} |
| 1985 |
% create input anchors |
| 1986 |
\expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{% |
| 1987 |
\pgf@circ@count@a=\inputs |
| 1988 |
\pgfmathloop% |
| 1989 |
\ifnum\pgfmathcounter>\pgf@circ@count@a% |
| 1990 |
\else% |
| 1991 |
%\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{% |
| 1992 |
\expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{% |
| 1993 |
\noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above |
| 1994 |
}% |
| 1995 |
\expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{% |
| 1996 |
\noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above |
| 1997 |
}% |
| 1998 |
\ifnum #2 = 3\relax % xor/xnor inner border pins |
| 1999 |
\expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{% |
| 2000 |
\noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above |
| 2001 |
}% |
| 2002 |
\fi |
| 2003 |
%}{}% |
| 2004 |
\repeatpgfmathloop% |
| 2005 |
} |
| 2006 |
% output anchor |
| 2007 |
\anchor{out}{% |
| 2008 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball |
| 2009 |
\advance\pgf@circ@res@other by\pinlen |
| 2010 |
\pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border |
| 2011 |
\ifdim \pgf@circ@res@temp > \pgf@circ@res@other |
| 2012 |
\pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... |
| 2013 |
\fi |
| 2014 |
\pgf@x=\pgf@circ@res@other\pgf@y=0pt |
| 2015 |
} |
| 2016 |
\anchor{bout}{\bottomright\pgf@y=0pt} |
| 2017 |
|
| 2018 |
\anchor{body right}{\bodyright\pgf@y=0pt} |
| 2019 |
\anchor{right}{\bottomright\pgf@y=0pt} |
| 2020 |
\anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body |
| 2021 |
\anchor{left}{% central edge of the component |
| 2022 |
\bodyleft\pgf@y=0pt |
| 2023 |
\ifnum #2=3\relax |
| 2024 |
\advance\pgf@x by -\xorbar |
| 2025 |
\fi |
| 2026 |
} |
| 2027 |
\anchor{up}{% |
| 2028 |
\bodyleft |
| 2029 |
\ifnum #2 > 1 % pointy shapes |
| 2030 |
\pgf@circ@ieeestd@stdH |
| 2031 |
% horizontal coordinate where the right semicircle starts |
| 2032 |
\pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} |
| 2033 |
% vertical drop of the circle at the above coordinate |
| 2034 |
\pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} |
| 2035 |
\advance \pgf@y by -\pgf@circ@res@step |
| 2036 |
\fi |
| 2037 |
\pgf@x=0pt |
| 2038 |
} |
| 2039 |
\anchor{down}{% |
| 2040 |
\bodyleft |
| 2041 |
\ifnum #2 > 1 % pointy shapes |
| 2042 |
\pgf@circ@ieeestd@stdH |
| 2043 |
% horizontal coordinate where the right semicircle starts |
| 2044 |
\pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)} |
| 2045 |
% vertical drop of the circle at the above coordinate |
| 2046 |
\pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))} |
| 2047 |
\advance \pgf@y by -\pgf@circ@res@step |
| 2048 |
\fi |
| 2049 |
\pgf@y=-\pgf@y\pgf@x=0pt |
| 2050 |
} |
| 2051 |
|
| 2052 |
% geographical anchors |
| 2053 |
\anchor{nw}{\northwest} |
| 2054 |
\anchor{ne}{\northeast} |
| 2055 |
\anchor{se}{\southeast} |
| 2056 |
\anchor{sw}{\southwest} |
| 2057 |
\anchor{north west}{\northwest} |
| 2058 |
\anchor{north east}{\northeast} |
| 2059 |
\anchor{south east}{\southeast} |
| 2060 |
\anchor{south west}{\southwest} |
| 2061 |
% over 0,0 even if asymmetric |
| 2062 |
% will break if the geocoords are not rectangular |
| 2063 |
\anchor{n}{\northwest\pgf@x=0pt\relax} |
| 2064 |
\anchor{e}{\northeast\pgf@y=0pt\relax} |
| 2065 |
\anchor{s}{\southwest\pgf@x=0pt\relax} |
| 2066 |
\anchor{w}{\northwest\pgf@y=0pt\relax} |
| 2067 |
\anchor{north}{\northwest\pgf@x=0pt\relax} |
| 2068 |
\anchor{east}{\northeast\pgf@y=0pt\relax} |
| 2069 |
\anchor{south}{\southwest\pgf@x=0pt\relax} |
| 2070 |
\anchor{west}{\northwest\pgf@y=0pt\relax} |
| 2071 |
|
| 2072 |
\pgf@circ@draw@component{ |
| 2073 |
\pgfscope |
| 2074 |
\pgf@circ@setcolor |
| 2075 |
#4% |
| 2076 |
\endpgfscope |
| 2077 |
% output lead: |
| 2078 |
\pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border |
| 2079 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball |
| 2080 |
\advance\pgf@circ@res@other by \pinlen\relax |
| 2081 |
\ifdim \pgf@circ@res@other > \pgf@circ@res@right |
| 2082 |
\ifpgfcirc@draw@output@leads |
| 2083 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2084 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 2085 |
\pgfusepath{draw} |
| 2086 |
\fi |
| 2087 |
\fi |
| 2088 |
\ifnum #3=1\relax\pgfscope |
| 2089 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2090 |
\pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} |
| 2091 |
\endpgfscope\fi |
| 2092 |
} |
| 2093 |
} |
| 2094 |
} |
| 2095 |
|
| 2096 |
%%% #1 direct name #2 negated name #3 type #4 drawing (without output) |
| 2097 |
\long\def\pgfcircdeclareieeeportpair#1#2#3#4{% |
| 2098 |
\pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct |
| 2099 |
\pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated |
| 2100 |
} |
| 2101 |
% |
| 2102 |
% ieeestd "and" and "nand" |
| 2103 |
% |
| 2104 |
\pgfcircdeclareieeeportpair{and}{nand}{1}{% |
| 2105 |
\pgf@circ@count@a = \inputs\relax |
| 2106 |
\pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port |
| 2107 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} |
| 2108 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2109 |
\pgfextracty{\pgf@circ@res@down}{\bodyleft} |
| 2110 |
\ifpgfcirc@draw@input@leads |
| 2111 |
%input leads --- all the same for AND ports |
| 2112 |
\loop\ifnum\pgf@circ@count@a>0 |
| 2113 |
\advance\pgf@circ@res@temp by -\pind |
| 2114 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% |
| 2115 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% |
| 2116 |
\advance\pgf@circ@count@a by -1 |
| 2117 |
\repeat |
| 2118 |
\fi |
| 2119 |
\pgfusepath{draw} |
| 2120 |
%% Body. let's start from the top left |
| 2121 |
\pgfscope |
| 2122 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2123 |
\pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} |
| 2124 |
\pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}} |
| 2125 |
\pgfpatharc{90}{-90}{\stdH} |
| 2126 |
\pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}} |
| 2127 |
\pgfpathclose |
| 2128 |
\pgf@circ@draworfill |
| 2129 |
% rack now; skip if not needed. |
| 2130 |
% \typeout{WHAT\space \inputs\space \inners} |
| 2131 |
\ifnum\inputs>\inners |
| 2132 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2133 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} |
| 2134 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} |
| 2135 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2136 |
\pgfusepath{draw} |
| 2137 |
\fi |
| 2138 |
\endpgfscope |
| 2139 |
} |
| 2140 |
% |
| 2141 |
% or/nor and xor/xnor are practically the same. Let factor out everything |
| 2142 |
% the argument #1 is put just before the drawing of the inner pins |
| 2143 |
% the argument #2 is put after the drawing of the body |
| 2144 |
% |
| 2145 |
\long\def\pgf@circ@ieeeport@orxor#1#2{% |
| 2146 |
\pgf@circ@count@a = \inputs\relax |
| 2147 |
\pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port |
| 2148 |
\pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} |
| 2149 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2150 |
\pgfextracty{\pgf@circ@res@down}{\bodyleft} |
| 2151 |
% rack (extended) pins; they are the same for all the ports |
| 2152 |
% call K = (inputs-inner)/2, rounded up; pins on the rack are: |
| 2153 |
% above: 1..K (included) |
| 2154 |
% below: inputs-K..inputs |
| 2155 |
% Find the pins on the rack; they are 1... |
| 2156 |
\pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! |
| 2157 |
\pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 |
| 2158 |
\ifpgfcirc@draw@input@leads |
| 2159 |
%input leads --- for or ports |
| 2160 |
\loop\ifnum\pgf@circ@count@a>0 |
| 2161 |
\pgfextractx{\pgf@circ@res@right}{\topleft} |
| 2162 |
\advance\pgf@circ@res@temp by -\pind |
| 2163 |
% this is the height; let's find the "right" position |
| 2164 |
\ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c |
| 2165 |
% inner pins |
| 2166 |
% \typeout{INNER\space\pgf@circ@count@a} |
| 2167 |
\pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))} |
| 2168 |
% hook for xor/xnor |
| 2169 |
#1% |
| 2170 |
\fi\fi |
| 2171 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}% |
| 2172 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}% |
| 2173 |
\pgfusepath{draw} |
| 2174 |
\advance\pgf@circ@count@a by -1 |
| 2175 |
\repeat |
| 2176 |
\fi |
| 2177 |
%% Body. let's start from the top left |
| 2178 |
\pgfscope |
| 2179 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2180 |
% it should start here, but with this trick the close comes out better. |
| 2181 |
% \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} |
| 2182 |
\pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}} |
| 2183 |
\pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} % |
| 2184 |
\pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}} |
| 2185 |
\pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}} |
| 2186 |
\pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} |
| 2187 |
%% this should be 2 and 2; but the round part is not a perfect circle that way |
| 2188 |
%% so the 2.15 is ajusted "by taste" to touch the anchors exactly. |
| 2189 |
\pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} |
| 2190 |
\pgfpathclose |
| 2191 |
\pgf@circ@draworfill |
| 2192 |
% hook for xor/xnor |
| 2193 |
#2% |
| 2194 |
% rack now; skip if not needed. |
| 2195 |
% \typeout{WHAT\space \inputs\space \inners} |
| 2196 |
\ifnum\inputs>\inners |
| 2197 |
\pgfextractx{\pgf@circ@res@left}{\topleft} |
| 2198 |
\pgfextracty{\pgf@circ@res@down}{\topleft} |
| 2199 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2200 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} |
| 2201 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}} |
| 2202 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2203 |
\pgfusepath{draw} |
| 2204 |
\fi |
| 2205 |
\endpgfscope |
| 2206 |
} |
| 2207 |
% |
| 2208 |
% ieeestd "or" and "nor" |
| 2209 |
% |
| 2210 |
\pgfcircdeclareieeeportpair{or}{nor}{2}{% |
| 2211 |
\pgf@circ@ieeeport@orxor{}{} |
| 2212 |
} |
| 2213 |
\pgfcircdeclareieeeportpair{xor}{xnor}{3}{% |
| 2214 |
\pgf@circ@ieeeport@orxor{ |
| 2215 |
\edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}} |
| 2216 |
\ifnum\@@tmp=0\relax |
| 2217 |
% move pin start to the left to leave the xor gap free (not standard) |
| 2218 |
\advance\pgf@circ@res@right by -\xorbar |
| 2219 |
\fi |
| 2220 |
}{% |
| 2221 |
% add the xor/xnor bar |
| 2222 |
\pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}} |
| 2223 |
% see the comment on the main body about the 2.2 |
| 2224 |
\pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}} |
| 2225 |
\pgfusepath{draw} |
| 2226 |
} |
| 2227 |
} |
| 2228 |
% |
| 2229 |
% Buffer and inverters |
| 2230 |
% |
| 2231 |
% #1: name |
| 2232 |
% #2: polarity |
| 2233 |
% #3: content |
| 2234 |
\long\def\pgfcircdeclareieeebufferport#1#2#3{% |
| 2235 |
\pgfdeclareshape{ieeestd #1 port}% |
| 2236 |
{% |
| 2237 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 2238 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 2239 |
\savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} |
| 2240 |
\saveddimen{\baselen}{% |
| 2241 |
\pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp |
| 2242 |
} |
| 2243 |
\saveddimen{\stdH}{% This is HALF the height of the inner port |
| 2244 |
\pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp |
| 2245 |
} |
| 2246 |
\saveddimen{\notdiameter}{ |
| 2247 |
\pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp |
| 2248 |
} |
| 2249 |
\saveddimen{\pinlen}{% |
| 2250 |
\pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp |
| 2251 |
} |
| 2252 |
% anchors for the body (no pins included here) |
| 2253 |
% Notice that 0.8660254 is cos(30) |
| 2254 |
\savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing |
| 2255 |
\pgf@circ@ieeestd@stdH |
| 2256 |
\pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} |
| 2257 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 2258 |
} |
| 2259 |
\savedanchor{\topleft}{% |
| 2260 |
\pgf@circ@ieeestd@stdH |
| 2261 |
\pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} |
| 2262 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 2263 |
} |
| 2264 |
\savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle |
| 2265 |
\pgf@circ@ieeestd@stdH |
| 2266 |
\pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp} |
| 2267 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 2268 |
} |
| 2269 |
\savedanchor{\bottomright}{% This DOES take into account the "NOT" circle |
| 2270 |
\pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp |
| 2271 |
\pgf@circ@ieeestd@stdH |
| 2272 |
% #2 is =1 if the port is a negated output one |
| 2273 |
\pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other} |
| 2274 |
\pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} |
| 2275 |
} |
| 2276 |
% geographical anchors --- must be rectangulars! |
| 2277 |
\savedanchor{\northwest}{% |
| 2278 |
\pgf@circ@ieeestd@stdH |
| 2279 |
\pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} |
| 2280 |
\pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp} |
| 2281 |
} |
| 2282 |
\savedanchor{\southwest}{% |
| 2283 |
\pgf@circ@ieeestd@stdH |
| 2284 |
\pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp} |
| 2285 |
\pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp} |
| 2286 |
} |
| 2287 |
\savedanchor{\southeast}{% |
| 2288 |
\pgf@circ@ieeestd@stdH |
| 2289 |
\pgf@circ@res@up=\pgf@circ@res@temp |
| 2290 |
\pgf@circ@find@ieeeport@not@right{#2} |
| 2291 |
\pgf@x=\pgf@circ@res@right |
| 2292 |
\pgf@y=-\pgf@circ@res@up |
| 2293 |
} |
| 2294 |
\savedanchor{\northeast}{% |
| 2295 |
\pgf@circ@ieeestd@stdH |
| 2296 |
\pgf@circ@res@up=\pgf@circ@res@temp |
| 2297 |
\pgf@circ@find@ieeeport@not@right{#2} |
| 2298 |
\pgf@x=\pgf@circ@res@right |
| 2299 |
\pgf@y=\pgf@circ@res@up |
| 2300 |
} |
| 2301 |
\anchor{center}{\pgfpointorigin} |
| 2302 |
\savedanchor{\textanchor}{% |
| 2303 |
\ifpgf@circ@center@text |
| 2304 |
\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 2305 |
\else |
| 2306 |
\pgf@circ@ieeestd@stdH |
| 2307 |
\pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 2308 |
\fi |
| 2309 |
} |
| 2310 |
\anchor{text}{\textanchor} |
| 2311 |
% input anchors |
| 2312 |
\anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} |
| 2313 |
\anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} |
| 2314 |
\anchor{bin}{\bodyleft\pgf@y=0pt\relax} |
| 2315 |
\anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} |
| 2316 |
% output anchors |
| 2317 |
\anchor{out}{% |
| 2318 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball |
| 2319 |
\advance\pgf@circ@res@other by\pinlen |
| 2320 |
\pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border |
| 2321 |
\ifdim \pgf@circ@res@temp > \pgf@circ@res@other |
| 2322 |
\pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... |
| 2323 |
\fi |
| 2324 |
\pgf@x=\pgf@circ@res@other\pgf@y=0pt |
| 2325 |
} |
| 2326 |
\anchor{bout}{\bottomright\pgf@y=0pt} |
| 2327 |
|
| 2328 |
\anchor{body right}{\bodyright\pgf@y=0pt} |
| 2329 |
\anchor{right}{\bottomright\pgf@y=0pt} |
| 2330 |
\anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body |
| 2331 |
\anchor{left}{\bodyleft\pgf@y=0pt} |
| 2332 |
\anchor{up}{% |
| 2333 |
\bodyleft |
| 2334 |
\pgf@y=+0.5\pgf@y\pgf@x=0pt |
| 2335 |
} |
| 2336 |
\anchor{down}{% |
| 2337 |
\bodyleft |
| 2338 |
\pgf@y=-0.5\pgf@y\pgf@x=0pt |
| 2339 |
} |
| 2340 |
% this is for when it's used as a bipole |
| 2341 |
% we use the enclosing rectangle (see below) |
| 2342 |
\anchorborder{% |
| 2343 |
%% This (commented out) is the correct border anchor. But if we use the correct |
| 2344 |
%% border anchor there is no horizontal space for the label ;-) because |
| 2345 |
%% the triangle is too steep. So we will use a simple square border |
| 2346 |
%% |
| 2347 |
%% find the border anchor of a triangle (like a not port or an |
| 2348 |
%% amplifier) --- |
| 2349 |
%% |
| 2350 |
%% -----^ up |
| 2351 |
%% I --- | |
| 2352 |
%% I -|-- |
| 2353 |
%%left I | --- right |
| 2354 |
%% ----I-----|-------I----- |
| 2355 |
%% |
| 2356 |
%% |
| 2357 |
%\pgf@xa=\pgf@x |
| 2358 |
%% it's simmetrical w/ vertical side, use only positive y |
| 2359 |
%\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} |
| 2360 |
%\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} |
| 2361 |
%\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2362 |
%\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2363 |
%\pgfextractx{\pgf@circ@res@right}{\bodyright} |
| 2364 |
%% limit angle for the left (vertical) side |
| 2365 |
%\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} |
| 2366 |
%\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} |
| 2367 |
%\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} |
| 2368 |
%% find the border |
| 2369 |
%\ifnum\@@leftside>0 |
| 2370 |
% % vertical side |
| 2371 |
% \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 2372 |
% {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2373 |
%\else |
| 2374 |
% % triangle upper line |
| 2375 |
% \pgfpointintersectionoflines |
| 2376 |
% {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} |
| 2377 |
% {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} |
| 2378 |
%\fi |
| 2379 |
%% readjust y sign |
| 2380 |
%\pgf@y=\@@switchy\pgf@y |
| 2381 |
% |
| 2382 |
% this is the square border to position the path label with a bit of horizontal space |
| 2383 |
% |
| 2384 |
\pgf@xa=\pgf@x |
| 2385 |
\pgf@ya=\pgf@y |
| 2386 |
\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2387 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2388 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 2389 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2390 |
} |
| 2391 |
% geographical anchors |
| 2392 |
\anchor{nw}{\northwest} |
| 2393 |
\anchor{ne}{\northeast} |
| 2394 |
\anchor{se}{\southeast} |
| 2395 |
\anchor{sw}{\southwest} |
| 2396 |
\anchor{north west}{\northwest} |
| 2397 |
\anchor{north east}{\northeast} |
| 2398 |
\anchor{south east}{\southeast} |
| 2399 |
\anchor{south west}{\southwest} |
| 2400 |
% over 0,0 even if asymmetric |
| 2401 |
% will break if the geocoords are not rectangular |
| 2402 |
\anchor{n}{\northwest\pgf@x=0pt\relax} |
| 2403 |
\anchor{e}{\northeast\pgf@y=0pt\relax} |
| 2404 |
\anchor{s}{\southwest\pgf@x=0pt\relax} |
| 2405 |
\anchor{w}{\northwest\pgf@y=0pt\relax} |
| 2406 |
\anchor{north}{\northwest\pgf@x=0pt\relax} |
| 2407 |
\anchor{east}{\northeast\pgf@y=0pt\relax} |
| 2408 |
\anchor{south}{\southwest\pgf@x=0pt\relax} |
| 2409 |
\anchor{west}{\northwest\pgf@y=0pt\relax} |
| 2410 |
|
| 2411 |
\pgf@circ@draw@component{ |
| 2412 |
\pgfscope |
| 2413 |
\pgf@circ@setcolor |
| 2414 |
#3% |
| 2415 |
\endpgfscope |
| 2416 |
% output lead: |
| 2417 |
\pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border |
| 2418 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball |
| 2419 |
\advance\pgf@circ@res@other by \pinlen\relax |
| 2420 |
\ifdim \pgf@circ@res@other > \pgf@circ@res@right |
| 2421 |
\ifpgfcirc@draw@output@leads |
| 2422 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2423 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 2424 |
\pgfusepath{draw} |
| 2425 |
\fi |
| 2426 |
\fi |
| 2427 |
\ifnum #2=1\relax\pgfscope |
| 2428 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2429 |
\pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}} |
| 2430 |
\endpgfscope\fi |
| 2431 |
} |
| 2432 |
} |
| 2433 |
} |
| 2434 |
|
| 2435 |
%%% #1 direct name #2 negated name #3 drawing (without output) |
| 2436 |
\long\def\pgfcircdeclareieeebufferportpair#1#2#3{% |
| 2437 |
\pgfcircdeclareieeebufferport{#1}{0}{#3}% direct |
| 2438 |
\pgfcircdeclareieeebufferport{#2}{1}{#3}% negated |
| 2439 |
} |
| 2440 |
|
| 2441 |
\pgfcircdeclareieeebufferportpair{buffer}{not}{% |
| 2442 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2443 |
\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2444 |
\pgfextractx{\pgf@circ@res@right}{\bodyright} |
| 2445 |
% \draw input pin |
| 2446 |
\ifpgfcirc@draw@input@leads |
| 2447 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 2448 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} |
| 2449 |
\pgfusepath{draw} |
| 2450 |
\fi |
| 2451 |
\pgfscope |
| 2452 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2453 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2454 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2455 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2456 |
\pgfpathclose |
| 2457 |
\pgf@circ@draworfill |
| 2458 |
\endpgfscope |
| 2459 |
} |
| 2460 |
|
| 2461 |
\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% |
| 2462 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2463 |
\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2464 |
\pgfextractx{\pgf@circ@res@right}{\bodyright} |
| 2465 |
% \draw input pin |
| 2466 |
\ifpgfcirc@draw@input@leads |
| 2467 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 2468 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} |
| 2469 |
\pgfusepath{draw} |
| 2470 |
\fi |
| 2471 |
\pgfscope |
| 2472 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2473 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2474 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2475 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2476 |
\pgfpathclose |
| 2477 |
\pgf@circ@draworfill |
| 2478 |
\endpgfscope |
| 2479 |
% draw schmitt symbol in normal line thickness |
| 2480 |
\pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} |
| 2481 |
\pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} |
| 2482 |
\pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} |
| 2483 |
\pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} |
| 2484 |
\pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}} |
| 2485 |
\pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} |
| 2486 |
\pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}} |
| 2487 |
\pgfusepath{draw} |
| 2488 |
} |
| 2489 |
|
| 2490 |
|
| 2491 |
\pgfdeclareshape{schmitt symbol}{ |
| 2492 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 2493 |
\anchor{center}{\pgfpointorigin} |
| 2494 |
\savedanchor\northwest{% |
| 2495 |
\pgf@circ@ieeestd@stdH |
| 2496 |
\pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp |
| 2497 |
\pgf@x=-1.5\pgf@y |
| 2498 |
} |
| 2499 |
\anchor{center}{\pgf@y=0pt \pgf@x=0pt} |
| 2500 |
\anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x} |
| 2501 |
\anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x} |
| 2502 |
\anchor{west}{\northwest\pgf@y=0pt} |
| 2503 |
\anchor{w}{\northwest \pgf@y=0pt} |
| 2504 |
\anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y} |
| 2505 |
\anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} |
| 2506 |
\anchor{north}{\northwest\pgf@x=0pt} |
| 2507 |
\anchor{n}{\northwest\pgf@x=0pt} |
| 2508 |
\anchor{south west}{\northwest\pgf@y=-\pgf@y} |
| 2509 |
\anchor{north east}{\northwest\pgf@x=-\pgf@x} |
| 2510 |
\anchor{north west}{\northwest} |
| 2511 |
\anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} |
| 2512 |
\pgf@circ@draw@component{ |
| 2513 |
\pgfscope |
| 2514 |
\pgf@circ@setcolor |
| 2515 |
\pgfextractx{\pgf@circ@res@left}{\northwest} |
| 2516 |
\pgfextracty{\pgf@circ@res@up}{\northwest} |
| 2517 |
\pgf@circ@res@left=0.7\pgf@circ@res@left |
| 2518 |
\pgf@circ@res@up=0.7\pgf@circ@res@up |
| 2519 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2520 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}} |
| 2521 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}} |
| 2522 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2523 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}} |
| 2524 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}} |
| 2525 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2526 |
\pgfusepath{draw} |
| 2527 |
\endpgfscope |
| 2528 |
} |
| 2529 |
} |
| 2530 |
|
| 2531 |
\pgfdeclareshape{notcirc}{ |
| 2532 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 2533 |
\savedanchor\northwest{% |
| 2534 |
\pgf@circ@notradius |
| 2535 |
\pgf@y=\pgf@circ@res@temp |
| 2536 |
\pgf@x=-\pgf@y |
| 2537 |
} |
| 2538 |
\pgfcirc@northwest@symmetric@geoanchors |
| 2539 |
\anchor{center}{\pgfpointorigin} |
| 2540 |
\anchorborder{ |
| 2541 |
\pgf@circ@res@left=\pgf@x |
| 2542 |
\pgf@circ@res@up=\pgf@y |
| 2543 |
\northwest\pgf@circ@res@temp=\pgf@y |
| 2544 |
\pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}% |
| 2545 |
{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} |
| 2546 |
} |
| 2547 |
\pgf@circ@draw@component{ |
| 2548 |
\pgfscope |
| 2549 |
\northwest\pgf@circ@res@temp=\pgf@y |
| 2550 |
\pgf@circ@setcolor |
| 2551 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2552 |
\pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp} |
| 2553 |
\ifx\tikz@fillcolor\pgfutil@empty |
| 2554 |
% set the default fill color to white |
| 2555 |
\pgfsetfillcolor{white} |
| 2556 |
% ...but override it if the class is defined! |
| 2557 |
\pgf@circ@setifdefinedfill{draw, fill}{draw, fill} |
| 2558 |
\else |
| 2559 |
\pgfsetfillcolor{\tikz@fillcolor} |
| 2560 |
\fi |
| 2561 |
\pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0 |
| 2562 |
\pgfusepath{draw,fill} |
| 2563 |
\endpgfscope |
| 2564 |
} |
| 2565 |
} |
| 2566 |
|
| 2567 |
%%%% Transmission gates |
| 2568 |
% tgates are only ieee style for now |
| 2569 |
\tikzset{% |
| 2570 |
tgate/.style ={shape=ieee tgate}, |
| 2571 |
double tgate/.style ={shape=ieee double tgate}, |
| 2572 |
} |
| 2573 |
\ctikzset{tgate scale/.initial=0.7} |
| 2574 |
% Buffer and inverters |
| 2575 |
% |
| 2576 |
% #1: name |
| 2577 |
% #2: 1: one-not, 2:double-not |
| 2578 |
% #3: content |
| 2579 |
\long\def\pgfcircdeclareieeetgate#1#2#3{% |
| 2580 |
\pgfdeclareshape{ieee #1}% |
| 2581 |
{% |
| 2582 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} |
| 2583 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 2584 |
\savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} |
| 2585 |
\saveddimen{\baselen}{% |
| 2586 |
\pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp |
| 2587 |
} |
| 2588 |
\saveddimen{\stdH}{% This is HALF the height of the inner port |
| 2589 |
\pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp |
| 2590 |
} |
| 2591 |
\saveddimen{\notdiameter}{ |
| 2592 |
\pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp |
| 2593 |
} |
| 2594 |
\saveddimen{\notradius}{ |
| 2595 |
\pgf@circ@notradius\pgf@x=\pgf@circ@res@temp |
| 2596 |
} |
| 2597 |
\saveddimen{\pinlen}{% |
| 2598 |
\pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp |
| 2599 |
} |
| 2600 |
% anchors for the body (no pins included here) |
| 2601 |
% Notice that 0.8660254 is cos(30) |
| 2602 |
\savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing |
| 2603 |
\pgf@circ@ieeestd@stdH |
| 2604 |
\pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2605 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2606 |
} |
| 2607 |
\savedanchor{\topleft}{% |
| 2608 |
\pgf@circ@ieeestd@stdH |
| 2609 |
\pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2610 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2611 |
} |
| 2612 |
\savedanchor{\bodyright}{% |
| 2613 |
\pgf@circ@ieeestd@stdH |
| 2614 |
\pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2615 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2616 |
} |
| 2617 |
\savedanchor{\bottomright}{% Here it is the same as \bodyright |
| 2618 |
\pgf@circ@ieeestd@stdH |
| 2619 |
\pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2620 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2621 |
} |
| 2622 |
% geographical anchors --- must be rectangulars! |
| 2623 |
\savedanchor{\northwest}{% |
| 2624 |
\pgf@circ@ieeestd@stdH |
| 2625 |
\pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2626 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2627 |
} |
| 2628 |
\savedanchor{\southwest}{% |
| 2629 |
\pgf@circ@ieeestd@stdH |
| 2630 |
\pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2631 |
\pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2632 |
} |
| 2633 |
\savedanchor{\southeast}{% |
| 2634 |
\pgf@circ@ieeestd@stdH |
| 2635 |
\pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2636 |
\pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2637 |
} |
| 2638 |
\savedanchor{\northeast}{% |
| 2639 |
\pgf@circ@ieeestd@stdH |
| 2640 |
\pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2641 |
\pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}} |
| 2642 |
} |
| 2643 |
\anchor{center}{\pgfpointorigin} |
| 2644 |
\savedanchor{\textanchor}{% |
| 2645 |
\ifpgf@circ@center@text |
| 2646 |
\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 2647 |
\else |
| 2648 |
\pgf@circ@ieeestd@stdH |
| 2649 |
\pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox} |
| 2650 |
\fi |
| 2651 |
} |
| 2652 |
\anchor{text}{\textanchor} |
| 2653 |
% input anchors |
| 2654 |
\anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} |
| 2655 |
\anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen} |
| 2656 |
\anchor{bin}{\bodyleft\pgf@y=0pt\relax} |
| 2657 |
\anchor{bin 1}{\bodyleft\pgf@y=0pt\relax} |
| 2658 |
% gates |
| 2659 |
\anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y |
| 2660 |
\pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} |
| 2661 |
\anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y |
| 2662 |
\pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}} |
| 2663 |
% gate (up) (2.1547 = 1+1/cos(30) |
| 2664 |
\anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y |
| 2665 |
\pgf@x=0pt\relax |
| 2666 |
\pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} |
| 2667 |
\ifdim\pinlen>\pgf@circ@res@temp |
| 2668 |
\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen} |
| 2669 |
\else |
| 2670 |
\pgf@y=\pgf@circ@res@temp |
| 2671 |
\fi |
| 2672 |
} |
| 2673 |
\anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y |
| 2674 |
\pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}} |
| 2675 |
|
| 2676 |
% output anchors |
| 2677 |
\anchor{out}{% |
| 2678 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball |
| 2679 |
\advance\pgf@circ@res@other by\pinlen |
| 2680 |
\pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border |
| 2681 |
\ifdim \pgf@circ@res@temp > \pgf@circ@res@other |
| 2682 |
\pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball... |
| 2683 |
\fi |
| 2684 |
\pgf@x=\pgf@circ@res@other\pgf@y=0pt |
| 2685 |
} |
| 2686 |
\anchor{bout}{\bottomright\pgf@y=0pt} |
| 2687 |
|
| 2688 |
\anchor{body right}{\bodyright\pgf@y=0pt} |
| 2689 |
\anchor{right}{\bottomright\pgf@y=0pt} |
| 2690 |
\anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body |
| 2691 |
\anchor{left}{\bodyleft\pgf@y=0pt} |
| 2692 |
\anchor{up}{% |
| 2693 |
\bodyleft |
| 2694 |
\pgf@x=0pt |
| 2695 |
\ifnum#2=1\relax |
| 2696 |
\pgf@y=0pt |
| 2697 |
\else |
| 2698 |
\pgf@y=.5\pgf@y |
| 2699 |
\fi |
| 2700 |
\advance\pgf@y by \notdiameter |
| 2701 |
} |
| 2702 |
\anchor{down}{% |
| 2703 |
\bodyleft |
| 2704 |
\pgf@x=0pt |
| 2705 |
\ifnum#2=1\relax |
| 2706 |
\pgf@y=0pt |
| 2707 |
\else |
| 2708 |
\pgf@y=-.5\pgf@y |
| 2709 |
\fi |
| 2710 |
} |
| 2711 |
% this is for when it's used as a bipole |
| 2712 |
% we use the enclosing rectangle (see below) |
| 2713 |
\anchorborder{% |
| 2714 |
% |
| 2715 |
% this is the square border to position the path label with a bit of horizontal space |
| 2716 |
% |
| 2717 |
\pgf@xa=\pgf@x |
| 2718 |
\pgf@ya=\pgf@y |
| 2719 |
\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2720 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2721 |
\pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 2722 |
{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2723 |
} |
| 2724 |
% geographical anchors |
| 2725 |
\anchor{nw}{\northwest} |
| 2726 |
\anchor{ne}{\northeast} |
| 2727 |
\anchor{se}{\southeast} |
| 2728 |
\anchor{sw}{\southwest} |
| 2729 |
\anchor{north west}{\northwest} |
| 2730 |
\anchor{north east}{\northeast} |
| 2731 |
\anchor{south east}{\southeast} |
| 2732 |
\anchor{south west}{\southwest} |
| 2733 |
% over 0,0 even if asymmetric |
| 2734 |
% will break if the geocoords are not rectangular |
| 2735 |
\anchor{n}{\northwest\pgf@x=0pt\relax} |
| 2736 |
\anchor{e}{\northeast\pgf@y=0pt\relax} |
| 2737 |
\anchor{s}{\southwest\pgf@x=0pt\relax} |
| 2738 |
\anchor{w}{\northwest\pgf@y=0pt\relax} |
| 2739 |
\anchor{north}{\northwest\pgf@x=0pt\relax} |
| 2740 |
\anchor{east}{\northeast\pgf@y=0pt\relax} |
| 2741 |
\anchor{south}{\southwest\pgf@x=0pt\relax} |
| 2742 |
\anchor{west}{\northwest\pgf@y=0pt\relax} |
| 2743 |
|
| 2744 |
\pgf@circ@draw@component{ |
| 2745 |
\pgfscope |
| 2746 |
\pgf@circ@setcolor |
| 2747 |
\pgfextractx{\pgf@circ@res@left}{\bodyleft} |
| 2748 |
\pgfextracty{\pgf@circ@res@up}{\bodyleft} |
| 2749 |
\pgfextractx{\pgf@circ@res@right}{\bodyright} |
| 2750 |
% \draw input pins |
| 2751 |
\ifpgfcirc@draw@input@leads |
| 2752 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 2753 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} |
| 2754 |
% gate (down) |
| 2755 |
\pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}} |
| 2756 |
\pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}} |
| 2757 |
% gate (up) (2.1547 = 1+1/cos(30) |
| 2758 |
\pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius} |
| 2759 |
\ifdim\pinlen>\pgf@circ@res@temp |
| 2760 |
\pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}} |
| 2761 |
\pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}} |
| 2762 |
\fi |
| 2763 |
\pgfusepath{draw} |
| 2764 |
\fi |
| 2765 |
#3% |
| 2766 |
\endpgfscope |
| 2767 |
% output lead: |
| 2768 |
\pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border |
| 2769 |
\pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball |
| 2770 |
\advance\pgf@circ@res@other by \pinlen\relax |
| 2771 |
\ifdim \pgf@circ@res@other > \pgf@circ@res@right |
| 2772 |
\ifpgfcirc@draw@output@leads |
| 2773 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2774 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} |
| 2775 |
\pgfusepath{draw} |
| 2776 |
\fi |
| 2777 |
\fi |
| 2778 |
} |
| 2779 |
} |
| 2780 |
} |
| 2781 |
|
| 2782 |
\pgfcircdeclareieeetgate{tgate}{1}{% |
| 2783 |
\pgfscope |
| 2784 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2785 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2786 |
\pgfpathlineto{\pgfpoint{0pt}{0pt}} |
| 2787 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2788 |
\pgfpathclose |
| 2789 |
\pgf@circ@draworfill |
| 2790 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 2791 |
\pgfpathlineto{\pgfpoint{0pt}{0pt}} |
| 2792 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} |
| 2793 |
\pgfpathclose |
| 2794 |
\pgf@circ@draworfill |
| 2795 |
\endpgfscope |
| 2796 |
\pgfscope |
| 2797 |
% 1.1547 is 1/cos(30) |
| 2798 |
\pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}} |
| 2799 |
\pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} |
| 2800 |
\endpgfscope |
| 2801 |
} |
| 2802 |
|
| 2803 |
\pgfcircdeclareieeetgate{double tgate}{2}{% |
| 2804 |
\pgfscope |
| 2805 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 2806 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 2807 |
\pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} |
| 2808 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 2809 |
\pgfpathclose |
| 2810 |
\pgf@circ@draworfill |
| 2811 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 2812 |
\pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}} |
| 2813 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2814 |
\pgfpathclose |
| 2815 |
\pgf@circ@draworfill |
| 2816 |
% bottom triangles |
| 2817 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}} |
| 2818 |
\pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} |
| 2819 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 2820 |
\pgfpathclose |
| 2821 |
\pgf@circ@draworfill |
| 2822 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}} |
| 2823 |
\pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}} |
| 2824 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 2825 |
\pgfpathclose |
| 2826 |
\pgf@circ@draworfill |
| 2827 |
\endpgfscope |
| 2828 |
\pgfscope |
| 2829 |
% 1.1547 is 1/cos(30) |
| 2830 |
\pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}} |
| 2831 |
\pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}} |
| 2832 |
\endpgfscope |
| 2833 |
}% %>>> |
| 2834 |
|
| 2835 |
%% Path-style definitions for logical ports%<<< |
| 2836 |
% |
| 2837 |
% create path-style element for one input --- one output logical ports |
| 2838 |
% |
| 2839 |
\def\pgfcirc@port@node@to@path#1#2{% |
| 2840 |
% |
| 2841 |
% add a logic port path style component --- we need to suppress leads |
| 2842 |
% and use the correct center |
| 2843 |
% |
| 2844 |
\pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}% |
| 2845 |
} |
| 2846 |
\pgfcirc@port@node@to@path{not port}{inline not} |
| 2847 |
\pgfcirc@port@node@to@path{buffer port}{inline buffer} |
| 2848 |
\pgfcirc@port@node@to@path{schmitt port}{inline schmitt} |
| 2849 |
\pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt} |
| 2850 |
|
| 2851 |
\pgfcirc@port@node@to@path{tgate}{inline tgate} |
| 2852 |
\pgfcirc@port@node@to@path{double tgate}{inline double tgate} |
| 2853 |
% %>>> |
| 2854 |
|
| 2855 |
%%%%%%%%%%%%%%%%%%%%%%%% |
| 2856 |
%% Transistors |
| 2857 |
%%%%%%%%%%%%%%%%%%%%%%%% |
| 2858 |
|
| 2859 |
% Settings for Transistors %<<<1 |
| 2860 |
|
| 2861 |
\newif\ifpgf@circuit@trans@depletiontype |
| 2862 |
\pgf@circuit@trans@depletiontypefalse |
| 2863 |
|
| 2864 |
\newif\ifpgf@circuit@mos@arrows |
| 2865 |
\ctikzset{tripoles/mos style/.is choice} |
| 2866 |
\ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}} |
| 2867 |
\ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}} |
| 2868 |
\pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}} |
| 2869 |
\pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}} |
| 2870 |
|
| 2871 |
% Fixed label positions |
| 2872 |
\newif\ifpgf@circuit@transisors@fixlabels |
| 2873 |
\pgf@circuit@transisors@fixlabelstrue |
| 2874 |
\pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} |
| 2875 |
\ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}} |
| 2876 |
\pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} |
| 2877 |
\ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}} |
| 2878 |
|
| 2879 |
% Option solderdot for fet |
| 2880 |
\newif\ifpgf@circuit@fet@solderdot |
| 2881 |
\pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} |
| 2882 |
\ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}} |
| 2883 |
\pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} |
| 2884 |
\ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}} |
| 2885 |
|
| 2886 |
%%%% activate doublegate |
| 2887 |
\newif\ifpgf@circuit@fet@doublegate |
| 2888 |
\pgfkeys{/tikz/doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}} |
| 2889 |
\ctikzset{doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}} |
| 2890 |
\pgfkeys{/tikz/nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}} |
| 2891 |
\ctikzset{nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}} |
| 2892 |
|
| 2893 |
% Option bodydiode for fet |
| 2894 |
\newif\ifpgf@circuit@fet@bodydiode |
| 2895 |
\pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} |
| 2896 |
\ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}} |
| 2897 |
\pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} |
| 2898 |
\ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}} |
| 2899 |
|
| 2900 |
% Option draw fet without gate connection |
| 2901 |
\newif\ifpgf@circuit@bpt@drawgate |
| 2902 |
\pgf@circuit@bpt@drawgatetrue |
| 2903 |
\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} |
| 2904 |
\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}} |
| 2905 |
\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} |
| 2906 |
\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}} |
| 2907 |
|
| 2908 |
% Option draw bpt with schottky base |
| 2909 |
\newif\ifpgf@circuit@bpt@schottky |
| 2910 |
\pgf@circuit@bpt@schottkyfalse |
| 2911 |
\pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} |
| 2912 |
\ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}} |
| 2913 |
\pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} |
| 2914 |
\ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}} |
| 2915 |
\ctikzset{tripoles/schottky base size/.initial=0.05} |
| 2916 |
|
| 2917 |
% Option to add ferroelectric symbol |
| 2918 |
\newif\ifpgf@circuit@tr@ferroel |
| 2919 |
\pgf@circuit@tr@ferroelfalse |
| 2920 |
\pgfkeys{/tikz/ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}} |
| 2921 |
\ctikzset{ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}} |
| 2922 |
\pgfkeys{/tikz/no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}} |
| 2923 |
\ctikzset{no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}} |
| 2924 |
|
| 2925 |
% Option draw bpt without base connection |
| 2926 |
\newif\ifpgf@circuit@bpt@drawbase |
| 2927 |
\pgf@circuit@bpt@drawbasetrue |
| 2928 |
\pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} |
| 2929 |
\ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}} |
| 2930 |
\pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} |
| 2931 |
\ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}} |
| 2932 |
|
| 2933 |
% Option draw bpt with optical input |
| 2934 |
\newif\ifpgf@circuit@bpt@drawphoto |
| 2935 |
\pgf@circuit@bpt@drawphotofalse |
| 2936 |
\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} |
| 2937 |
\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} |
| 2938 |
\pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} |
| 2939 |
\ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}} |
| 2940 |
|
| 2941 |
% Option draw fet without bulk connection -- Added by Burak Kelleci |
| 2942 |
\newif\ifpgf@circuit@bpt@drawbulk |
| 2943 |
\pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} |
| 2944 |
\ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}} |
| 2945 |
\pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} |
| 2946 |
\ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}} |
| 2947 |
|
| 2948 |
% FDSOI bulk connection symbol https://github.com/circuitikz/circuitikz/issues/871 |
| 2949 |
\newif\ifpgf@circuit@trans@fdsoi |
| 2950 |
\pgf@circuit@trans@fdsoifalse |
| 2951 |
\ctikzset{transistors/fdsoi/.is if=pgf@circuit@trans@fdsoi} |
| 2952 |
\tikzset{fdsoi/.is if=pgf@circuit@trans@fdsoi} |
| 2953 |
% in simplified fet, use a dot symbol for back gate |
| 2954 |
\newif\ifpgf@circuit@trans@fdsoidot |
| 2955 |
\pgf@circuit@trans@fdsoidotfalse |
| 2956 |
\ctikzset{transistors/fdsoidot/.is if=pgf@circuit@trans@fdsoidot} |
| 2957 |
\ctikzset{transistors/fdsoidot/.is choice} |
| 2958 |
\ctikzset{transistores/fdsoidot/true/.code={\pgf@circuit@trans@fdsoitrue\pgf@circuit@trans@fdsoidottrue}} |
| 2959 |
\ctikzset{transistores/fdsoidot/false/.code={\pgf@circuit@trans@fdsoifalse\pgf@circuit@trans@fdsoidotfalse}} |
| 2960 |
\tikzset{fdsoidot/.code={\pgf@circuit@trans@fdsoitrue\pgf@circuit@trans@fdsoidottrue}} |
| 2961 |
\tikzset{nofdsoidot/.code={\pgf@circuit@trans@fdsoifalse\pgf@circuit@trans@fdsoidotfalse}} |
| 2962 |
|
| 2963 |
% Option draw pmos with empty circle |
| 2964 |
\newif\ifpgf@circuit@pmos@emptycircle |
| 2965 |
\pgf@circuit@pmos@emptycirclefalse |
| 2966 |
\ctikzset{tripoles/pmos style/.is choice} |
| 2967 |
\pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} |
| 2968 |
\ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}} |
| 2969 |
|
| 2970 |
% Option draw pmos with no circle |
| 2971 |
\newif\ifpgf@circuit@pmos@nocircle |
| 2972 |
\pgf@circuit@pmos@nocirclefalse |
| 2973 |
\pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} |
| 2974 |
\ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}} |
| 2975 |
|
| 2976 |
% back to normal |
| 2977 |
\pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} |
| 2978 |
\ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}} |
| 2979 |
|
| 2980 |
% arrows at the end, the correct way |
| 2981 |
\newif\ifpgf@circuit@trans@arrowatend |
| 2982 |
\pgf@circuit@trans@arrowatendfalse |
| 2983 |
\ctikzset{transistors/arrow pos/.is choice} |
| 2984 |
\ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}} |
| 2985 |
\ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}} |
| 2986 |
|
| 2987 |
% relative thickness of the gate "bar" |
| 2988 |
\ctikzset{transistors/gate thickness/.initial=1} |
| 2989 |
|
| 2990 |
% arrows at the end, the correct way |
| 2991 |
\newif\ifpgf@circuit@trans@roundedcap |
| 2992 |
\pgf@circuit@trans@roundedcapfalse |
| 2993 |
\ctikzset{transistors/rounded caps/.is if=pgf@circuit@trans@roundedcap} |
| 2994 |
|
| 2995 |
\newif\ifpgf@circuit@trans@ntype |
| 2996 |
\pgf@circuit@trans@ntypetrue %default true |
| 2997 |
%\newif\ifpgf@circuit@trans@ptype |
| 2998 |
%\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}} |
| 2999 |
\ctikzset{tripoles/nmos/width/.initial=.7} |
| 3000 |
\ctikzset{tripoles/nmos/gate height/.initial=.35} |
| 3001 |
\ctikzset{tripoles/nmos/base height/.initial=.5} |
| 3002 |
\ctikzset{tripoles/nmos/conn height/.initial=0} |
| 3003 |
\ctikzset{tripoles/nmos/height/.initial=1.1} |
| 3004 |
\ctikzset{tripoles/nmos/base width/.initial=.5} |
| 3005 |
\ctikzset{tripoles/nmos/gate width/.initial=.62} |
| 3006 |
\ctikzset{tripoles/nmos/arrow pos/.initial=.6} |
| 3007 |
\ctikzset{tripoles/nmos/bodydiode scale/.initial=.3} |
| 3008 |
\ctikzset{tripoles/nmos/bodydiode distance/.initial=.3} |
| 3009 |
\ctikzset{tripoles/nmos/bodydiode conn/.initial=.6} |
| 3010 |
\ctikzset{tripoles/nmos/curr direction/.initial=1} |
| 3011 |
|
| 3012 |
\ctikzset{tripoles/pmos/width/.initial=.7} |
| 3013 |
\ctikzset{tripoles/pmos/gate height/.initial=.35} |
| 3014 |
\ctikzset{tripoles/pmos/base height/.initial=.5} |
| 3015 |
\ctikzset{tripoles/pmos/conn height/.initial=0} |
| 3016 |
\ctikzset{tripoles/pmos/height/.initial=1.1} |
| 3017 |
\ctikzset{tripoles/pmos/base width/.initial=.5} |
| 3018 |
\ctikzset{tripoles/pmos/gate width/.initial=.62} |
| 3019 |
\ctikzset{tripoles/pmos/arrow pos/.initial=.4} |
| 3020 |
\ctikzset{tripoles/pmos/bodydiode scale/.initial=.3} |
| 3021 |
\ctikzset{tripoles/pmos/bodydiode distance/.initial=.3} |
| 3022 |
\ctikzset{tripoles/pmos/bodydiode conn/.initial=.6} |
| 3023 |
\ctikzset{tripoles/pmos/curr direction/.initial=-1} |
| 3024 |
|
| 3025 |
\ctikzset{tripoles/nmosd/width/.initial=.7} |
| 3026 |
\ctikzset{tripoles/nmosd/gate height/.initial=.35} |
| 3027 |
\ctikzset{tripoles/nmosd/base height/.initial=.5} |
| 3028 |
\ctikzset{tripoles/nmosd/conn height/.initial=0} |
| 3029 |
\ctikzset{tripoles/nmosd/height/.initial=1.1} |
| 3030 |
\ctikzset{tripoles/nmosd/base width/.initial=.5} |
| 3031 |
\ctikzset{tripoles/nmosd/gate width/.initial=.62} |
| 3032 |
\ctikzset{tripoles/nmosd/arrow pos/.initial=.6} |
| 3033 |
\ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3} |
| 3034 |
\ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3} |
| 3035 |
\ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6} |
| 3036 |
\ctikzset{tripoles/nmosd/curr direction/.initial=1} |
| 3037 |
\ctikzset{tripoles/nmosd/depletion width/.initial=.1} |
| 3038 |
\ctikzset{tripoles/nmosd/depletion color/.initial=default} |
| 3039 |
|
| 3040 |
\ctikzset{tripoles/pmosd/width/.initial=.7} |
| 3041 |
\ctikzset{tripoles/pmosd/gate height/.initial=.35} |
| 3042 |
\ctikzset{tripoles/pmosd/base height/.initial=.5} |
| 3043 |
\ctikzset{tripoles/pmosd/conn height/.initial=0} |
| 3044 |
\ctikzset{tripoles/pmosd/height/.initial=1.1} |
| 3045 |
\ctikzset{tripoles/pmosd/base width/.initial=.5} |
| 3046 |
\ctikzset{tripoles/pmosd/gate width/.initial=.62} |
| 3047 |
\ctikzset{tripoles/pmosd/arrow pos/.initial=.4} |
| 3048 |
\ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3} |
| 3049 |
\ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3} |
| 3050 |
\ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6} |
| 3051 |
\ctikzset{tripoles/pmosd/curr direction/.initial=-1} |
| 3052 |
\ctikzset{tripoles/pmosd/depletion width/.initial=.1} |
| 3053 |
\ctikzset{tripoles/pmosd/depletion color/.initial=default} |
| 3054 |
\ctikzset{tripoles/hemt/width/.initial=.7} |
| 3055 |
\ctikzset{tripoles/hemt/gate height/.initial=.35} |
| 3056 |
\ctikzset{tripoles/hemt/base height/.initial=.5} |
| 3057 |
\ctikzset{tripoles/hemt/conn height/.initial=0} |
| 3058 |
\ctikzset{tripoles/hemt/height/.initial=1.1} |
| 3059 |
\ctikzset{tripoles/hemt/base width/.initial=.5} |
| 3060 |
\ctikzset{tripoles/hemt/gate width/.initial=.5}% the horizontal position is the same |
| 3061 |
\ctikzset{tripoles/hemt/bodydiode scale/.initial=.3} |
| 3062 |
\ctikzset{tripoles/hemt/bodydiode distance/.initial=.3} |
| 3063 |
\ctikzset{tripoles/hemt/bodydiode conn/.initial=.6} |
| 3064 |
\ctikzset{tripoles/hemt/curr direction/.initial=1} |
| 3065 |
%% New parameters |
| 3066 |
\ctikzset{tripoles/hemt/curr direction/.initial=1} |
| 3067 |
\ctikzset{tripoles/hemt/gate asym/.initial=0} |
| 3068 |
\newif\ifpgf@circ@hemt@split |
| 3069 |
\ctikzset{tripoles/hemt/split gate/.is if=pgf@circ@hemt@split} |
| 3070 |
\ctikzset{tripoles/hemt/source arrow/.initial=0} |
| 3071 |
|
| 3072 |
\ctikzset{tripoles/nfet/width/.initial=.7} |
| 3073 |
\ctikzset{tripoles/nfet/gate height/.initial=.35} |
| 3074 |
\ctikzset{tripoles/nfet/base height/.initial=.5} |
| 3075 |
\ctikzset{tripoles/nfet/conn height/.initial=0} |
| 3076 |
\ctikzset{tripoles/nfet/height/.initial=1.1} |
| 3077 |
\ctikzset{tripoles/nfet/base width/.initial=.5} |
| 3078 |
\ctikzset{tripoles/nfet/gate width/.initial=.62} |
| 3079 |
\ctikzset{tripoles/nfet/bodydiode scale/.initial=.3} |
| 3080 |
\ctikzset{tripoles/nfet/bodydiode distance/.initial=.3} |
| 3081 |
\ctikzset{tripoles/nfet/bodydiode conn/.initial=.6} |
| 3082 |
\ctikzset{tripoles/nfet/curr direction/.initial=1} |
| 3083 |
|
| 3084 |
\ctikzset{tripoles/pfet/width/.initial=.7} |
| 3085 |
\ctikzset{tripoles/pfet/gate height/.initial=.35} |
| 3086 |
\ctikzset{tripoles/pfet/base height/.initial=.5} |
| 3087 |
\ctikzset{tripoles/pfet/conn height/.initial=0} |
| 3088 |
\ctikzset{tripoles/pfet/height/.initial=1.1} |
| 3089 |
\ctikzset{tripoles/pfet/base width/.initial=.5} |
| 3090 |
\ctikzset{tripoles/pfet/gate width/.initial=.62} |
| 3091 |
\ctikzset{tripoles/pfet/bodydiode scale/.initial=.3} |
| 3092 |
\ctikzset{tripoles/pfet/bodydiode distance/.initial=.3} |
| 3093 |
\ctikzset{tripoles/pfet/bodydiode conn/.initial=.6} |
| 3094 |
\ctikzset{tripoles/pfet/curr direction/.initial=-1} |
| 3095 |
|
| 3096 |
\ctikzset{tripoles/nfetd/width/.initial=.7} |
| 3097 |
\ctikzset{tripoles/nfetd/gate height/.initial=.35} |
| 3098 |
\ctikzset{tripoles/nfetd/base height/.initial=.5} |
| 3099 |
\ctikzset{tripoles/nfetd/conn height/.initial=0} |
| 3100 |
\ctikzset{tripoles/nfetd/height/.initial=1.1} |
| 3101 |
\ctikzset{tripoles/nfetd/base width/.initial=.5} |
| 3102 |
\ctikzset{tripoles/nfetd/gate width/.initial=.62} |
| 3103 |
\ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3} |
| 3104 |
\ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3} |
| 3105 |
\ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6} |
| 3106 |
\ctikzset{tripoles/nfetd/curr direction/.initial=1} |
| 3107 |
|
| 3108 |
\ctikzset{tripoles/pfetd/width/.initial=.7} |
| 3109 |
\ctikzset{tripoles/pfetd/gate height/.initial=.35} |
| 3110 |
\ctikzset{tripoles/pfetd/base height/.initial=.5} |
| 3111 |
\ctikzset{tripoles/pfetd/conn height/.initial=0} |
| 3112 |
\ctikzset{tripoles/pfetd/height/.initial=1.1} |
| 3113 |
\ctikzset{tripoles/pfetd/base width/.initial=.5} |
| 3114 |
\ctikzset{tripoles/pfetd/gate width/.initial=.62} |
| 3115 |
\ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3} |
| 3116 |
\ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3} |
| 3117 |
\ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6} |
| 3118 |
\ctikzset{tripoles/pfetd/curr direction/.initial=-1} |
| 3119 |
|
| 3120 |
\ctikzset{tripoles/nigfete/width/.initial=.7} |
| 3121 |
\ctikzset{tripoles/nigfete/gate height/.initial=.35} |
| 3122 |
\ctikzset{tripoles/nigfete/base height/.initial=.5} |
| 3123 |
\ctikzset{tripoles/nigfete/conn height/.initial=.35} |
| 3124 |
\ctikzset{tripoles/nigfete/height/.initial=1.1} |
| 3125 |
\ctikzset{tripoles/nigfete/base width/.initial=.5} |
| 3126 |
\ctikzset{tripoles/nigfete/gate width/.initial=.62} |
| 3127 |
\ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3} |
| 3128 |
\ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3} |
| 3129 |
\ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6} |
| 3130 |
\ctikzset{tripoles/nigfete/curr direction/.initial=1} |
| 3131 |
|
| 3132 |
\ctikzset{tripoles/nigfetd/width/.initial=.7} |
| 3133 |
\ctikzset{tripoles/nigfetd/gate height/.initial=.35} |
| 3134 |
\ctikzset{tripoles/nigfetd/base height/.initial=.5} |
| 3135 |
\ctikzset{tripoles/nigfetd/conn height/.initial=.35} |
| 3136 |
\ctikzset{tripoles/nigfetd/height/.initial=1.1} |
| 3137 |
\ctikzset{tripoles/nigfetd/base width/.initial=.5} |
| 3138 |
\ctikzset{tripoles/nigfetd/gate width/.initial=.62} |
| 3139 |
\ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3} |
| 3140 |
\ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3} |
| 3141 |
\ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6} |
| 3142 |
\ctikzset{tripoles/nigfetd/curr direction/.initial=1} |
| 3143 |
|
| 3144 |
\ctikzset{tripoles/nigfetebulk/width/.initial=.7} |
| 3145 |
\ctikzset{tripoles/nigfetebulk/gate height/.initial=.35} |
| 3146 |
\ctikzset{tripoles/nigfetebulk/base height/.initial=.5} |
| 3147 |
\ctikzset{tripoles/nigfetebulk/conn height/.initial=.35} |
| 3148 |
\ctikzset{tripoles/nigfetebulk/height/.initial=1.1} |
| 3149 |
\ctikzset{tripoles/nigfetebulk/base width/.initial=.5} |
| 3150 |
\ctikzset{tripoles/nigfetebulk/gate width/.initial=.62} |
| 3151 |
\ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3} |
| 3152 |
\ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3} |
| 3153 |
\ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6} |
| 3154 |
\ctikzset{tripoles/nigfetebulk/curr direction/.initial=1} |
| 3155 |
|
| 3156 |
\ctikzset{tripoles/pigfete/width/.initial=.7} |
| 3157 |
\ctikzset{tripoles/pigfete/gate height/.initial=.35} |
| 3158 |
\ctikzset{tripoles/pigfete/base height/.initial=.5} |
| 3159 |
\ctikzset{tripoles/pigfete/conn height/.initial=.35} |
| 3160 |
\ctikzset{tripoles/pigfete/height/.initial=1.1} |
| 3161 |
\ctikzset{tripoles/pigfete/base width/.initial=.5} |
| 3162 |
\ctikzset{tripoles/pigfete/gate width/.initial=.62} |
| 3163 |
\ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3} |
| 3164 |
\ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3} |
| 3165 |
\ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6} |
| 3166 |
\ctikzset{tripoles/pigfete/curr direction/.initial=-1} |
| 3167 |
|
| 3168 |
\ctikzset{tripoles/pigfetd/width/.initial=.7} |
| 3169 |
\ctikzset{tripoles/pigfetd/gate height/.initial=.35} |
| 3170 |
\ctikzset{tripoles/pigfetd/base height/.initial=.5} |
| 3171 |
\ctikzset{tripoles/pigfetd/conn height/.initial=.35} |
| 3172 |
\ctikzset{tripoles/pigfetd/height/.initial=1.1} |
| 3173 |
\ctikzset{tripoles/pigfetd/base width/.initial=.5} |
| 3174 |
\ctikzset{tripoles/pigfetd/gate width/.initial=.62} |
| 3175 |
\ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3} |
| 3176 |
\ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3} |
| 3177 |
\ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6} |
| 3178 |
\ctikzset{tripoles/pigfetd/curr direction/.initial=-1} |
| 3179 |
|
| 3180 |
\ctikzset{tripoles/pigfetebulk/width/.initial=.7} |
| 3181 |
\ctikzset{tripoles/pigfetebulk/gate height/.initial=.35} |
| 3182 |
\ctikzset{tripoles/pigfetebulk/conn height/.initial=.35} |
| 3183 |
\ctikzset{tripoles/pigfetebulk/base height/.initial=.5} |
| 3184 |
\ctikzset{tripoles/pigfetebulk/height/.initial=1.1} |
| 3185 |
\ctikzset{tripoles/pigfetebulk/base width/.initial=.5} |
| 3186 |
\ctikzset{tripoles/pigfetebulk/gate width/.initial=.62} |
| 3187 |
\ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3} |
| 3188 |
\ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3} |
| 3189 |
\ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6} |
| 3190 |
\ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1} |
| 3191 |
|
| 3192 |
\ctikzset{tripoles/npn/width/.initial=.6} |
| 3193 |
\ctikzset{tripoles/npn/base height/.initial=.45} |
| 3194 |
\ctikzset{tripoles/npn/base height 2/.initial=.15} |
| 3195 |
\ctikzset{tripoles/npn/base height/.initial=.4} |
| 3196 |
\ctikzset{tripoles/npn/conn height/.initial=0} |
| 3197 |
\ctikzset{tripoles/npn/height/.initial=1.1} |
| 3198 |
\ctikzset{tripoles/npn/base width/.initial=.5} |
| 3199 |
\ctikzset{tripoles/npn/arrow pos/.initial=.5} |
| 3200 |
\ctikzset{tripoles/npn/bodydiode scale/.initial=.3} |
| 3201 |
\ctikzset{tripoles/npn/bodydiode distance/.initial=.3} |
| 3202 |
\ctikzset{tripoles/npn/bodydiode conn/.initial=.6} |
| 3203 |
\ctikzset{tripoles/npn/curr direction/.initial=1} |
| 3204 |
|
| 3205 |
\ctikzset{tripoles/pnp/width/.initial=.6} |
| 3206 |
\ctikzset{tripoles/pnp/base height/.initial=.45} |
| 3207 |
\ctikzset{tripoles/pnp/base height 2/.initial=.15} |
| 3208 |
\ctikzset{tripoles/pnp/base height/.initial=.4} |
| 3209 |
\ctikzset{tripoles/pnp/conn height/.initial=0} |
| 3210 |
\ctikzset{tripoles/pnp/height/.initial=1.1} |
| 3211 |
\ctikzset{tripoles/pnp/base width/.initial=.5} |
| 3212 |
\ctikzset{tripoles/pnp/arrow pos/.initial=.5} |
| 3213 |
\ctikzset{tripoles/pnp/bodydiode scale/.initial=.3} |
| 3214 |
\ctikzset{tripoles/pnp/bodydiode distance/.initial=.3} |
| 3215 |
\ctikzset{tripoles/pnp/bodydiode conn/.initial=.6} |
| 3216 |
\ctikzset{tripoles/pnp/curr direction/.initial=-1} |
| 3217 |
|
| 3218 |
\ctikzset{tripoles/pigbt/width/.initial=.6} |
| 3219 |
\ctikzset{tripoles/pigbt/gate height/.initial=.45} |
| 3220 |
\ctikzset{tripoles/pigbt/gate height 2/.initial=.15} |
| 3221 |
\ctikzset{tripoles/pigbt/base height/.initial=.4} |
| 3222 |
\ctikzset{tripoles/pigbt/outer base height/.initial=.4} |
| 3223 |
\ctikzset{tripoles/pigbt/outer base thickness/.initial=1} |
| 3224 |
\ctikzset{tripoles/pigbt/conn height/.initial=0} |
| 3225 |
\ctikzset{tripoles/pigbt/height/.initial=1.1} |
| 3226 |
\ctikzset{tripoles/pigbt/gate width/.initial=.62} |
| 3227 |
\ctikzset{tripoles/pigbt/base width/.initial=.5} |
| 3228 |
\ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3} |
| 3229 |
\ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3} |
| 3230 |
\ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6} |
| 3231 |
\ctikzset{tripoles/pigbt/curr direction/.initial=-1} |
| 3232 |
|
| 3233 |
\ctikzset{tripoles/nigbt/width/.initial=.6} |
| 3234 |
\ctikzset{tripoles/nigbt/gate height/.initial=.45} |
| 3235 |
\ctikzset{tripoles/nigbt/gate height 2/.initial=.15} |
| 3236 |
\ctikzset{tripoles/nigbt/base height/.initial=.4} |
| 3237 |
\ctikzset{tripoles/nigbt/outer base height/.initial=.4} |
| 3238 |
\ctikzset{tripoles/nigbt/outer base thickness/.initial=1} |
| 3239 |
\ctikzset{tripoles/nigbt/conn height/.initial=0} |
| 3240 |
\ctikzset{tripoles/nigbt/height/.initial=1.1} |
| 3241 |
\ctikzset{tripoles/nigbt/gate width/.initial=.62} |
| 3242 |
\ctikzset{tripoles/nigbt/base width/.initial=.5} |
| 3243 |
\ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3} |
| 3244 |
\ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3} |
| 3245 |
\ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6} |
| 3246 |
\ctikzset{tripoles/nigbt/curr direction/.initial=1} |
| 3247 |
|
| 3248 |
\ctikzset{tripoles/Lpigbt/width/.initial=.6} |
| 3249 |
\ctikzset{tripoles/Lpigbt/gate height/.initial=.45} |
| 3250 |
\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15} |
| 3251 |
\ctikzset{tripoles/Lpigbt/base height/.initial=.4} |
| 3252 |
\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4} |
| 3253 |
\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1} |
| 3254 |
\ctikzset{tripoles/Lpigbt/conn height/.initial=.4} |
| 3255 |
\ctikzset{tripoles/Lpigbt/height/.initial=1.1} |
| 3256 |
\ctikzset{tripoles/Lpigbt/gate width/.initial=.62} |
| 3257 |
\ctikzset{tripoles/Lpigbt/base width/.initial=.5} |
| 3258 |
\ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3} |
| 3259 |
\ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3} |
| 3260 |
\ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6} |
| 3261 |
\ctikzset{tripoles/Lpigbt/curr direction/.initial=-1} |
| 3262 |
|
| 3263 |
\ctikzset{tripoles/Lnigbt/width/.initial=.6} |
| 3264 |
\ctikzset{tripoles/Lnigbt/gate height/.initial=.45} |
| 3265 |
\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15} |
| 3266 |
\ctikzset{tripoles/Lnigbt/base height/.initial=.4} |
| 3267 |
\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4} |
| 3268 |
\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1} |
| 3269 |
\ctikzset{tripoles/Lnigbt/conn height/.initial=.4} |
| 3270 |
\ctikzset{tripoles/Lnigbt/height/.initial=1.1} |
| 3271 |
\ctikzset{tripoles/Lnigbt/gate width/.initial=.62} |
| 3272 |
\ctikzset{tripoles/Lnigbt/base width/.initial=.5} |
| 3273 |
\ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3} |
| 3274 |
\ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3} |
| 3275 |
\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6} |
| 3276 |
\ctikzset{tripoles/Lnigbt/curr direction/.initial=1} |
| 3277 |
|
| 3278 |
\ctikzset{tripoles/igbt/outer base height/.code={ |
| 3279 |
\ctikzset{tripoles/nigbt/outer base height/.initial=#1} |
| 3280 |
\ctikzset{tripoles/pigbt/outer base height/.initial=#1} |
| 3281 |
\ctikzset{tripoles/Lnigbt/outer base height/.initial=#1} |
| 3282 |
\ctikzset{tripoles/Lpigbt/outer base height/.initial=#1} |
| 3283 |
\ctikzset{tripoles/Lnigbt/conn height/.initial=#1} |
| 3284 |
\ctikzset{tripoles/Lpigbt/conn height/.initial=#1} |
| 3285 |
}} |
| 3286 |
\ctikzset{tripoles/igbt/outer base thickness/.code={ |
| 3287 |
\ctikzset{tripoles/nigbt/outer base thickness=#1} |
| 3288 |
\ctikzset{tripoles/pigbt/outer base thickness=#1} |
| 3289 |
\ctikzset{tripoles/Lnigbt/outer base thickness=#1} |
| 3290 |
\ctikzset{tripoles/Lpigbt/outer base thickness=#1} |
| 3291 |
}} |
| 3292 |
|
| 3293 |
\ctikzset{tripoles/njfet/width/.initial=.7} |
| 3294 |
\ctikzset{tripoles/njfet/gate height/.initial=.5} |
| 3295 |
\ctikzset{tripoles/njfet/gate height 2/.initial=.35} |
| 3296 |
\ctikzset{tripoles/njfet/gate width/.initial=.5} |
| 3297 |
\ctikzset{tripoles/njfet/base width/.initial=.5} |
| 3298 |
\ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior |
| 3299 |
\ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate |
| 3300 |
\ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink |
| 3301 |
\ctikzset{tripoles/njfet/height/.initial=1.1} |
| 3302 |
\ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} |
| 3303 |
\ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} |
| 3304 |
\ctikzset{tripoles/njfet/bodydiode conn/.initial=.6} |
| 3305 |
\ctikzset{tripoles/njfet/curr direction/.initial=1} |
| 3306 |
|
| 3307 |
\ctikzset{tripoles/pjfet/width/.initial=.7} |
| 3308 |
\ctikzset{tripoles/pjfet/gate height/.initial=.5} |
| 3309 |
\ctikzset{tripoles/pjfet/gate height 2/.initial=.35} |
| 3310 |
\ctikzset{tripoles/pjfet/gate width/.initial=.5} |
| 3311 |
\ctikzset{tripoles/pjfet/base width/.initial=.5} |
| 3312 |
\ctikzset{tripoles/pjfet/conn height/.initial=.35} |
| 3313 |
\ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate |
| 3314 |
\ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink |
| 3315 |
\ctikzset{tripoles/pjfet/height/.initial=1.1} |
| 3316 |
\ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} |
| 3317 |
\ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} |
| 3318 |
\ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} |
| 3319 |
\ctikzset{tripoles/pjfet/curr direction/.initial=-1} |
| 3320 |
% set the gate height of jfet |
| 3321 |
\ctikzset{transistors/jfet gate height/.code={% |
| 3322 |
\pgfmathsetmacro{\@@tmp}{\ctikzvalof{tripoles/njfet/width}*0.5*(#1)}% |
| 3323 |
\ctikzset{tripoles/njfet/conn height=\@@tmp}% |
| 3324 |
\ctikzset{tripoles/njfet/union height=\@@tmp}% |
| 3325 |
\pgfmathsetmacro{\@@tmp}{\ctikzvalof{tripoles/pjfet/width}*0.5*(#1)}% |
| 3326 |
\ctikzset{tripoles/pjfet/conn height=\@@tmp}% |
| 3327 |
\ctikzset{tripoles/pjfet/union height=\@@tmp}% |
| 3328 |
} |
| 3329 |
} |
| 3330 |
|
| 3331 |
\ctikzset{tripoles/nujt/width/.initial=.7} |
| 3332 |
\ctikzset{tripoles/nujt/gate height/.initial=.5} |
| 3333 |
\ctikzset{tripoles/nujt/gate height 2/.initial=.35} |
| 3334 |
\ctikzset{tripoles/nujt/gate width/.initial=.5} |
| 3335 |
\ctikzset{tripoles/nujt/base width/.initial=.5} |
| 3336 |
\ctikzset{tripoles/nujt/conn height/.initial=.35} |
| 3337 |
\ctikzset{tripoles/nujt/union height/.initial=0}% at the gate |
| 3338 |
\ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position |
| 3339 |
\ctikzset{tripoles/nujt/height/.initial=1.1} |
| 3340 |
\ctikzset{tripoles/nujt/bodydiode scale/.initial=.3} |
| 3341 |
\ctikzset{tripoles/nujt/bodydiode distance/.initial=.3} |
| 3342 |
\ctikzset{tripoles/nujt/bodydiode conn/.initial=.6} |
| 3343 |
\ctikzset{tripoles/nujt/curr direction/.initial=1} |
| 3344 |
|
| 3345 |
\ctikzset{tripoles/pujt/width/.initial=.7} |
| 3346 |
\ctikzset{tripoles/pujt/gate height/.initial=.5} |
| 3347 |
\ctikzset{tripoles/pujt/gate height 2/.initial=.35} |
| 3348 |
\ctikzset{tripoles/pujt/gate width/.initial=.5} |
| 3349 |
\ctikzset{tripoles/pujt/base width/.initial=.5} |
| 3350 |
\ctikzset{tripoles/pujt/conn height/.initial=.35} |
| 3351 |
\ctikzset{tripoles/pujt/union height/.initial=0}% at the gate |
| 3352 |
\ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position |
| 3353 |
\ctikzset{tripoles/pujt/height/.initial=1.1} |
| 3354 |
\ctikzset{tripoles/pujt/bodydiode scale/.initial=.3} |
| 3355 |
\ctikzset{tripoles/pujt/bodydiode distance/.initial=.3} |
| 3356 |
\ctikzset{tripoles/pujt/bodydiode conn/.initial=.6} |
| 3357 |
\ctikzset{tripoles/pujt/curr direction/.initial=-1} |
| 3358 |
|
| 3359 |
\ctikzset{tripoles/isfet/width/.initial=1} |
| 3360 |
\ctikzset{tripoles/isfet/gate height/.initial=.35} |
| 3361 |
\ctikzset{tripoles/isfet/base height/.initial=.5} |
| 3362 |
\ctikzset{tripoles/isfet/height/.initial=1.1} |
| 3363 |
\ctikzset{tripoles/isfet/base width/.initial=.3} |
| 3364 |
\ctikzset{tripoles/isfet/gate width/.initial=.5} |
| 3365 |
\ctikzset{tripoles/isfet/conn height/.initial=0} |
| 3366 |
\ctikzset{tripoles/isfet/wave width/.initial=.16} |
| 3367 |
\ctikzset{tripoles/isfet/wave amp/.initial=.06} |
| 3368 |
\ctikzset{tripoles/isfet/waves y sep/.initial=.22} |
| 3369 |
\ctikzset{tripoles/isfet/waves x sep/.initial=.8} |
| 3370 |
\ctikzset{tripoles/isfet/bodydiode scale/.initial=.3} |
| 3371 |
\ctikzset{tripoles/isfet/bodydiode distance/.initial=.3} |
| 3372 |
\ctikzset{tripoles/isfet/bodydiode conn/.initial=.6} |
| 3373 |
\ctikzset{tripoles/isfet/curr direction/.initial=1} |
| 3374 |
% |
| 3375 |
% graphene FET |
| 3376 |
% |
| 3377 |
\ctikzset{tripoles/pgfet/width/.initial=.6} |
| 3378 |
\ctikzset{tripoles/pgfet/gate height/.initial=.5} |
| 3379 |
\ctikzset{tripoles/pgfet/gate height 2/.initial=0.25} % must be "gate height"/2 |
| 3380 |
\ctikzset{tripoles/pgfet/base height/.initial=.5} % must be "gate height" |
| 3381 |
\ctikzset{tripoles/pgfet/outer base height/.initial=.25} % must be "gate height 2" |
| 3382 |
\ctikzset{tripoles/pgfet/outer base thickness/.initial=1} |
| 3383 |
\ctikzset{tripoles/pgfet/conn height/.initial=0} |
| 3384 |
\ctikzset{tripoles/pgfet/height/.initial=1.1} |
| 3385 |
\ctikzset{tripoles/pgfet/gate width/.initial=.5} |
| 3386 |
\ctikzset{tripoles/pgfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width) |
| 3387 |
\ctikzset{tripoles/pgfet/bodydiode scale/.initial=.3} |
| 3388 |
\ctikzset{tripoles/pgfet/bodydiode distance/.initial=.6} |
| 3389 |
\ctikzset{tripoles/pgfet/bodydiode conn/.initial=.6} |
| 3390 |
\ctikzset{tripoles/pgfet/curr direction/.initial=-1} |
| 3391 |
|
| 3392 |
\ctikzset{tripoles/ngfet/width/.initial=.6} |
| 3393 |
\ctikzset{tripoles/ngfet/gate height/.initial=.5} |
| 3394 |
\ctikzset{tripoles/ngfet/gate height 2/.initial=0.25} % must be "gate height"/2 |
| 3395 |
\ctikzset{tripoles/ngfet/base height/.initial=.5} % must be "gate height" |
| 3396 |
\ctikzset{tripoles/ngfet/outer base height/.initial=.25} % must be "gate height 2" |
| 3397 |
\ctikzset{tripoles/ngfet/outer base thickness/.initial=1} |
| 3398 |
\ctikzset{tripoles/ngfet/conn height/.initial=0} |
| 3399 |
\ctikzset{tripoles/ngfet/height/.initial=1.1} |
| 3400 |
\ctikzset{tripoles/ngfet/gate width/.initial=.5} |
| 3401 |
\ctikzset{tripoles/ngfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width) |
| 3402 |
\ctikzset{tripoles/ngfet/bodydiode scale/.initial=.3} |
| 3403 |
\ctikzset{tripoles/ngfet/bodydiode distance/.initial=.6} |
| 3404 |
\ctikzset{tripoles/ngfet/bodydiode conn/.initial=.6} |
| 3405 |
\ctikzset{tripoles/ngfet/curr direction/.initial=1} |
| 3406 |
% |
| 3407 |
% multi-emitter and multi-collector BJTs by Romano Giannetti |
| 3408 |
% |
| 3409 |
\ctikzset{tripoles/bjt/emitters/.initial=1} |
| 3410 |
\ctikzset{tripoles/bjt/collectors/.initial=1} |
| 3411 |
\pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}} |
| 3412 |
\pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}} |
| 3413 |
\ctikzset{tripoles/bjt/pins width/.initial=0.3} |
| 3414 |
\pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}} |
| 3415 |
\ctikzset{tripoles/bjt/multi height/.initial=.5} |
| 3416 |
\pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}} |
| 3417 |
% |
| 3418 |
\ctikzset{tripoles/bjt/width/.initial=.3} |
| 3419 |
\ctikzset{tripoles/bjt/base height 2/.initial=.4} |
| 3420 |
\ctikzset{tripoles/bjt/base height/.initial=1.1} |
| 3421 |
\ctikzset{tripoles/bjt/height/.initial=.4} |
| 3422 |
\ctikzset{tripoles/bjt/base width/.initial=1} |
| 3423 |
\ctikzset{tripoles/bjt/arrow pos/.initial=.5} |
| 3424 |
% do NOT touch these two! |
| 3425 |
\ctikzset{tripoles/bjt/npn/curr direction/.initial=1} |
| 3426 |
\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1} |
| 3427 |
|
| 3428 |
|
| 3429 |
% |
| 3430 |
% definitions for transistor circles |
| 3431 |
% |
| 3432 |
\ctikzset{transistor circle/.is family} |
| 3433 |
\ctikzset{transistor circle/relative thickness/.initial=1} |
| 3434 |
\ctikzset{transistor circle/color/.initial=default} |
| 3435 |
\ctikzset{transistor circle/dash/.initial=default} |
| 3436 |
\ctikzset{transistor circle/scale circle radius/.initial=1} |
| 3437 |
\ctikzset{transistor circle/default base in/.initial=0.9} |
| 3438 |
\ctikzset{transistor circle/njfet base in/.initial=1.05} |
| 3439 |
\ctikzset{transistor circle/pjfet base in/.initial=1.05} |
| 3440 |
\ctikzset{transistor circle/isfet base in/.initial=0.65} |
| 3441 |
|
| 3442 |
\newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse |
| 3443 |
\ctikzset{tr circle/.is if=pgf@circ@trcircle} |
| 3444 |
\tikzset{tr circle/.is if=pgf@circ@trcircle} |
| 3445 |
% partial borders styles |
| 3446 |
% this can be "none" or 4 numbers saying the style for each part: |
| 3447 |
% 0 --- nothing, 1 --- solid, 2 --- dashed |
| 3448 |
\ctikzset{transistor circle/partial borders/.initial=none} % Value none for normal borders |
| 3449 |
\ctikzset{transistor circle/partial border dash/.initial={{2pt}{2pt}}} |
| 3450 |
% |
| 3451 |
% body diode style |
| 3452 |
\ctikzset{transistor bodydiode/.is family} |
| 3453 |
\ctikzset{transistor bodydiode/relative thickness/.initial=1} |
| 3454 |
\ctikzset{transistor bodydiode/color/.initial=default} |
| 3455 |
\ctikzset{transistor bodydiode/dash/.initial=default} |
| 3456 |
\ctikzset{transistor bodydiode/dot scale/.initial=0.7} |
| 3457 |
\ctikzset{transistor solderdot scale/.initial=0.7} |
| 3458 |
% this is unfortunate, but needed for backward compatibility |
| 3459 |
\ctikzset{transistor bodydiode/scale/.code={% |
| 3460 |
\ctikzset{tripoles/nmos/bodydiode scale=#1}% |
| 3461 |
\ctikzset{tripoles/pmos/bodydiode scale=#1}% |
| 3462 |
\ctikzset{tripoles/nmosd/bodydiode scale=#1}% |
| 3463 |
\ctikzset{tripoles/pmosd/bodydiode scale=#1}% |
| 3464 |
\ctikzset{tripoles/hemt/bodydiode scale=#1}% |
| 3465 |
\ctikzset{tripoles/nfet/bodydiode scale=#1}% |
| 3466 |
\ctikzset{tripoles/pfet/bodydiode scale=#1}% |
| 3467 |
\ctikzset{tripoles/nfetd/bodydiode scale=#1}% |
| 3468 |
\ctikzset{tripoles/pfetd/bodydiode scale=#1}% |
| 3469 |
\ctikzset{tripoles/nigfete/bodydiode scale=#1}% |
| 3470 |
\ctikzset{tripoles/nigfetd/bodydiode scale=#1}% |
| 3471 |
\ctikzset{tripoles/nigfetebulk/bodydiode scale=#1}% |
| 3472 |
\ctikzset{tripoles/pigfete/bodydiode scale=#1}% |
| 3473 |
\ctikzset{tripoles/pigfetd/bodydiode scale=#1}% |
| 3474 |
\ctikzset{tripoles/pigfetebulk/bodydiode scale=#1}% |
| 3475 |
\ctikzset{tripoles/npn/bodydiode scale=#1}% |
| 3476 |
\ctikzset{tripoles/pnp/bodydiode scale=#1}% |
| 3477 |
\ctikzset{tripoles/pigbt/bodydiode scale=#1}% |
| 3478 |
\ctikzset{tripoles/nigbt/bodydiode scale=#1}% |
| 3479 |
\ctikzset{tripoles/Lpigbt/bodydiode scale=#1}% |
| 3480 |
\ctikzset{tripoles/Lnigbt/bodydiode scale=#1}% |
| 3481 |
\ctikzset{tripoles/njfet/bodydiode scale=#1}% |
| 3482 |
\ctikzset{tripoles/pjfet/bodydiode scale=#1}% |
| 3483 |
\ctikzset{tripoles/nujt/bodydiode scale=#1}% |
| 3484 |
\ctikzset{tripoles/pujt/bodydiode scale=#1}% |
| 3485 |
\ctikzset{tripoles/isfet/bodydiode scale=#1}% |
| 3486 |
\ctikzset{tripoles/pgfet/bodydiode scale=#1}% |
| 3487 |
\ctikzset{tripoles/ngfet/bodydiode scale=#1}% |
| 3488 |
}} |
| 3489 |
%%>>> |
| 3490 |
|
| 3491 |
%% definitions of transistor shapes%<<< |
| 3492 |
% |
| 3493 |
% draw partial transistor outline |
| 3494 |
% |
| 3495 |
\def\pgf@circ@trcircle@split#1#2#3#4\relax{%split the six numbers |
| 3496 |
\edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}% |
| 3497 |
} |
| 3498 |
\def\pgf@circ@trcircle@setdash{% |
| 3499 |
\edef\@@dash{\ctikzvalof{transistor circle/partial border dash}}% |
| 3500 |
% \typeout{DASH:\@@dash}% |
| 3501 |
\expandafter\pgfsetdash\expandafter{\@@dash}{0pt}% |
| 3502 |
} |
| 3503 |
% this is the same as the tubes' one, but let's keep it separated |
| 3504 |
\def\pgf@circ@trcircle@draw@style#1{% |
| 3505 |
\ifcase#1 |
| 3506 |
\pgfusepath{discard}% case 0, will discard the path |
| 3507 |
\or |
| 3508 |
\pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid |
| 3509 |
\or |
| 3510 |
\pgf@circ@trcircle@setdash\pgfusepath{draw}% case 2, dashed |
| 3511 |
\else |
| 3512 |
\pgfutil@packagewarning{circuitikz}{Transistor circle draw style not known!}% |
| 3513 |
\pgfusepath{draw}% |
| 3514 |
\fi |
| 3515 |
} |
| 3516 |
% |
| 3517 |
% add a circle to the transistor: |
| 3518 |
\def\pgf@circ@trcircle@draw@partial#1{% |
| 3519 |
\expandafter\pgf@circ@trcircle@split#1\relax |
| 3520 |
% \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d} |
| 3521 |
\pgfscope % right side upper arc |
| 3522 |
\pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{\circleradius}} |
| 3523 |
\pgfpatharc{90}{0}{\circleradius} |
| 3524 |
\pgf@circ@trcircle@draw@style{\@@a} |
| 3525 |
\endpgfscope |
| 3526 |
\pgfscope % right side lower arc |
| 3527 |
\pgfpathmoveto{\pgfpoint{\circleleft+2*\circleradius}{0pt}} |
| 3528 |
\pgfpatharc{0}{-90}{\circleradius} |
| 3529 |
\pgf@circ@trcircle@draw@style{\@@b} |
| 3530 |
\endpgfscope |
| 3531 |
\pgfscope % left side lower arc |
| 3532 |
\pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{-\circleradius}} |
| 3533 |
\pgfpatharc{-90}{-180}{\circleradius} |
| 3534 |
\pgf@circ@trcircle@draw@style{\@@c} |
| 3535 |
\endpgfscope |
| 3536 |
\pgfscope % left side upper arc |
| 3537 |
\pgfpathmoveto{\pgfpoint{\circleleft}{0pt}} |
| 3538 |
\pgfpatharc{-180}{-270}{\circleradius} |
| 3539 |
\pgf@circ@trcircle@draw@style{\@@d} |
| 3540 |
\endpgfscope |
| 3541 |
} |
| 3542 |
% |
| 3543 |
\def\pgfcirc@transistorcircle{ |
| 3544 |
\ifpgf@circ@trcircle |
| 3545 |
\pgfscope |
| 3546 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 3547 |
\pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth} |
| 3548 |
\pgf@circ@subset@color@dash{transistor circle} |
| 3549 |
% radius of the circle |
| 3550 |
% \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2} |
| 3551 |
% \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp} |
| 3552 |
\pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius} |
| 3553 |
\edef\@@partial{\ctikzvalof{transistor circle/partial borders}} |
| 3554 |
\ifx\@@partial\pgf@nonetext |
| 3555 |
% Circle fill and draw if it's not partial... for speed |
| 3556 |
\pgf@circ@draworfill |
| 3557 |
\else |
| 3558 |
% otherwise, just fill and do the partial fill |
| 3559 |
\pgf@circ@maybefill |
| 3560 |
\pgf@circ@trcircle@draw@partial{\@@partial} |
| 3561 |
\fi |
| 3562 |
\endpgfscope |
| 3563 |
\fi |
| 3564 |
} |
| 3565 |
|
| 3566 |
% add a ferroelectric squish to transistors |
| 3567 |
|
| 3568 |
\def\pgfcirc@ferroelectric#1#2{% #1 -> transistor type, #2 horizontal enlargment (prop to ...@left), |
| 3569 |
\ifpgf@circuit@tr@ferroel\pgfscope |
| 3570 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 3571 |
\pgf@circ@set@relative@thickness{modifier thickness} |
| 3572 |
% base-gate center and width of the sigmoid |
| 3573 |
\pgfmathsetlength{\pgf@circ@res@other} |
| 3574 |
{0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width}-(#2))*\pgf@circ@res@left} |
| 3575 |
\pgfmathsetlength{\pgf@circ@res@temp} |
| 3576 |
{1.2*abs(\ctikzvalof{tripoles/#1/gate width}-\ctikzvalof{tripoles/#1/base width}+0.5*(#2))*\pgf@circ@res@left} |
| 3577 |
\pgfsetcornersarced{\pgfpoint{-0.2\pgf@circ@res@temp}{-0.2\pgf@circ@res@temp}} |
| 3578 |
\pgfpathmoveto{\pgfpoint |
| 3579 |
{\pgf@circ@res@other+\pgf@circ@res@temp} |
| 3580 |
{1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}} |
| 3581 |
\pgfpathlineto{\pgfpoint |
| 3582 |
{\pgf@circ@res@other+\pgf@circ@res@temp} |
| 3583 |
{0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}} |
| 3584 |
\pgfpathlineto{\pgfpoint |
| 3585 |
{\pgf@circ@res@other-\pgf@circ@res@temp} |
| 3586 |
{0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}} |
| 3587 |
\pgfpathlineto{\pgfpoint |
| 3588 |
{\pgf@circ@res@other-\pgf@circ@res@temp} |
| 3589 |
{1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}} |
| 3590 |
\pgfusepath{draw} |
| 3591 |
\endpgfscope\fi |
| 3592 |
} |
| 3593 |
|
| 3594 |
\ctikzset{tr gap fill/.initial=none} |
| 3595 |
\tikzset{tr gap fill/.style={\circuitikzbasekey/tr gap fill={#1}}} |
| 3596 |
% fill the gap in relevant transistors |
| 3597 |
\def\pgfcirc@fillgategap#1{% #1 transistor type |
| 3598 |
\edef\@@@none{none}\edef\@@@color{\ctikzvalof{tr gap fill}}% always exists |
| 3599 |
\ifx\@@@none\@@@color\relax\else |
| 3600 |
\begingroup % save the value of @res: other, step, temp |
| 3601 |
\edef\@@@doit{1}% draw it, set to zero if we give up |
| 3602 |
% ok, we have the color here. we have to get center position, with and height |
| 3603 |
% normally is gate height; but in igbt is outer base height (grrrr) |
| 3604 |
\pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/outer base height}{ |
| 3605 |
% yes, it's an IGBT |
| 3606 |
\pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/outer base height}*\pgf@circ@res@up} |
| 3607 |
}{ |
| 3608 |
%no. Let's try with gate height |
| 3609 |
\pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate height}{ |
| 3610 |
% yes, go for it |
| 3611 |
\pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/gate height}*\pgf@circ@res@up} |
| 3612 |
}{ |
| 3613 |
%no, give up, let value to 0 |
| 3614 |
\edef\@@@doit{0} |
| 3615 |
} |
| 3616 |
} |
| 3617 |
% now we have to find x1 and x2: these are base width and gate width |
| 3618 |
% if do not have one of that, bail out. |
| 3619 |
\pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{ |
| 3620 |
\pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{tripoles/#1/gate width}*\pgf@circ@res@left} |
| 3621 |
}{ |
| 3622 |
\edef\@@@doit{0} |
| 3623 |
} |
| 3624 |
\pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/base width}{ |
| 3625 |
\pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left} |
| 3626 |
}{ |
| 3627 |
\edef\@@@doit{0} |
| 3628 |
} |
| 3629 |
% if found, draw it. |
| 3630 |
\ifnum\@@@doit>0\relax |
| 3631 |
\pgfscope |
| 3632 |
\pgfsetfillcolor{\@@@color} |
| 3633 |
\pgfsetcolor{\@@@color} |
| 3634 |
\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@other}} |
| 3635 |
\pgfusepath{fill, draw} |
| 3636 |
\endpgfscope |
| 3637 |
\fi |
| 3638 |
\endgroup |
| 3639 |
\fi |
| 3640 |
} |
| 3641 |
|
| 3642 |
\long\def\pgfcircdeclaretransistor#1#2#3{ |
| 3643 |
\pgfdeclareshape{#1} |
| 3644 |
{ |
| 3645 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} |
| 3646 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 3647 |
\savedmacro{\circlebase}{ |
| 3648 |
\pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}% |
| 3649 |
{% yes, we have it |
| 3650 |
\edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}% |
| 3651 |
}{% no, use default |
| 3652 |
\edef\circlebase{\ctikzvalof{transistor circle/default base in}} |
| 3653 |
}} |
| 3654 |
% \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}} |
| 3655 |
\savedmacro{\scalecircleradius}{ |
| 3656 |
\edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}} |
| 3657 |
} |
| 3658 |
\saveddimen{\circleradius}{ |
| 3659 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3660 |
% repeat the extrabodydiodelen (grrr) |
| 3661 |
\ifpgf@circuit@fet@bodydiode |
| 3662 |
% try to put the text to the right of the flyback diode |
| 3663 |
\pgfmathsetlength{\pgf@circ@res@other}{( |
| 3664 |
\ctikzvalof{tripoles/#1/bodydiode distance}* |
| 3665 |
\ctikzvalof{tripoles/#1/width} + |
| 3666 |
\ctikzvalof{tripoles/#1/bodydiode scale}* |
| 3667 |
\ctikzvalof{bipoles/diode/height}/2 |
| 3668 |
)*\pgf@circ@scaled@Rlen} |
| 3669 |
\else |
| 3670 |
\pgf@circ@res@other=0pt\relax |
| 3671 |
\fi |
| 3672 |
% left |
| 3673 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3674 |
\pgf@xa=\circlebase\pgf@xa % this is the base point of the circle |
| 3675 |
% northeast |
| 3676 |
\pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle |
| 3677 |
\pgf@yb=.5\pgf@yb |
| 3678 |
\pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle |
| 3679 |
% |
| 3680 |
\pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle |
| 3681 |
% find the radius of the circle |
| 3682 |
\pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius} |
| 3683 |
} |
| 3684 |
\saveddimen{\circleleft}{ |
| 3685 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3686 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3687 |
\pgf@x=\circlebase\pgf@xa |
| 3688 |
} |
| 3689 |
\savedanchor{\textanchor}{ |
| 3690 |
%% \northeast |
| 3691 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3692 |
\pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen |
| 3693 |
\pgf@y=.5\pgf@y |
| 3694 |
\pgf@x=0pt |
| 3695 |
% extrabodydiodelen computed here |
| 3696 |
\ifpgf@circuit@transisors@fixlabels |
| 3697 |
% \typeout{DEBUG: Saving base text anchor for transistors, with fix} |
| 3698 |
\pgf@circ@res@other=0pt\relax |
| 3699 |
\ifpgf@circuit@fet@bodydiode |
| 3700 |
% try to put the text to the right of the flyback diode |
| 3701 |
\pgfmathsetlength{\pgf@circ@res@other}{( |
| 3702 |
\ctikzvalof{tripoles/#1/bodydiode distance}* |
| 3703 |
\ctikzvalof{tripoles/#1/width} + |
| 3704 |
\ctikzvalof{tripoles/#1/bodydiode scale}* |
| 3705 |
\ctikzvalof{bipoles/diode/height}/2 |
| 3706 |
)*\pgf@circ@scaled@Rlen} |
| 3707 |
\fi |
| 3708 |
\ifpgf@circ@trcircle |
| 3709 |
% in this case, the offset that wins is the circle one |
| 3710 |
% left |
| 3711 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3712 |
\pgf@xa=\circlebase\pgf@xa % this is the base point of the circle |
| 3713 |
% northeast |
| 3714 |
\pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle |
| 3715 |
\pgf@yb=.5\pgf@yb |
| 3716 |
\pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle |
| 3717 |
% |
| 3718 |
\pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle |
| 3719 |
% find the position of the text as 2*\circleradius+ \circleleft |
| 3720 |
\pgfmathsetlength{\pgf@circ@res@other}{2*((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius + \pgf@xa} |
| 3721 |
\fi |
| 3722 |
\pgf@x=\pgf@circ@res@other |
| 3723 |
\advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax |
| 3724 |
\ifpgf@circ@center@text |
| 3725 |
\pgf@y=0pt |
| 3726 |
\else % if the text is not on the center line, can be up or down |
| 3727 |
\ifpgf@circ@trcircle |
| 3728 |
\pgf@y = 0.7\pgf@y |
| 3729 |
\advance \pgf@y by 0.3\pgf@x |
| 3730 |
\pgf@x = 0.7\pgf@x |
| 3731 |
\else |
| 3732 |
\pgf@y=0.7\pgf@y |
| 3733 |
\fi |
| 3734 |
\ifpgf@circ@up@text\else\pgf@y=-\pgf@y\fi |
| 3735 |
\fi |
| 3736 |
\advance\pgf@y by \dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 3737 |
\else % fixlabels; legacy transistor text here |
| 3738 |
% \typeout{DEBUG: Saving base text anchor for transistors, without fix} |
| 3739 |
\pgf@y=.7\pgf@y |
| 3740 |
\pgf@x= \pgf@circ@scaled@Rlen |
| 3741 |
\pgf@x=0.1\pgf@x |
| 3742 |
\fi |
| 3743 |
} |
| 3744 |
\anchor{circle center}{ |
| 3745 |
\pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius |
| 3746 |
} |
| 3747 |
\anchor{circle top}{ |
| 3748 |
\pgf@y=\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius |
| 3749 |
} |
| 3750 |
\anchor{circle bottom}{ |
| 3751 |
\pgf@y=-\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius |
| 3752 |
} |
| 3753 |
\anchor{circle left}{ |
| 3754 |
\pgf@y=0pt\pgf@x=\circleleft |
| 3755 |
} |
| 3756 |
\anchor{circle right}{ |
| 3757 |
\pgf@y=0pt\pgf@x=\circleleft |
| 3758 |
\advance\pgf@x by \circleradius\advance\pgf@x by \circleradius |
| 3759 |
} |
| 3760 |
\savedanchor{\centergap}{% this is the center position between gate and base |
| 3761 |
% get "left" |
| 3762 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3763 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3764 |
\pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{ |
| 3765 |
% yes, we have a separated gate |
| 3766 |
\pgfmathsetlength{\pgf@x} |
| 3767 |
{0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width})*\pgf@xa} |
| 3768 |
}{ |
| 3769 |
% no, use just the base |
| 3770 |
\pgfmathsetlength{\pgf@x} |
| 3771 |
{\ctikzvalof{tripoles/#1/base width}*\pgf@xa} |
| 3772 |
} |
| 3773 |
\pgf@y=0pt\relax |
| 3774 |
} |
| 3775 |
\anchor{centergap}{\centergap} |
| 3776 |
\anchor{center}{ |
| 3777 |
\pgfpointorigin |
| 3778 |
} |
| 3779 |
\savedanchor\northeast{% upper right |
| 3780 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3781 |
\pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen |
| 3782 |
\pgf@y=.5\pgf@y |
| 3783 |
\pgf@x=0pt |
| 3784 |
} |
| 3785 |
\savedanchor\left{%center left |
| 3786 |
\pgf@y=0pt |
| 3787 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3788 |
\pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3789 |
} |
| 3790 |
\savedanchor\right{ |
| 3791 |
\pgf@x=0pt\pgf@y=0pt |
| 3792 |
\ifpgf@circ@trcircle |
| 3793 |
% repeat the \circleradius computation (GRRRR) |
| 3794 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 3795 |
% repeat the extrabodydiodelen (grrr) |
| 3796 |
\ifpgf@circuit@fet@bodydiode |
| 3797 |
% try to put the text to the right of the flyback diode |
| 3798 |
\pgfmathsetlength{\pgf@circ@res@other}{( |
| 3799 |
\ctikzvalof{tripoles/#1/bodydiode distance}* |
| 3800 |
\ctikzvalof{tripoles/#1/width} + |
| 3801 |
\ctikzvalof{tripoles/#1/bodydiode scale}* |
| 3802 |
\ctikzvalof{bipoles/diode/height}/2 |
| 3803 |
)*\pgf@circ@scaled@Rlen} |
| 3804 |
\else |
| 3805 |
\pgf@circ@res@other=0pt\relax |
| 3806 |
\fi |
| 3807 |
% left |
| 3808 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3809 |
\pgf@xa=\circlebase\pgf@xa % this is the base point of the circle |
| 3810 |
% northeast |
| 3811 |
\pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle |
| 3812 |
\pgf@yb=.5\pgf@yb |
| 3813 |
\pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle |
| 3814 |
% |
| 3815 |
\pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle |
| 3816 |
% find the radius of the circle |
| 3817 |
\pgfmathsetlength{\pgf@circ@res@other}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius} |
| 3818 |
% repeat the circleleft computation |
| 3819 |
\pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 3820 |
\pgf@xb=\circlebase\pgf@xa |
| 3821 |
\pgfmathsetlength{\pgf@x}{\pgf@xb+2*\pgf@circ@res@other} |
| 3822 |
\fi |
| 3823 |
} |
| 3824 |
\anchor{text}{\textanchor} |
| 3825 |
\anchor{pathstart}{ % south |
| 3826 |
\northeast |
| 3827 |
\pgf@y=-\pgf@y |
| 3828 |
} |
| 3829 |
\anchor{pathend}{ |
| 3830 |
\northeast |
| 3831 |
} |
| 3832 |
\anchor{north}{ |
| 3833 |
\northeast |
| 3834 |
\pgf@circ@res@step=\pgf@y |
| 3835 |
\left |
| 3836 |
\pgf@y=\pgf@circ@res@step |
| 3837 |
\pgf@x=.5\pgf@x |
| 3838 |
} |
| 3839 |
\anchor{west}{ |
| 3840 |
\left |
| 3841 |
} |
| 3842 |
\anchor{left}{ |
| 3843 |
\left |
| 3844 |
} |
| 3845 |
\anchor{east}{ |
| 3846 |
\northeast |
| 3847 |
\pgf@y=0pt |
| 3848 |
} |
| 3849 |
\anchor{right}{ |
| 3850 |
\right |
| 3851 |
} |
| 3852 |
\anchor{south}{ |
| 3853 |
\northeast |
| 3854 |
\pgf@circ@res@step=\pgf@y |
| 3855 |
\left |
| 3856 |
\pgf@y=-\pgf@circ@res@step |
| 3857 |
\pgf@x=.5\pgf@x |
| 3858 |
} |
| 3859 |
\anchor{south west}{ |
| 3860 |
\northeast |
| 3861 |
\pgf@circ@res@step=\pgf@y |
| 3862 |
\left |
| 3863 |
\pgf@y=-\pgf@circ@res@step |
| 3864 |
} |
| 3865 |
\anchor{north east}{ |
| 3866 |
\northeast |
| 3867 |
} |
| 3868 |
\anchor{north west}{ |
| 3869 |
\northeast |
| 3870 |
\pgf@circ@res@step=\pgf@y |
| 3871 |
\left |
| 3872 |
\pgf@y=\pgf@circ@res@step |
| 3873 |
} |
| 3874 |
\anchor{south east}{ |
| 3875 |
\northeast |
| 3876 |
\pgf@y=-\pgf@y |
| 3877 |
} |
| 3878 |
\anchor{B}{ |
| 3879 |
\northeast |
| 3880 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3881 |
\left |
| 3882 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3883 |
} |
| 3884 |
\anchor{base}{ |
| 3885 |
\northeast |
| 3886 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3887 |
\left |
| 3888 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3889 |
} |
| 3890 |
\anchor{bulk}{ %added by Burak Kelleci |
| 3891 |
\northeast |
| 3892 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3893 |
\right |
| 3894 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3895 |
} |
| 3896 |
\anchor{nobulk}{ %added by Burak Kelleci |
| 3897 |
\left |
| 3898 |
\pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 3899 |
} |
| 3900 |
\anchor{G}{ |
| 3901 |
\northeast |
| 3902 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3903 |
\left |
| 3904 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3905 |
} |
| 3906 |
\anchor{G1}{ |
| 3907 |
\northeast |
| 3908 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3909 |
\left |
| 3910 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3911 |
} |
| 3912 |
\anchor{G2}{ |
| 3913 |
\northeast |
| 3914 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3915 |
\pgf@circ@res@step=-0.3333333\pgf@circ@res@step |
| 3916 |
\left |
| 3917 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3918 |
} |
| 3919 |
\anchor{gate}{ |
| 3920 |
\northeast |
| 3921 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3922 |
\left |
| 3923 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3924 |
} |
| 3925 |
\anchor{gate1}{ |
| 3926 |
\northeast |
| 3927 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3928 |
\left |
| 3929 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3930 |
} |
| 3931 |
\anchor{gate2}{ |
| 3932 |
\northeast |
| 3933 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 3934 |
\pgf@circ@res@step=-0.3333333\pgf@circ@res@step |
| 3935 |
\left |
| 3936 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step |
| 3937 |
} |
| 3938 |
\anchor{nobase}{ |
| 3939 |
\left |
| 3940 |
\pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 3941 |
} |
| 3942 |
\anchor{circle base}{ |
| 3943 |
\left |
| 3944 |
\pgf@x=\circlebase\pgf@x |
| 3945 |
} |
| 3946 |
\anchor{nogate}{ |
| 3947 |
\left |
| 3948 |
\pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x |
| 3949 |
} |
| 3950 |
\anchor{E}{ |
| 3951 |
\northeast |
| 3952 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3953 |
} |
| 3954 |
\anchor{emitter}{ |
| 3955 |
\northeast |
| 3956 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3957 |
} |
| 3958 |
\anchor{C}{ |
| 3959 |
\northeast |
| 3960 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3961 |
} |
| 3962 |
\anchor{collector}{ |
| 3963 |
\northeast |
| 3964 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3965 |
} |
| 3966 |
\anchor{S}{ |
| 3967 |
\northeast |
| 3968 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3969 |
} |
| 3970 |
\anchor{source}{ |
| 3971 |
\northeast |
| 3972 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3973 |
} |
| 3974 |
\anchor{D}{ |
| 3975 |
\northeast |
| 3976 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3977 |
} |
| 3978 |
\anchor{drain}{ |
| 3979 |
\northeast |
| 3980 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3981 |
} |
| 3982 |
\anchor{body C in}{ |
| 3983 |
\northeast |
| 3984 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 3985 |
\pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y |
| 3986 |
} |
| 3987 |
\anchor{circle C}{ |
| 3988 |
\left |
| 3989 |
\pgf@xa=\circlebase\pgf@x % this is #1 of the circle |
| 3990 |
\northeast |
| 3991 |
\pgf@xb=\pgf@x %this is #2 of the circle |
| 3992 |
\pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle |
| 3993 |
% the base of the triangle is x_2 - x_1 - r |
| 3994 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} |
| 3995 |
% so let's go with the height |
| 3996 |
\pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} |
| 3997 |
% finally, direction |
| 3998 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya |
| 3999 |
} |
| 4000 |
\anchor{circle E}{ |
| 4001 |
\left |
| 4002 |
\pgf@xa=\circlebase\pgf@x % this is #1 of the circle |
| 4003 |
\northeast |
| 4004 |
\pgf@xb=\pgf@x %this is #2 of the circle |
| 4005 |
\pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle |
| 4006 |
% the base of the triangle is x_2 - x_1 - r |
| 4007 |
\pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius} |
| 4008 |
% so let's go with the height |
| 4009 |
\pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))} |
| 4010 |
% finally, direction |
| 4011 |
% finally, direction |
| 4012 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya |
| 4013 |
} |
| 4014 |
\anchor{body E in}{ |
| 4015 |
\northeast |
| 4016 |
\pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 4017 |
\pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y |
| 4018 |
} |
| 4019 |
\anchor{body C out}{ |
| 4020 |
\northeast |
| 4021 |
\pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 4022 |
\pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya |
| 4023 |
\pgf@y=\pgf@ya |
| 4024 |
\left |
| 4025 |
\pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x |
| 4026 |
\pgf@y=\pgf@ya |
| 4027 |
} |
| 4028 |
\anchor{body E out}{ |
| 4029 |
\northeast |
| 4030 |
\pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 4031 |
\pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya |
| 4032 |
\pgf@y=\pgf@ya |
| 4033 |
\left |
| 4034 |
\pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x |
| 4035 |
\pgf@y=\pgf@ya |
| 4036 |
} |
| 4037 |
#2% |
| 4038 |
\pgf@circ@draw@component{ |
| 4039 |
\pgftransformationadjustments |
| 4040 |
\pgf@circ@setcolor |
| 4041 |
% |
| 4042 |
\ifnum \ctikzvalof{tripoles/#1/curr direction} > 0 |
| 4043 |
\pgf@circuit@trans@ntypetrue |
| 4044 |
\else |
| 4045 |
\pgf@circuit@trans@ntypefalse |
| 4046 |
\fi |
| 4047 |
\northeast |
| 4048 |
\pgf@circ@res@up = \pgf@y |
| 4049 |
\pgf@circ@res@down = -\pgf@y |
| 4050 |
\pgf@circ@res@right = \pgf@x |
| 4051 |
\left |
| 4052 |
\pgf@circ@res@left = \pgf@x |
| 4053 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 4054 |
% |
| 4055 |
#3% |
| 4056 |
% BODY DIODE |
| 4057 |
\ifpgf@circuit@fet@bodydiode |
| 4058 |
\drawbodydiode{#1} |
| 4059 |
\fi |
| 4060 |
% |
| 4061 |
} |
| 4062 |
} |
| 4063 |
} |
| 4064 |
|
| 4065 |
\def\drawdobydiodedot#1#2{ |
| 4066 |
% retrieve dot scale |
| 4067 |
\edef\@@tmp{\ctikzvalof{transistor bodydiode/dot scale}} |
| 4068 |
\ifdim\@@tmp pt>0pt |
| 4069 |
\pgfscope |
| 4070 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right} |
| 4071 |
{\ctikzvalof{tripoles/#1/bodydiode conn}#2}} |
| 4072 |
\pgftransformscale{\@@tmp} |
| 4073 |
% I'm not sure why this is needed, but... |
| 4074 |
\pgf@circ@maybe@color{transistor bodydiode/color} |
| 4075 |
\pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}} |
| 4076 |
\endpgfscope |
| 4077 |
\fi |
| 4078 |
} |
| 4079 |
|
| 4080 |
\long\def\drawbodydiode#1{ |
| 4081 |
\pgfsetlinewidth{\ctikzvalof{transistor bodydiode/relative thickness}\pgflinewidth} |
| 4082 |
\pgf@circ@subset@color@dash{transistor bodydiode} |
| 4083 |
\pgfscope |
| 4084 |
\pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4085 |
\pgftransformrotate{90} |
| 4086 |
% diode scale and bodydiode scale interacts. We want the size of the diode |
| 4087 |
% proportional to the transistor, so we will: |
| 4088 |
% 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale |
| 4089 |
\pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}} |
| 4090 |
\pgftransformscale{\@@BDscale} |
| 4091 |
\ifpgf@circuit@fulldiode |
| 4092 |
% I'm not sure why this is needed, but... |
| 4093 |
\pgf@circ@maybe@color{transistor bodydiode/color} |
| 4094 |
\pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} |
| 4095 |
\else |
| 4096 |
\pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} |
| 4097 |
\fi |
| 4098 |
\endpgfscope |
| 4099 |
% Draw stroke line |
| 4100 |
\ifpgf@circuit@strokediode |
| 4101 |
\pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}} |
| 4102 |
\pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} |
| 4103 |
\pgfusepath{stroke} |
| 4104 |
\fi |
| 4105 |
%Draw upper connection to body diode |
| 4106 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} |
| 4107 |
{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} |
| 4108 |
\pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left} |
| 4109 |
{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}} |
| 4110 |
\pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}} |
| 4111 |
\pgfusepath{draw} |
| 4112 |
\drawdobydiodedot{#1}{\pgf@circ@res@up} |
| 4113 |
%Draw lower connection to body diode |
| 4114 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} |
| 4115 |
{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} |
| 4116 |
\pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}} |
| 4117 |
\pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}} |
| 4118 |
\pgfusepath{draw} |
| 4119 |
\drawdobydiodedot{#1}{\pgf@circ@res@down} |
| 4120 |
} |
| 4121 |
|
| 4122 |
\long\def\declarebpt#1{ |
| 4123 |
\pgfcircdeclaretransistor{#1}{ |
| 4124 |
\anchor{inner up}{ |
| 4125 |
\northeast |
| 4126 |
\pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y |
| 4127 |
} |
| 4128 |
\anchor{inner down}{ |
| 4129 |
\northeast |
| 4130 |
\pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y |
| 4131 |
} |
| 4132 |
\anchor{arrows}{ |
| 4133 |
\northeast |
| 4134 |
\pgf@circ@res@up = \pgf@y |
| 4135 |
\left |
| 4136 |
\pgf@circ@res@left = \pgf@x |
| 4137 |
\pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left |
| 4138 |
\advance\pgf@x by 0.6\pgf@circ@res@left |
| 4139 |
\pgf@y=0.2\pgf@circ@res@up |
| 4140 |
} |
| 4141 |
}{ |
| 4142 |
% add the circle if requested (before everything else, so we can fill it) |
| 4143 |
\pgfcirc@transistorcircle |
| 4144 |
|
| 4145 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4146 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4147 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} |
| 4148 |
\pgfpathlineto{\pgfpoint |
| 4149 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4150 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}} |
| 4151 |
\pgfusepath{draw} |
| 4152 |
|
| 4153 |
% drawing base |
| 4154 |
\pgfscope |
| 4155 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 4156 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 4157 |
\pgfpathmoveto{\pgfpoint |
| 4158 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4159 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} |
| 4160 |
\pgfpathlineto{\pgfpoint |
| 4161 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4162 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 4163 |
\ifpgf@circuit@bpt@schottky |
| 4164 |
% upper |
| 4165 |
\pgfpathmoveto{\pgfpoint |
| 4166 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4167 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} |
| 4168 |
\pgfpathlineto{\pgfpoint |
| 4169 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4170 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ |
| 4171 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4172 |
\pgfpathlineto{\pgfpoint |
| 4173 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ |
| 4174 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4175 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+ |
| 4176 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4177 |
\pgfpathlineto{\pgfpoint |
| 4178 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+ |
| 4179 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4180 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} |
| 4181 |
% % lower |
| 4182 |
\pgfpathmoveto{\pgfpoint |
| 4183 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4184 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 4185 |
\pgfpathlineto{\pgfpoint |
| 4186 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4187 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- |
| 4188 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4189 |
\pgfpathlineto{\pgfpoint |
| 4190 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- |
| 4191 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4192 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down- |
| 4193 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4194 |
\pgfpathlineto{\pgfpoint |
| 4195 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left- |
| 4196 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4197 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 4198 |
\fi |
| 4199 |
\pgfusepath{draw} |
| 4200 |
\endpgfscope |
| 4201 |
|
| 4202 |
\pgfpathmoveto{\pgfpoint |
| 4203 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4204 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}} |
| 4205 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4206 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 4207 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4208 |
\pgfusepath{draw} |
| 4209 |
%draw arrow depending on type of transistor |
| 4210 |
\pgfscope |
| 4211 |
\pgfslopedattimetrue |
| 4212 |
\pgfallowupsidedownattimetrue |
| 4213 |
\pgfresetnontranslationattimefalse |
| 4214 |
\edef\@@anchor{center} |
| 4215 |
\ifpgf@circuit@trans@ntype |
| 4216 |
\ifpgf@circuit@trans@arrowatend |
| 4217 |
\edef\@@anchor{btip} |
| 4218 |
\pgftransformlineattime{1.0}{% |
| 4219 |
\pgfpoint% |
| 4220 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4221 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% |
| 4222 |
}{% |
| 4223 |
\pgfpoint{\pgf@circ@res@right}% |
| 4224 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% |
| 4225 |
} |
| 4226 |
\else |
| 4227 |
\pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% |
| 4228 |
\pgfpoint% |
| 4229 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4230 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}% |
| 4231 |
}{% |
| 4232 |
\pgfpoint{\pgf@circ@res@right}% |
| 4233 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}% |
| 4234 |
} |
| 4235 |
\fi |
| 4236 |
\else % p-type |
| 4237 |
\ifpgf@circuit@trans@arrowatend |
| 4238 |
\edef\@@anchor{tip} |
| 4239 |
\pgftransformlineattime{1.0}{% |
| 4240 |
\pgfpoint{\pgf@circ@res@right}% |
| 4241 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% |
| 4242 |
}{% |
| 4243 |
\pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4244 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% |
| 4245 |
} |
| 4246 |
\else |
| 4247 |
\pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{% |
| 4248 |
\pgfpoint{\pgf@circ@res@right}% |
| 4249 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}% |
| 4250 |
}{% |
| 4251 |
\pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4252 |
{\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}% |
| 4253 |
} |
| 4254 |
\fi |
| 4255 |
\fi |
| 4256 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 4257 |
\endpgfscope |
| 4258 |
|
| 4259 |
\ifpgf@circuit@bpt@drawphoto |
| 4260 |
\pgfscope |
| 4261 |
\pgf@circ@fill@strokecolor |
| 4262 |
\pgf@circ@set@optoarrow@style |
| 4263 |
\pgfpathmoveto{\pgfpoint |
| 4264 |
{(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left} |
| 4265 |
{0.3\pgf@circ@res@up}} |
| 4266 |
\pgfpathlineto{\pgfpoint |
| 4267 |
{(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left} |
| 4268 |
{0.1\pgf@circ@res@up}} |
| 4269 |
\pgfusepath{draw} |
| 4270 |
\pgfpathmoveto{\pgfpoint |
| 4271 |
{(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left} |
| 4272 |
{0.1\pgf@circ@res@up}} |
| 4273 |
\pgfpathlineto{\pgfpoint |
| 4274 |
{(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left} |
| 4275 |
{-0.1\pgf@circ@res@up}} |
| 4276 |
\pgfusepath{draw} |
| 4277 |
\endpgfscope |
| 4278 |
\else |
| 4279 |
\ifpgf@circuit@bpt@drawbase |
| 4280 |
\pgfpathmoveto{\pgfpoint |
| 4281 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4282 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4283 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4284 |
\pgfusepath{draw} |
| 4285 |
\fi |
| 4286 |
\fi |
| 4287 |
} |
| 4288 |
} |
| 4289 |
|
| 4290 |
\declarebpt{npn} |
| 4291 |
\declarebpt{pnp} |
| 4292 |
% |
| 4293 |
% multi-emitter and multi-collector BJTs by Romano Giannetti |
| 4294 |
% |
| 4295 |
\def\pgf@circ@bjt@C@anchor#1{% #1: collector number |
| 4296 |
\pgfextractx{\pgf@circ@res@temp}{\basedimension} |
| 4297 |
\pgfextracty{\pgf@circ@res@other}{\basedimension} |
| 4298 |
\ifnum\cdir>0 % NPN, above |
| 4299 |
\pgfpoint{\pgf@circ@res@temp}{% |
| 4300 |
\pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} |
| 4301 |
\else % PNP, below |
| 4302 |
\pgfpoint{\pgf@circ@res@temp}{% |
| 4303 |
-\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} |
| 4304 |
\fi |
| 4305 |
} |
| 4306 |
\def\pgf@circ@bjt@E@anchor#1{% #1: collector number |
| 4307 |
\pgfextractx{\pgf@circ@res@temp}{\basedimension} |
| 4308 |
\pgfextracty{\pgf@circ@res@other}{\basedimension} |
| 4309 |
\ifnum\cdir<0 % PNP, above |
| 4310 |
\pgfpoint{\pgf@circ@res@temp}{% |
| 4311 |
\pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep} |
| 4312 |
\else % PNP, below |
| 4313 |
\pgfpoint{\pgf@circ@res@temp}{% |
| 4314 |
-\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep} |
| 4315 |
\fi |
| 4316 |
} |
| 4317 |
|
| 4318 |
\long\def\declarebjt#1{ |
| 4319 |
\pgfdeclareshape{bjt#1}{ |
| 4320 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}} |
| 4321 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 4322 |
% \cdir is 1 for npn, -1 for pnp |
| 4323 |
\savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}} |
| 4324 |
\savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}} |
| 4325 |
\savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}} |
| 4326 |
% step up or down for the additional C/Es |
| 4327 |
\saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{% |
| 4328 |
\ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* |
| 4329 |
\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} |
| 4330 |
\saveddimen{\external}{\pgfmathsetlength{\pgf@x}{% |
| 4331 |
\ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}} |
| 4332 |
\savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1 |
| 4333 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4334 |
\pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4335 |
\pgf@y=.5\pgf@y |
| 4336 |
\pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen |
| 4337 |
\pgf@x=.5\pgf@x |
| 4338 |
} |
| 4339 |
\savedanchor\northeast{% upper right |
| 4340 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4341 |
\pgfmathsetlength{\pgf@circ@res@step}{% |
| 4342 |
\ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* |
| 4343 |
\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4344 |
\ifnum\cdir> 0 |
| 4345 |
\edef\numup{\numC}\edef\numdown{\numE} |
| 4346 |
\else |
| 4347 |
\edef\numup{\numE}\edef\numdown{\numC} |
| 4348 |
\fi |
| 4349 |
\pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4350 |
+ (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth |
| 4351 |
+ \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4352 |
\pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen |
| 4353 |
\pgf@x=.5\pgf@x |
| 4354 |
} |
| 4355 |
\savedanchor\southeast{% lower right |
| 4356 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4357 |
\pgfmathsetlength{\pgf@circ@res@step}{% |
| 4358 |
\ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* |
| 4359 |
\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4360 |
\ifnum\cdir> 0 |
| 4361 |
\edef\numup{\numC}\edef\numdown{\numE} |
| 4362 |
\else |
| 4363 |
\edef\numup{\numE}\edef\numdown{\numC} |
| 4364 |
\fi |
| 4365 |
\pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4366 |
- (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth |
| 4367 |
- \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4368 |
\pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen |
| 4369 |
\pgf@x=.5\pgf@x |
| 4370 |
} |
| 4371 |
\savedanchor\southwest{% lower left |
| 4372 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4373 |
\pgfmathsetlength{\pgf@circ@res@step}{% |
| 4374 |
\ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* |
| 4375 |
\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4376 |
\ifnum\cdir> 0 |
| 4377 |
\edef\numup{\numC}\edef\numdown{\numE} |
| 4378 |
\else |
| 4379 |
\edef\numup{\numE}\edef\numdown{\numC} |
| 4380 |
\fi |
| 4381 |
\pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4382 |
- (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth |
| 4383 |
- \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4384 |
\pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen |
| 4385 |
- \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4386 |
} |
| 4387 |
\anchor{center}{\pgfpointorigin} |
| 4388 |
\anchor{north}{\northeast\pgf@x=0cm\relax} |
| 4389 |
\anchor{east}{\northeast\pgf@y=0cm\relax} |
| 4390 |
\anchor{south}{\southwest\pgf@x=0cm\relax} |
| 4391 |
\anchor{west}{\southwest\pgf@y=0cm} |
| 4392 |
\anchor{north east}{\northeast} |
| 4393 |
\anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya} |
| 4394 |
\anchor{south west}{\southwest} |
| 4395 |
\anchor{south east}{\southeast} |
| 4396 |
\savedanchor{\textanchor}{% |
| 4397 |
%% \northeast |
| 4398 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4399 |
\pgfmathsetlength{\pgf@circ@res@step}{% |
| 4400 |
\ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}* |
| 4401 |
\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4402 |
\ifnum\cdir> 0 |
| 4403 |
\edef\numup{\numC}\edef\numdown{\numE} |
| 4404 |
\else |
| 4405 |
\edef\numup{\numE}\edef\numdown{\numC} |
| 4406 |
\fi |
| 4407 |
\pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen |
| 4408 |
\ifpgf@circ@center@text |
| 4409 |
\pgf@y=0pt |
| 4410 |
\pgf@x=.5\pgf@x |
| 4411 |
\else |
| 4412 |
\ifpgf@circ@up@text |
| 4413 |
\pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4414 |
+ (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth |
| 4415 |
+ \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4416 |
\else |
| 4417 |
\pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen |
| 4418 |
+ (\numdown-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth |
| 4419 |
+ \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen} |
| 4420 |
\pgf@y=-\pgf@y |
| 4421 |
\fi |
| 4422 |
\pgf@y=0.95\pgf@y |
| 4423 |
\fi |
| 4424 |
\advance\pgf@y by \dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 4425 |
} |
| 4426 |
\anchor{text}{\textanchor} |
| 4427 |
\anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} |
| 4428 |
\anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external} |
| 4429 |
\anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x} |
| 4430 |
% center of the base "bar" |
| 4431 |
\anchor{cbase}{\basedimension\pgf@x=-\pgf@x |
| 4432 |
\pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% |
| 4433 |
} |
| 4434 |
% geometrical centers |
| 4435 |
\anchor{vcenter}{\pgf@x=0cm\relax |
| 4436 |
\pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% |
| 4437 |
} |
| 4438 |
\anchor{gcenter}{% |
| 4439 |
\northeast\pgf@xa=0.5\pgf@x |
| 4440 |
\southwest\advance\pgf@xa by 0.5\pgf@x |
| 4441 |
\pgf@x=\pgf@xa |
| 4442 |
\pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}% |
| 4443 |
} |
| 4444 |
% external connections |
| 4445 |
\anchor{E}{ |
| 4446 |
\ifnum\cdir>0% npn, emitter down |
| 4447 |
\southeast |
| 4448 |
\else |
| 4449 |
\northeast |
| 4450 |
\fi |
| 4451 |
}% first emitter |
| 4452 |
\anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter |
| 4453 |
\anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi} |
| 4454 |
\anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi} |
| 4455 |
|
| 4456 |
\pgf@circ@draw@component{ |
| 4457 |
\pgftransformationadjustments |
| 4458 |
\pgf@circ@setcolor |
| 4459 |
% |
| 4460 |
% set the type and up and down number of connections |
| 4461 |
% |
| 4462 |
\ifnum\cdir> 0 |
| 4463 |
\pgf@circuit@trans@ntypetrue |
| 4464 |
\edef\numup{\numC} |
| 4465 |
\edef\numdown{\numE} |
| 4466 |
\else |
| 4467 |
\pgf@circuit@trans@ntypefalse |
| 4468 |
\edef\numup{\numE} |
| 4469 |
\edef\numdown{\numC} |
| 4470 |
\fi |
| 4471 |
\basedimension |
| 4472 |
\pgf@circ@res@up = \pgf@y |
| 4473 |
\pgf@circ@res@down = -\pgf@y |
| 4474 |
\pgf@circ@res@right = \pgf@x |
| 4475 |
\pgf@circ@res@left = -\pgf@x |
| 4476 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 4477 |
\pgf@circ@res@step=\multistep |
| 4478 |
% |
| 4479 |
% set arrow positions options |
| 4480 |
% |
| 4481 |
\edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}} |
| 4482 |
\ifpgf@circuit@trans@arrowatend |
| 4483 |
\edef\@@pos{1.0} |
| 4484 |
\ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit |
| 4485 |
\edef\@@anchor{btip} |
| 4486 |
\else |
| 4487 |
\edef\@@anchor{tip} |
| 4488 |
\fi |
| 4489 |
\fi |
| 4490 |
% |
| 4491 |
% Drawing upper connections |
| 4492 |
% |
| 4493 |
\pgfscope |
| 4494 |
\pgf@circ@count@a=\numup\relax |
| 4495 |
\pgfmathloop% |
| 4496 |
\ifnum\pgf@circ@count@a>0 |
| 4497 |
\advance\pgf@circ@count@a-1\relax |
| 4498 |
\pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% |
| 4499 |
\ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection |
| 4500 |
\pgfpathmoveto{\pgfpoint |
| 4501 |
{\pgf@circ@res@right}% |
| 4502 |
{\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% |
| 4503 |
\pgfpathlineto{\pgfpoint |
| 4504 |
{\pgf@circ@res@right}% |
| 4505 |
{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% |
| 4506 |
\else |
| 4507 |
\pgfpathmoveto{\pgfpoint |
| 4508 |
{\pgf@circ@res@right}% |
| 4509 |
{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}% |
| 4510 |
\fi |
| 4511 |
\pgfpathlineto{\pgfpoint |
| 4512 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% |
| 4513 |
{\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}% |
| 4514 |
\pgfsetroundcap % better when connecting to sloped lines |
| 4515 |
\pgfusepath{draw} |
| 4516 |
\ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow |
| 4517 |
\pgfscope |
| 4518 |
\pgfslopedattimetrue |
| 4519 |
\pgfallowupsidedownattimetrue |
| 4520 |
\pgfresetnontranslationattimefalse |
| 4521 |
\pgftransformlineattime{\@@pos}{% |
| 4522 |
\pgfpoint |
| 4523 |
{\pgf@circ@res@right}% |
| 4524 |
{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}% |
| 4525 |
}{\pgfpoint |
| 4526 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% |
| 4527 |
{\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}% |
| 4528 |
} |
| 4529 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 4530 |
\endpgfscope |
| 4531 |
\fi |
| 4532 |
\repeatpgfmathloop |
| 4533 |
\endpgfscope |
| 4534 |
% |
| 4535 |
% Drawing base |
| 4536 |
% |
| 4537 |
\pgfscope |
| 4538 |
\pgfpathmoveto{\pgfpoint |
| 4539 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4540 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} |
| 4541 |
\pgfpathlineto{\pgfpoint |
| 4542 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4543 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} |
| 4544 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 4545 |
\ifpgf@circuit@bpt@schottky |
| 4546 |
% upper |
| 4547 |
\pgfpathmoveto{\pgfpoint |
| 4548 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4549 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} |
| 4550 |
\pgfpathlineto{\pgfpoint |
| 4551 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4552 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ |
| 4553 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4554 |
\pgfpathlineto{\pgfpoint |
| 4555 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ |
| 4556 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4557 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+ |
| 4558 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4559 |
\pgfpathlineto{\pgfpoint |
| 4560 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+ |
| 4561 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4562 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}} |
| 4563 |
% lower |
| 4564 |
\pgfpathmoveto{\pgfpoint |
| 4565 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4566 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} |
| 4567 |
\pgfpathlineto{\pgfpoint |
| 4568 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4569 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- |
| 4570 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4571 |
\pgfpathlineto{\pgfpoint |
| 4572 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- |
| 4573 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4574 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep- |
| 4575 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}} |
| 4576 |
\pgfpathlineto{\pgfpoint |
| 4577 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left- |
| 4578 |
\ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen} |
| 4579 |
{\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}} |
| 4580 |
\fi |
| 4581 |
\pgfsetroundcap % I like it more... |
| 4582 |
\pgfusepath{draw} |
| 4583 |
\endpgfscope |
| 4584 |
% |
| 4585 |
% draw base external connection |
| 4586 |
% |
| 4587 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}} |
| 4588 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}} |
| 4589 |
\pgfusepath{draw} |
| 4590 |
% |
| 4591 |
% Drawing lower connections |
| 4592 |
% |
| 4593 |
\pgfscope |
| 4594 |
\pgf@circ@count@a=\numdown\relax |
| 4595 |
\pgfmathloop% |
| 4596 |
\ifnum\pgf@circ@count@a>0 |
| 4597 |
\advance\pgf@circ@count@a-1\relax |
| 4598 |
\pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}% |
| 4599 |
\pgfpathmoveto{\pgfpoint |
| 4600 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left} |
| 4601 |
{\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}} |
| 4602 |
\pgfpathlineto{\pgfpoint |
| 4603 |
{\pgf@circ@res@right} |
| 4604 |
{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}} |
| 4605 |
\ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection |
| 4606 |
\pgfpathlineto{\pgfpoint |
| 4607 |
{\pgf@circ@res@right} |
| 4608 |
{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}} |
| 4609 |
\fi |
| 4610 |
\pgfsetroundcap % better when connecting to sloped lines |
| 4611 |
\pgfusepath{draw} |
| 4612 |
\ifpgf@circuit@trans@ntype % it's a NPN; draw arrow |
| 4613 |
\pgfscope |
| 4614 |
\pgfslopedattimetrue |
| 4615 |
\pgfallowupsidedownattimetrue |
| 4616 |
\pgfresetnontranslationattimefalse |
| 4617 |
\pgftransformlineattime{\@@pos}{% |
| 4618 |
\pgfpoint |
| 4619 |
{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}% |
| 4620 |
{\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}% |
| 4621 |
}{\pgfpoint |
| 4622 |
{\pgf@circ@res@right}% |
| 4623 |
{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}% |
| 4624 |
} |
| 4625 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 4626 |
\endpgfscope |
| 4627 |
\fi |
| 4628 |
\repeatpgfmathloop |
| 4629 |
\endpgfscope |
| 4630 |
} |
| 4631 |
% \pgf@sh@s@<name of the shape here> contains all the code for the shape |
| 4632 |
% and is executed just before a node is drawn. |
| 4633 |
\expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{% |
| 4634 |
% Start with the maximum collector number and go backwards. |
| 4635 |
\pgf@circ@count@a=\numC\relax |
| 4636 |
\pgfmathloop% |
| 4637 |
\ifnum\pgf@circ@count@a>0 |
| 4638 |
% we will create two anchors per pin: the "normal one" like `pin 1` for the |
| 4639 |
% electrical contact, and the "border one" like `bpin 1` for labels. |
| 4640 |
% they will coincide if `external pins width` is set to 0. |
| 4641 |
\expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{% |
| 4642 |
\noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}% |
| 4643 |
} |
| 4644 |
\advance\pgf@circ@count@a by -1\relax% |
| 4645 |
\repeatpgfmathloop% |
| 4646 |
% and emitters |
| 4647 |
\pgf@circ@count@a=\numE\relax |
| 4648 |
\pgfmathloop% |
| 4649 |
\ifnum\pgf@circ@count@a>0 |
| 4650 |
% we will create two anchors per pin: the "normal one" like `pin 1` for the |
| 4651 |
% electrical contact, and the "border one" like `bpin 1` for labels. |
| 4652 |
% they will coincide if `external pins width` is set to 0. |
| 4653 |
\expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{% |
| 4654 |
\noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}% |
| 4655 |
} |
| 4656 |
\advance\pgf@circ@count@a by -1\relax% |
| 4657 |
\repeatpgfmathloop% |
| 4658 |
}% |
| 4659 |
} |
| 4660 |
} |
| 4661 |
|
| 4662 |
\declarebjt{npn} |
| 4663 |
\declarebjt{pnp} |
| 4664 |
|
| 4665 |
% end of multi-bjts |
| 4666 |
|
| 4667 |
\long\def\declareigbt#1{ |
| 4668 |
\pgfcircdeclaretransistor{#1}{ |
| 4669 |
\anchor{inner up}{ |
| 4670 |
\northeast |
| 4671 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 4672 |
} |
| 4673 |
\anchor{inner down}{ |
| 4674 |
\northeast |
| 4675 |
\pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 4676 |
} |
| 4677 |
\anchor{nobase}{ |
| 4678 |
\left |
| 4679 |
\pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x |
| 4680 |
} |
| 4681 |
} |
| 4682 |
{ |
| 4683 |
% add the circle if requested (before everything else, so we can fill it) |
| 4684 |
\pgfcirc@transistorcircle |
| 4685 |
% fill the gap color if requested |
| 4686 |
\pgfcirc@fillgategap{#1} |
| 4687 |
%draw upper connection |
| 4688 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4689 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4690 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 4691 |
\pgfpathlineto{\pgfpoint |
| 4692 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4693 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 4694 |
\pgfusepath{draw} |
| 4695 |
|
| 4696 |
%draw thicker gate lines |
| 4697 |
\pgfscope |
| 4698 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 4699 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 4700 |
\pgfscope |
| 4701 |
\pgfpathmoveto{\pgfpoint |
| 4702 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4703 |
{\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4704 |
\pgfpathlineto{\pgfpoint |
| 4705 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4706 |
{\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4707 |
% set the normal thickness |
| 4708 |
\edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}} |
| 4709 |
\pgfsetlinewidth{\@@extrat\pgflinewidth} |
| 4710 |
\pgfusepath{draw} |
| 4711 |
\endpgfscope |
| 4712 |
\pgfpathmoveto{\pgfpoint |
| 4713 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4714 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4715 |
\pgfpathlineto{\pgfpoint |
| 4716 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4717 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4718 |
\pgfusepath{draw} |
| 4719 |
\endpgfscope |
| 4720 |
%draw lower connection |
| 4721 |
\pgfpathmoveto{\pgfpoint |
| 4722 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4723 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} |
| 4724 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4725 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 4726 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4727 |
\pgfusepath{draw} |
| 4728 |
%draw arrow depending on type of transistor |
| 4729 |
\pgfscope |
| 4730 |
\pgfslopedattimetrue |
| 4731 |
\pgfallowupsidedownattimetrue |
| 4732 |
\pgfresetnontranslationattimefalse |
| 4733 |
\ifpgf@circuit@trans@arrowatend |
| 4734 |
\ifpgf@circuit@trans@ntype |
| 4735 |
\edef\@@anchor{btip}\edef\@@pos{1.0} |
| 4736 |
\else |
| 4737 |
\edef\@@anchor{tip}\edef\@@pos{1.0} |
| 4738 |
\fi |
| 4739 |
\else |
| 4740 |
\edef\@@anchor{center}\edef\@@pos{0.5} |
| 4741 |
\fi |
| 4742 |
\ifpgf@circuit@trans@ntype |
| 4743 |
\pgftransformlineattime{\@@pos}{% |
| 4744 |
\pgfpoint% |
| 4745 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4746 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% |
| 4747 |
}{% |
| 4748 |
\pgfpoint{\pgf@circ@res@right}% |
| 4749 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% |
| 4750 |
} |
| 4751 |
\else |
| 4752 |
\pgftransformlineattime{\@@pos}{% |
| 4753 |
\pgfpoint{\pgf@circ@res@right}% |
| 4754 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% |
| 4755 |
}{% |
| 4756 |
\pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4757 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% |
| 4758 |
} |
| 4759 |
\fi |
| 4760 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 4761 |
\endpgfscope |
| 4762 |
%draw gate |
| 4763 |
\ifpgf@circuit@bpt@drawgate |
| 4764 |
\ifpgf@circuit@trans@ntype |
| 4765 |
\pgfpathmoveto{\pgfpoint |
| 4766 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4767 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} |
| 4768 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% |
| 4769 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} |
| 4770 |
\else |
| 4771 |
\pgfpathmoveto{\pgfpoint |
| 4772 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4773 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} |
| 4774 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% |
| 4775 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} |
| 4776 |
\fi |
| 4777 |
\fi |
| 4778 |
\pgfusepath{draw} |
| 4779 |
} |
| 4780 |
} |
| 4781 |
|
| 4782 |
\declareigbt{pigbt} |
| 4783 |
\declareigbt{nigbt} |
| 4784 |
\declareigbt{Lnigbt} |
| 4785 |
\declareigbt{Lpigbt} |
| 4786 |
|
| 4787 |
% Graphene FET, See https://github.com/circuitikz/circuitikz/issues/496 |
| 4788 |
\long\def\declaregfet#1{ |
| 4789 |
\pgfcircdeclaretransistor{#1}{ |
| 4790 |
\anchor{inner up}{ |
| 4791 |
\northeast |
| 4792 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 4793 |
} |
| 4794 |
\anchor{inner down}{ |
| 4795 |
\northeast |
| 4796 |
\pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 4797 |
} |
| 4798 |
\anchor{outer hex up}{ |
| 4799 |
\left |
| 4800 |
\pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 4801 |
\northeast |
| 4802 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 4803 |
\pgf@x=-\pgf@xa |
| 4804 |
} |
| 4805 |
\anchor{outer hex down}{ |
| 4806 |
\left |
| 4807 |
\pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 4808 |
\northeast |
| 4809 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 4810 |
\pgf@y=-\pgf@y |
| 4811 |
\pgf@x=-\pgf@xa |
| 4812 |
} |
| 4813 |
\anchor{inner hex up}{ |
| 4814 |
\left |
| 4815 |
\pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 4816 |
\northeast |
| 4817 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 4818 |
\pgf@x=\pgf@xa |
| 4819 |
} |
| 4820 |
\anchor{inner hex down}{ |
| 4821 |
\left |
| 4822 |
\pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x |
| 4823 |
\northeast |
| 4824 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 4825 |
\pgf@y=-\pgf@y |
| 4826 |
\pgf@x=\pgf@xa |
| 4827 |
} |
| 4828 |
\anchor{right}{ |
| 4829 |
\northeast\pgf@y=0pt\relax |
| 4830 |
\pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}* |
| 4831 |
\ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen} |
| 4832 |
\advance \pgf@x by \pgf@xa |
| 4833 |
} |
| 4834 |
\savedanchor{\textanchor}{ |
| 4835 |
% need a different text: no circle, shift to the right |
| 4836 |
%% \northeast |
| 4837 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 4838 |
\pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen |
| 4839 |
\pgf@y=.5\pgf@y |
| 4840 |
\pgf@x=0pt |
| 4841 |
%% \gfettextoffset calculation here |
| 4842 |
\ifpgf@circuit@fet@bodydiode |
| 4843 |
% try to put the text to the right of the flyback diode |
| 4844 |
\pgfmathsetlength{\pgf@circ@res@other}{( |
| 4845 |
\ctikzvalof{tripoles/#1/bodydiode distance}* |
| 4846 |
\ctikzvalof{tripoles/#1/width} + |
| 4847 |
\ctikzvalof{tripoles/#1/bodydiode scale}* |
| 4848 |
\ctikzvalof{bipoles/diode/height}/2 |
| 4849 |
)*\pgf@circ@scaled@Rlen} |
| 4850 |
\else |
| 4851 |
\pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/base width}* |
| 4852 |
\ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen} |
| 4853 |
\fi |
| 4854 |
\ifpgf@circuit@transisors@fixlabels |
| 4855 |
\advance \pgf@x by \pgf@circ@res@other |
| 4856 |
\ifpgf@circ@center@text |
| 4857 |
\pgf@y=0pt |
| 4858 |
\else % if the text is not on the center line, can be up or down |
| 4859 |
\pgf@y=0.7\pgf@y |
| 4860 |
\ifpgf@circ@up@text\else\pgf@y=-\pgf@y\fi |
| 4861 |
\fi |
| 4862 |
\advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax |
| 4863 |
\advance\pgf@y by \dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 4864 |
\else |
| 4865 |
\pgf@y=.7\pgf@y |
| 4866 |
\pgf@x= \pgf@circ@scaled@Rlen |
| 4867 |
\pgf@x=0.1\pgf@x |
| 4868 |
\fi |
| 4869 |
} |
| 4870 |
\anchor{text}{\textanchor} |
| 4871 |
} |
| 4872 |
{ |
| 4873 |
% no circle for gfets (clearly!) |
| 4874 |
%draw upper connection to hexagon |
| 4875 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4876 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4877 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 4878 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right} |
| 4879 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 4880 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 4881 |
\pgfusepath{draw} |
| 4882 |
% draw (fillable) hexagon |
| 4883 |
\pgfscope |
| 4884 |
\pgfpathmoveto{\pgfpoint |
| 4885 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4886 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 4887 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4888 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 4889 |
\pgfpathlineto{\pgfpoint |
| 4890 |
{-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4891 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 4892 |
\pgfpathlineto{\pgfpoint |
| 4893 |
{-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4894 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} |
| 4895 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 4896 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 4897 |
\pgfpathlineto{\pgfpoint |
| 4898 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4899 |
{-\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 4900 |
\pgfpathclose |
| 4901 |
\pgf@circ@draworfill |
| 4902 |
\endpgfscope |
| 4903 |
%draw thicker gate lines |
| 4904 |
\pgfscope |
| 4905 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 4906 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 4907 |
\pgfscope |
| 4908 |
% draw the gate |
| 4909 |
\pgfpathmoveto{\pgfpoint |
| 4910 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4911 |
{\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4912 |
\pgfpathlineto{\pgfpoint |
| 4913 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4914 |
{\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4915 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 4916 |
\edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}} |
| 4917 |
\pgfsetlinewidth{\@@extrat\pgflinewidth} |
| 4918 |
\pgfusepath{draw} |
| 4919 |
\endpgfscope |
| 4920 |
% draw the base (channel) |
| 4921 |
\pgfpathmoveto{\pgfpoint |
| 4922 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4923 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4924 |
\pgfpathlineto{\pgfpoint |
| 4925 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 4926 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} |
| 4927 |
\pgfusepath{draw} |
| 4928 |
\endpgfscope |
| 4929 |
%draw arrow depending on type of transistor |
| 4930 |
\pgfscope |
| 4931 |
\pgfslopedattimetrue |
| 4932 |
\pgfallowupsidedownattimetrue |
| 4933 |
\pgfresetnontranslationattimefalse |
| 4934 |
\ifpgf@circuit@trans@arrowatend |
| 4935 |
\ifpgf@circuit@trans@ntype |
| 4936 |
\edef\@@anchor{btip}\edef\@@pos{1.0} |
| 4937 |
\else |
| 4938 |
\edef\@@anchor{tip}\edef\@@pos{1.0} |
| 4939 |
\fi |
| 4940 |
\else |
| 4941 |
\edef\@@anchor{center}\edef\@@pos{0.5} |
| 4942 |
\fi |
| 4943 |
\ifpgf@circuit@trans@ntype |
| 4944 |
\pgftransformlineattime{\@@pos}{% |
| 4945 |
\pgfpoint% |
| 4946 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4947 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}% |
| 4948 |
}{% |
| 4949 |
\pgfpoint{\pgf@circ@res@right}% |
| 4950 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}% |
| 4951 |
} |
| 4952 |
\else |
| 4953 |
\pgftransformlineattime{\@@pos}{% |
| 4954 |
\pgfpoint{\pgf@circ@res@right}% |
| 4955 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}% |
| 4956 |
}{% |
| 4957 |
\pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}% |
| 4958 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}% |
| 4959 |
} |
| 4960 |
\fi |
| 4961 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 4962 |
\endpgfscope |
| 4963 |
%draw gate |
| 4964 |
\ifpgf@circuit@trans@ntype |
| 4965 |
\pgfpathmoveto{\pgfpoint |
| 4966 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4967 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} |
| 4968 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% |
| 4969 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}} |
| 4970 |
\else |
| 4971 |
\pgfpathmoveto{\pgfpoint |
| 4972 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 4973 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} |
| 4974 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}% |
| 4975 |
{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}} |
| 4976 |
\fi |
| 4977 |
\pgfusepath{draw} |
| 4978 |
} |
| 4979 |
} |
| 4980 |
|
| 4981 |
\declaregfet{pgfet} |
| 4982 |
\declaregfet{ngfet} |
| 4983 |
|
| 4984 |
% Plain MOSes |
| 4985 |
|
| 4986 |
\def\pgfcirc@simplemos@drawbulk#1{% |
| 4987 |
\ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci |
| 4988 |
\ifpgf@circuit@trans@fdsoi % FDSOI added by Romano Giannetti |
| 4989 |
\pgfpathmoveto{\pgfpoint{0.4*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left} |
| 4990 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4991 |
\else |
| 4992 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left} |
| 4993 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4994 |
\fi |
| 4995 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} |
| 4996 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 4997 |
\pgfusepath{draw} |
| 4998 |
% back gate, with the same thickness than the main gate |
| 4999 |
\ifpgf@circuit@trans@fdsoi |
| 5000 |
\ifpgf@circuit@trans@fdsoidot |
| 5001 |
\pgfpathcircle{\pgfpoint |
| 5002 |
{0.4*\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5003 |
{\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 5004 |
\pgfusepath{draw,fill} |
| 5005 |
\else |
| 5006 |
\pgfscope |
| 5007 |
\pgfpathmoveto{\pgfpoint |
| 5008 |
{0.4*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{1.2*\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5009 |
\pgfpathlineto{\pgfpoint |
| 5010 |
{0.4*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{\pgf@circ@res@up+1.2*\pgf@circ@res@down}} |
| 5011 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5012 |
\pgfusepath{draw} |
| 5013 |
\endpgfscope |
| 5014 |
\fi |
| 5015 |
\fi |
| 5016 |
\fi |
| 5017 |
} |
| 5018 |
|
| 5019 |
|
| 5020 |
\pgfcircdeclaretransistor{nmos}{ |
| 5021 |
\anchor{inner up}{ |
| 5022 |
\northeast |
| 5023 |
\pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y |
| 5024 |
} |
| 5025 |
\anchor{inner down}{ |
| 5026 |
\northeast |
| 5027 |
\pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y |
| 5028 |
} |
| 5029 |
}{% |
| 5030 |
% add the circle if requested (before everything else, so we can fill it) |
| 5031 |
\pgfcirc@transistorcircle |
| 5032 |
% fill the gap color if requested |
| 5033 |
\pgfcirc@fillgategap{nmos} |
| 5034 |
|
| 5035 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5036 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5037 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} |
| 5038 |
\pgfpathlineto{\pgfpoint |
| 5039 |
{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} |
| 5040 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} |
| 5041 |
|
| 5042 |
\pgfpathmoveto{\pgfpoint |
| 5043 |
{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} |
| 5044 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} |
| 5045 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5046 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} |
| 5047 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5048 |
\pgfusepath{draw} |
| 5049 |
|
| 5050 |
\pgfscope |
| 5051 |
% draw the channel |
| 5052 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5053 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5054 |
\pgfpathmoveto{\pgfpoint |
| 5055 |
{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} |
| 5056 |
{\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}} |
| 5057 |
\pgfpathlineto{\pgfpoint |
| 5058 |
{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left} |
| 5059 |
{\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}} |
| 5060 |
\pgfusepath{draw} |
| 5061 |
\pgfscope |
| 5062 |
% draw the gate |
| 5063 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5064 |
\pgfpathmoveto{\pgfpoint |
| 5065 |
{\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} |
| 5066 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}} |
| 5067 |
\pgfpathlineto{\pgfpoint |
| 5068 |
{\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} |
| 5069 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}} |
| 5070 |
\pgfusepath{draw} |
| 5071 |
\endpgfscope |
| 5072 |
\endpgfscope |
| 5073 |
\ifpgf@circuit@mos@arrows |
| 5074 |
\pgfscope |
| 5075 |
\ifpgf@circuit@trans@arrowatend |
| 5076 |
\pgftransformshift{\pgfpoint |
| 5077 |
{\pgf@circ@res@right}% |
| 5078 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% |
| 5079 |
} |
| 5080 |
\pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} |
| 5081 |
\else |
| 5082 |
\pgfslopedattimetrue |
| 5083 |
\pgfallowupsidedownattimetrue |
| 5084 |
\pgfresetnontranslationattimefalse |
| 5085 |
\pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{% |
| 5086 |
\pgfpoint% |
| 5087 |
{\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}% |
| 5088 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% |
| 5089 |
}{% |
| 5090 |
\pgfpoint |
| 5091 |
{\pgf@circ@res@right}% |
| 5092 |
{\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}% |
| 5093 |
} |
| 5094 |
\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} |
| 5095 |
\fi |
| 5096 |
\endpgfscope |
| 5097 |
\fi |
| 5098 |
|
| 5099 |
\ifpgf@circuit@bpt@drawgate |
| 5100 |
\pgfpathmoveto{\pgfpoint |
| 5101 |
{\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left} |
| 5102 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5103 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5104 |
\pgfusepath{draw} |
| 5105 |
\fi |
| 5106 |
|
| 5107 |
\pgfcirc@simplemos@drawbulk{nmos} |
| 5108 |
\pgfcirc@ferroelectric{nmos}{0} |
| 5109 |
} |
| 5110 |
|
| 5111 |
\pgfcircdeclaretransistor{pmos}{ |
| 5112 |
\anchor{inner up}{ |
| 5113 |
\northeast |
| 5114 |
\pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y |
| 5115 |
} |
| 5116 |
\anchor{inner down}{ |
| 5117 |
\northeast |
| 5118 |
\pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y |
| 5119 |
} |
| 5120 |
}{% |
| 5121 |
% add the circle if requested (before everything else, so we can fill it) |
| 5122 |
\pgfcirc@transistorcircle |
| 5123 |
% fill the gap color if requested |
| 5124 |
\pgfcirc@fillgategap{nmos} |
| 5125 |
|
| 5126 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5127 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5128 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} |
| 5129 |
\pgfpathlineto{\pgfpoint |
| 5130 |
{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} |
| 5131 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} |
| 5132 |
\pgfusepath{draw} |
| 5133 |
|
| 5134 |
\ifpgf@circuit@mos@arrows |
| 5135 |
\pgfscope |
| 5136 |
\ifpgf@circuit@trans@arrowatend |
| 5137 |
\pgftransformshift{\pgfpoint |
| 5138 |
{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}% |
| 5139 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% |
| 5140 |
} |
| 5141 |
\pgftransformrotate{180} |
| 5142 |
\pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} |
| 5143 |
\else |
| 5144 |
\pgfslopedattimetrue |
| 5145 |
\pgfallowupsidedownattimetrue |
| 5146 |
\pgfresetnontranslationattimefalse |
| 5147 |
\pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{% |
| 5148 |
\pgfpoint% |
| 5149 |
{\pgf@circ@res@right}% |
| 5150 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% |
| 5151 |
}{% |
| 5152 |
\pgfpoint |
| 5153 |
{\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}% |
| 5154 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}% |
| 5155 |
} |
| 5156 |
\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} |
| 5157 |
\fi |
| 5158 |
\endpgfscope |
| 5159 |
\fi |
| 5160 |
|
| 5161 |
\pgfscope |
| 5162 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5163 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5164 |
% draw the channel |
| 5165 |
\pgfpathmoveto{\pgfpoint |
| 5166 |
{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} |
| 5167 |
{\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}} |
| 5168 |
\pgfpathlineto{\pgfpoint |
| 5169 |
{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} |
| 5170 |
{\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}} |
| 5171 |
\pgfusepath{draw} |
| 5172 |
\pgfscope |
| 5173 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5174 |
\pgfpathmoveto{\pgfpoint |
| 5175 |
{\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} |
| 5176 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}} |
| 5177 |
\pgfpathlineto{\pgfpoint |
| 5178 |
{\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} |
| 5179 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} |
| 5180 |
\pgfusepath{draw} |
| 5181 |
\endpgfscope |
| 5182 |
\endpgfscope |
| 5183 |
|
| 5184 |
\pgfpathmoveto{\pgfpoint |
| 5185 |
{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left} |
| 5186 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} |
| 5187 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5188 |
{\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}} |
| 5189 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5190 |
|
| 5191 |
|
| 5192 |
\pgfusepath{draw} |
| 5193 |
\ifpgf@circuit@bpt@drawgate |
| 5194 |
\pgfpathmoveto{\pgfpoint |
| 5195 |
{\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left} |
| 5196 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5197 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5198 |
\pgfusepath{draw} |
| 5199 |
\fi |
| 5200 |
|
| 5201 |
\ifpgf@circuit@pmos@nocircle\else |
| 5202 |
% we are not scaling the circle with the MOS --- I think it's better to have it |
| 5203 |
% coherent with the poles/nodes of the rest of the circuit. |
| 5204 |
\pgfpathcircle{\pgfpoint |
| 5205 |
{\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 5206 |
{\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 5207 |
\ifpgf@circuit@pmos@emptycircle |
| 5208 |
\pgfsetfillcolor{white} |
| 5209 |
\fi |
| 5210 |
\pgfusepath{draw,fill} |
| 5211 |
\fi |
| 5212 |
|
| 5213 |
\pgfcirc@simplemos@drawbulk{pmos} |
| 5214 |
\pgfcirc@ferroelectric{pmos}{0} |
| 5215 |
} |
| 5216 |
|
| 5217 |
%%% depletion MOSFET (simplified symbols) |
| 5218 |
|
| 5219 |
\long\def\pgfcirc@filldraw@depletion#1{% |
| 5220 |
\ifx\tikz@fillcolor\pgfutil@empty |
| 5221 |
% if there is no explicit fill check the specific key |
| 5222 |
\edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}% |
| 5223 |
\ifx\@@tmp\@@none % if it's none |
| 5224 |
\pgfusepath{draw}% |
| 5225 |
\else |
| 5226 |
\edef\@@default{default}% |
| 5227 |
\ifx\@@tmp\@@default % fill with the pen color |
| 5228 |
\pgf@circ@fill@strokecolor |
| 5229 |
\pgfusepath{draw, fill}% |
| 5230 |
\else |
| 5231 |
\pgfsetfillcolor{\@@tmp}% |
| 5232 |
\pgfusepath{draw, fill}% |
| 5233 |
\fi |
| 5234 |
\fi |
| 5235 |
\else |
| 5236 |
\pgfsetfillcolor{\tikz@fillcolor}% |
| 5237 |
\pgfusepath{draw, fill}% |
| 5238 |
\fi |
| 5239 |
} |
| 5240 |
|
| 5241 |
\pgfcircdeclaretransistor{nmosd}{ |
| 5242 |
\anchor{inner up}{ |
| 5243 |
\northeast |
| 5244 |
\pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y |
| 5245 |
} |
| 5246 |
\anchor{inner down}{ |
| 5247 |
\northeast |
| 5248 |
\pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y |
| 5249 |
} |
| 5250 |
\anchor{nobulk}{ %override |
| 5251 |
\left |
| 5252 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x |
| 5253 |
\pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x |
| 5254 |
\advance\pgf@x by -\pgf@circ@res@temp |
| 5255 |
} |
| 5256 |
}{% |
| 5257 |
% draw depletion channel |
| 5258 |
% add the circle if requested (before everything else, so we can fill it) |
| 5259 |
\pgfcirc@transistorcircle |
| 5260 |
% fill the gap color if requested |
| 5261 |
\pgfcirc@fillgategap{nmos} |
| 5262 |
\pgfscope |
| 5263 |
\pgfpathrectanglecorners |
| 5264 |
{\pgfpoint |
| 5265 |
{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} |
| 5266 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} |
| 5267 |
{\pgfpoint |
| 5268 |
{(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left} |
| 5269 |
{-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} |
| 5270 |
\pgfcirc@filldraw@depletion{nmosd} |
| 5271 |
\endpgfscope |
| 5272 |
% draw drain and source terminals |
| 5273 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5274 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} |
| 5275 |
\pgfpathlineto{\pgfpoint |
| 5276 |
{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} |
| 5277 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} |
| 5278 |
|
| 5279 |
\pgfpathmoveto{\pgfpoint |
| 5280 |
{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} |
| 5281 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} |
| 5282 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5283 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} |
| 5284 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5285 |
\pgfusepath{draw} |
| 5286 |
|
| 5287 |
\pgfscope |
| 5288 |
% draw the channel |
| 5289 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5290 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5291 |
\pgfpathmoveto{\pgfpoint |
| 5292 |
{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} |
| 5293 |
{\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}} |
| 5294 |
\pgfpathlineto{\pgfpoint |
| 5295 |
{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left} |
| 5296 |
{\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}} |
| 5297 |
\pgfusepath{draw} |
| 5298 |
\pgfscope |
| 5299 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5300 |
\pgfpathmoveto{\pgfpoint |
| 5301 |
{\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} |
| 5302 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}} |
| 5303 |
\pgfpathlineto{\pgfpoint |
| 5304 |
{\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} |
| 5305 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}} |
| 5306 |
\pgfusepath{draw} |
| 5307 |
\endpgfscope |
| 5308 |
\endpgfscope |
| 5309 |
\ifpgf@circuit@mos@arrows |
| 5310 |
\pgfscope |
| 5311 |
\ifpgf@circuit@trans@arrowatend |
| 5312 |
\pgftransformshift{\pgfpoint |
| 5313 |
{\pgf@circ@res@right}% |
| 5314 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}% |
| 5315 |
} |
| 5316 |
\pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}} |
| 5317 |
\else |
| 5318 |
\pgfslopedattimetrue |
| 5319 |
\pgfallowupsidedownattimetrue |
| 5320 |
\pgfresetnontranslationattimefalse |
| 5321 |
\pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{% |
| 5322 |
\pgfpoint% |
| 5323 |
{\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}% |
| 5324 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% |
| 5325 |
}{% |
| 5326 |
\pgfpoint |
| 5327 |
{\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% |
| 5328 |
{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}% |
| 5329 |
} |
| 5330 |
\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} |
| 5331 |
\fi |
| 5332 |
\endpgfscope |
| 5333 |
\fi |
| 5334 |
|
| 5335 |
\ifpgf@circuit@bpt@drawgate |
| 5336 |
\pgfpathmoveto{\pgfpoint |
| 5337 |
{\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left} |
| 5338 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5339 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5340 |
\pgfusepath{draw} |
| 5341 |
\fi |
| 5342 |
|
| 5343 |
\pgfcirc@simplemos@drawbulk{nmosd} |
| 5344 |
\pgfcirc@ferroelectric{nmosd}{\ctikzvalof{tripoles/nmosd/depletion width}} |
| 5345 |
} |
| 5346 |
|
| 5347 |
\pgfcircdeclaretransistor{pmosd}{ |
| 5348 |
\anchor{inner up}{ |
| 5349 |
\northeast |
| 5350 |
\pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y |
| 5351 |
} |
| 5352 |
\anchor{inner down}{ |
| 5353 |
\northeast |
| 5354 |
\pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y |
| 5355 |
} |
| 5356 |
\anchor{nobulk}{ %override |
| 5357 |
\left |
| 5358 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x |
| 5359 |
\pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x |
| 5360 |
\advance\pgf@x by -\pgf@circ@res@temp |
| 5361 |
} |
| 5362 |
}{% |
| 5363 |
% add the circle if requested (before everything else, so we can fill it) |
| 5364 |
\pgfcirc@transistorcircle |
| 5365 |
% fill the gap color if requested |
| 5366 |
\pgfcirc@fillgategap{nmos} |
| 5367 |
% draw depletion channel |
| 5368 |
\pgfscope |
| 5369 |
\pgfpathrectanglecorners |
| 5370 |
{\pgfpoint |
| 5371 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} |
| 5372 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} |
| 5373 |
{\pgfpoint |
| 5374 |
{(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left} |
| 5375 |
{-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} |
| 5376 |
\pgfcirc@filldraw@depletion{pmosd} |
| 5377 |
\endpgfscope |
| 5378 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5379 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5380 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} |
| 5381 |
\pgfpathlineto{\pgfpoint |
| 5382 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} |
| 5383 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} |
| 5384 |
\pgfusepath{draw} |
| 5385 |
|
| 5386 |
\ifpgf@circuit@mos@arrows |
| 5387 |
\pgfscope |
| 5388 |
\ifpgf@circuit@trans@arrowatend |
| 5389 |
\pgftransformshift{\pgfpoint |
| 5390 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% |
| 5391 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% |
| 5392 |
} |
| 5393 |
\pgftransformrotate{180} |
| 5394 |
\pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} |
| 5395 |
\else |
| 5396 |
\pgfslopedattimetrue |
| 5397 |
\pgfallowupsidedownattimetrue |
| 5398 |
\pgfresetnontranslationattimefalse |
| 5399 |
\pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{% |
| 5400 |
\pgfpoint% |
| 5401 |
{\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}% |
| 5402 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% |
| 5403 |
}{% |
| 5404 |
\pgfpoint |
| 5405 |
{\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}% |
| 5406 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}% |
| 5407 |
} |
| 5408 |
\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} |
| 5409 |
\fi |
| 5410 |
\endpgfscope |
| 5411 |
\fi |
| 5412 |
|
| 5413 |
\pgfscope |
| 5414 |
% draw the channel |
| 5415 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5416 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5417 |
\pgfpathmoveto{\pgfpoint |
| 5418 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} |
| 5419 |
{\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}} |
| 5420 |
\pgfpathlineto{\pgfpoint |
| 5421 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} |
| 5422 |
{\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}} |
| 5423 |
\pgfusepath{draw} |
| 5424 |
\pgfscope |
| 5425 |
% draw the gate |
| 5426 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5427 |
\pgfpathmoveto{\pgfpoint |
| 5428 |
{\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} |
| 5429 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}} |
| 5430 |
\pgfpathlineto{\pgfpoint |
| 5431 |
{\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} |
| 5432 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} |
| 5433 |
\pgfusepath{draw} |
| 5434 |
\endpgfscope |
| 5435 |
\endpgfscope |
| 5436 |
|
| 5437 |
\pgfpathmoveto{\pgfpoint |
| 5438 |
{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left} |
| 5439 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} |
| 5440 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5441 |
{\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}} |
| 5442 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5443 |
|
| 5444 |
|
| 5445 |
\pgfusepath{draw} |
| 5446 |
\ifpgf@circuit@bpt@drawgate |
| 5447 |
\pgfpathmoveto{\pgfpoint |
| 5448 |
{\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left} |
| 5449 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5450 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5451 |
\pgfusepath{draw} |
| 5452 |
\fi |
| 5453 |
|
| 5454 |
\ifpgf@circuit@pmos@nocircle\else |
| 5455 |
% we are not scaling the circle with the MOS --- I think it's better to have it |
| 5456 |
% coherent with the poles/nodes of the rest of the circuit. |
| 5457 |
\pgfpathcircle{\pgfpoint |
| 5458 |
{\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 5459 |
{\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} |
| 5460 |
\ifpgf@circuit@pmos@emptycircle |
| 5461 |
\pgfsetfillcolor{white} |
| 5462 |
\fi |
| 5463 |
\pgfusepath{draw,fill} |
| 5464 |
\fi |
| 5465 |
|
| 5466 |
\pgfcirc@simplemos@drawbulk{pmosd} |
| 5467 |
\pgfcirc@ferroelectric{pmosd}{\ctikzvalof{tripoles/pmosd/depletion width}} |
| 5468 |
} |
| 5469 |
%% HEMT FET Transistor |
| 5470 |
\def\pgf@circ@hemt@gate@anchor@helper{% |
| 5471 |
\northeast |
| 5472 |
\pgf@circ@res@up = \pgf@y |
| 5473 |
\pgf@circ@res@down = -\pgf@y |
| 5474 |
\pgfmathsetlength{\pgf@circ@res@step}{{(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}} |
| 5475 |
\left |
| 5476 |
\pgf@y=\pgf@circ@res@step |
| 5477 |
} |
| 5478 |
\pgfcircdeclaretransistor{hemt}{ |
| 5479 |
\savedmacro{\gateasym}{\edef\gateasym{\ctikzvalof{tripoles/hemt/gate asym}}} |
| 5480 |
\anchor{inner up}{ |
| 5481 |
\northeast |
| 5482 |
\pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y |
| 5483 |
} |
| 5484 |
\anchor{inner down}{ |
| 5485 |
\northeast |
| 5486 |
\pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y |
| 5487 |
} |
| 5488 |
% override gate/base anchors |
| 5489 |
\anchor{G}{\pgf@circ@hemt@gate@anchor@helper} |
| 5490 |
\anchor{gate}{\pgf@circ@hemt@gate@anchor@helper} |
| 5491 |
\anchor{nogate}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x} |
| 5492 |
\anchor{B}{\pgf@circ@hemt@gate@anchor@helper} |
| 5493 |
\anchor{base}{\pgf@circ@hemt@gate@anchor@helper} |
| 5494 |
\anchor{nobase}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x} |
| 5495 |
}{% |
| 5496 |
% add the circle if requested (before everything else, so we can fill it) |
| 5497 |
\pgfcirc@transistorcircle |
| 5498 |
% upper connection |
| 5499 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5500 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5501 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} |
| 5502 |
\pgfpathlineto{\pgfpoint |
| 5503 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5504 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}} |
| 5505 |
% lower connection |
| 5506 |
\pgfpathmoveto{\pgfpoint |
| 5507 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5508 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} |
| 5509 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5510 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} |
| 5511 |
\pgfpathlineto{\pgfpoint |
| 5512 |
{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5513 |
\pgfusepath{draw} |
| 5514 |
\pgfscope |
| 5515 |
\edef\@@tmp{\ctikzvalof{tripoles/hemt/source arrow}} |
| 5516 |
\ifnum\@@tmp=0 \else |
| 5517 |
\ifpgf@circuit@trans@arrowatend |
| 5518 |
\ifnum\@@tmp > 0 % |
| 5519 |
\pgftransformshift{\pgfpoint |
| 5520 |
{\pgf@circ@res@right} |
| 5521 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} |
| 5522 |
\else |
| 5523 |
\pgftransformshift{\pgfpoint |
| 5524 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5525 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} |
| 5526 |
\ifnum\@@tmp < 0 \pgftransformrotate{180}\fi |
| 5527 |
\fi |
| 5528 |
\pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}} |
| 5529 |
\else |
| 5530 |
% the position here is a bit strange... |
| 5531 |
\pgftransformshift{\pgfpoint |
| 5532 |
{0.5*\pgf@circ@res@right+0.5*\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5533 |
{\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}} |
| 5534 |
\ifnum\@@tmp < 0 \pgftransformrotate{180}\fi |
| 5535 |
\pgfnode{trarrow}{center}{}{}{\pgfusepath{stroke}} |
| 5536 |
\fi |
| 5537 |
\fi |
| 5538 |
\endpgfscope |
| 5539 |
\pgfscope |
| 5540 |
% draw gate (base) bar |
| 5541 |
\ifpgf@circ@hemt@split |
| 5542 |
\pgfpathmoveto{\pgfpoint |
| 5543 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5544 |
{\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} |
| 5545 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5546 |
{(1.1+\gateasym)*\pgf@circ@res@up + |
| 5547 |
(0.9-\gateasym)*\pgf@circ@res@down}} |
| 5548 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5549 |
{(1.05+\gateasym)*\pgf@circ@res@up + |
| 5550 |
(0.95-\gateasym)*\pgf@circ@res@down}} |
| 5551 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5552 |
{(0.95+\gateasym)*\pgf@circ@res@up + |
| 5553 |
(1.05-\gateasym)*\pgf@circ@res@down}} |
| 5554 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5555 |
{(0.9+\gateasym)*\pgf@circ@res@up + |
| 5556 |
(1.1-\gateasym)*\pgf@circ@res@down}} |
| 5557 |
\pgfpathlineto{\pgfpoint |
| 5558 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5559 |
{\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} |
| 5560 |
\else |
| 5561 |
\pgfpathmoveto{\pgfpoint |
| 5562 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5563 |
{\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}} |
| 5564 |
\pgfpathlineto{\pgfpoint |
| 5565 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5566 |
{\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}} |
| 5567 |
\fi |
| 5568 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5569 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5570 |
\pgfusepath{draw} |
| 5571 |
\endpgfscope |
| 5572 |
% draw the gate horizontal segment |
| 5573 |
\ifpgf@circuit@bpt@drawgate |
| 5574 |
\pgfpathmoveto{\pgfpoint |
| 5575 |
{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left} |
| 5576 |
{(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}} |
| 5577 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} |
| 5578 |
{(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}} |
| 5579 |
\pgfusepath{draw} |
| 5580 |
\fi |
| 5581 |
} |
| 5582 |
\tikzset{GaN hemt/.style={hemt, |
| 5583 |
circuitikz/tripoles/hemt/base height=0.6,%length of the "base" vertical bar |
| 5584 |
circuitikz/tripoles/hemt/gate height=0.5,%distance of the S/D terminals |
| 5585 |
circuitikz/tripoles/hemt/bodydiode conn=0.85,% attachment point of body diode |
| 5586 |
circuitikz/tripoles/hemt/gate asym=-0.1,% slightly down |
| 5587 |
circuitikz/tripoles/hemt/split gate=true,% split gate |
| 5588 |
circuitikz/tripoles/hemt/source arrow=1,% right-facing arrow |
| 5589 |
}, |
| 5590 |
} |
| 5591 |
|
| 5592 |
\long\def\drawfetcore#1{ |
| 5593 |
\pgftransformationadjustments |
| 5594 |
% add the circle if requested (before everything else, so we can fill it) |
| 5595 |
\pgfcirc@transistorcircle |
| 5596 |
% fill the gap color if requested |
| 5597 |
\pgfcirc@fillgategap{#1} |
| 5598 |
%top connection |
| 5599 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5600 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5601 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 5602 |
\pgfpathlineto{\pgfpoint |
| 5603 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5604 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 5605 |
\pgfusepath{draw} |
| 5606 |
\pgfscope |
| 5607 |
% draw the channel (base) |
| 5608 |
\pgfpathmoveto{\pgfpoint |
| 5609 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5610 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}} |
| 5611 |
\ifpgf@circuit@trans@depletiontype |
| 5612 |
\pgfpathlineto{\pgfpoint |
| 5613 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5614 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 5615 |
\else |
| 5616 |
\pgfpathlineto{\pgfpoint |
| 5617 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5618 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}} |
| 5619 |
\pgfpathmoveto{\pgfpoint |
| 5620 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5621 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}} |
| 5622 |
\pgfpathlineto{\pgfpoint |
| 5623 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5624 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}} |
| 5625 |
\pgfpathmoveto{\pgfpoint |
| 5626 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5627 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.45}} |
| 5628 |
\pgfpathlineto{\pgfpoint |
| 5629 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5630 |
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}} |
| 5631 |
\fi |
| 5632 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5633 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5634 |
\pgfusepath{draw} |
| 5635 |
\endpgfscope |
| 5636 |
%Bulk connection line |
| 5637 |
\ifpgf@circuit@trans@fdsoi |
| 5638 |
\pgfpathmoveto{\pgfpoint |
| 5639 |
{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5640 |
% beware, fixed numbers here. The 0.5 MUST coincide with @@final below in arrow positioning |
| 5641 |
\pgfpathlineto{\pgfpoint |
| 5642 |
{0.5*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5643 |
\pgfpathmoveto{\pgfpoint |
| 5644 |
{0.3*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5645 |
\else |
| 5646 |
\pgfpathmoveto{\pgfpoint |
| 5647 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5648 |
\fi |
| 5649 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} |
| 5650 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5651 |
\pgfusepath{draw} |
| 5652 |
% back gate, with the same thickness than the main gate |
| 5653 |
\ifpgf@circuit@trans@fdsoi |
| 5654 |
\pgfscope |
| 5655 |
\pgfpathmoveto{\pgfpoint |
| 5656 |
{0.3*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{1.2*\pgf@circ@res@up+\pgf@circ@res@down}} |
| 5657 |
\pgfpathlineto{\pgfpoint |
| 5658 |
{0.3*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}{\pgf@circ@res@up+1.2*\pgf@circ@res@down}} |
| 5659 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5660 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5661 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5662 |
\pgfusepath{draw} |
| 5663 |
\endpgfscope |
| 5664 |
\fi |
| 5665 |
%bottom connection |
| 5666 |
\pgfpathmoveto{\pgfpoint |
| 5667 |
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} |
| 5668 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 5669 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5670 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 5671 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5672 |
\pgfusepath{draw} |
| 5673 |
%draw thick gate line |
| 5674 |
\pgfscope%%% gate line |
| 5675 |
\pgfpathmoveto{\pgfpoint |
| 5676 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5677 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5678 |
\ifpgf@circuit@fet@doublegate |
| 5679 |
\edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})} |
| 5680 |
\pgfpathlineto{\pgfpoint |
| 5681 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5682 |
{\@@gateconnheight*\pgf@circ@res@up/3}} |
| 5683 |
\pgfpathmoveto{\pgfpoint |
| 5684 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5685 |
{\@@gateconnheight*\pgf@circ@res@down/3}} |
| 5686 |
\fi |
| 5687 |
\pgfpathlineto{\pgfpoint |
| 5688 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5689 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5690 |
\pgfsetlinewidth{\ctikzvalof{transistors/gate thickness}\pgflinewidth} |
| 5691 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5692 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5693 |
\pgfusepath{draw} |
| 5694 |
\endpgfscope |
| 5695 |
% arrows |
| 5696 |
\pgfscope |
| 5697 |
\pgfslopedattimetrue |
| 5698 |
\pgfallowupsidedownattimetrue |
| 5699 |
\pgfresetnontranslationattimefalse |
| 5700 |
% this is an OR, see https://tex.stackexchange.com/a/29906/38080 |
| 5701 |
% I love TeX... |
| 5702 |
\edef\@@final{1.0} %position in the bulk line |
| 5703 |
\ifnum\ifpgf@circuit@trans@arrowatend 1\else\ifpgf@circuit@trans@fdsoi 1\else 0 \fi\fi =1 % |
| 5704 |
\ifpgf@circuit@trans@ntype |
| 5705 |
\edef\@@anchor{tip} |
| 5706 |
\edef\@@pos{1.0} |
| 5707 |
\else |
| 5708 |
\edef\@@anchor{btip} |
| 5709 |
\edef\@@pos{0.0} |
| 5710 |
\ifpgf@circuit@trans@fdsoi |
| 5711 |
\edef\@@pos{1.0} |
| 5712 |
\edef\@@final{0.5}% this MUST coincide with the bulk drawing above |
| 5713 |
\fi |
| 5714 |
\fi |
| 5715 |
\else |
| 5716 |
\edef\@@anchor{center}\edef\@@pos{0.6} |
| 5717 |
\fi |
| 5718 |
\pgftransformlineattime{\@@pos}{% |
| 5719 |
\pgfpoint |
| 5720 |
{\pgf@circ@res@right}% |
| 5721 |
{\pgf@circ@res@up+\pgf@circ@res@down}% |
| 5722 |
}{% |
| 5723 |
\pgfpoint% |
| 5724 |
{\@@final*\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}% |
| 5725 |
{\pgf@circ@res@up+\pgf@circ@res@down}% |
| 5726 |
} |
| 5727 |
\ifpgf@circuit@trans@ntype |
| 5728 |
\else |
| 5729 |
\pgftransformrotate{180} |
| 5730 |
\fi |
| 5731 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 5732 |
\endpgfscope |
| 5733 |
% GATE CONNECTION |
| 5734 |
\ifpgf@circuit@bpt@drawgate |
| 5735 |
\pgfscope %% gate connection |
| 5736 |
\ifpgf@circuit@trans@ntype |
| 5737 |
\edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})} |
| 5738 |
\else |
| 5739 |
\edef\@@gateconnheight{(-\ctikzvalof{tripoles/#1/conn height})} |
| 5740 |
\fi |
| 5741 |
\pgfpathmoveto{\pgfpoint |
| 5742 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5743 |
{\@@gateconnheight*\pgf@circ@res@down}} |
| 5744 |
\pgfpathlineto{\pgfpoint |
| 5745 |
{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} |
| 5746 |
{\@@gateconnheight*\pgf@circ@res@down}} |
| 5747 |
\ifpgf@circuit@fet@doublegate |
| 5748 |
\pgfpathmoveto{\pgfpoint |
| 5749 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5750 |
{-\@@gateconnheight*\pgf@circ@res@down/3}} |
| 5751 |
\pgfpathlineto{\pgfpoint |
| 5752 |
{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} |
| 5753 |
{-\@@gateconnheight*\pgf@circ@res@down/3}} |
| 5754 |
\fi |
| 5755 |
\pgfusepath{draw} |
| 5756 |
\endpgfscope |
| 5757 |
\fi |
| 5758 |
\pgfcirc@ferroelectric{#1}{0} |
| 5759 |
} |
| 5760 |
|
| 5761 |
\long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3{ |
| 5762 |
\pgfcircdeclaretransistor{#1}{ |
| 5763 |
\anchor{bulk}{\left\pgf@x=0pt} |
| 5764 |
\anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt |
| 5765 |
\anchor{inner up}{ |
| 5766 |
\northeast |
| 5767 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 5768 |
} |
| 5769 |
\anchor{inner down}{ |
| 5770 |
\northeast |
| 5771 |
\pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y |
| 5772 |
} |
| 5773 |
#2% |
| 5774 |
} |
| 5775 |
{#3} |
| 5776 |
} |
| 5777 |
|
| 5778 |
\pgfdeclaretransistorwrapperaddbulk{nfet}{}{% |
| 5779 |
\pgf@circuit@trans@depletiontypefalse |
| 5780 |
\drawfetcore{nfet} |
| 5781 |
} |
| 5782 |
|
| 5783 |
\pgfdeclaretransistorwrapperaddbulk{pfet}{}{% |
| 5784 |
\pgf@circuit@trans@depletiontypefalse |
| 5785 |
\drawfetcore{pfet} |
| 5786 |
} |
| 5787 |
|
| 5788 |
\pgfdeclaretransistorwrapperaddbulk{nfetd}{}{% |
| 5789 |
\pgf@circuit@trans@depletiontypetrue |
| 5790 |
\drawfetcore{nfetd} |
| 5791 |
} |
| 5792 |
|
| 5793 |
\pgfdeclaretransistorwrapperaddbulk{pfetd}{}{% |
| 5794 |
\pgf@circuit@trans@depletiontypetrue |
| 5795 |
\drawfetcore{pfetd} |
| 5796 |
} |
| 5797 |
% N-CHANNEL IGFET ENHANCEMENT TYPE |
| 5798 |
\pgfdeclaretransistorwrapperaddbulk{nigfete}{}{% |
| 5799 |
\pgf@circuit@trans@depletiontypefalse |
| 5800 |
\drawfetcore{nigfete} |
| 5801 |
|
| 5802 |
% SOURCE CONNECTION |
| 5803 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 5804 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 5805 |
\pgfusepath{draw} |
| 5806 |
|
| 5807 |
% SOLDER DOT at source-bulk connection |
| 5808 |
\ifpgf@circuit@fet@solderdot |
| 5809 |
\pgfscope |
| 5810 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 5811 |
\ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} |
| 5812 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 5813 |
\pgfnode{circ}{center}{}{}{} |
| 5814 |
\endpgfscope{} |
| 5815 |
\fi |
| 5816 |
} |
| 5817 |
|
| 5818 |
% N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector |
| 5819 |
\pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{% |
| 5820 |
\pgf@circuit@trans@depletiontypefalse |
| 5821 |
\drawfetcore{nigfetebulk} |
| 5822 |
% SOLDER DOT at source-bulk connection |
| 5823 |
\ifpgf@circuit@fet@solderdot |
| 5824 |
\pgfscope |
| 5825 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 5826 |
\ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}} |
| 5827 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 5828 |
\pgfnode{circ}{center}{}{}{} |
| 5829 |
\endpgfscope{} |
| 5830 |
\fi |
| 5831 |
} |
| 5832 |
|
| 5833 |
% N-CHANNEL IGFET DEPLETION TYPE |
| 5834 |
\pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{% |
| 5835 |
\pgf@circuit@trans@depletiontypetrue |
| 5836 |
\drawfetcore{nigfetd} |
| 5837 |
|
| 5838 |
% SOURCE CONNECTION |
| 5839 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 5840 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 5841 |
\pgfusepath{draw} |
| 5842 |
|
| 5843 |
% SOLDER DOT at source-bulk connection |
| 5844 |
\ifpgf@circuit@fet@solderdot |
| 5845 |
\pgfscope |
| 5846 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 5847 |
\ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} |
| 5848 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 5849 |
\pgfnode{circ}{center}{}{}{} |
| 5850 |
\endpgfscope{} |
| 5851 |
\fi |
| 5852 |
} |
| 5853 |
|
| 5854 |
% P-CHANNEL IGFET ENHANCEMENT TYPE |
| 5855 |
\pgfdeclaretransistorwrapperaddbulk{pigfete}{}{% |
| 5856 |
\pgf@circuit@trans@depletiontypefalse |
| 5857 |
\drawfetcore{pigfete} |
| 5858 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 5859 |
|
| 5860 |
% SOURCE CONNECTION |
| 5861 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 5862 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 5863 |
\pgfusepath{draw} |
| 5864 |
|
| 5865 |
|
| 5866 |
% SOLDER DOT at source-bulk connection |
| 5867 |
\ifpgf@circuit@fet@solderdot |
| 5868 |
\pgfscope |
| 5869 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 5870 |
\ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}} |
| 5871 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 5872 |
\pgfnode{circ}{center}{}{}{} |
| 5873 |
\endpgfscope |
| 5874 |
\fi |
| 5875 |
} |
| 5876 |
|
| 5877 |
% P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector |
| 5878 |
\pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{% |
| 5879 |
\pgf@circuit@trans@depletiontypefalse |
| 5880 |
\drawfetcore{pigfetebulk} |
| 5881 |
} |
| 5882 |
|
| 5883 |
% P-CHANNEL IGFET DEPLETION TYPE |
| 5884 |
\pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{% |
| 5885 |
\pgf@circuit@trans@depletiontypetrue |
| 5886 |
\drawfetcore{pigfetd} |
| 5887 |
|
| 5888 |
% SOURCE CONNECTION |
| 5889 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 5890 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 5891 |
\pgfusepath{draw} |
| 5892 |
|
| 5893 |
|
| 5894 |
% SOLDER DOT at source-bulk connection |
| 5895 |
\ifpgf@circuit@fet@solderdot |
| 5896 |
\pgfscope |
| 5897 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 5898 |
\ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}} |
| 5899 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 5900 |
\pgfnode{circ}{center}{}{}{} |
| 5901 |
\endpgfscope{} |
| 5902 |
\fi |
| 5903 |
} |
| 5904 |
|
| 5905 |
%%% uni-junction transistors: jfets, ujts |
| 5906 |
|
| 5907 |
\long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw |
| 5908 |
\pgfcircdeclaretransistor{#1}{ |
| 5909 |
\anchor{inner up}{ |
| 5910 |
\northeast |
| 5911 |
\pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 5912 |
} |
| 5913 |
\anchor{inner down}{ |
| 5914 |
\northeast |
| 5915 |
\pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 5916 |
} |
| 5917 |
\anchor{kink}{ |
| 5918 |
\northeast |
| 5919 |
\pgf@ya=-\ctikzvalof{tripoles/#1/conn height}\pgf@y |
| 5920 |
\left |
| 5921 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya |
| 5922 |
\pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x |
| 5923 |
} |
| 5924 |
% extra anchors (or override) |
| 5925 |
#2% |
| 5926 |
}{% |
| 5927 |
% add the circle if requested (before everything else, so we can fill it) |
| 5928 |
\pgfcirc@transistorcircle |
| 5929 |
|
| 5930 |
% get direction |
| 5931 |
\edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}} |
| 5932 |
|
| 5933 |
% draw drain/source connections: up |
| 5934 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5935 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5936 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 5937 |
\pgfpathlineto{\pgfpoint |
| 5938 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5939 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} |
| 5940 |
|
| 5941 |
% down |
| 5942 |
\pgfpathmoveto{\pgfpoint |
| 5943 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5944 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} |
| 5945 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 5946 |
{\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} |
| 5947 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 5948 |
\pgfusepath{draw} |
| 5949 |
|
| 5950 |
\pgfscope |
| 5951 |
\pgfpathmoveto{\pgfpoint |
| 5952 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5953 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} |
| 5954 |
\pgfpathlineto{\pgfpoint |
| 5955 |
{\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} |
| 5956 |
{\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} |
| 5957 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 5958 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 5959 |
\pgfusepath{draw} |
| 5960 |
\endpgfscope |
| 5961 |
|
| 5962 |
% arrow |
| 5963 |
\pgfscope |
| 5964 |
\pgfslopedattimetrue |
| 5965 |
\pgfallowupsidedownattimetrue |
| 5966 |
\pgfresetnontranslationattimefalse |
| 5967 |
\ifpgf@circuit@trans@arrowatend |
| 5968 |
\ifnum\@@dir>0 |
| 5969 |
\edef\@@anchor{tip}\edef\@@pos{1.0} |
| 5970 |
\else |
| 5971 |
\edef\@@anchor{btip}\edef\@@pos{1.0} |
| 5972 |
\fi |
| 5973 |
\else |
| 5974 |
\ifnum\@@dir>0 |
| 5975 |
\edef\@@anchor{center}\edef\@@pos{0.6} |
| 5976 |
\else |
| 5977 |
\edef\@@anchor{center}\edef\@@pos{0.4} |
| 5978 |
\fi |
| 5979 |
\fi |
| 5980 |
% find x1, x2 and y for the base arrow |
| 5981 |
\ifnum\@@dir>0 |
| 5982 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left |
| 5983 |
\pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left |
| 5984 |
\pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down |
| 5985 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down |
| 5986 |
\else |
| 5987 |
\pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left |
| 5988 |
\pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left |
| 5989 |
\pgf@circ@res@zero=\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up |
| 5990 |
\pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up |
| 5991 |
\fi |
| 5992 |
% |
| 5993 |
% gate line (called emitter in UJT) |
| 5994 |
% |
| 5995 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} |
| 5996 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} |
| 5997 |
% |
| 5998 |
% horizontal gate line |
| 5999 |
% |
| 6000 |
\ifpgf@circuit@bpt@drawgate |
| 6001 |
\ifnum\@@dir>0 |
| 6002 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} |
| 6003 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} |
| 6004 |
\else |
| 6005 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} |
| 6006 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} |
| 6007 |
\fi |
| 6008 |
\fi |
| 6009 |
\pgfusepath{draw} |
| 6010 |
% |
| 6011 |
% gate arrows (called emitter in UJT) |
| 6012 |
% |
| 6013 |
\pgftransformlineattime{\@@pos}{% |
| 6014 |
\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp} |
| 6015 |
}{% |
| 6016 |
\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero} |
| 6017 |
} |
| 6018 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 6019 |
% |
| 6020 |
% gate line (called emitter in UJT) |
| 6021 |
% |
| 6022 |
\endpgfscope |
| 6023 |
|
| 6024 |
% extra drawings |
| 6025 |
#3% |
| 6026 |
} |
| 6027 |
} |
| 6028 |
|
| 6029 |
% NJFET and PJFET |
| 6030 |
|
| 6031 |
\pgfcircdeclarejunctiontransistor{njfet}{}{} |
| 6032 |
\pgfcircdeclarejunctiontransistor{pjfet}{}{} |
| 6033 |
|
| 6034 |
\def\@ujtanchoroverride#1{ |
| 6035 |
\savedanchor{\ujtrealemitter}{ |
| 6036 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6037 |
\pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen |
| 6038 |
\pgf@y=.5\pgf@y %north anchor height |
| 6039 |
% kink AND conn height, they're the same |
| 6040 |
\pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y |
| 6041 |
\pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y |
| 6042 |
% horizontal |
| 6043 |
\pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left |
| 6044 |
\ifpgf@circuit@bpt@drawgate\else |
| 6045 |
\pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x |
| 6046 |
\fi |
| 6047 |
} |
| 6048 |
\anchor{E}{\ujtrealemitter} |
| 6049 |
\anchor{emitter}{\ujtrealemitter} |
| 6050 |
\anchor{B2}{\northeast\pgf@y=-\pgf@y} |
| 6051 |
\anchor{B1}{\northeast} |
| 6052 |
} |
| 6053 |
|
| 6054 |
|
| 6055 |
\pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{} |
| 6056 |
\pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{} |
| 6057 |
|
| 6058 |
|
| 6059 |
\pgfdeclaretransistorwrapperaddbulk{isfet}{ |
| 6060 |
}{% |
| 6061 |
% add the circle if requested (before everything else, so we can fill it) |
| 6062 |
\pgfcirc@transistorcircle |
| 6063 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 6064 |
% DRAIN CONNECTION |
| 6065 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 6066 |
{\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} |
| 6067 |
% DRAIN |
| 6068 |
\pgfpathlineto{\pgfpoint |
| 6069 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} |
| 6070 |
{\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}} |
| 6071 |
\pgfusepath{draw} |
| 6072 |
|
| 6073 |
% GATE, DEPLETION TYPE |
| 6074 |
\pgfscope %% added |
| 6075 |
\pgfpathmoveto{\pgfpoint |
| 6076 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} |
| 6077 |
{\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}} |
| 6078 |
\pgfpathlineto{\pgfpoint |
| 6079 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} |
| 6080 |
{\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}} |
| 6081 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added |
| 6082 |
\ifpgf@circuit@trans@roundedcap\pgfsetroundcap\fi |
| 6083 |
\pgfusepath{draw} %% added |
| 6084 |
\endpgfscope %% added |
| 6085 |
|
| 6086 |
% BULK |
| 6087 |
\pgfpathmoveto{\pgfpoint |
| 6088 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} |
| 6089 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 6090 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth} |
| 6091 |
{\pgf@circ@res@up+\pgf@circ@res@down}} |
| 6092 |
|
| 6093 |
% SOURCE |
| 6094 |
\pgfpathmoveto{\pgfpoint |
| 6095 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left} |
| 6096 |
{\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} |
| 6097 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right} |
| 6098 |
{\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}} |
| 6099 |
% SOURCE CONNECTION |
| 6100 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 6101 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} |
| 6102 |
\pgfusepath{draw} |
| 6103 |
|
| 6104 |
% SOLDER DOT at source-bulk connection |
| 6105 |
\ifpgf@circuit@fet@solderdot |
| 6106 |
\pgfscope |
| 6107 |
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{ |
| 6108 |
\ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}} |
| 6109 |
\pgftransformscale{\ctikzvalof{transistor solderdot scale}} |
| 6110 |
\pgfnode{circ}{center}{}{}{} |
| 6111 |
\endpgfscope{} |
| 6112 |
\fi |
| 6113 |
% ARROW |
| 6114 |
\pgfscope |
| 6115 |
\pgfslopedattimetrue |
| 6116 |
\pgfallowupsidedownattimetrue |
| 6117 |
\pgfresetnontranslationattimefalse |
| 6118 |
\ifpgf@circuit@trans@arrowatend |
| 6119 |
\edef\@@anchor{tip}\edef\@@pos{1.0} |
| 6120 |
\else |
| 6121 |
\edef\@@anchor{center}\edef\@@pos{0.6} |
| 6122 |
\fi |
| 6123 |
\pgftransformlineattime{\@@pos}{% |
| 6124 |
\pgfpoint |
| 6125 |
{\pgf@circ@res@right}% |
| 6126 |
{\pgf@circ@res@up+\pgf@circ@res@down}% |
| 6127 |
}{% |
| 6128 |
\pgfpoint% |
| 6129 |
{\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}% |
| 6130 |
{\pgf@circ@res@up+\pgf@circ@res@down}% |
| 6131 |
} |
| 6132 |
\pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} |
| 6133 |
\endpgfscope |
| 6134 |
\pgfusepath{draw} |
| 6135 |
|
| 6136 |
% Wavy lines |
| 6137 |
\pgfscope |
| 6138 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} |
| 6139 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6140 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6141 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6142 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6143 |
\pgfusepath{draw} |
| 6144 |
|
| 6145 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}} |
| 6146 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6147 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6148 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6149 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6150 |
\pgfusepath{draw} |
| 6151 |
|
| 6152 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}} |
| 6153 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6154 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6155 |
\pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6156 |
\pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}} |
| 6157 |
\pgfusepath{draw} |
| 6158 |
\endpgfscope |
| 6159 |
} |
| 6160 |
|
| 6161 |
% end of transistors |
| 6162 |
% %>>> |
| 6163 |
|
| 6164 |
%% Transistor's path definitions%<<< |
| 6165 |
|
| 6166 |
\pgf@circ@definetranspath{nmos} |
| 6167 |
\pgf@circ@definetranspath{pmos} |
| 6168 |
\pgf@circ@definetranspath{nmosd} |
| 6169 |
\pgf@circ@definetranspath{pmosd} |
| 6170 |
\pgf@circ@definetranspath{hemt} |
| 6171 |
\pgf@circ@definetranspath{npn} |
| 6172 |
\pgf@circ@definetranspath{pnp} |
| 6173 |
\pgf@circ@definetranspath{nfet} |
| 6174 |
\pgf@circ@definetranspath{nigfete} |
| 6175 |
\pgf@circ@definetranspath{nigfetd} |
| 6176 |
\pgf@circ@definetranspath{nigfetebulk} |
| 6177 |
\pgf@circ@definetranspath{pfet} |
| 6178 |
\pgf@circ@definetranspath{pigfete} |
| 6179 |
\pgf@circ@definetranspath{pigfetd} |
| 6180 |
\pgf@circ@definetranspath{pigfetebulk} |
| 6181 |
\pgf@circ@definetranspath{njfet} |
| 6182 |
\pgf@circ@definetranspath{pjfet} |
| 6183 |
\pgf@circ@definetranspath{pigbt} |
| 6184 |
\pgf@circ@definetranspath{nigbt} |
| 6185 |
\pgf@circ@definetranspath{Lpigbt} |
| 6186 |
\pgf@circ@definetranspath{Lnigbt}% %>>> |
| 6187 |
|
| 6188 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 6189 |
%% Amplifiers |
| 6190 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 6191 |
|
| 6192 |
% Settings for Amplifiers%<<<1 |
| 6193 |
% |
| 6194 |
% switches for op amps |
| 6195 |
% changing input polarity |
| 6196 |
% |
| 6197 |
\newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse |
| 6198 |
\pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} |
| 6199 |
\ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}} |
| 6200 |
\pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} |
| 6201 |
\ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}} |
| 6202 |
% |
| 6203 |
% changing output polarity (for fully diff objects) |
| 6204 |
% |
| 6205 |
\newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue |
| 6206 |
\pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} |
| 6207 |
\ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}} |
| 6208 |
\pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} |
| 6209 |
\ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}} |
| 6210 |
|
| 6211 |
% Operational amplifier |
| 6212 |
\ctikzset{tripoles/op amp/width/.initial=1.7} % Total width |
| 6213 |
\ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length |
| 6214 |
\ctikzset{tripoles/op amp/height/.initial=1.4} % Total height |
| 6215 |
\ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation |
| 6216 |
\ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position |
| 6217 |
\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6218 |
|
| 6219 |
% Fully differential operational amplifier |
| 6220 |
\ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width |
| 6221 |
\ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length |
| 6222 |
\ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height |
| 6223 |
\ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation |
| 6224 |
\ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation |
| 6225 |
\ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position |
| 6226 |
\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6227 |
|
| 6228 |
\ctikzset{tripoles/en amp/width/.initial=1.7} |
| 6229 |
\ctikzset{tripoles/en amp/port width/.initial=.7} |
| 6230 |
\ctikzset{tripoles/en amp/height/.initial=1.6} |
| 6231 |
\ctikzset{tripoles/en amp/input height/.initial=.3} |
| 6232 |
\ctikzset{tripoles/en amp/up pos/.initial=.45} |
| 6233 |
\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6234 |
\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! |
| 6235 |
\ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} |
| 6236 |
\tikzset{ |
| 6237 |
en amp text/.code = {% |
| 6238 |
\ctikzsetvalof{tripoles/en amp/text}{#1}% |
| 6239 |
}, |
| 6240 |
en amp text A/.code = {% |
| 6241 |
\ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}% |
| 6242 |
}, |
| 6243 |
} |
| 6244 |
|
| 6245 |
% Transconductance amplifier |
| 6246 |
\ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width |
| 6247 |
\ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length |
| 6248 |
\ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid |
| 6249 |
\ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid |
| 6250 |
\ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation |
| 6251 |
\ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position |
| 6252 |
\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6253 |
|
| 6254 |
% Instrumentation amplifier |
| 6255 |
\ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width |
| 6256 |
\ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length |
| 6257 |
\ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid |
| 6258 |
\ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid |
| 6259 |
\ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation |
| 6260 |
\ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position |
| 6261 |
\ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position |
| 6262 |
\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6263 |
|
| 6264 |
% Instrumentation amplifier with differential output |
| 6265 |
\ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width |
| 6266 |
\ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length |
| 6267 |
\ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid |
| 6268 |
\ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid |
| 6269 |
\ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation |
| 6270 |
\ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation |
| 6271 |
\ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position |
| 6272 |
\ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position |
| 6273 |
\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6274 |
|
| 6275 |
% Instrumentation amplifier with gain resistor terminals |
| 6276 |
\ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width |
| 6277 |
\ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length |
| 6278 |
\ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid |
| 6279 |
\ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid |
| 6280 |
\ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation |
| 6281 |
\ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position |
| 6282 |
\ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position |
| 6283 |
\ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation |
| 6284 |
\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! |
| 6285 |
|
| 6286 |
% Plain amplifier |
| 6287 |
\ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width |
| 6288 |
\ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length |
| 6289 |
\ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height |
| 6290 |
\ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation |
| 6291 |
\ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position |
| 6292 |
|
| 6293 |
% changing fonts and symbols of amplifiers |
| 6294 |
\ctikzset{amplifiers/symbol font/.code={% |
| 6295 |
\ctikzset{tripoles/inst amp ra/font=#1}% |
| 6296 |
\ctikzset{tripoles/fd inst amp/font=#1}% |
| 6297 |
\ctikzset{tripoles/inst amp/font=#1}% |
| 6298 |
\ctikzset{tripoles/gm amp/font=#1}% |
| 6299 |
\ctikzset{tripoles/en amp/font=#1}% |
| 6300 |
\ctikzset{tripoles/fd op amp/font=#1}% |
| 6301 |
\ctikzset{tripoles/op amp/font=#1}% |
| 6302 |
}} |
| 6303 |
\ctikzset{amplifiers/plus/.initial={$+$}} |
| 6304 |
% In the mayority of fonts, the size of - is smaller than +, so we have |
| 6305 |
% unaligned signs when positioned independently. |
| 6306 |
% See https://github.com/circuitikz/circuitikz/issues/721 |
| 6307 |
\ctikzset{amplifiers/minus/.initial={$\vphantom{+}-$}} |
| 6308 |
\tikzset{amp symbol font/.code={% |
| 6309 |
\ctikzset{amplifiers/symbol font={#1}}% |
| 6310 |
} |
| 6311 |
} |
| 6312 |
\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} |
| 6313 |
\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} |
| 6314 |
\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} |
| 6315 |
\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} |
| 6316 |
%%>>> |
| 6317 |
|
| 6318 |
%% Nodes for amplifiers%<<< |
| 6319 |
%% Amplifiers should be rewritten from scratch to factor out common things. |
| 6320 |
%% Better, if there where a anchor alias facility, rewrite them in terms of muxdemux-es |
| 6321 |
%% |
| 6322 |
%% Macro support for border anchors |
| 6323 |
\def\pgf@circ@amps@leftedge#1{% |
| 6324 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6325 |
\pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen |
| 6326 |
\pgf@x=.5\pgf@x |
| 6327 |
\pgf@x = \ctikzvalof{tripoles/#1/port width}\pgf@x |
| 6328 |
\pgf@y=0pt\relax |
| 6329 |
} |
| 6330 |
\def\pgf@circ@amps@setup@letfedge#1{% |
| 6331 |
\savedanchor\leftedge{% |
| 6332 |
\pgf@circ@amps@leftedge{#1} |
| 6333 |
} |
| 6334 |
\anchor{leftedge}{\leftedge} |
| 6335 |
} |
| 6336 |
\def\pgf@circ@amps@setup@text#1{% |
| 6337 |
\savedanchor{\textanchor}{% |
| 6338 |
\ifpgf@circ@center@text |
| 6339 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 6340 |
\else |
| 6341 |
\pgf@circ@amps@leftedge{#1} |
| 6342 |
\pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} |
| 6343 |
\fi |
| 6344 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 6345 |
} |
| 6346 |
\anchor{text}{\textanchor} |
| 6347 |
} |
| 6348 |
%% operational and instrumentation amplifiers |
| 6349 |
|
| 6350 |
\pgfdeclareshape{op amp} |
| 6351 |
{ |
| 6352 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 6353 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 6354 |
\anchor{center}{\pgfpointorigin} |
| 6355 |
\savedanchor\northwest{% |
| 6356 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6357 |
\pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen |
| 6358 |
\pgf@y=.5\pgf@y |
| 6359 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6360 |
\pgf@x=.5\pgf@x |
| 6361 |
} |
| 6362 |
\savedanchor\left{% |
| 6363 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6364 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6365 |
\pgf@x=.5\pgf@x |
| 6366 |
\pgf@y=0pt |
| 6367 |
} |
| 6368 |
\anchor{south}{ |
| 6369 |
\northwest |
| 6370 |
\pgf@y=-\pgf@y |
| 6371 |
\pgf@x=0pt |
| 6372 |
} |
| 6373 |
\anchor{north}{ |
| 6374 |
\northwest |
| 6375 |
\pgf@x=0pt |
| 6376 |
} |
| 6377 |
\savedanchor\left{% |
| 6378 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6379 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6380 |
\pgf@x=.5\pgf@x |
| 6381 |
\pgf@y=0pt |
| 6382 |
} |
| 6383 |
\savedanchor\inOneFixed{% |
| 6384 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6385 |
\pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen |
| 6386 |
\pgf@y=.5\pgf@y |
| 6387 |
\pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y |
| 6388 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6389 |
\pgf@x=.5\pgf@x |
| 6390 |
} |
| 6391 |
\anchor{in up}{ |
| 6392 |
\inOneFixed |
| 6393 |
} |
| 6394 |
\anchor{in down}{ |
| 6395 |
\inOneFixed |
| 6396 |
\pgf@y=-\pgf@y |
| 6397 |
} |
| 6398 |
\savedanchor\inOne{% |
| 6399 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6400 |
\pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen |
| 6401 |
\pgf@y=.5\pgf@y |
| 6402 |
\pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y |
| 6403 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6404 |
\pgf@x=.5\pgf@x |
| 6405 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 6406 |
} |
| 6407 |
\anchor{-}{ |
| 6408 |
\inOne |
| 6409 |
} |
| 6410 |
\anchor{+}{ |
| 6411 |
\inOne |
| 6412 |
\pgf@y=-\pgf@y |
| 6413 |
} |
| 6414 |
\savedanchor\up{% |
| 6415 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6416 |
\pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen |
| 6417 |
\pgf@y=.5\pgf@y |
| 6418 |
\pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen |
| 6419 |
\pgf@x=.5\pgf@x |
| 6420 |
\pgf@circ@res@up = \pgf@y |
| 6421 |
\pgf@circ@res@right = -\pgf@x |
| 6422 |
\pgf@circ@res@left = \pgf@x |
| 6423 |
\pgfpointlineattime{ |
| 6424 |
\ctikzvalof{tripoles/op amp/up pos}}{ |
| 6425 |
\pgfpoint{ |
| 6426 |
\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} |
| 6427 |
{\pgf@circ@res@up}} |
| 6428 |
{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} |
| 6429 |
} |
| 6430 |
\anchor{up}{ |
| 6431 |
\up |
| 6432 |
} |
| 6433 |
\anchor{down}{ |
| 6434 |
\up |
| 6435 |
\pgf@y=-\pgf@y |
| 6436 |
} |
| 6437 |
\anchor{out}{ |
| 6438 |
\northwest |
| 6439 |
\pgf@y=0pt |
| 6440 |
\pgf@x=-\pgf@x |
| 6441 |
} |
| 6442 |
\anchor{west}{ |
| 6443 |
\left |
| 6444 |
} |
| 6445 |
\anchor{east}{ |
| 6446 |
\left |
| 6447 |
\pgf@x=-\pgf@x |
| 6448 |
} |
| 6449 |
\pgf@circ@amps@setup@letfedge{op amp} |
| 6450 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 6451 |
\anchor{bin up}{ |
| 6452 |
\inOneFixed |
| 6453 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6454 |
} |
| 6455 |
\anchor{bin down}{ |
| 6456 |
\inOneFixed |
| 6457 |
\pgf@y=-\pgf@y |
| 6458 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6459 |
} |
| 6460 |
\anchor{b-}{ |
| 6461 |
\inOne |
| 6462 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6463 |
} |
| 6464 |
\anchor{b+}{ |
| 6465 |
\inOne |
| 6466 |
\pgf@y=-\pgf@y |
| 6467 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6468 |
} |
| 6469 |
\anchor{bout}{ |
| 6470 |
\leftedge |
| 6471 |
\pgf@y=0pt |
| 6472 |
\pgf@x=-\pgf@x |
| 6473 |
} |
| 6474 |
% end border anchors |
| 6475 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 6476 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 6477 |
\anchor{north west}{ \northwest } |
| 6478 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 6479 |
\pgf@circ@amps@setup@text{op amp} |
| 6480 |
\pgf@circ@draw@component{ |
| 6481 |
\pgf@circ@setcolor |
| 6482 |
\northwest |
| 6483 |
\pgf@circ@res@up = \pgf@y |
| 6484 |
\pgf@circ@res@down = -\pgf@y |
| 6485 |
\pgf@circ@res@right = -\pgf@x |
| 6486 |
\pgf@circ@res@left = \pgf@x |
| 6487 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 6488 |
% Triangle |
| 6489 |
\pgfscope |
| 6490 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 6491 |
\pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} |
| 6492 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 6493 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 6494 |
\pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step |
| 6495 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 6496 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 6497 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 6498 |
\pgfpathclose |
| 6499 |
\pgf@circ@draworfill |
| 6500 |
\endpgfscope |
| 6501 |
% Negative input terminal |
| 6502 |
\pgfpathmoveto{\pgfpoint |
| 6503 |
{\pgf@circ@res@left} |
| 6504 |
{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} |
| 6505 |
\pgfpathlineto{\pgfpoint |
| 6506 |
{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} |
| 6507 |
{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} |
| 6508 |
% Positive input terminal |
| 6509 |
\pgfpathmoveto{\pgfpoint |
| 6510 |
{\pgf@circ@res@left} |
| 6511 |
{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} |
| 6512 |
\pgfpathlineto{\pgfpoint |
| 6513 |
{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} |
| 6514 |
{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} |
| 6515 |
% Output terminal |
| 6516 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 6517 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}} |
| 6518 |
\pgfsetrectcap |
| 6519 |
\pgfusepath{draw} |
| 6520 |
\pgf@circ@text@strokecolor |
| 6521 |
\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} |
| 6522 |
\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} |
| 6523 |
} |
| 6524 |
} |
| 6525 |
|
| 6526 |
% Op amp shape as in european standard EN 60617 |
| 6527 |
\pgfdeclareshape{en amp} |
| 6528 |
{ |
| 6529 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 6530 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 6531 |
\anchor{center}{\pgfpointorigin} |
| 6532 |
\savedanchor\northwest{% |
| 6533 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6534 |
\pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen |
| 6535 |
\pgf@y=.5\pgf@y |
| 6536 |
\pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen |
| 6537 |
\pgf@x=.5\pgf@x |
| 6538 |
} |
| 6539 |
\savedanchor\left{% |
| 6540 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6541 |
\pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen |
| 6542 |
\pgf@x=.5\pgf@x |
| 6543 |
\pgf@y=0pt |
| 6544 |
} |
| 6545 |
\anchor{south}{ |
| 6546 |
\northwest |
| 6547 |
\pgf@y=-\pgf@y |
| 6548 |
\pgf@x=0pt |
| 6549 |
} |
| 6550 |
\anchor{north}{ |
| 6551 |
\northwest |
| 6552 |
\pgf@x=0pt |
| 6553 |
} |
| 6554 |
\savedanchor\inOneFixed{% |
| 6555 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6556 |
\pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen |
| 6557 |
\pgf@y=.5\pgf@y |
| 6558 |
\pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y |
| 6559 |
\pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen |
| 6560 |
\pgf@x=.5\pgf@x |
| 6561 |
} |
| 6562 |
\anchor{in up}{ |
| 6563 |
\inOneFixed |
| 6564 |
} |
| 6565 |
\anchor{in down}{ |
| 6566 |
\inOneFixed |
| 6567 |
\pgf@y=-\pgf@y |
| 6568 |
} |
| 6569 |
\savedanchor\inOne{% |
| 6570 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6571 |
\pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen |
| 6572 |
\pgf@y=.5\pgf@y |
| 6573 |
\pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y |
| 6574 |
\pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen |
| 6575 |
\pgf@x=.5\pgf@x |
| 6576 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 6577 |
} |
| 6578 |
\anchor{-}{ |
| 6579 |
\inOne |
| 6580 |
} |
| 6581 |
\anchor{+}{ |
| 6582 |
\inOne |
| 6583 |
\pgf@y=-\pgf@y |
| 6584 |
} |
| 6585 |
\anchor{up}{ |
| 6586 |
\northwest |
| 6587 |
\pgf@x=0pt |
| 6588 |
} |
| 6589 |
\anchor{down}{ |
| 6590 |
\northwest |
| 6591 |
\pgf@x=0pt |
| 6592 |
\pgf@y=-\pgf@y |
| 6593 |
} |
| 6594 |
\anchor{out}{ |
| 6595 |
\northwest |
| 6596 |
\pgf@y=0pt |
| 6597 |
\pgf@x=-\pgf@x |
| 6598 |
} |
| 6599 |
\anchor{west}{ |
| 6600 |
\left |
| 6601 |
} |
| 6602 |
\anchor{east}{ |
| 6603 |
\left |
| 6604 |
\pgf@x=-\pgf@x |
| 6605 |
} |
| 6606 |
% support for border anchors |
| 6607 |
\pgf@circ@amps@setup@letfedge{en amp} |
| 6608 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 6609 |
\anchor{bin up}{ |
| 6610 |
\inOneFixed |
| 6611 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6612 |
} |
| 6613 |
\anchor{bin down}{ |
| 6614 |
\inOneFixed |
| 6615 |
\pgf@y=-\pgf@y |
| 6616 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6617 |
} |
| 6618 |
\anchor{b-}{ |
| 6619 |
\inOne |
| 6620 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6621 |
} |
| 6622 |
\anchor{b+}{ |
| 6623 |
\inOne |
| 6624 |
\pgf@y=-\pgf@y |
| 6625 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6626 |
} |
| 6627 |
\anchor{bout}{ |
| 6628 |
\leftedge |
| 6629 |
\pgf@y=0pt |
| 6630 |
\pgf@x=-\pgf@x |
| 6631 |
} |
| 6632 |
% end border anchors |
| 6633 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 6634 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 6635 |
\anchor{north west}{ \northwest } |
| 6636 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 6637 |
\pgf@circ@amps@setup@text{en amp} |
| 6638 |
\pgf@circ@draw@component{ |
| 6639 |
\pgf@circ@setcolor |
| 6640 |
\northwest |
| 6641 |
\pgf@circ@res@up = \pgf@y |
| 6642 |
\pgf@circ@res@down = -\pgf@y |
| 6643 |
\pgf@circ@res@right = -\pgf@x |
| 6644 |
\pgf@circ@res@left = \pgf@x |
| 6645 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 6646 |
|
| 6647 |
\pgfscope |
| 6648 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 6649 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}} |
| 6650 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}} |
| 6651 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}} |
| 6652 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}} |
| 6653 |
\pgfpathclose |
| 6654 |
\pgf@circ@draworfill |
| 6655 |
\endpgfscope |
| 6656 |
|
| 6657 |
\pgfpathmoveto{\pgfpoint |
| 6658 |
{\pgf@circ@res@left} |
| 6659 |
{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} |
| 6660 |
\pgfpathlineto{\pgfpoint |
| 6661 |
{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} |
| 6662 |
{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} |
| 6663 |
|
| 6664 |
\pgfpathmoveto{\pgfpoint |
| 6665 |
{\pgf@circ@res@left} |
| 6666 |
{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} |
| 6667 |
\pgfpathlineto{\pgfpoint |
| 6668 |
{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} |
| 6669 |
{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} |
| 6670 |
|
| 6671 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 6672 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} |
| 6673 |
\pgfsetrectcap |
| 6674 |
\pgfusepath{draw} |
| 6675 |
\pgf@circ@text@strokecolor |
| 6676 |
\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} |
| 6677 |
\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} |
| 6678 |
\pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}} |
| 6679 |
} |
| 6680 |
} |
| 6681 |
|
| 6682 |
% Fully differential output op amp |
| 6683 |
% Contributed by Kristofer M. Monisit |
| 6684 |
\pgfdeclareshape{fd op amp} |
| 6685 |
{ |
| 6686 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 6687 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 6688 |
\anchor{center}{\pgfpointorigin} |
| 6689 |
\savedanchor\northwest{% |
| 6690 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6691 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen |
| 6692 |
\pgf@y=.5\pgf@y |
| 6693 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6694 |
\pgf@x=.5\pgf@x |
| 6695 |
} |
| 6696 |
\savedanchor\outline{% |
| 6697 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6698 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen |
| 6699 |
\pgf@y=.5\pgf@y |
| 6700 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6701 |
\pgf@x=.5\pgf@x |
| 6702 |
\ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi |
| 6703 |
} |
| 6704 |
\anchor{south}{ |
| 6705 |
\northwest |
| 6706 |
\pgf@y=-\pgf@y\pgf@x=0pt\relax |
| 6707 |
} |
| 6708 |
\anchor{north}{ |
| 6709 |
\northwest\pgf@x=0pt\relax |
| 6710 |
} |
| 6711 |
\savedanchor\left{% |
| 6712 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6713 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6714 |
\pgf@x=.5\pgf@x |
| 6715 |
\pgf@y=0pt |
| 6716 |
} |
| 6717 |
\savedanchor\inOneFixed{% |
| 6718 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6719 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen |
| 6720 |
\pgf@y=.5\pgf@y |
| 6721 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y |
| 6722 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6723 |
\pgf@x=.5\pgf@x |
| 6724 |
} |
| 6725 |
\anchor{in up}{ |
| 6726 |
\inOneFixed |
| 6727 |
} |
| 6728 |
\anchor{in down}{ |
| 6729 |
\inOneFixed |
| 6730 |
\pgf@y=-\pgf@y |
| 6731 |
} |
| 6732 |
\savedanchor\inOne{% |
| 6733 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6734 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen |
| 6735 |
\pgf@y=.5\pgf@y |
| 6736 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y |
| 6737 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6738 |
\pgf@x=.5\pgf@x |
| 6739 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 6740 |
} |
| 6741 |
\anchor{-}{ |
| 6742 |
\inOne |
| 6743 |
} |
| 6744 |
\anchor{+}{ |
| 6745 |
\inOne |
| 6746 |
\pgf@y=-\pgf@y |
| 6747 |
} |
| 6748 |
\savedanchor\up{% |
| 6749 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6750 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen |
| 6751 |
\pgf@y=.5\pgf@y |
| 6752 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen |
| 6753 |
\pgf@x=.5\pgf@x |
| 6754 |
\pgf@circ@res@up = \pgf@y |
| 6755 |
\pgf@circ@res@right = -\pgf@x |
| 6756 |
\pgf@circ@res@left = \pgf@x |
| 6757 |
\pgfpointlineattime{ |
| 6758 |
\ctikzvalof{tripoles/fd op amp/up pos}}{ |
| 6759 |
\pgfpoint{ |
| 6760 |
\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} |
| 6761 |
{\pgf@circ@res@up}} |
| 6762 |
{\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}} |
| 6763 |
} |
| 6764 |
\anchor{up}{ |
| 6765 |
\up |
| 6766 |
} |
| 6767 |
\anchor{down}{ |
| 6768 |
\up |
| 6769 |
\pgf@y=-\pgf@y |
| 6770 |
} |
| 6771 |
\anchor{out up}{ |
| 6772 |
\northwest |
| 6773 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y |
| 6774 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6775 |
} |
| 6776 |
\anchor{out down}{ |
| 6777 |
\northwest |
| 6778 |
\pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y |
| 6779 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6780 |
} |
| 6781 |
\anchor{out +}{ |
| 6782 |
\outline |
| 6783 |
\pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y |
| 6784 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6785 |
} |
| 6786 |
\anchor{out -}{ |
| 6787 |
\outline |
| 6788 |
\pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y |
| 6789 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6790 |
} |
| 6791 |
% support for border anchors |
| 6792 |
\pgf@circ@amps@setup@letfedge{fd op amp} |
| 6793 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 6794 |
\anchor{bin up}{ |
| 6795 |
\inOneFixed |
| 6796 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6797 |
} |
| 6798 |
\anchor{bin down}{ |
| 6799 |
\inOneFixed |
| 6800 |
\pgf@y=-\pgf@y |
| 6801 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6802 |
} |
| 6803 |
\anchor{b-}{ |
| 6804 |
\inOne |
| 6805 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6806 |
} |
| 6807 |
\anchor{b+}{ |
| 6808 |
\inOne |
| 6809 |
\pgf@y=-\pgf@y |
| 6810 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 6811 |
} |
| 6812 |
\anchor{bout}{ |
| 6813 |
\leftedge |
| 6814 |
\pgf@y=0pt |
| 6815 |
\pgf@x=-\pgf@x |
| 6816 |
} |
| 6817 |
\anchor{bout +}{ |
| 6818 |
\outline |
| 6819 |
\pgf@xa=\pgf@x\pgf@ya=\pgf@y |
| 6820 |
\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} |
| 6821 |
{\pgfpoint{\pgf@xa}{0pt}} |
| 6822 |
{\pgfpoint{0pt}{\pgf@ya}} |
| 6823 |
} |
| 6824 |
\anchor{bout -}{ |
| 6825 |
\outline |
| 6826 |
\pgf@xa=\pgf@x\pgf@ya=\pgf@y |
| 6827 |
\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} |
| 6828 |
{\pgfpoint{\pgf@xa}{0pt}} |
| 6829 |
{\pgfpoint{0pt}{\pgf@ya}} |
| 6830 |
\pgf@y=-\pgf@y |
| 6831 |
} |
| 6832 |
\anchor{bout up}{ |
| 6833 |
\northwest |
| 6834 |
\pgf@xa=\pgf@x\pgf@ya=\pgf@y |
| 6835 |
\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} |
| 6836 |
{\pgfpoint{\pgf@xa}{0pt}} |
| 6837 |
{\pgfpoint{0pt}{\pgf@ya}} |
| 6838 |
} |
| 6839 |
\anchor{bout down}{ |
| 6840 |
\northwest |
| 6841 |
\pgf@xa=\pgf@x\pgf@ya=\pgf@y |
| 6842 |
\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} |
| 6843 |
{\pgfpoint{\pgf@xa}{0pt}} |
| 6844 |
{\pgfpoint{0pt}{\pgf@ya}} |
| 6845 |
\pgf@y=-\pgf@y |
| 6846 |
} |
| 6847 |
% end border anchors |
| 6848 |
\anchor{west}{ |
| 6849 |
\left |
| 6850 |
} |
| 6851 |
\anchor{east}{ |
| 6852 |
\left |
| 6853 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6854 |
} |
| 6855 |
\anchor{out}{% should not be used |
| 6856 |
\left |
| 6857 |
\pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x |
| 6858 |
} |
| 6859 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 6860 |
\anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } |
| 6861 |
\anchor{north west}{ \northwest } |
| 6862 |
\anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } |
| 6863 |
\pgf@circ@amps@setup@text{fd op amp} |
| 6864 |
\pgf@circ@draw@component{ |
| 6865 |
\pgf@circ@setcolor |
| 6866 |
|
| 6867 |
\northwest |
| 6868 |
\pgf@circ@res@up = \pgf@y |
| 6869 |
\pgf@circ@res@down = -\pgf@y |
| 6870 |
\pgf@circ@res@right = -\pgf@x |
| 6871 |
\pgf@circ@res@left = \pgf@x |
| 6872 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 6873 |
|
| 6874 |
% Triangle |
| 6875 |
% Includes output terminals in the traingular shape |
| 6876 |
% to ensure that diagonal joins are properly displayed |
| 6877 |
% we first draw the main triangle and the leads with normal thickness, |
| 6878 |
% and the redraw the main triangle with the component shape |
| 6879 |
\pgfscope |
| 6880 |
% shift origin a bit to ease calculations |
| 6881 |
\pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} |
| 6882 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 6883 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 6884 |
\pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step |
| 6885 |
|
| 6886 |
% Initial point (right vertex) |
| 6887 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 6888 |
|
| 6889 |
% Negative output terminal |
| 6890 |
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} |
| 6891 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}} |
| 6892 |
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}} |
| 6893 |
|
| 6894 |
% Top vertex |
| 6895 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 6896 |
|
| 6897 |
% Bottom vertex |
| 6898 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 6899 |
|
| 6900 |
% Positive output terminal |
| 6901 |
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} |
| 6902 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}} |
| 6903 |
\pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}} |
| 6904 |
|
| 6905 |
% Right vertex |
| 6906 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 6907 |
|
| 6908 |
\pgfpathclose |
| 6909 |
\pgfusepath{stroke} |
| 6910 |
|
| 6911 |
% ok, now we'll redraw the triangle with the class specific |
| 6912 |
% thickness and optionally fill |
| 6913 |
|
| 6914 |
\pgfscope |
| 6915 |
\pgf@circ@setlinewidth{quadpoles}{\pgflinewidth} |
| 6916 |
|
| 6917 |
% Initial point (right vertex) |
| 6918 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 6919 |
% Top vertex |
| 6920 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 6921 |
% Bottom vertex |
| 6922 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 6923 |
|
| 6924 |
\pgfpathclose |
| 6925 |
\pgf@circ@draworfill |
| 6926 |
\endpgfscope % thick and fill |
| 6927 |
\endpgfscope % shift |
| 6928 |
|
| 6929 |
% Negative input terminal |
| 6930 |
\pgfpathmoveto{\pgfpoint |
| 6931 |
{\pgf@circ@res@left} |
| 6932 |
{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} |
| 6933 |
\pgfpathlineto{\pgfpoint |
| 6934 |
{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} |
| 6935 |
{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} |
| 6936 |
|
| 6937 |
% Positive input terminal |
| 6938 |
\pgfpathmoveto{\pgfpoint |
| 6939 |
{\pgf@circ@res@left} |
| 6940 |
{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} |
| 6941 |
\pgfpathlineto{\pgfpoint |
| 6942 |
{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} |
| 6943 |
{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} |
| 6944 |
\pgfsetrectcap |
| 6945 |
\pgfusepath{draw} |
| 6946 |
\pgf@circ@text@strokecolor |
| 6947 |
\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} |
| 6948 |
\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} |
| 6949 |
% Negative output terminal label |
| 6950 |
\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} |
| 6951 |
% Positive output terminal label |
| 6952 |
\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} |
| 6953 |
} |
| 6954 |
} |
| 6955 |
|
| 6956 |
|
| 6957 |
% Instrumentation amplifier with differential output |
| 6958 |
\pgfdeclareshape{fd inst amp} |
| 6959 |
{ |
| 6960 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 6961 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 6962 |
% when tikz calls the anchor it wants the relative position in the lengths |
| 6963 |
% \pgf@x \pgf@y |
| 6964 |
% \pgfpoint* functions set that variables |
| 6965 |
% anchors are visible outside and run on use |
| 6966 |
\anchor{center}{\pgfpointorigin} |
| 6967 |
% savedanchors are internals and run on node creation (not use) |
| 6968 |
% bounding-box top left |
| 6969 |
\savedanchor\northwest{% |
| 6970 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6971 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 6972 |
\pgf@y=.5\pgf@y |
| 6973 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 6974 |
\pgf@x=.5\pgf@x |
| 6975 |
} |
| 6976 |
\anchor{nw}{ |
| 6977 |
\northwest |
| 6978 |
} |
| 6979 |
\anchor{south}{ |
| 6980 |
\northwest |
| 6981 |
\pgf@y=-\pgf@y\pgf@x=0pt\relax |
| 6982 |
} |
| 6983 |
\anchor{north}{ |
| 6984 |
\northwest\pgf@x=0pt\relax |
| 6985 |
} |
| 6986 |
\savedanchor\left{% |
| 6987 |
\pgf@y=0pt |
| 6988 |
} |
| 6989 |
\anchor{leftedge} |
| 6990 |
{\left |
| 6991 |
\pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x |
| 6992 |
} |
| 6993 |
\savedanchor\inOneFixed{% |
| 6994 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 6995 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 6996 |
\pgf@y=.5\pgf@y |
| 6997 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y |
| 6998 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 6999 |
\pgf@x=.5\pgf@x |
| 7000 |
} |
| 7001 |
\anchor{in up}{ |
| 7002 |
\inOneFixed |
| 7003 |
} |
| 7004 |
\anchor{in down}{ |
| 7005 |
\inOneFixed |
| 7006 |
\pgf@y=-\pgf@y |
| 7007 |
} |
| 7008 |
\savedanchor\inOne{% |
| 7009 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7010 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 7011 |
\pgf@y=.5\pgf@y |
| 7012 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y |
| 7013 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 7014 |
\pgf@x=.5\pgf@x |
| 7015 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 7016 |
} |
| 7017 |
\anchor{-}{ |
| 7018 |
\inOne |
| 7019 |
} |
| 7020 |
\anchor{+}{ |
| 7021 |
\inOne |
| 7022 |
\pgf@y=-\pgf@y |
| 7023 |
} |
| 7024 |
\savedanchor\up{% |
| 7025 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7026 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 7027 |
\pgf@y=.5\pgf@y |
| 7028 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 7029 |
\pgf@x=.5\pgf@x |
| 7030 |
\pgf@circ@res@up = \pgf@y |
| 7031 |
\pgf@circ@res@right = -\pgf@x |
| 7032 |
\pgf@circ@res@left = \pgf@x |
| 7033 |
\pgfpointlineattime{ |
| 7034 |
\ctikzvalof{tripoles/fd inst amp/up pos}}{ |
| 7035 |
\pgfpoint{ |
| 7036 |
\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} |
| 7037 |
{\pgf@circ@res@up}} |
| 7038 |
{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} |
| 7039 |
} |
| 7040 |
\anchor{up}{ |
| 7041 |
\up |
| 7042 |
} |
| 7043 |
\anchor{down}{ |
| 7044 |
\up |
| 7045 |
\pgf@y=-\pgf@y |
| 7046 |
} |
| 7047 |
% reference voltage input anchors. |
| 7048 |
\savedanchor\refv{% |
| 7049 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7050 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 7051 |
\pgf@y=.5\pgf@y |
| 7052 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 7053 |
\pgf@x=.5\pgf@x |
| 7054 |
\pgf@circ@res@up = \pgf@y |
| 7055 |
\pgf@circ@res@right = -\pgf@x |
| 7056 |
\pgf@circ@res@left = \pgf@x |
| 7057 |
\pgfpointlineattime{ |
| 7058 |
\ctikzvalof{tripoles/fd inst amp/refv pos}}{ |
| 7059 |
\pgfpoint{ |
| 7060 |
\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} |
| 7061 |
{\pgf@circ@res@up}} |
| 7062 |
{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}} |
| 7063 |
} |
| 7064 |
% we need both because they are normally drawn under the amp, and if you |
| 7065 |
% mirror it vertically you need them |
| 7066 |
\anchor{refv up}{ |
| 7067 |
\refv |
| 7068 |
} |
| 7069 |
\anchor{refv down}{ |
| 7070 |
\refv |
| 7071 |
\pgf@y=-\pgf@y |
| 7072 |
} |
| 7073 |
\savedanchor\outport{ |
| 7074 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7075 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 7076 |
\pgf@y=.5\pgf@y |
| 7077 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y |
| 7078 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 7079 |
\pgf@x=-.5\pgf@x |
| 7080 |
\ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi |
| 7081 |
} |
| 7082 |
\anchor{out}{ |
| 7083 |
\outport |
| 7084 |
\pgf@y=0pt |
| 7085 |
} |
| 7086 |
\anchor{out +}{ |
| 7087 |
\outport |
| 7088 |
} |
| 7089 |
\anchor{out -}{ |
| 7090 |
\outport |
| 7091 |
\pgf@y=-\pgf@y |
| 7092 |
} |
| 7093 |
\savedanchor\outportfixed{ |
| 7094 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7095 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen |
| 7096 |
\pgf@y=.5\pgf@y |
| 7097 |
\pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y |
| 7098 |
\pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen |
| 7099 |
\pgf@x=-.5\pgf@x |
| 7100 |
} |
| 7101 |
\anchor{out up}{ |
| 7102 |
\outportfixed |
| 7103 |
} |
| 7104 |
\anchor{out down}{ |
| 7105 |
\outportfixed |
| 7106 |
\pgf@y=-\pgf@y |
| 7107 |
} |
| 7108 |
% support for border anchors |
| 7109 |
\pgf@circ@amps@setup@letfedge{fd inst amp} |
| 7110 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 7111 |
\anchor{bin up}{ |
| 7112 |
\inOneFixed |
| 7113 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7114 |
} |
| 7115 |
\anchor{bin down}{ |
| 7116 |
\inOneFixed |
| 7117 |
\pgf@y=-\pgf@y |
| 7118 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7119 |
} |
| 7120 |
\anchor{b-}{ |
| 7121 |
\inOne |
| 7122 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7123 |
} |
| 7124 |
\anchor{b+}{ |
| 7125 |
\inOne |
| 7126 |
\pgf@y=-\pgf@y |
| 7127 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7128 |
} |
| 7129 |
\anchor{bout}{ |
| 7130 |
\leftedge |
| 7131 |
\pgf@x=-\pgf@x \pgf@y=0pt |
| 7132 |
} |
| 7133 |
\anchor{bout +}{ |
| 7134 |
\outport |
| 7135 |
\pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya |
| 7136 |
} |
| 7137 |
\anchor{bout -}{ |
| 7138 |
\outport |
| 7139 |
\pgf@y=-\pgf@y |
| 7140 |
\pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya |
| 7141 |
} |
| 7142 |
\anchor{bout up}{ |
| 7143 |
\outportfixed |
| 7144 |
\pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya |
| 7145 |
} |
| 7146 |
\anchor{bout down}{ |
| 7147 |
\outportfixed |
| 7148 |
\pgf@y=-\pgf@y |
| 7149 |
\pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya |
| 7150 |
} |
| 7151 |
% end border anchors |
| 7152 |
% |
| 7153 |
\anchor{west}{ |
| 7154 |
\left |
| 7155 |
} |
| 7156 |
\anchor{east}{ |
| 7157 |
\left |
| 7158 |
\pgf@x=-\pgf@x |
| 7159 |
} |
| 7160 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 7161 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 7162 |
\anchor{north west}{ \northwest } |
| 7163 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 7164 |
\pgf@circ@amps@setup@text{fd inst amp} |
| 7165 |
% let's start drawing the component |
| 7166 |
\pgf@circ@draw@component{ |
| 7167 |
\pgf@circ@setcolor |
| 7168 |
% |
| 7169 |
\northwest |
| 7170 |
\pgf@circ@res@up = \pgf@y |
| 7171 |
\pgf@circ@res@down = -\pgf@y |
| 7172 |
\pgf@circ@res@right = -\pgf@x |
| 7173 |
\pgf@circ@res@left = \pgf@x |
| 7174 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 7175 |
% main component, normally in thicker lines |
| 7176 |
\pgfscope |
| 7177 |
\newdimen\pgf@circ@res@right@double |
| 7178 |
\pgf@circ@res@right@double=2\pgf@circ@res@right |
| 7179 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 7180 |
\pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} |
| 7181 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 7182 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 7183 |
\pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step |
| 7184 |
%first point (near output) |
| 7185 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}} |
| 7186 |
%from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors |
| 7187 |
\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}} |
| 7188 |
% and then to the input "front up", "down", to the output short side "down" |
| 7189 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 7190 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 7191 |
\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}} |
| 7192 |
% ...and close |
| 7193 |
\pgfpathclose |
| 7194 |
\pgf@circ@draworfill |
| 7195 |
\endpgfscope |
| 7196 |
|
| 7197 |
% input terminal up |
| 7198 |
\pgfpathmoveto{\pgfpoint |
| 7199 |
{\pgf@circ@res@left} |
| 7200 |
{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} |
| 7201 |
% |
| 7202 |
\pgfpathlineto{\pgfpoint |
| 7203 |
{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} |
| 7204 |
{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} |
| 7205 |
% |
| 7206 |
|
| 7207 |
% input terminal down |
| 7208 |
\pgfpathmoveto{\pgfpoint |
| 7209 |
{\pgf@circ@res@left} |
| 7210 |
{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} |
| 7211 |
% |
| 7212 |
\pgfpathlineto{\pgfpoint |
| 7213 |
{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} |
| 7214 |
{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} |
| 7215 |
|
| 7216 |
% output leads down and up |
| 7217 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} |
| 7218 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} % |
| 7219 |
|
| 7220 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} |
| 7221 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} % |
| 7222 |
% |
| 7223 |
\pgfsetrectcap |
| 7224 |
\pgfusepath{draw} |
| 7225 |
\pgf@circ@text@strokecolor |
| 7226 |
\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} |
| 7227 |
\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} |
| 7228 |
\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} |
| 7229 |
\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} |
| 7230 |
} |
| 7231 |
} |
| 7232 |
|
| 7233 |
% Transconductance amplifier (Transkonduktanzverstärker) |
| 7234 |
\pgfdeclareshape{gm amp} |
| 7235 |
{ |
| 7236 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 7237 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 7238 |
\anchor{center}{\pgfpointorigin} |
| 7239 |
\savedanchor\northwest{% |
| 7240 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7241 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 7242 |
\pgf@y=.5\pgf@y |
| 7243 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 7244 |
\pgf@x=.5\pgf@x |
| 7245 |
} |
| 7246 |
\anchor{south}{ |
| 7247 |
\northwest |
| 7248 |
\pgf@y=-\pgf@y |
| 7249 |
} |
| 7250 |
\anchor{north}{ |
| 7251 |
\northwest |
| 7252 |
} |
| 7253 |
\savedanchor\left{% |
| 7254 |
\pgf@y=0pt |
| 7255 |
} |
| 7256 |
\anchor{leftedge} |
| 7257 |
{\left |
| 7258 |
\pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x |
| 7259 |
} |
| 7260 |
\savedanchor\inOneFixed{% |
| 7261 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7262 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 7263 |
\pgf@y=.5\pgf@y |
| 7264 |
\pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y |
| 7265 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 7266 |
\pgf@x=.5\pgf@x |
| 7267 |
} |
| 7268 |
\anchor{in up}{ |
| 7269 |
\inOneFixed |
| 7270 |
} |
| 7271 |
\anchor{in down}{ |
| 7272 |
\inOneFixed |
| 7273 |
\pgf@y=-\pgf@y |
| 7274 |
} |
| 7275 |
\savedanchor\inOne{% |
| 7276 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7277 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 7278 |
\pgf@y=.5\pgf@y |
| 7279 |
\pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y |
| 7280 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 7281 |
\pgf@x=.5\pgf@x |
| 7282 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 7283 |
} |
| 7284 |
\anchor{-}{ |
| 7285 |
\inOne |
| 7286 |
} |
| 7287 |
\anchor{+}{ |
| 7288 |
\inOne |
| 7289 |
\pgf@y=-\pgf@y |
| 7290 |
} |
| 7291 |
\savedanchor\up{% |
| 7292 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7293 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 7294 |
\pgf@y=.5\pgf@y |
| 7295 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 7296 |
\pgf@x=.5\pgf@x |
| 7297 |
\pgf@circ@res@up = \pgf@y |
| 7298 |
\pgf@circ@res@right = -\pgf@x |
| 7299 |
\pgf@circ@res@left = \pgf@x |
| 7300 |
\pgfpointlineattime{ |
| 7301 |
\ctikzvalof{tripoles/gm amp/up pos}}{ |
| 7302 |
\pgfpoint{ |
| 7303 |
\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 7304 |
{\pgf@circ@res@up}} |
| 7305 |
{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} |
| 7306 |
} |
| 7307 |
\anchor{up}{ |
| 7308 |
\up |
| 7309 |
} |
| 7310 |
\anchor{down}{ |
| 7311 |
\up |
| 7312 |
\pgf@y=-\pgf@y |
| 7313 |
} |
| 7314 |
\anchor{out}{ |
| 7315 |
\northwest |
| 7316 |
\pgf@y=0pt |
| 7317 |
\pgf@x=-\pgf@x |
| 7318 |
} |
| 7319 |
% support for border anchors |
| 7320 |
\pgf@circ@amps@setup@letfedge{gm amp} |
| 7321 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 7322 |
\anchor{bin up}{ |
| 7323 |
\inOneFixed |
| 7324 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7325 |
} |
| 7326 |
\anchor{bin down}{ |
| 7327 |
\inOneFixed |
| 7328 |
\pgf@y=-\pgf@y |
| 7329 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7330 |
} |
| 7331 |
\anchor{b-}{ |
| 7332 |
\inOne |
| 7333 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7334 |
} |
| 7335 |
\anchor{b+}{ |
| 7336 |
\inOne |
| 7337 |
\pgf@y=-\pgf@y |
| 7338 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7339 |
} |
| 7340 |
\anchor{bout}{ |
| 7341 |
\leftedge |
| 7342 |
\pgf@y=0pt |
| 7343 |
\pgf@x=-\pgf@x |
| 7344 |
} |
| 7345 |
% end border anchors |
| 7346 |
\anchor{west}{ |
| 7347 |
\left |
| 7348 |
} |
| 7349 |
\anchor{east}{ |
| 7350 |
\left |
| 7351 |
\pgf@x=-\pgf@x |
| 7352 |
} |
| 7353 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 7354 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 7355 |
\anchor{north west}{ \northwest } |
| 7356 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 7357 |
\pgf@circ@amps@setup@text{gm amp} |
| 7358 |
\pgf@circ@draw@component{ |
| 7359 |
\pgf@circ@setcolor |
| 7360 |
|
| 7361 |
\northwest |
| 7362 |
\pgf@circ@res@up = \pgf@y |
| 7363 |
\pgf@circ@res@down = -\pgf@y |
| 7364 |
\pgf@circ@res@right = -\pgf@x |
| 7365 |
\pgf@circ@res@left = \pgf@x |
| 7366 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 7367 |
|
| 7368 |
\pgfscope |
| 7369 |
\newdimen\pgf@circ@res@right@double |
| 7370 |
\pgf@circ@res@right@double=2\pgf@circ@res@right |
| 7371 |
|
| 7372 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 7373 |
\pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 7374 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 7375 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 7376 |
\pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step |
| 7377 |
%Umrandung: |
| 7378 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich |
| 7379 |
\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 |
| 7380 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben |
| 7381 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter |
| 7382 |
\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 |
| 7383 |
\pgfpathclose |
| 7384 |
\pgf@circ@draworfill |
| 7385 |
\endpgfscope |
| 7386 |
|
| 7387 |
\pgfpathmoveto{\pgfpoint |
| 7388 |
{\pgf@circ@res@left} |
| 7389 |
{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} |
| 7390 |
\pgfpathlineto{\pgfpoint |
| 7391 |
{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 7392 |
{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} |
| 7393 |
\pgfpathmoveto{\pgfpoint |
| 7394 |
{\pgf@circ@res@left} |
| 7395 |
{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} |
| 7396 |
\pgfpathlineto{\pgfpoint |
| 7397 |
{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 7398 |
{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} |
| 7399 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 7400 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} % |
| 7401 |
\pgfsetrectcap |
| 7402 |
\pgfusepath{draw} |
| 7403 |
\pgf@circ@text@strokecolor |
| 7404 |
\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} |
| 7405 |
\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} |
| 7406 |
} |
| 7407 |
} |
| 7408 |
|
| 7409 |
% Instrumentation amplifier |
| 7410 |
\pgfdeclareshape{inst amp} |
| 7411 |
{ |
| 7412 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 7413 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 7414 |
% when tikz calls the anchor it wants the relative position in the lengths |
| 7415 |
% \pgf@x \pgf@y |
| 7416 |
% \pgfpoint* functions set that variables |
| 7417 |
% anchors are visible outside and run on use |
| 7418 |
\anchor{center}{\pgfpointorigin} |
| 7419 |
% savedanchors are internals and run on node creation (not use) |
| 7420 |
% bounding-box top left |
| 7421 |
\savedanchor\northwest{% |
| 7422 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7423 |
\pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen |
| 7424 |
\pgf@y=.5\pgf@y |
| 7425 |
\pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen |
| 7426 |
\pgf@x=.5\pgf@x |
| 7427 |
} |
| 7428 |
\anchor{nw}{ |
| 7429 |
\northwest |
| 7430 |
} |
| 7431 |
\anchor{south}{ |
| 7432 |
\northwest |
| 7433 |
\pgf@y=-\pgf@y |
| 7434 |
} |
| 7435 |
\anchor{north}{ |
| 7436 |
\northwest |
| 7437 |
} |
| 7438 |
\savedanchor\left{% |
| 7439 |
\pgf@y=0pt |
| 7440 |
} |
| 7441 |
\anchor{leftedge} |
| 7442 |
{\left |
| 7443 |
\pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x |
| 7444 |
} |
| 7445 |
\savedanchor\inOneFixed{% |
| 7446 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7447 |
\pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen |
| 7448 |
\pgf@y=.5\pgf@y |
| 7449 |
\pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y |
| 7450 |
\pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen |
| 7451 |
\pgf@x=.5\pgf@x |
| 7452 |
} |
| 7453 |
\anchor{in up}{ |
| 7454 |
\inOneFixed |
| 7455 |
} |
| 7456 |
\anchor{in down}{ |
| 7457 |
\inOneFixed |
| 7458 |
\pgf@y=-\pgf@y |
| 7459 |
} |
| 7460 |
\savedanchor\inOne{% |
| 7461 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7462 |
\pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen |
| 7463 |
\pgf@y=.5\pgf@y |
| 7464 |
\pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y |
| 7465 |
\pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen |
| 7466 |
\pgf@x=.5\pgf@x |
| 7467 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 7468 |
} |
| 7469 |
\anchor{-}{ |
| 7470 |
\inOne |
| 7471 |
} |
| 7472 |
\anchor{+}{ |
| 7473 |
\inOne |
| 7474 |
\pgf@y=-\pgf@y |
| 7475 |
} |
| 7476 |
\savedanchor\up{% |
| 7477 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7478 |
\pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen |
| 7479 |
\pgf@y=.5\pgf@y |
| 7480 |
\pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen |
| 7481 |
\pgf@x=.5\pgf@x |
| 7482 |
\pgf@circ@res@up = \pgf@y |
| 7483 |
\pgf@circ@res@right = -\pgf@x |
| 7484 |
\pgf@circ@res@left = \pgf@x |
| 7485 |
\pgfpointlineattime{ |
| 7486 |
\ctikzvalof{tripoles/inst amp/up pos}}{ |
| 7487 |
\pgfpoint{ |
| 7488 |
\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} |
| 7489 |
{\pgf@circ@res@up}} |
| 7490 |
{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} |
| 7491 |
} |
| 7492 |
\anchor{up}{ |
| 7493 |
\up |
| 7494 |
} |
| 7495 |
\anchor{down}{ |
| 7496 |
\up |
| 7497 |
\pgf@y=-\pgf@y |
| 7498 |
} |
| 7499 |
% reference voltage input anchors. |
| 7500 |
\savedanchor\refv{% |
| 7501 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7502 |
\pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen |
| 7503 |
\pgf@y=.5\pgf@y |
| 7504 |
\pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen |
| 7505 |
\pgf@x=.5\pgf@x |
| 7506 |
\pgf@circ@res@up = \pgf@y |
| 7507 |
\pgf@circ@res@right = -\pgf@x |
| 7508 |
\pgf@circ@res@left = \pgf@x |
| 7509 |
\pgfpointlineattime{ |
| 7510 |
\ctikzvalof{tripoles/inst amp/refv pos}}{ |
| 7511 |
\pgfpoint{ |
| 7512 |
\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} |
| 7513 |
{\pgf@circ@res@up}} |
| 7514 |
{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} |
| 7515 |
} |
| 7516 |
% we need both because they are normally drawn under the amp, and if you |
| 7517 |
% mirror it vertically you need them |
| 7518 |
\anchor{refv up}{ |
| 7519 |
\refv |
| 7520 |
} |
| 7521 |
\anchor{refv down}{ |
| 7522 |
\refv |
| 7523 |
\pgf@y=-\pgf@y |
| 7524 |
} |
| 7525 |
\anchor{out}{ |
| 7526 |
\northwest |
| 7527 |
\pgf@y=0pt |
| 7528 |
\pgf@x=-\pgf@x |
| 7529 |
} |
| 7530 |
% support for border anchors |
| 7531 |
\pgf@circ@amps@setup@letfedge{inst amp} |
| 7532 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 7533 |
\anchor{bin up}{ |
| 7534 |
\inOneFixed |
| 7535 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7536 |
} |
| 7537 |
\anchor{bin down}{ |
| 7538 |
\inOneFixed |
| 7539 |
\pgf@y=-\pgf@y |
| 7540 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7541 |
} |
| 7542 |
\anchor{b-}{ |
| 7543 |
\inOne |
| 7544 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7545 |
} |
| 7546 |
\anchor{b+}{ |
| 7547 |
\inOne |
| 7548 |
\pgf@y=-\pgf@y |
| 7549 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7550 |
} |
| 7551 |
\anchor{bout}{ |
| 7552 |
\leftedge |
| 7553 |
\pgf@y=0pt |
| 7554 |
\pgf@x=-\pgf@x |
| 7555 |
} |
| 7556 |
% end border anchors |
| 7557 |
\anchor{west}{ |
| 7558 |
\left |
| 7559 |
} |
| 7560 |
\anchor{east}{ |
| 7561 |
\left |
| 7562 |
\pgf@x=-\pgf@x |
| 7563 |
} |
| 7564 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 7565 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 7566 |
\anchor{north west}{ \northwest } |
| 7567 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 7568 |
\pgf@circ@amps@setup@text{inst amp} |
| 7569 |
% let's start drawing the component |
| 7570 |
\pgf@circ@draw@component{ |
| 7571 |
\pgf@circ@setcolor |
| 7572 |
% |
| 7573 |
\northwest |
| 7574 |
\pgf@circ@res@up = \pgf@y |
| 7575 |
\pgf@circ@res@down = -\pgf@y |
| 7576 |
\pgf@circ@res@right = -\pgf@x |
| 7577 |
\pgf@circ@res@left = \pgf@x |
| 7578 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 7579 |
|
| 7580 |
% main component, normally in thicker lines |
| 7581 |
\pgfscope |
| 7582 |
\newdimen\pgf@circ@res@right@double |
| 7583 |
\pgf@circ@res@right@double=2\pgf@circ@res@right |
| 7584 |
|
| 7585 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 7586 |
\pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} |
| 7587 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 7588 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 7589 |
\pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step |
| 7590 |
%first point (near output) |
| 7591 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}} |
| 7592 |
%from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors |
| 7593 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}} |
| 7594 |
% and then to the input "front up", "down", to the output short side "down" |
| 7595 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 7596 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 7597 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}} |
| 7598 |
% ...and close |
| 7599 |
\pgfpathclose |
| 7600 |
\pgf@circ@draworfill |
| 7601 |
\endpgfscope |
| 7602 |
|
| 7603 |
% Negative input terminal |
| 7604 |
\pgfpathmoveto{\pgfpoint |
| 7605 |
{\pgf@circ@res@left} |
| 7606 |
{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} |
| 7607 |
% |
| 7608 |
\pgfpathlineto{\pgfpoint |
| 7609 |
{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} |
| 7610 |
{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} |
| 7611 |
% |
| 7612 |
|
| 7613 |
% Positive input terminal |
| 7614 |
\pgfpathmoveto{\pgfpoint |
| 7615 |
{\pgf@circ@res@left} |
| 7616 |
{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} |
| 7617 |
% |
| 7618 |
\pgfpathlineto{\pgfpoint |
| 7619 |
{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} |
| 7620 |
{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} |
| 7621 |
|
| 7622 |
% Output terminal |
| 7623 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 7624 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} % |
| 7625 |
% |
| 7626 |
\pgfsetrectcap |
| 7627 |
\pgfusepath{draw} |
| 7628 |
\pgf@circ@text@strokecolor |
| 7629 |
\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} |
| 7630 |
\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} |
| 7631 |
} |
| 7632 |
} |
| 7633 |
|
| 7634 |
% Instrumentation amplifier with terminals for gain resistance between inputs |
| 7635 |
\pgfdeclareshape{inst amp ra} |
| 7636 |
{ |
| 7637 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 7638 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 7639 |
\anchor{center}{\pgfpointorigin} |
| 7640 |
% bounding-box top left |
| 7641 |
\savedanchor\northwest{% |
| 7642 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7643 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen |
| 7644 |
\pgf@y=.5\pgf@y |
| 7645 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7646 |
\pgf@x=.5\pgf@x |
| 7647 |
} |
| 7648 |
\anchor{nw}{ |
| 7649 |
\northwest |
| 7650 |
} |
| 7651 |
\anchor{south}{ |
| 7652 |
\northwest |
| 7653 |
\pgf@y=-\pgf@y\pgf@x=0pt\relax |
| 7654 |
} |
| 7655 |
\anchor{north}{ |
| 7656 |
\northwest\pgf@x=0pt\relax |
| 7657 |
} |
| 7658 |
\savedanchor\left{% |
| 7659 |
\pgf@y=0pt |
| 7660 |
} |
| 7661 |
\anchor{leftedge} |
| 7662 |
{\left |
| 7663 |
\pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x |
| 7664 |
} |
| 7665 |
% inputs (+-) |
| 7666 |
\savedanchor\inOneFixed{% |
| 7667 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7668 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen |
| 7669 |
\pgf@y=.5\pgf@y |
| 7670 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y |
| 7671 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7672 |
\pgf@x=.5\pgf@x |
| 7673 |
} |
| 7674 |
\anchor{in up}{ |
| 7675 |
\inOneFixed |
| 7676 |
} |
| 7677 |
\anchor{in down}{ |
| 7678 |
\inOneFixed |
| 7679 |
\pgf@y=-\pgf@y |
| 7680 |
} |
| 7681 |
\savedanchor\inOne{% |
| 7682 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7683 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen |
| 7684 |
\pgf@y=.5\pgf@y |
| 7685 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y |
| 7686 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7687 |
\pgf@x=.5\pgf@x |
| 7688 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 7689 |
} |
| 7690 |
\anchor{-}{ |
| 7691 |
\inOne |
| 7692 |
} |
| 7693 |
\anchor{+}{ |
| 7694 |
\inOne |
| 7695 |
\pgf@y=-\pgf@y |
| 7696 |
} |
| 7697 |
% R ampli anchors. They are by default at 20% more than R-length distance |
| 7698 |
% you can change that with the `ra pos` key (use 0.5 for one-R). |
| 7699 |
\savedanchor\raOneFixed{% |
| 7700 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7701 |
\pgf@y=\pgf@circ@scaled@Rlen |
| 7702 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y |
| 7703 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7704 |
\pgf@x=.5\pgf@x |
| 7705 |
} |
| 7706 |
\anchor{ra up}{ |
| 7707 |
\raOneFixed |
| 7708 |
} |
| 7709 |
\anchor{ra down}{ |
| 7710 |
\raOneFixed |
| 7711 |
\pgf@y=-\pgf@y |
| 7712 |
} |
| 7713 |
\savedanchor\raOne{% |
| 7714 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7715 |
\pgf@y=\pgf@circ@scaled@Rlen |
| 7716 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y |
| 7717 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7718 |
\pgf@x=.5\pgf@x |
| 7719 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 7720 |
} |
| 7721 |
\anchor{ra-}{ |
| 7722 |
\raOne |
| 7723 |
} |
| 7724 |
\anchor{ra+}{ |
| 7725 |
\raOne |
| 7726 |
\pgf@y=-\pgf@y |
| 7727 |
} |
| 7728 |
% power supplies |
| 7729 |
\savedanchor\up{% |
| 7730 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7731 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen |
| 7732 |
\pgf@y=.5\pgf@y |
| 7733 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7734 |
\pgf@x=.5\pgf@x |
| 7735 |
\pgf@circ@res@up = \pgf@y |
| 7736 |
\pgf@circ@res@right = -\pgf@x |
| 7737 |
\pgf@circ@res@left = \pgf@x |
| 7738 |
\pgfpointlineattime{ |
| 7739 |
\ctikzvalof{tripoles/inst amp ra/up pos}}{ |
| 7740 |
\pgfpoint{ |
| 7741 |
\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7742 |
{\pgf@circ@res@up}} |
| 7743 |
{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} |
| 7744 |
} |
| 7745 |
\anchor{up}{ |
| 7746 |
\up |
| 7747 |
} |
| 7748 |
\anchor{down}{ |
| 7749 |
\up |
| 7750 |
\pgf@y=-\pgf@y |
| 7751 |
} |
| 7752 |
% reference voltage input anchors. |
| 7753 |
\savedanchor\refv{% |
| 7754 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7755 |
\pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen |
| 7756 |
\pgf@y=0.5\pgf@y |
| 7757 |
\pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen |
| 7758 |
\pgf@x=0.5\pgf@x |
| 7759 |
\pgf@circ@res@up = \pgf@y |
| 7760 |
\pgf@circ@res@right = -\pgf@x |
| 7761 |
\pgf@circ@res@left = \pgf@x |
| 7762 |
\pgfpointlineattime{ |
| 7763 |
\ctikzvalof{tripoles/inst amp ra/refv pos}}{ |
| 7764 |
\pgfpoint{ |
| 7765 |
\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7766 |
{\pgf@circ@res@up}} |
| 7767 |
{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}} |
| 7768 |
} |
| 7769 |
% we need both because they are normally drawn under the amp, and if you |
| 7770 |
% mirror it vertically you need them |
| 7771 |
\anchor{refv up}{ |
| 7772 |
\refv |
| 7773 |
} |
| 7774 |
\anchor{refv down}{ |
| 7775 |
\refv |
| 7776 |
\pgf@y=-\pgf@y |
| 7777 |
} |
| 7778 |
\anchor{out}{ |
| 7779 |
\northwest |
| 7780 |
\pgf@y=0pt |
| 7781 |
\pgf@x=-\pgf@x |
| 7782 |
} |
| 7783 |
% support for border anchors |
| 7784 |
\pgf@circ@amps@setup@letfedge{inst amp ra} |
| 7785 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 7786 |
\anchor{bin up}{ |
| 7787 |
\inOneFixed |
| 7788 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7789 |
} |
| 7790 |
\anchor{bin down}{ |
| 7791 |
\inOneFixed |
| 7792 |
\pgf@y=-\pgf@y |
| 7793 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7794 |
} |
| 7795 |
\anchor{b-}{ |
| 7796 |
\inOne |
| 7797 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7798 |
} |
| 7799 |
\anchor{b+}{ |
| 7800 |
\inOne |
| 7801 |
\pgf@y=-\pgf@y |
| 7802 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7803 |
} |
| 7804 |
\anchor{bra up}{ |
| 7805 |
\raOneFixed |
| 7806 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7807 |
} |
| 7808 |
\anchor{bra down}{ |
| 7809 |
\raOneFixed |
| 7810 |
\pgf@y=-\pgf@y |
| 7811 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7812 |
} |
| 7813 |
\anchor{bra-}{ |
| 7814 |
\raOne |
| 7815 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7816 |
} |
| 7817 |
\anchor{bra+}{ |
| 7818 |
\raOne |
| 7819 |
\pgf@y=-\pgf@y |
| 7820 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 7821 |
} |
| 7822 |
\anchor{bout}{ |
| 7823 |
\leftedge |
| 7824 |
\pgf@y=0pt |
| 7825 |
\pgf@x=-\pgf@x |
| 7826 |
} |
| 7827 |
% end border anchors |
| 7828 |
\anchor{west}{ |
| 7829 |
\left |
| 7830 |
} |
| 7831 |
\anchor{east}{ |
| 7832 |
\left |
| 7833 |
\pgf@x=-\pgf@x |
| 7834 |
} |
| 7835 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 7836 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 7837 |
\anchor{north west}{ \northwest } |
| 7838 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 7839 |
\pgf@circ@amps@setup@text{inst amp ra} |
| 7840 |
% drawing of the component |
| 7841 |
\pgf@circ@draw@component{ |
| 7842 |
\pgf@circ@setcolor |
| 7843 |
|
| 7844 |
\northwest |
| 7845 |
\pgf@circ@res@up = \pgf@y |
| 7846 |
\pgf@circ@res@down = -\pgf@y |
| 7847 |
\pgf@circ@res@right = -\pgf@x |
| 7848 |
\pgf@circ@res@left = \pgf@x |
| 7849 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 7850 |
|
| 7851 |
\newdimen\pgf@circ@res@right@double |
| 7852 |
\pgf@circ@res@right@double=2\pgf@circ@res@right |
| 7853 |
|
| 7854 |
% main component, normally in thicker lines |
| 7855 |
\pgfscope |
| 7856 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 7857 |
\pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7858 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 7859 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 7860 |
\pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step |
| 7861 |
%primer punto: la linea de salida (lado componente) |
| 7862 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}} |
| 7863 |
%from the exit to the top (short side)... (note that the .6 must be copied in \up anchor |
| 7864 |
\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}} |
| 7865 |
% and then to the input "front up", "down", to the output short side "down" |
| 7866 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 7867 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 7868 |
\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}} |
| 7869 |
% ...and close |
| 7870 |
\pgfpathclose |
| 7871 |
\pgf@circ@draworfill |
| 7872 |
\endpgfscope |
| 7873 |
|
| 7874 |
% ra terminal - |
| 7875 |
\pgfpathmoveto{\pgfpoint |
| 7876 |
{\pgf@circ@res@left} |
| 7877 |
{\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}} |
| 7878 |
% |
| 7879 |
\pgfpathlineto{\pgfpoint |
| 7880 |
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7881 |
{\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}} |
| 7882 |
% ra terminal + |
| 7883 |
\pgfpathmoveto{\pgfpoint |
| 7884 |
{\pgf@circ@res@left} |
| 7885 |
{-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}} |
| 7886 |
% |
| 7887 |
\pgfpathlineto{\pgfpoint |
| 7888 |
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7889 |
{-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}} |
| 7890 |
|
| 7891 |
% Negative input terminal |
| 7892 |
\pgfpathmoveto{\pgfpoint |
| 7893 |
{\pgf@circ@res@left} |
| 7894 |
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} |
| 7895 |
% |
| 7896 |
\pgfpathlineto{\pgfpoint |
| 7897 |
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7898 |
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} |
| 7899 |
% |
| 7900 |
|
| 7901 |
% Positive input terminal |
| 7902 |
\pgfpathmoveto{\pgfpoint |
| 7903 |
{\pgf@circ@res@left} |
| 7904 |
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} |
| 7905 |
% |
| 7906 |
\pgfpathlineto{\pgfpoint |
| 7907 |
{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} |
| 7908 |
{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} |
| 7909 |
|
| 7910 |
% Output terminal |
| 7911 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 7912 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} % |
| 7913 |
% |
| 7914 |
\pgfsetrectcap |
| 7915 |
\pgfusepath{draw} |
| 7916 |
\pgf@circ@text@strokecolor |
| 7917 |
\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} |
| 7918 |
\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} |
| 7919 |
} |
| 7920 |
} |
| 7921 |
|
| 7922 |
% Buffer |
| 7923 |
% Contributed by Danilo Piazzalunga |
| 7924 |
\pgfdeclareshape{buffer} |
| 7925 |
{ |
| 7926 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 7927 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 7928 |
\anchor{center}{\pgfpointorigin} |
| 7929 |
\savedanchor\northwest{% |
| 7930 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7931 |
\pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen |
| 7932 |
\pgf@y=.5\pgf@y |
| 7933 |
\pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen |
| 7934 |
\pgf@x=.5\pgf@x |
| 7935 |
} |
| 7936 |
\anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } |
| 7937 |
\anchor{west}{ \northwest \pgf@y=0pt } |
| 7938 |
\anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } |
| 7939 |
\anchor{north}{ \northwest \pgf@x=0pt } |
| 7940 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 7941 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 7942 |
\anchor{north west}{ \northwest } |
| 7943 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 7944 |
\savedanchor\left{% |
| 7945 |
\pgf@y=0pt |
| 7946 |
} |
| 7947 |
\anchor{in}{ |
| 7948 |
\northwest |
| 7949 |
\pgf@y=0pt |
| 7950 |
} |
| 7951 |
\anchor{out}{ |
| 7952 |
\northwest |
| 7953 |
\pgf@y=0pt |
| 7954 |
\pgf@x=-\pgf@x |
| 7955 |
} |
| 7956 |
\anchor{bin}{ |
| 7957 |
\northwest |
| 7958 |
\pgf@y=0pt |
| 7959 |
\pgf@x=0.7\pgf@x |
| 7960 |
} |
| 7961 |
\anchor{bout}{ |
| 7962 |
\northwest |
| 7963 |
\pgf@y=0pt |
| 7964 |
\pgf@x=-0.7\pgf@x |
| 7965 |
} |
| 7966 |
\savedanchor{\textanchor}{ |
| 7967 |
\ifpgf@circ@center@text |
| 7968 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 7969 |
\else |
| 7970 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 7971 |
\pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen |
| 7972 |
\pgf@y=.5\pgf@y |
| 7973 |
\pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen |
| 7974 |
\pgf@x=.5\pgf@x |
| 7975 |
\pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}} |
| 7976 |
\fi |
| 7977 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 7978 |
} |
| 7979 |
\anchor{text}{\textanchor} |
| 7980 |
\pgf@circ@draw@component{ |
| 7981 |
\pgf@circ@setcolor |
| 7982 |
|
| 7983 |
\northwest |
| 7984 |
\pgf@circ@res@up = \pgf@y |
| 7985 |
\pgf@circ@res@down = -\pgf@y |
| 7986 |
\pgf@circ@res@right = -\pgf@x |
| 7987 |
\pgf@circ@res@left = \pgf@x |
| 7988 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 7989 |
\pgfscope |
| 7990 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 7991 |
\pgftransformxshift{.7\pgf@circ@res@left} |
| 7992 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 7993 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 7994 |
\pgf@circ@res@step=.7\pgf@circ@res@step |
| 7995 |
|
| 7996 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 7997 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 7998 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 7999 |
\pgfpathclose |
| 8000 |
\pgf@circ@draworfill |
| 8001 |
\endpgfscope |
| 8002 |
|
| 8003 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} |
| 8004 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} |
| 8005 |
|
| 8006 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 8007 |
\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} |
| 8008 |
|
| 8009 |
\pgfusepath{draw} |
| 8010 |
} |
| 8011 |
} |
| 8012 |
|
| 8013 |
% plain amplifier, no symbols |
| 8014 |
\pgfdeclareshape{plain amp} |
| 8015 |
{ |
| 8016 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 8017 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 8018 |
\anchor{center}{\pgfpointorigin} |
| 8019 |
\savedanchor\northwest{% |
| 8020 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8021 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8022 |
\pgf@y=.5\pgf@y |
| 8023 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8024 |
\pgf@x=.5\pgf@x |
| 8025 |
} |
| 8026 |
\anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } |
| 8027 |
\anchor{west}{ \northwest \pgf@y=0pt } |
| 8028 |
\anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } |
| 8029 |
\anchor{north}{ \northwest \pgf@x=0pt } |
| 8030 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 8031 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 8032 |
\anchor{north west}{ \northwest } |
| 8033 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 8034 |
\savedanchor\left{% |
| 8035 |
\pgf@y=0pt |
| 8036 |
} |
| 8037 |
\savedanchor\inOne{% |
| 8038 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8039 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8040 |
\pgf@y=.5\pgf@y |
| 8041 |
\pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y |
| 8042 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8043 |
\pgf@x=.5\pgf@x |
| 8044 |
\ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi |
| 8045 |
} |
| 8046 |
\savedanchor\inOneFixed{% |
| 8047 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8048 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8049 |
\pgf@y=.5\pgf@y |
| 8050 |
\pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y |
| 8051 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8052 |
\pgf@x=.5\pgf@x |
| 8053 |
} |
| 8054 |
\anchor{-}{ |
| 8055 |
\inOne |
| 8056 |
} |
| 8057 |
\anchor{+}{ |
| 8058 |
\inOne |
| 8059 |
\pgf@y=-\pgf@y |
| 8060 |
} |
| 8061 |
\anchor{in up}{ |
| 8062 |
\inOneFixed |
| 8063 |
} |
| 8064 |
\anchor{in down}{ |
| 8065 |
\inOneFixed |
| 8066 |
\pgf@y=-\pgf@y |
| 8067 |
} |
| 8068 |
% support for border anchors |
| 8069 |
\pgf@circ@amps@setup@letfedge{plain amp} |
| 8070 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 8071 |
\anchor{bin up}{ |
| 8072 |
\inOneFixed |
| 8073 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8074 |
} |
| 8075 |
\anchor{bin down}{ |
| 8076 |
\inOneFixed |
| 8077 |
\pgf@y=-\pgf@y |
| 8078 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8079 |
} |
| 8080 |
\anchor{b-}{ |
| 8081 |
\inOne |
| 8082 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8083 |
} |
| 8084 |
\anchor{b+}{ |
| 8085 |
\inOne |
| 8086 |
\pgf@y=-\pgf@y |
| 8087 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8088 |
} |
| 8089 |
\anchor{bout}{ |
| 8090 |
\leftedge |
| 8091 |
\pgf@y=0pt |
| 8092 |
\pgf@x=-\pgf@x |
| 8093 |
} |
| 8094 |
% end border anchors |
| 8095 |
\savedanchor\up{% |
| 8096 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8097 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8098 |
\pgf@y=.5\pgf@y |
| 8099 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8100 |
\pgf@x=.5\pgf@x |
| 8101 |
\pgf@circ@res@up = \pgf@y |
| 8102 |
\pgf@circ@res@right = -\pgf@x |
| 8103 |
\pgf@circ@res@left = \pgf@x |
| 8104 |
\pgfpointlineattime{ |
| 8105 |
\ctikzvalof{tripoles/plain amp/up pos}}{ |
| 8106 |
\pgfpoint{ |
| 8107 |
\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8108 |
{\pgf@circ@res@up}} |
| 8109 |
{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} |
| 8110 |
} |
| 8111 |
\anchor{up}{ |
| 8112 |
\up |
| 8113 |
} |
| 8114 |
\anchor{down}{ |
| 8115 |
\up |
| 8116 |
\pgf@y=-\pgf@y |
| 8117 |
} |
| 8118 |
\anchor{out}{ |
| 8119 |
\northwest |
| 8120 |
\pgf@y=0pt |
| 8121 |
\pgf@x=-\pgf@x |
| 8122 |
} |
| 8123 |
\pgf@circ@amps@setup@text{plain amp} |
| 8124 |
\pgf@circ@draw@component{ |
| 8125 |
\pgf@circ@setcolor |
| 8126 |
|
| 8127 |
\northwest |
| 8128 |
\pgf@circ@res@up = \pgf@y |
| 8129 |
\pgf@circ@res@down = -\pgf@y |
| 8130 |
\pgf@circ@res@right = -\pgf@x |
| 8131 |
\pgf@circ@res@left = \pgf@x |
| 8132 |
|
| 8133 |
\pgfscope |
| 8134 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 8135 |
\pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8136 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 8137 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 8138 |
\pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step |
| 8139 |
|
| 8140 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 8141 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 8142 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 8143 |
\pgfpathclose |
| 8144 |
\pgf@circ@draworfill |
| 8145 |
\endpgfscope |
| 8146 |
\pgfpathmoveto{\pgfpoint |
| 8147 |
{\pgf@circ@res@left} |
| 8148 |
{\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} |
| 8149 |
\pgfpathlineto{\pgfpoint |
| 8150 |
{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8151 |
{\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}} |
| 8152 |
|
| 8153 |
|
| 8154 |
\pgfpathmoveto{\pgfpoint |
| 8155 |
{\pgf@circ@res@left} |
| 8156 |
{\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} |
| 8157 |
\pgfpathlineto{\pgfpoint |
| 8158 |
{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8159 |
{\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}} |
| 8160 |
|
| 8161 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 8162 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} |
| 8163 |
|
| 8164 |
\pgfusepath{draw} |
| 8165 |
} |
| 8166 |
} |
| 8167 |
|
| 8168 |
% plain amplifier, no symbols, one input |
| 8169 |
\pgfdeclareshape{plain mono amp} |
| 8170 |
{ |
| 8171 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 8172 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 8173 |
\anchor{center}{\pgfpointorigin} |
| 8174 |
\savedanchor\northwest{% |
| 8175 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8176 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8177 |
\pgf@y=.5\pgf@y |
| 8178 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8179 |
\pgf@x=.5\pgf@x |
| 8180 |
} |
| 8181 |
\anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } |
| 8182 |
\anchor{west}{ \northwest \pgf@y=0pt } |
| 8183 |
\anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } |
| 8184 |
\anchor{north}{ \northwest \pgf@x=0pt } |
| 8185 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 8186 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 8187 |
\anchor{north west}{ \northwest } |
| 8188 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 8189 |
\savedanchor\left{% |
| 8190 |
\pgf@y=0pt |
| 8191 |
} |
| 8192 |
\savedanchor\inOne{% |
| 8193 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8194 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8195 |
\pgf@x=.5\pgf@x |
| 8196 |
\pgf@y=0pt\relax |
| 8197 |
} |
| 8198 |
\anchor{in}{ |
| 8199 |
\inOne |
| 8200 |
} |
| 8201 |
% support for border anchors |
| 8202 |
\pgf@circ@amps@setup@letfedge{plain amp}% Warning: plain mono amp using plain amp settings |
| 8203 |
\anchor{leftedge}{\leftedge} |
| 8204 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 8205 |
\anchor{bin}{ |
| 8206 |
\inOne |
| 8207 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8208 |
} |
| 8209 |
\anchor{bout}{ |
| 8210 |
\leftedge |
| 8211 |
\pgf@y=0pt |
| 8212 |
\pgf@x=-\pgf@x |
| 8213 |
} |
| 8214 |
% end border anchors |
| 8215 |
\savedanchor\up{% |
| 8216 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8217 |
\pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen |
| 8218 |
\pgf@y=.5\pgf@y |
| 8219 |
\pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen |
| 8220 |
\pgf@x=.5\pgf@x |
| 8221 |
\pgf@circ@res@up = \pgf@y |
| 8222 |
\pgf@circ@res@right = -\pgf@x |
| 8223 |
\pgf@circ@res@left = \pgf@x |
| 8224 |
\pgfpointlineattime{ |
| 8225 |
\ctikzvalof{tripoles/plain amp/up pos}}{ |
| 8226 |
\pgfpoint{ |
| 8227 |
\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8228 |
{\pgf@circ@res@up}} |
| 8229 |
{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} |
| 8230 |
} |
| 8231 |
\anchor{up}{ |
| 8232 |
\up |
| 8233 |
} |
| 8234 |
\anchor{down}{ |
| 8235 |
\up |
| 8236 |
\pgf@y=-\pgf@y |
| 8237 |
} |
| 8238 |
\anchor{out}{ |
| 8239 |
\northwest |
| 8240 |
\pgf@y=0pt |
| 8241 |
\pgf@x=-\pgf@x |
| 8242 |
} |
| 8243 |
\pgf@circ@amps@setup@text{plain amp}% Warning: plain mono amp using plain amp settings |
| 8244 |
\savedanchor{\textanchor}{% |
| 8245 |
\ifpgf@circ@center@text |
| 8246 |
\pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax |
| 8247 |
\else |
| 8248 |
\pgf@circ@amps@leftedge{plain amp}% Warning: plain mono amp using plain amp settings |
| 8249 |
\pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} |
| 8250 |
\fi |
| 8251 |
\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax |
| 8252 |
} |
| 8253 |
\anchor{text}{\textanchor} |
| 8254 |
\pgf@circ@draw@component{ |
| 8255 |
\pgf@circ@setcolor |
| 8256 |
|
| 8257 |
\northwest |
| 8258 |
\pgf@circ@res@up = \pgf@y |
| 8259 |
\pgf@circ@res@down = -\pgf@y |
| 8260 |
\pgf@circ@res@right = -\pgf@x |
| 8261 |
\pgf@circ@res@left = \pgf@x |
| 8262 |
|
| 8263 |
\pgfscope |
| 8264 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 8265 |
\pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8266 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 8267 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 8268 |
\pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step |
| 8269 |
|
| 8270 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} |
| 8271 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 8272 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 8273 |
\pgfpathclose |
| 8274 |
\pgf@circ@draworfill |
| 8275 |
\endpgfscope |
| 8276 |
\pgfpathmoveto{\pgfpoint |
| 8277 |
{\pgf@circ@res@left} |
| 8278 |
{0pt}} |
| 8279 |
\pgfpathlineto{\pgfpoint |
| 8280 |
{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} |
| 8281 |
{0pt}} |
| 8282 |
|
| 8283 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 8284 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} |
| 8285 |
|
| 8286 |
\pgfusepath{draw} |
| 8287 |
} |
| 8288 |
} |
| 8289 |
|
| 8290 |
% plain gm mono amplifier, no symbols, one input |
| 8291 |
\pgfdeclareshape{plain gm mono amp} |
| 8292 |
{ |
| 8293 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} |
| 8294 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 8295 |
\anchor{center}{\pgfpointorigin} |
| 8296 |
\savedanchor\northwest{% |
| 8297 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8298 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 8299 |
\pgf@y=.5\pgf@y |
| 8300 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 8301 |
\pgf@x=.5\pgf@x |
| 8302 |
} |
| 8303 |
\anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } |
| 8304 |
\anchor{west}{ \northwest \pgf@y=0pt } |
| 8305 |
\anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } |
| 8306 |
\anchor{north}{ \northwest \pgf@x=0pt } |
| 8307 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 8308 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 8309 |
\anchor{north west}{ \northwest } |
| 8310 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 8311 |
\savedanchor\left{% |
| 8312 |
\pgf@y=0pt |
| 8313 |
} |
| 8314 |
\savedanchor\inOne{ |
| 8315 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8316 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 8317 |
\pgf@x=.5\pgf@x |
| 8318 |
\pgf@y=0pt\relax |
| 8319 |
} |
| 8320 |
\anchor{in}{ |
| 8321 |
\inOne |
| 8322 |
} |
| 8323 |
\pgf@circ@amps@setup@letfedge{gm amp}% Warning plain gm mono amp using gm amp settings |
| 8324 |
\anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } |
| 8325 |
\anchor{bin}{ |
| 8326 |
\inOne |
| 8327 |
\pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya |
| 8328 |
} |
| 8329 |
\anchor{bout}{ |
| 8330 |
\leftedge |
| 8331 |
\pgf@y=0pt |
| 8332 |
\pgf@x=-\pgf@x |
| 8333 |
} |
| 8334 |
|
| 8335 |
\savedanchor\up{% |
| 8336 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8337 |
\pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen |
| 8338 |
\pgf@y=.5\pgf@y |
| 8339 |
\pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen |
| 8340 |
\pgf@x=.5\pgf@x |
| 8341 |
\pgf@circ@res@up = \pgf@y |
| 8342 |
\pgf@circ@res@right = -\pgf@x |
| 8343 |
\pgf@circ@res@left = \pgf@x |
| 8344 |
\pgfpointlineattime{ |
| 8345 |
\ctikzvalof{tripoles/gm amp/up pos}}{ |
| 8346 |
\pgfpoint{ |
| 8347 |
\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 8348 |
{\pgf@circ@res@up}} |
| 8349 |
{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} |
| 8350 |
} |
| 8351 |
\anchor{up}{ |
| 8352 |
\up |
| 8353 |
} |
| 8354 |
\anchor{down}{ |
| 8355 |
\up |
| 8356 |
\pgf@y=-\pgf@y |
| 8357 |
} |
| 8358 |
\anchor{out}{ |
| 8359 |
\northwest |
| 8360 |
\pgf@y=0pt |
| 8361 |
\pgf@x=-\pgf@x |
| 8362 |
} |
| 8363 |
\pgf@circ@amps@setup@text{gm amp}% Warning plain gm mono amp using gm amp settings |
| 8364 |
\pgf@circ@draw@component{ |
| 8365 |
\pgf@circ@setcolor |
| 8366 |
|
| 8367 |
\northwest |
| 8368 |
\pgf@circ@res@up = \pgf@y |
| 8369 |
\pgf@circ@res@down = -\pgf@y |
| 8370 |
\pgf@circ@res@right = -\pgf@x |
| 8371 |
\pgf@circ@res@left = \pgf@x |
| 8372 |
|
| 8373 |
\pgfscope |
| 8374 |
\newdimen\pgf@circ@res@right@double |
| 8375 |
\pgf@circ@res@right@double=2\pgf@circ@res@right |
| 8376 |
|
| 8377 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 8378 |
\pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 8379 |
\pgf@circ@res@step=\pgf@circ@res@right |
| 8380 |
\advance\pgf@circ@res@step by -\pgf@circ@res@left |
| 8381 |
\pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step |
| 8382 |
|
| 8383 |
\pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} |
| 8384 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}} |
| 8385 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 8386 |
\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} |
| 8387 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}} |
| 8388 |
\pgfpathclose |
| 8389 |
\pgf@circ@draworfill |
| 8390 |
\endpgfscope |
| 8391 |
\pgfpathmoveto{\pgfpoint |
| 8392 |
{\pgf@circ@res@left} |
| 8393 |
{0pt}} |
| 8394 |
\pgfpathlineto{\pgfpoint |
| 8395 |
{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} |
| 8396 |
{0pt}} |
| 8397 |
|
| 8398 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 8399 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} |
| 8400 |
|
| 8401 |
\pgfusepath{draw} |
| 8402 |
} |
| 8403 |
} |
| 8404 |
|
| 8405 |
|
| 8406 |
%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 8407 |
%% Tubes and magnetron |
| 8408 |
%%%%%%%%%%%%%%%%%%%%%%%% |
| 8409 |
|
| 8410 |
% Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1 |
| 8411 |
\ctikzset{tubes/width/.initial=1} % relative width |
| 8412 |
\ctikzset{tubes/height/.initial=1.4} % relative height |
| 8413 |
\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle |
| 8414 |
\ctikzset{tubes/anode distance/.initial=0.40} % distance from center |
| 8415 |
\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate |
| 8416 |
\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center |
| 8417 |
\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes |
| 8418 |
\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids |
| 8419 |
\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center |
| 8420 |
\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid |
| 8421 |
\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode |
| 8422 |
\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire |
| 8423 |
\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side |
| 8424 |
\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode |
| 8425 |
\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint |
| 8426 |
% partial borders styles |
| 8427 |
% this can be "none" or 6 numbers saying the style for each part: |
| 8428 |
% 0 --- nothing, 1 --- solid, 2 --- dashed |
| 8429 |
\ctikzset{tubes/partial borders/.initial=none} % Value none for normal borders |
| 8430 |
\ctikzset{tubes/partial border dash/.initial={{2pt}{2pt}}} |
| 8431 |
|
| 8432 |
\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1} |
| 8433 |
|
| 8434 |
\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse |
| 8435 |
\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} |
| 8436 |
\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}} |
| 8437 |
\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse |
| 8438 |
\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} |
| 8439 |
\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}} |
| 8440 |
\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse |
| 8441 |
\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}} |
| 8442 |
\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}% |
| 8443 |
%>>> |
| 8444 |
|
| 8445 |
%% Node shapes for tubes & co%<<< |
| 8446 |
|
| 8447 |
%%%%%%%%%%%%%%%%%%% |
| 8448 |
%% Magnetron |
| 8449 |
%%%%%%%%%%%%%%%%%%% |
| 8450 |
|
| 8451 |
\pgfdeclareshape{magnetron} |
| 8452 |
{ |
| 8453 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components |
| 8454 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 8455 |
\savedanchor\northwest{ |
| 8456 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8457 |
\pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen |
| 8458 |
\pgf@y=.5\pgf@y |
| 8459 |
\pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen |
| 8460 |
\pgf@x=.5\pgf@x |
| 8461 |
} |
| 8462 |
\anchor{center}{ |
| 8463 |
\pgfpointorigin |
| 8464 |
} |
| 8465 |
\anchor{anode}{ |
| 8466 |
\northwest |
| 8467 |
\pgf@x=0pt |
| 8468 |
\pgf@y=-\pgf@y |
| 8469 |
} |
| 8470 |
\anchor{cathode1}{ |
| 8471 |
\northwest |
| 8472 |
\pgf@circ@res@step=\pgf@y |
| 8473 |
\pgfmathparse{cos(105)} |
| 8474 |
\pgf@x=\pgfmathresult\pgf@circ@res@step |
| 8475 |
\pgfmathparse{sin(105)} |
| 8476 |
\pgf@y=\pgfmathresult\pgf@circ@res@step |
| 8477 |
%\pgfpointorigin |
| 8478 |
%\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture |
| 8479 |
} |
| 8480 |
\anchor{cathode2}{ |
| 8481 |
\northwest |
| 8482 |
\pgf@circ@res@step=\pgf@y |
| 8483 |
\pgfmathparse{cos(75)} |
| 8484 |
\pgf@x=\pgfmathresult\pgf@circ@res@step |
| 8485 |
\pgfmathparse{sin(75)} |
| 8486 |
\pgf@y=\pgfmathresult\pgf@circ@res@step |
| 8487 |
%\pgfpointorigin |
| 8488 |
%\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture |
| 8489 |
} |
| 8490 |
\savedanchor{\textanchor}{ |
| 8491 |
\pgfpointorigin |
| 8492 |
\advance \pgf@x by -.5\wd\pgfnodeparttextbox |
| 8493 |
\advance \pgf@y by -.5\ht\pgfnodeparttextbox |
| 8494 |
} |
| 8495 |
\anchor{text}{\textanchor} |
| 8496 |
\anchor{left}{% |
| 8497 |
\northwest |
| 8498 |
\pgf@y=0pt |
| 8499 |
} |
| 8500 |
\anchor{right}{% |
| 8501 |
\northwest |
| 8502 |
\pgf@y=0pt |
| 8503 |
\pgf@x=-\pgf@x |
| 8504 |
} |
| 8505 |
\anchor{top}{ |
| 8506 |
\northwest |
| 8507 |
\pgf@x=0pt |
| 8508 |
} |
| 8509 |
\anchor{pathstart}{ |
| 8510 |
\northwest |
| 8511 |
\pgf@x=0pt |
| 8512 |
} |
| 8513 |
\anchor{pathend}{ |
| 8514 |
\northwest |
| 8515 |
\pgf@x=0pt |
| 8516 |
\pgf@y=-\pgf@y |
| 8517 |
} |
| 8518 |
\anchor{bottom}{ |
| 8519 |
\northwest |
| 8520 |
\pgf@x=0pt |
| 8521 |
\pgf@y=-\pgf@y |
| 8522 |
} |
| 8523 |
\anchor{center}{ |
| 8524 |
\pgf@y=0pt |
| 8525 |
\pgf@x=0pt |
| 8526 |
} |
| 8527 |
\anchor{east}{ |
| 8528 |
\northwest |
| 8529 |
\pgf@y=0pt |
| 8530 |
\pgf@x=-\pgf@x |
| 8531 |
} |
| 8532 |
\anchor{west}{ |
| 8533 |
\northwest |
| 8534 |
\pgf@y=0pt |
| 8535 |
} |
| 8536 |
\anchor{south}{ |
| 8537 |
\northwest |
| 8538 |
\pgf@x=0pt |
| 8539 |
\pgf@y=-\pgf@y |
| 8540 |
} |
| 8541 |
\anchor{north}{ |
| 8542 |
\northwest |
| 8543 |
\pgf@x=0pt |
| 8544 |
} |
| 8545 |
\anchor{south west}{ \northwest \pgf@y=-\pgf@y } |
| 8546 |
\anchor{north east}{ \northwest \pgf@x=-\pgf@x } |
| 8547 |
\anchor{north west}{ \northwest } |
| 8548 |
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } |
| 8549 |
\pgf@circ@draw@component{ |
| 8550 |
\pgf@circ@setcolor |
| 8551 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 8552 |
\pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen |
| 8553 |
\northwest |
| 8554 |
\pgf@circ@res@up = \pgf@y |
| 8555 |
\pgf@circ@res@down = -\pgf@y |
| 8556 |
\pgf@circ@res@right = -\pgf@x |
| 8557 |
\pgf@circ@res@left = \pgf@x |
| 8558 |
\pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up} |
| 8559 |
|
| 8560 |
\pgfscope |
| 8561 |
\pgfstartlinewidth=\pgflinewidth |
| 8562 |
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} |
| 8563 |
%create outer circle |
| 8564 |
\pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right} |
| 8565 |
\pgf@circ@draworfill |
| 8566 |
%create chambers |
| 8567 |
\foreach \angle in {45,135,225,315}{ |
| 8568 |
\pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}} |
| 8569 |
\pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}} |
| 8570 |
} |
| 8571 |
\pgfsetroundcap |
| 8572 |
\pgfusepath{draw} |
| 8573 |
\pgfscope |
| 8574 |
%draw connection from outside |
| 8575 |
%anode |
| 8576 |
\pgfsetlinewidth{\pgfstartlinewidth} |
| 8577 |
\pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}} |
| 8578 |
\pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}} |
| 8579 |
%cathodes |
| 8580 |
\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}} |
| 8581 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} |
| 8582 |
\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}} |
| 8583 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} |
| 8584 |
\pgfsetbuttcap |
| 8585 |
\pgfusepath{draw} |
| 8586 |
\endpgfscope |
| 8587 |
%create cathode |
| 8588 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}} |
| 8589 |
\pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}} |
| 8590 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}} |
| 8591 |
\pgfusepath{draw} |
| 8592 |
%create anode |
| 8593 |
\pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}} |
| 8594 |
\pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}} |
| 8595 |
|
| 8596 |
\pgfsetbuttcap |
| 8597 |
\pgfusepath{draw} |
| 8598 |
\endpgfscope |
| 8599 |
} |
| 8600 |
} |
| 8601 |
|
| 8602 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 8603 |
% Electronic tubes, submitted by J. op den Brouw |
| 8604 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 8605 |
% |
| 8606 |
% draw partial tube outline |
| 8607 |
% |
| 8608 |
\def\pgf@circ@tubes@split#1#2#3#4#5#6\relax{%split the six numbers |
| 8609 |
\edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}% |
| 8610 |
} |
| 8611 |
\def\pgf@circ@tubes@setdash{% |
| 8612 |
\edef\@@dash{\ctikzvalof{tubes/partial border dash}}% |
| 8613 |
% \typeout{DASH:\@@dash}% |
| 8614 |
\expandafter\pgfsetdash\expandafter{\@@dash}{0pt}% |
| 8615 |
} |
| 8616 |
% this is the same as the transistor circles' one, but let's keep it separated |
| 8617 |
\def\pgf@circ@tubes@draw@style#1{% |
| 8618 |
\ifcase#1 |
| 8619 |
\pgfusepath{discard}% case 0, will discard the path |
| 8620 |
\or |
| 8621 |
\pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid |
| 8622 |
\or |
| 8623 |
\pgf@circ@tubes@setdash\pgfusepath{draw}% case 2, dashed |
| 8624 |
\else |
| 8625 |
\pgfutil@packagewarning{circuitikz}{Tube border draw style not known!}% |
| 8626 |
\pgfusepath{draw}% |
| 8627 |
\fi |
| 8628 |
} |
| 8629 |
\def\pgf@circ@tubes@draw@partial#1{% |
| 8630 |
\expandafter\pgf@circ@tubes@split#1\relax |
| 8631 |
% \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d:\@@e:\@@f} |
| 8632 |
\ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax |
| 8633 |
% horizontal tube |
| 8634 |
\pgfutil@tempdima=\pgf@circ@res@right |
| 8635 |
\advance\pgfutil@tempdima by -\pgf@circ@res@up |
| 8636 |
\pgfscope % left side upper arc |
| 8637 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} |
| 8638 |
\pgfpatharc{180}{90}{\pgf@circ@res@up} |
| 8639 |
\pgf@circ@tubes@draw@style{\@@a} |
| 8640 |
\endpgfscope |
| 8641 |
\pgfscope % upper horizontal part |
| 8642 |
\pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{\pgf@circ@res@up}} |
| 8643 |
\pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} |
| 8644 |
\pgf@circ@tubes@draw@style{\@@b} |
| 8645 |
\endpgfscope |
| 8646 |
\pgfscope % right side upper arc |
| 8647 |
\pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} |
| 8648 |
\pgfpatharc{90}{0}{\pgf@circ@res@up} |
| 8649 |
\pgf@circ@tubes@draw@style{\@@c} |
| 8650 |
\endpgfscope |
| 8651 |
\pgfscope % right side lower arc |
| 8652 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} |
| 8653 |
\pgfpatharc{0}{-90}{\pgf@circ@res@up} |
| 8654 |
\pgf@circ@tubes@draw@style{\@@d} |
| 8655 |
\endpgfscope |
| 8656 |
\pgfscope % lower horizontal part |
| 8657 |
\pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{-\pgf@circ@res@up}} |
| 8658 |
\pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} |
| 8659 |
\pgf@circ@tubes@draw@style{\@@e} |
| 8660 |
\endpgfscope |
| 8661 |
\pgfscope % left side lower arc |
| 8662 |
\pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} |
| 8663 |
\pgfpatharc{270}{180}{\pgf@circ@res@up} |
| 8664 |
\pgf@circ@tubes@draw@style{\@@f} |
| 8665 |
\endpgfscope |
| 8666 |
\else |
| 8667 |
% vertical tube |
| 8668 |
\pgfutil@tempdima=\pgf@circ@res@up |
| 8669 |
\advance\pgfutil@tempdima by -\pgf@circ@res@right |
| 8670 |
\pgfscope % left side upper arc |
| 8671 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 8672 |
\pgfpatharc{90}{0}{\pgf@circ@res@right} |
| 8673 |
\pgf@circ@tubes@draw@style{\@@a} |
| 8674 |
\endpgfscope |
| 8675 |
\pgfscope % right vertical part |
| 8676 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 8677 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} |
| 8678 |
\pgf@circ@tubes@draw@style{\@@b} |
| 8679 |
\endpgfscope |
| 8680 |
\pgfscope % right side lower arc |
| 8681 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} |
| 8682 |
\pgfpatharc{0}{-90}{\pgf@circ@res@right} |
| 8683 |
\pgf@circ@tubes@draw@style{\@@c} |
| 8684 |
\endpgfscope |
| 8685 |
\pgfscope % right side lower arc |
| 8686 |
\pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}} |
| 8687 |
\pgfpatharc{-90}{-180}{\pgf@circ@res@right} |
| 8688 |
\pgf@circ@tubes@draw@style{\@@d} |
| 8689 |
\endpgfscope |
| 8690 |
\pgfscope % left vertical part |
| 8691 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgfutil@tempdima}} |
| 8692 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 8693 |
\pgf@circ@tubes@draw@style{\@@e} |
| 8694 |
\endpgfscope |
| 8695 |
\pgfscope % left side upper arc |
| 8696 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 8697 |
\pgfpatharc{180}{90}{\pgf@circ@res@right} |
| 8698 |
\pgf@circ@tubes@draw@style{\@@f} |
| 8699 |
\endpgfscope |
| 8700 |
\fi |
| 8701 |
} |
| 8702 |
% Draw tube outline |
| 8703 |
\def\pgf@circ@tubes@drawtube{% |
| 8704 |
\ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax |
| 8705 |
% horizontal tube |
| 8706 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} |
| 8707 |
\pgfutil@tempdima=\pgf@circ@res@right |
| 8708 |
\advance\pgfutil@tempdima by -\pgf@circ@res@up |
| 8709 |
\pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}} |
| 8710 |
\pgfpatharc{90}{-90}{\pgf@circ@res@up} |
| 8711 |
\pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}} |
| 8712 |
\pgfpatharc{270}{90}{\pgf@circ@res@up} |
| 8713 |
\else |
| 8714 |
% vertical tube |
| 8715 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}} |
| 8716 |
\pgfutil@tempdima=\pgf@circ@res@up |
| 8717 |
\advance\pgfutil@tempdima by -\pgf@circ@res@right |
| 8718 |
\pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 8719 |
\pgfpatharc{180}{0}{\pgf@circ@res@right} |
| 8720 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}} |
| 8721 |
\pgfpatharc{180}{0}{-\pgf@circ@res@right} |
| 8722 |
\fi |
| 8723 |
\pgfpathclose |
| 8724 |
\edef\@@partial{\ctikzvalof{tubes/partial borders}} |
| 8725 |
\ifx\@@partial\pgf@nonetext |
| 8726 |
% Tube fill and draw if it's not partial... for speed |
| 8727 |
\pgf@circ@draworfill |
| 8728 |
\else |
| 8729 |
% otherwise, just fill and do the partial fill |
| 8730 |
\pgf@circ@maybefill |
| 8731 |
\pgf@circ@tubes@draw@partial{\@@partial} |
| 8732 |
% |
| 8733 |
\fi |
| 8734 |
} |
| 8735 |
|
| 8736 |
\long\def\pgfcirctubedrawanodestd{% Standard anode code (one anode) |
| 8737 |
% Anode (or plate) |
| 8738 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north |
| 8739 |
\pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 8740 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 8741 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 8742 |
} |
| 8743 |
\long\def\pgfcirctubedrawcathodestd{% Standard cathode code (one cathode) |
| 8744 |
% Cathode |
| 8745 |
\ifpgf@circuit@tubes@nocathode |
| 8746 |
\pgf@circuit@tubes@nocathodefalse |
| 8747 |
\else |
| 8748 |
\pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} |
| 8749 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} |
| 8750 |
\pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} |
| 8751 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} |
| 8752 |
\ifpgf@circuit@tubes@fullcathode |
| 8753 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}} |
| 8754 |
\pgf@circuit@tubes@fullcathodefalse |
| 8755 |
\else |
| 8756 |
\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}} |
| 8757 |
\fi |
| 8758 |
\fi |
| 8759 |
} |
| 8760 |
|
| 8761 |
%% generic macro to create a tube. Most of them will use the standard macro for |
| 8762 |
%% anode and cathode (see above) |
| 8763 |
\long\def\pgfcircdeclaretubegeneric#1#2#3#4#5#6{% name, anchors, grid, anode, cathode variable anchors |
| 8764 |
\pgfdeclareshape{#1}{ |
| 8765 |
\savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} |
| 8766 |
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} |
| 8767 |
\savedanchor\northwest{% |
| 8768 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8769 |
\pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8770 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8771 |
% x and y should be half the Rlen |
| 8772 |
\pgf@y=\pgf@circ@res@up |
| 8773 |
\pgf@y=.5\pgf@y |
| 8774 |
\pgf@x=-\pgf@circ@res@right |
| 8775 |
\pgf@x=.5\pgf@x |
| 8776 |
} |
| 8777 |
\savedanchor\tubene{% |
| 8778 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8779 |
\pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8780 |
\pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8781 |
\pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp |
| 8782 |
\pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other |
| 8783 |
\pgf@y=\pgf@circ@res@up |
| 8784 |
\pgf@x=\pgf@circ@res@right |
| 8785 |
} |
| 8786 |
\savedanchor\tubesquarene{% |
| 8787 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8788 |
\pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8789 |
\pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8790 |
\pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp |
| 8791 |
\pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other |
| 8792 |
\ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax |
| 8793 |
% horizontal |
| 8794 |
\pgf@y=\pgf@circ@res@up |
| 8795 |
\pgf@x=\pgf@circ@res@right\advance\pgf@x by -\pgf@circ@res@up |
| 8796 |
\else |
| 8797 |
% vertical |
| 8798 |
\pgf@x=\pgf@circ@res@right |
| 8799 |
\pgf@y=\pgf@circ@res@up\advance\pgf@y by -\pgf@circ@res@right |
| 8800 |
\fi |
| 8801 |
} |
| 8802 |
\savedmacro{\tubes@filament@angle}{\edef\tubes@filament@angle{\ctikzvalof{tubes/filament angle}}} |
| 8803 |
\savedmacro{\tubes@filament@distance}{\edef\tubes@filament@distance{\ctikzvalof{tubes/filament distance}}} |
| 8804 |
\savedmacro{\tubes@tube@radius}{\edef\tubes@tube@radius{\ctikzvalof{tubes/tube radius}}} |
| 8805 |
\savedmacro{\tubes@cathode@width}{\edef\tubes@cathode@width{\ctikzvalof{tubes/cathode width}}} |
| 8806 |
\savedmacro{\tubes@cathode@distance}{\edef\tubes@cathode@distance{\ctikzvalof{tubes/cathode distance}}} |
| 8807 |
\anchor{tube ne}{\tubene} |
| 8808 |
\anchor{tubesq ne}{\tubesquarene} |
| 8809 |
% tube shape anchors: geo |
| 8810 |
\anchor{tube top}{\tubene\pgf@x=0pt\relax} |
| 8811 |
\anchor{tube bottom}{\tubene\pgf@x=0pt\pgf@y=-\pgf@y} |
| 8812 |
\anchor{tube right}{\tubene\pgf@y=0pt\relax} |
| 8813 |
\anchor{tube left}{\tubene\pgf@y=0pt\pgf@x=-\pgf@x} |
| 8814 |
% tube shape straight part anchors |
| 8815 |
\anchor{tube top right}{\tubesquarene} |
| 8816 |
\anchor{tube bottom right}{\tubesquarene\pgf@y=-\pgf@y} |
| 8817 |
\anchor{tube top left}{\tubesquarene\pgf@x=-\pgf@x} |
| 8818 |
\anchor{tube bottom left}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=-\pgf@x} |
| 8819 |
% tube shape centers |
| 8820 |
\anchor{tube top center}{\tubesquarene\pgf@x=0pt\relax} |
| 8821 |
\anchor{tube bottom center}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=0pt\relax} |
| 8822 |
\anchor{tube right center}{\tubesquarene\pgf@y=0pt\relax} |
| 8823 |
\anchor{tube left center}{\tubesquarene\pgf@x=-\pgf@x\pgf@y=0pt\relax} |
| 8824 |
% rest of anchors |
| 8825 |
\anchor{center}{\pgfpointorigin} |
| 8826 |
% geo anchors based on north-west |
| 8827 |
\pgfcirc@northwest@symmetric@geoanchors |
| 8828 |
% text anchor |
| 8829 |
\savedanchor{\textanchor}{% |
| 8830 |
%% \northwest |
| 8831 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 8832 |
\pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8833 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8834 |
% x and y should be half the Rlen |
| 8835 |
\pgf@y=\pgf@circ@res@up |
| 8836 |
\pgf@y=.5\pgf@y |
| 8837 |
\pgf@x=-\pgf@circ@res@right |
| 8838 |
\pgf@x=.5\pgf@x |
| 8839 |
\pgf@x=-\pgf@x |
| 8840 |
\pgf@y=-.5\ht\pgfnodeparttextbox |
| 8841 |
} |
| 8842 |
\anchor{text}{\textanchor} |
| 8843 |
% specific anchors |
| 8844 |
\anchor{anode} {% |
| 8845 |
\northwest |
| 8846 |
\pgf@x=0pt |
| 8847 |
} |
| 8848 |
\anchor{cathode}{% |
| 8849 |
\northwest |
| 8850 |
\pgf@y=-\pgf@y |
| 8851 |
\pgf@x=\tubes@cathode@width\pgf@x |
| 8852 |
} |
| 8853 |
\anchor{cathode 1}{% |
| 8854 |
\northwest |
| 8855 |
\pgf@y=-\pgf@y |
| 8856 |
\pgf@x=\tubes@cathode@width\pgf@x |
| 8857 |
} |
| 8858 |
\anchor{cathode 2}{% |
| 8859 |
\northwest |
| 8860 |
\pgf@y=-\pgf@y |
| 8861 |
\pgf@x=-\tubes@cathode@width\pgf@x |
| 8862 |
} |
| 8863 |
\anchor{filament 1}{% |
| 8864 |
\northwest |
| 8865 |
\pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)} |
| 8866 |
\pgf@x=\pgfmathresult\pgf@x |
| 8867 |
\pgf@y=-\pgf@y |
| 8868 |
} |
| 8869 |
\anchor{filament 2}{% |
| 8870 |
\northwest |
| 8871 |
\pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)} |
| 8872 |
\pgf@x=-\pgfmathresult\pgf@x |
| 8873 |
\pgf@y=-\pgf@y |
| 8874 |
} |
| 8875 |
\anchor{filament center}{% |
| 8876 |
\northwest |
| 8877 |
\pgf@ya=0.5\pgf@y |
| 8878 |
\pgf@ya=-\tubes@cathode@distance\pgf@y |
| 8879 |
\advance\pgf@ya by -\tubes@filament@distance\pgf@y |
| 8880 |
\pgf@x=0pt\pgf@y=\pgf@ya |
| 8881 |
} |
| 8882 |
|
| 8883 |
% Extra anchors |
| 8884 |
#2% |
| 8885 |
|
| 8886 |
\pgf@circ@draw@component{ |
| 8887 |
% Line width for tripoles |
| 8888 |
\pgf@circ@setlinewidth{tripoles}{\pgflinewidth} |
| 8889 |
\pgf@circ@scaled@Rlen=\scaledRlen |
| 8890 |
|
| 8891 |
% Setup to draw tube |
| 8892 |
\pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8893 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8894 |
\pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up |
| 8895 |
\pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 8896 |
|
| 8897 |
% Tube outline |
| 8898 |
\pgf@circ@tubes@drawtube |
| 8899 |
|
| 8900 |
% Setup to draw grid, filament, anode and cathode |
| 8901 |
\pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 8902 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 8903 |
\pgf@circ@res@up=0.5\pgf@circ@res@up |
| 8904 |
\pgf@circ@res@right=0.5\pgf@circ@res@right |
| 8905 |
|
| 8906 |
% Grid drawing |
| 8907 |
#3% |
| 8908 |
|
| 8909 |
% Filament (is not drawn by default) |
| 8910 |
\ifpgf@circuit@tubes@filament |
| 8911 |
\pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up |
| 8912 |
\advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up |
| 8913 |
\pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} |
| 8914 |
\pgf@xa=\pgfmathresult\pgf@circ@res@right |
| 8915 |
\pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}} |
| 8916 |
\pgf@ya=\pgfmathresult\pgf@circ@res@up |
| 8917 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} |
| 8918 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} |
| 8919 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}} |
| 8920 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}} |
| 8921 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} |
| 8922 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}} |
| 8923 |
\pgf@circuit@tubes@filamentfalse |
| 8924 |
\fi |
| 8925 |
|
| 8926 |
% Anode (or plate) |
| 8927 |
#4 |
| 8928 |
% Cathode |
| 8929 |
#5 |
| 8930 |
% Draw the background |
| 8931 |
\pgfusepath{draw} |
| 8932 |
} |
| 8933 |
#6 |
| 8934 |
} |
| 8935 |
} |
| 8936 |
|
| 8937 |
%% The diode (tube), triode, tetrode and pentode only differ in the |
| 8938 |
%% number of grids. So we construct a generic declare function in |
| 8939 |
%% which we can put code for the grid anchors and grid drawing code |
| 8940 |
%% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code} |
| 8941 |
\long\def\pgfcircdeclaretube#1#2#3{% name, anchors, grid |
| 8942 |
\pgfcircdeclaretubegeneric{#1}{#2}{#3}{\pgfcirctubedrawanodestd}{\pgfcirctubedrawcathodestd}{} |
| 8943 |
} |
| 8944 |
|
| 8945 |
\pgfcircdeclaretube{diodetube}{}{} % shape diode already exists |
| 8946 |
|
| 8947 |
\pgfcircdeclaretube{triode} |
| 8948 |
{ |
| 8949 |
\anchor{grid} {% should not be used |
| 8950 |
\northwest |
| 8951 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 8952 |
} |
| 8953 |
\anchor{control} {% |
| 8954 |
\northwest |
| 8955 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 8956 |
} |
| 8957 |
} |
| 8958 |
{ |
| 8959 |
% Grid protrusion |
| 8960 |
\pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 8961 |
\advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right |
| 8962 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 8963 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 8964 |
% Grid dashes: calculations |
| 8965 |
\pgf@xb=2\pgf@circ@res@right |
| 8966 |
\pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb |
| 8967 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 |
| 8968 |
\multiply\pgf@circ@count@a by 2\relax |
| 8969 |
\advance\pgf@circ@count@a by 1\relax |
| 8970 |
\advance\pgf@circ@res@step by -\pgf@xa |
| 8971 |
\divide\pgf@circ@res@step by \pgf@circ@count@a |
| 8972 |
% Grid dashes: draw |
| 8973 |
\pgf@circ@res@temp=\pgf@xa |
| 8974 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} |
| 8975 |
\loop |
| 8976 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 8977 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 8978 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 8979 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 8980 |
\advance\pgf@circ@count@a by-1 |
| 8981 |
\ifnum\pgf@circ@count@a>0\relax |
| 8982 |
\repeat |
| 8983 |
} |
| 8984 |
|
| 8985 |
\pgfcircdeclaretube{tetrode} |
| 8986 |
{ |
| 8987 |
\anchor{grid} {% should not be used |
| 8988 |
\northwest |
| 8989 |
\pgfutil@tempdima=\pgf@y |
| 8990 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 8991 |
\pgf@y=0.5\pgf@y |
| 8992 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 8993 |
} |
| 8994 |
\anchor{control} {% |
| 8995 |
\northwest |
| 8996 |
\pgfutil@tempdima=\pgf@y |
| 8997 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 8998 |
\pgf@y=0.5\pgf@y |
| 8999 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9000 |
} |
| 9001 |
\anchor{screen} {% |
| 9002 |
\northwest |
| 9003 |
\pgfutil@tempdima=\pgf@y |
| 9004 |
\pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y |
| 9005 |
\pgf@y=0.5\pgf@y |
| 9006 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9007 |
} |
| 9008 |
} |
| 9009 |
{ |
| 9010 |
% Grid x/y points |
| 9011 |
\pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 9012 |
\advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right |
| 9013 |
\pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up |
| 9014 |
\pgfutil@tempdimb=-\pgfutil@tempdima |
| 9015 |
\pgfutil@tempdima=0.5\pgfutil@tempdima |
| 9016 |
\advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9017 |
\pgfutil@tempdimb=0.5\pgfutil@tempdimb |
| 9018 |
\advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9019 |
% Grid protrusion |
| 9020 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} |
| 9021 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} |
| 9022 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 9023 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} |
| 9024 |
% Grid dashes: calculations |
| 9025 |
\pgf@xb=2\pgf@circ@res@right |
| 9026 |
\pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb |
| 9027 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 |
| 9028 |
\multiply\pgf@circ@count@a by 2\relax |
| 9029 |
\advance\pgf@circ@count@a by 1\relax |
| 9030 |
\advance\pgf@circ@res@step by -\pgf@xa |
| 9031 |
\divide\pgf@circ@res@step by \pgf@circ@count@a |
| 9032 |
% Grid dashes: draw |
| 9033 |
\pgf@circ@res@temp=\pgf@xa |
| 9034 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} |
| 9035 |
\loop |
| 9036 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9037 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} |
| 9038 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} |
| 9039 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} |
| 9040 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} |
| 9041 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9042 |
\advance\pgf@circ@count@a by-1 |
| 9043 |
\ifnum\pgf@circ@count@a>0\relax |
| 9044 |
\repeat |
| 9045 |
} |
| 9046 |
|
| 9047 |
\pgfcircdeclaretube{pentode} |
| 9048 |
{ |
| 9049 |
\anchor{grid} {% should not be used |
| 9050 |
\northwest |
| 9051 |
\pgfutil@tempdima=\pgf@y |
| 9052 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 9053 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9054 |
} |
| 9055 |
\anchor{control} {% |
| 9056 |
\northwest |
| 9057 |
\pgfutil@tempdima=\pgf@y |
| 9058 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 9059 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9060 |
} |
| 9061 |
\anchor{screen} {% |
| 9062 |
\northwest |
| 9063 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 9064 |
} |
| 9065 |
\anchor{suppressor} {% |
| 9066 |
\northwest |
| 9067 |
\pgfutil@tempdima=\pgf@y |
| 9068 |
\pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y |
| 9069 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9070 |
} |
| 9071 |
} |
| 9072 |
{ |
| 9073 |
% Grid x/y points |
| 9074 |
\pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 9075 |
\advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right |
| 9076 |
\pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up |
| 9077 |
\pgfutil@tempdimb=-\pgfutil@tempdima |
| 9078 |
\advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9079 |
\advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9080 |
\pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9081 |
% Grid protrusion |
| 9082 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} |
| 9083 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} |
| 9084 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}} |
| 9085 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}} |
| 9086 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} |
| 9087 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} |
| 9088 |
% Grid dashes: calculations |
| 9089 |
\pgf@xb=2\pgf@circ@res@right |
| 9090 |
\pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb |
| 9091 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 |
| 9092 |
\multiply\pgf@circ@count@a by 2\relax |
| 9093 |
\advance\pgf@circ@count@a by 1\relax |
| 9094 |
\advance\pgf@circ@res@step by -\pgf@xa |
| 9095 |
\divide\pgf@circ@res@step by \pgf@circ@count@a |
| 9096 |
% Grid dashes: draw |
| 9097 |
\pgf@circ@res@temp=\pgf@xa |
| 9098 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} |
| 9099 |
\loop |
| 9100 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9101 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} |
| 9102 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} |
| 9103 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} |
| 9104 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} |
| 9105 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} |
| 9106 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} |
| 9107 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9108 |
\advance\pgf@circ@count@a by-1 |
| 9109 |
\ifnum\pgf@circ@count@a>0\relax |
| 9110 |
\repeat |
| 9111 |
} |
| 9112 |
|
| 9113 |
\pgfcircdeclaretube{pentode suppressor to cathode} |
| 9114 |
{ |
| 9115 |
\anchor{grid} {% should not be used |
| 9116 |
\northwest |
| 9117 |
\pgfutil@tempdima=\pgf@y |
| 9118 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 9119 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9120 |
} |
| 9121 |
\anchor{control} {% |
| 9122 |
\northwest |
| 9123 |
\pgfutil@tempdima=\pgf@y |
| 9124 |
\pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y |
| 9125 |
\advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima |
| 9126 |
} |
| 9127 |
\anchor{screen} {% |
| 9128 |
\northwest |
| 9129 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 9130 |
} |
| 9131 |
} |
| 9132 |
{ |
| 9133 |
% Grid x/y points |
| 9134 |
\pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 9135 |
\advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right |
| 9136 |
\pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up |
| 9137 |
\pgfutil@tempdimb=-\pgfutil@tempdima |
| 9138 |
\advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9139 |
\advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9140 |
\pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up |
| 9141 |
% Grid protrusion |
| 9142 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}} |
| 9143 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}} |
| 9144 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}} |
| 9145 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}} |
| 9146 |
% Grid dashes: calculations |
| 9147 |
\pgf@xb=2\pgf@circ@res@right |
| 9148 |
\pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb |
| 9149 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 |
| 9150 |
\multiply\pgf@circ@count@a by 2\relax |
| 9151 |
\advance\pgf@circ@count@a by 1\relax |
| 9152 |
\advance\pgf@circ@res@step by -\pgf@xa |
| 9153 |
\divide\pgf@circ@res@step by \pgf@circ@count@a |
| 9154 |
% Grid dashes: draw |
| 9155 |
\pgf@circ@res@temp=\pgf@xa |
| 9156 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} |
| 9157 |
\loop |
| 9158 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9159 |
\ifnum\pgf@circ@count@a>1\relax |
| 9160 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}} |
| 9161 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}} |
| 9162 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}} |
| 9163 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}} |
| 9164 |
\fi |
| 9165 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}} |
| 9166 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}} |
| 9167 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9168 |
\advance\pgf@circ@count@a by-1 |
| 9169 |
\ifnum\pgf@circ@count@a>0\relax |
| 9170 |
\repeat |
| 9171 |
% Grid: connection from suppressor to cathode |
| 9172 |
\pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}} |
| 9173 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}} |
| 9174 |
\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}} |
| 9175 |
|
| 9176 |
}% |
| 9177 |
% |
| 9178 |
% multi-anode tube, added by Romano for version 1.6.8, suggested by @bogger33 on GitHub |
| 9179 |
% see https://github.com/circuitikz/circuitikz/issues/785 |
| 9180 |
% |
| 9181 |
\ctikzset{tubes/anodes/.initial=3} % number of anodes. Ignored in most tubes. |
| 9182 |
\newif\ifpgf@circuit@tubes@anodedot\pgf@circuit@tubes@anodedotfalse |
| 9183 |
\pgfkeys{/tikz/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}} |
| 9184 |
\ctikzset{tubes/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}} |
| 9185 |
\newif\ifpgf@circuit@tubes@nogrid\pgf@circuit@tubes@nogridfalse |
| 9186 |
\pgfkeys{/tikz/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}} |
| 9187 |
\ctikzset{tubes/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}} |
| 9188 |
\newif\ifpgf@circuit@tubes@nixieanode\pgf@circuit@tubes@nixieanodefalse |
| 9189 |
\pgfkeys{/tikz/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}} |
| 9190 |
\ctikzset{tubes/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}} |
| 9191 |
\long\def\pgfcirctubedraw@multi@anode{% Separate to override in matubes |
| 9192 |
% Anodes (or plates) |
| 9193 |
% Use saved len/anchors to find the first drawn position. |
| 9194 |
\pgf@circ@res@temp=\anodelen\divide\pgf@circ@res@temp by 2 % half the anode length |
| 9195 |
\firstanodepos\pgf@circ@res@other=\pgf@x |
| 9196 |
\advance\pgf@circ@res@other by \pgf@circ@res@temp |
| 9197 |
\pgf@circ@count@a=0 |
| 9198 |
\loop |
| 9199 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} % north |
| 9200 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 9201 |
\ifpgf@circuit@tubes@anodedot |
| 9202 |
\pgfpathcircle{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@[email protected]*\circlelen}}{\circlelen} |
| 9203 |
\else |
| 9204 |
% this is the horizontal line of the anode |
| 9205 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 9206 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}} |
| 9207 |
\fi |
| 9208 |
\advance\pgf@circ@res@other by 4\pgf@circ@res@temp |
| 9209 |
\advance\pgf@circ@count@a by 1 |
| 9210 |
\ifnum\pgf@circ@count@a<\Nanodes\relax |
| 9211 |
\repeat |
| 9212 |
} |
| 9213 |
\long\def\pgfcirctubedraw@cathode@or@nixie{% |
| 9214 |
\ifpgf@circuit@tubes@nixieanode |
| 9215 |
\pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}} |
| 9216 |
\pgfpathlineto{\pgfpoint{0pt}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} |
| 9217 |
\pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} |
| 9218 |
\pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}} |
| 9219 |
\else |
| 9220 |
\pgfcirctubedrawcathodestd |
| 9221 |
\fi |
| 9222 |
} |
| 9223 |
\pgfcircdeclaretubegeneric{matube} |
| 9224 |
{% anchors |
| 9225 |
\savedmacro{\Nanodes}{\edef\Nanodes{\ctikzvalof{tubes/anodes}}} |
| 9226 |
\savedanchor\firstanodepos{% |
| 9227 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 9228 |
\pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen |
| 9229 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen |
| 9230 |
\pgf@circ@res@right=\ctikzvalof{tubes/anode width}\pgf@circ@res@right |
| 9231 |
% x and y are one half |
| 9232 |
\pgf@y=\pgf@circ@res@up |
| 9233 |
\pgf@y=.5\pgf@y |
| 9234 |
\pgf@x=-\pgf@circ@res@right |
| 9235 |
\pgf@x=.5\pgf@x |
| 9236 |
} |
| 9237 |
\saveddimen\anodelen{% |
| 9238 |
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} |
| 9239 |
\pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen % full width, left to right |
| 9240 |
% the length of one of the N anodes is the full width divided by 2*N+1 |
| 9241 |
\pgfmathsetlength\pgf@x{\ctikzvalof{tubes/anode width}*\pgf@circ@res@right/(2*\Nanodes-1)} |
| 9242 |
} |
| 9243 |
\saveddimen\circlelen{% |
| 9244 |
\pgf@x=\ctikzvalof{nodes width}\pgf@circ@Rlen |
| 9245 |
} |
| 9246 |
\anchor{grid} {% should not be used |
| 9247 |
\northwest |
| 9248 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 9249 |
} |
| 9250 |
\anchor{control} {% |
| 9251 |
\northwest |
| 9252 |
\pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y |
| 9253 |
} |
| 9254 |
\anchor{nixie a}{% |
| 9255 |
\northwest\pgf@x=0pt\pgf@y=-\pgf@y |
| 9256 |
} |
| 9257 |
} |
| 9258 |
{% grid |
| 9259 |
\ifpgf@circuit@tubes@nogrid\else |
| 9260 |
% Grid protrusion |
| 9261 |
\pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right |
| 9262 |
\advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right |
| 9263 |
\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 9264 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 9265 |
% Grid dashes: calculations |
| 9266 |
\pgf@xb=2\pgf@circ@res@right |
| 9267 |
\pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb |
| 9268 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1 |
| 9269 |
\multiply\pgf@circ@count@a by 2\relax |
| 9270 |
\advance\pgf@circ@count@a by 1\relax |
| 9271 |
\advance\pgf@circ@res@step by -\pgf@xa |
| 9272 |
\divide\pgf@circ@res@step by \pgf@circ@count@a |
| 9273 |
% Grid dashes: draw |
| 9274 |
\pgf@circ@res@temp=\pgf@xa |
| 9275 |
\pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} |
| 9276 |
\loop |
| 9277 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9278 |
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 9279 |
\advance\pgf@circ@res@temp by\pgf@circ@res@step |
| 9280 |
\pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}} |
| 9281 |
\advance\pgf@circ@count@a by-1 |
| 9282 |
\ifnum\pgf@circ@count@a>0\relax |
| 9283 |
\repeat |
| 9284 |
\fi |
| 9285 |
} |
| 9286 |
{\pgfcirctubedraw@multi@anode}% anodes |
| 9287 |
{\pgfcirctubedraw@cathode@or@nixie}% cathode |
| 9288 |
{% extra dynamics anchors |
| 9289 |
\pgfutil@g@addto@macro\pgf@sh@s@matube{% |
| 9290 |
% Start with the maximum pin number and go backwards. |
| 9291 |
\pgf@circ@count@a=\Nanodes\relax |
| 9292 |
\pgfmathloop% |
| 9293 |
\ifnum\pgf@circ@count@a>0 |
| 9294 |
\expandafter\xdef\csname pgf@anchor@matube@anode\space\the\pgf@circ@count@a\endcsname{% |
| 9295 |
\noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}% |
| 9296 |
} |
| 9297 |
\expandafter\xdef\csname pgf@anchor@matube@nixie\space k\the\pgf@circ@count@a\endcsname{% |
| 9298 |
\noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}% |
| 9299 |
} |
| 9300 |
\advance\pgf@circ@count@a by -1\relax% |
| 9301 |
\repeatpgfmathloop% |
| 9302 |
}% |
| 9303 |
} |
| 9304 |
\def\pgf@circ@ma@anode@anchor#1{ |
| 9305 |
\firstanodepos |
| 9306 |
\pgf@circ@res@temp=\pgf@x |
| 9307 |
\pgfmathsetlength\pgf@x{\pgf@circ@res@temp + (0.5 + 2*(#1 -1))*\anodelen} |
| 9308 |
} |
| 9309 |
|
| 9310 |
|
| 9311 |
|
| 9312 |
%>>> |
| 9313 |
|
| 9314 |
\endinput |
| 9315 |
% vim: set fdm=marker fmr=%<<<,%>>>: |