Debian Codegraph @

texmf-dist/tex/latex/kblocks/kblocks.sty

raw
1 % some LaTeX code
2 % kblocks.sty
3 % TikZ-based block-diagram package for control theory applications
4 % version 2.0 (February 2021)
5 % version 1.0 (October 2019)
6 %
7 % Author: Somefun Oluwasegun {[email protected]}
8 % Change Log:
9 % significant improvements and introduction of new macros and annotation
10
11 % Credits:
12 % (2014): motivated by the helpful pointers in https://tex.stackexchange.com/users/14704/s-c
13 % (2005): motivated by the TikZ-bloques package by Alejandro Garces {Alejandro [email protected]}
14 %
15
16 % Copyright (c) 2021 by Oluwasegun Somefun <[email protected]>.
17
18 % MIT LICENSE
19 % Permission is hereby granted, free of charge, to any person obtaining a copy of this software
20 % and associated documentation files (the "Software"), to deal in the Software without restriction,
21 % including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
22 % and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
23 % subject to the following conditions:
24 %
25 % The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
26 %
27 % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
28 % TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29 % IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
30 % WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
31 % OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 %
33
34 \typeout{**}
35
36 \typeout{kblocks: A package to easily typeset Control Block Diagrams and Signal
37 Flow Graphs with TikZ/PGF.}
38
39 \typeout{(c) 2021. Oluwasegun Somefun}
40
41 \typeout{*}
42
43 \typeout{--Attention: The package has external dependency on TikZ/PGF.}
44
45 \typeout{This package is covered with the MIT License.}
46
47 \typeout{**}
48
49 % Import Libraries
50 \RequirePackage{tikz,circuitikz}
51 \usepgflibrary{shapes.misc}
52 \usetikzlibrary{math,calc,arrows,decorations.pathmorphing,decorations.markings,
53 arrows.meta,backgrounds,fit,shadows,matrix,chains,scopes,positioning,
54 decorations.pathreplacing,decorations.text,shapes.multipart,graphs,external}
55
56 % Helpful
57
58 \newcommand{\horizdist}{1.2cm}
59 \newcommand{\sfghorizdist}{\horizdist*2}
60 \newcommand{\verticdist}{1.2cm}
61 \newcommand{\phasedist}{3.5cm}
62 \newcommand{\minheight}{0.7cm}
63 \newcommand{\textsize}{\footnotesize}
64 \newcommand{\backgroundcolor}{white}
65 \newcommand{\colortext}{black}
66 \newcommand{\linecolor}{black}
67 \newcommand{\dark}{0}
68 \newcommand{\linetype}{very thick}
69 \newcommand{\linepathtype}{semithick}
70
71 \newcommand{\kmT}[1]{$\:\bm{#1}\:$} % block math text with 1 left-right border spacing
72
73 \newcommand{\kmTw}[1]{$\:\:\: \bm{#1} \:\:\:$} %block math text with wider left-right border spacing
74
75 \newcommand{\kShadow}{\renewcommand{\dark}{1}}
76 \newcommand{\kColorB}[1]{\renewcommand{\backgroundcolor}{#1}}
77 \newcommand{\kColorT}[1]{\renewcommand{\colortext}{#1}}
78 \newcommand{\kColorL}[1]{\renewcommand{\linecolor}{#1}}
79
80 \newcommand{\kScaleDistY}[1][1]{
81 \renewcommand{\verticdist}{1.2cm * #1}
82 }
83
84 \newcommand{\kScaleDistX}[1][1]{
85 \renewcommand{\horizdist}{1.5cm * #1}
86 }
87
88 % to add very very thick width for vector lines
89 \tikzset{veclinetype/.style={line width=2.0pt}}
90
91 % Global variables for Coordinate Calculations
92 \newdimen\xc
93 \newdimen\yc
94
95 \newcommand*{\ExtractCoordinate}[1]{
96 \path (#1);
97 \pgfgetlastxy{\xc}{\yc};
98 }%
99
100 % Global styles
101 \tikzset{every node/.style={anchor=center, text centered, align=center}}
102
103 \tikzset{midarrow/.style={decoration={markings,
104 mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}}
105
106 % DEDICATED ENVIRONMENT
107
108 %% Usage:
109 %\begin{kblock}
110 %
111 %\end{kblock}
112
113 \newenvironment{kblock}{\begin{tikzpicture}\begin{scope}}{\end{scope}\end{tikzpicture}}
114
115
116 % BLOCK DIAGRAM
117
118 % Start Nodes
119
120 \newcommand{\kStartNode}[2][]{
121 % name coordinate label
122 \node (#2) {\color{\colortext}\textsize{#1}};
123 }
124
125 \newcommand{\kStartNodec}[3][]{
126 \node (#3) at #2 {\color{\colortext}\textsize{#1}};
127 }
128
129
130 % Area Cover Rectangle
131 %% Usage [colour]{ref node}{north shift dimension}{south shift dimension}{west shift dimension}{east shift dimension}
132
133 \newcommand{\kCoverRect}[6][black]{
134
135 \coordinate (centn) at (#2.north);
136 \coordinate (cents) at (#2.south);
137 \coordinate (cente) at (#2.east);
138 \coordinate (centw) at (#2.west);
139
140 \def\dn{#3};
141 \def\ds{#4};
142 \def\dw{#5};
143 \def\de{#6};
144
145 \ifx\dn\empty
146 \def\dn{0};
147 \else
148 \fi
149 \ifx\ds\empty
150 \def\ds{0};
151 \else
152 \fi
153 \ifx\dw\empty
154 \def\dw{0};
155 \else
156 \fi
157 \ifx\de\empty
158 \def\de{0};
159 \else
160 \fi
161
162
163 \newdimen\xn;%
164 \newdimen\yn;%
165 \path (centn); \pgfgetlastxy{\xn}{\yn};
166 \newdimen\xs;%
167 \newdimen\ys;%
168 \path (cents); \pgfgetlastxy{\xs}{\ys};
169
170 \newdimen\xw;%
171 \newdimen\yw;%
172 \path (centw); \pgfgetlastxy{\xw}{\yw};
173 \newdimen\xe;%
174 \newdimen\ye;%
175 \path (cente); \pgfgetlastxy{\xe}{\ye};
176
177 \newdimen\xonw;%
178 \newdimen\xone;%
179 \newdimen\xose;%
180 \newdimen\xosw;%
181 \newdimen\xon;%
182 \newdimen\yon;%
183 \newdimen\xos;%
184 \newdimen\yos;%
185
186 \tikzmath{
187 \xonw = \xw - \dw;%
188 \xone = \xe + \de;%
189 \xon = \xn;%
190 \yon = \yn + \dn;%
191 \xosw = \xw - \dw;%
192 \xose = \xe + \de;%
193 \xos = \xs;%
194 \yos = \ys - \ds;%
195 }
196
197 \coordinate [label=] (BFitN) at ($(\xon,\yon)$);
198 \coordinate [label=] (BFitS) at ($(\xos,\yos)$);
199 \coordinate [label=] (BFitW) at ($(\xosw,\yw)$);
200 \coordinate [label=] (BFitE) at ($(\xone,\ye)$);
201
202 \coordinate [label=] (BFitNW) at ($(\xonw,\yon)$);
203 \coordinate [label=] (BFitNE) at ($(\xone,\yon)$);
204 \coordinate [label=] (BFitSW) at ($(\xosw,\yos)$);
205 \coordinate [label=] (BFitSE) at ($(\xose,\yos)$);
206
207 \begin{scope}[on background layer]
208 \draw [color=#1, dashed] (BFitSW) -- (BFitSE) -- (BFitNE) -- (BFitNW) -- (BFitSW);
209 \end{scope}
210
211 }
212
213 % Cover Text
214 %% Usage: [optional shift dimension]{from node label}{to current tf node label}{tf text content}
215
216 \newcommand{\kCoverTextRight}[5]{
217 \def\dxt{#1};
218 \def\dyt{#2};
219
220 \ifx\dxt\empty
221 \def\dxt{0};
222 \else
223 \fi
224
225 \ifx\dyt\empty
226 \def\dxt{0};
227 \else
228 \fi
229
230 \node [right of= BFitE, node distance= 0.2cm, xshift= \dxt, yshift = \dyt,
231 font=\textsize] (#3) {\color{\colortext}#4};
232 }
233
234 \newcommand{\kCoverTextLeft}[5]{
235 \def\dxt{#1};
236 \def\dyt{#2};
237
238 \ifx\dxt\empty
239 \def\dxt{0};
240 \else
241 \fi
242
243 \ifx\dyt\empty
244 \def\dxt{0};
245 \else
246 \fi
247
248 \node [left of= BFitW, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4};
249 }
250
251 \newcommand{\kCoverTextAbove}[5]{
252 \def\dxt{#1};
253 \def\dyt{#2};
254
255 \ifx\dxt\empty
256 \def\dxt{0};
257 \else
258 \fi
259
260 \ifx\dyt\empty
261 \def\dxt{0};
262 \else
263 \fi
264
265 \node [above of= BFitN, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4};
266 }
267 \newcommand{\kCoverTextBelow}[5]{
268 \def\dxt{#1};
269 \def\dyt{#2};
270
271 \ifx\dxt\empty
272 \def\dxt{0};
273 \else
274 \fi
275
276 \ifx\dyt\empty
277 \def\dxt{0};
278 \else
279 \fi
280
281 \node [below of= BFitS, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4};
282 }
283
284
285 % Arithmetic Summer Blocks
286 %% Usage: {from node label}{to current sum node label}{optional horizontal position shift}
287 % left down
288 \newcommand{\kMinusPlusDown}[3]{
289
290 \def\dxpm{#3};
291
292 \ifx\dxpm\empty
293 \def\dxpm{0};
294 \else
295 \fi
296
297 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype,
298 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
299 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
300 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
301 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
302 }
303 \newcommand{\kMinusPlusDownL}[3]{
304
305 \def\dxpm{#3};
306
307 \ifx\dxpm\empty
308 \def\dxpm{0};
309 \else
310 \fi
311
312 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype,
313 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
314 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
315 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
316 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
317 }
318 \newcommand{\kMinusPlusDownA}[3]{
319
320 \def\dxpm{#3};
321
322 \ifx\dxpm\empty
323 \def\dxpm{0};
324 \else
325 \fi
326
327 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype,
328 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
329 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
330 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
331 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
332 }
333 \newcommand{\kMinusPlusDownB}[3]{
334
335 \def\dxpm{#3};
336
337 \ifx\dxpm\empty
338 \def\dxpm{0};
339 \else
340 \fi
341
342 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype,
343 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
344 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
345 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
346 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
347 }
348
349 \newcommand{\kMinusMinusDown}[3]{
350
351 \def\dxpm{#3};
352
353 \ifx\dxpm\empty
354 \def\dxpm{0};
355 \else
356 \fi
357
358 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype,
359 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
360 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
361 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
362 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
363 }
364 \newcommand{\kMinusMinusDownL}[3]{
365
366 \def\dxpm{#3};
367
368 \ifx\dxpm\empty
369 \def\dxpm{0};
370 \else
371 \fi
372
373 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype,
374 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
375 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
376 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
377 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
378 }
379 \newcommand{\kMinusMinusDownA}[3]{
380
381 \def\dxpm{#3};
382
383 \ifx\dxpm\empty
384 \def\dxpm{0};
385 \else
386 \fi
387
388 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist + \dxpm, \linetype,
389 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
390 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
391 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
392 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
393 }
394 \newcommand{\kMinusMinusDownB}[3]{
395
396 \def\dxpm{#3};
397
398 \ifx\dxpm\empty
399 \def\dxpm{0};
400 \else
401 \fi
402
403 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist + \dxpm, \linetype,
404 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
405 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
406 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
407 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
408 }
409
410 \newcommand{\kPlusMinusDown}[3]{
411
412 \def\dxpm{#3};
413
414 \ifx\dxpm\empty
415 \def\dxpm{0};
416 \else
417 \fi
418
419 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype,
420 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
421 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
422 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
423 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
424 }
425 \newcommand{\kPlusMinusDownL}[3]{
426
427 \def\dxpm{#3};
428
429 \ifx\dxpm\empty
430 \def\dxpm{0};
431 \else
432 \fi
433
434 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype,
435 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
436 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
437 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
438 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
439 }
440 \newcommand{\kPlusMinusDownA}[3]{
441
442 \def\dxpm{#3};
443
444 \ifx\dxpm\empty
445 \def\dxpm{0};
446 \else
447 \fi
448
449 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype,
450 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
451 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
452 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
453 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
454 }
455 \newcommand{\kPlusMinusDownB}[3]{
456
457 \def\dxpm{#3};
458
459 \ifx\dxpm\empty
460 \def\dxpm{0};
461 \else
462 \fi
463
464 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype,
465 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
466 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
467 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
468 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
469 }
470
471 \newcommand{\kPlusPlusDown}[3]{
472 \def\dxpm{#3};
473
474 \ifx\dxpm\empty
475 \def\dxpm{0};
476 \else
477 \fi
478
479 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype,
480 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
481 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
482 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
483 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
484 }
485 \newcommand{\kPlusPlusDownL}[3]{
486
487 \def\dxpm{#3};
488
489 \ifx\dxpm\empty
490 \def\dxpm{0};
491 \else
492 \fi
493
494 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype,
495 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
496 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
497 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
498 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
499 }
500 \newcommand{\kPlusPlusDownA}[3]{
501
502 \def\dxpm{#3};
503
504 \ifx\dxpm\empty
505 \def\dxpm{0};
506 \else
507 \fi
508
509 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype,
510 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
511 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
512 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
513 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
514 }
515 \newcommand{\kPlusPlusDownB}[3]{
516
517 \def\dxpm{#3};
518
519 \ifx\dxpm\empty
520 \def\dxpm{0};
521 \else
522 \fi
523
524 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype,
525 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
526 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
527 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
528 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
529 }
530
531 \newcommand{\kPlusMinusDownPlaceAbove}[3]{
532
533 \def\dxpm{#3};
534
535 \ifx\dxpm\empty
536 \def\dxpm{0};
537 \else
538 \fi
539
540 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype,
541 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
542 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
543 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
544 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
545 }
546
547 \newcommand{\kPlusMinusDownPlaceBelow}[3]{
548
549 \def\dxpm{#3};
550
551 \ifx\dxpm\empty
552 \def\dxpm{0};
553 \else
554 \fi
555
556 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype,
557 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
558 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
559 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
560 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
561 }
562
563
564 % left up
565 \newcommand{\kMinusPlusUp}[3]{
566
567 \def\dxpm{#3};
568
569 \ifx\dxpm\empty
570 \def\dxpm{0};
571 \else
572 \fi
573
574 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
575 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
576 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
577 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
578 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
579 }
580 \newcommand{\kMinusPlusUpL}[3]{
581
582 \def\dxpm{#3};
583
584 \ifx\dxpm\empty
585 \def\dxpm{0};
586 \else
587 \fi
588
589 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
590 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
591 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
592 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
593 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
594 }
595 \newcommand{\kMinusPlusUpA}[3]{
596
597 \def\dxpm{#3};
598
599 \ifx\dxpm\empty
600 \def\dxpm{0};
601 \else
602 \fi
603
604 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
605 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
606 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
607 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
608 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
609 }
610 \newcommand{\kMinusPlusUpB}[3]{
611
612 \def\dxpm{#3};
613
614 \ifx\dxpm\empty
615 \def\dxpm{0};
616 \else
617 \fi
618
619 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
620 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
621 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
622 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
623 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
624 }
625
626 \newcommand{\kMinusMinusUp}[3]{
627
628 \def\dxpm{#3};
629
630 \ifx\dxpm\empty
631 \def\dxpm{0};
632 \else
633 \fi
634
635 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
636 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
637 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
638 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
639 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
640 }
641 \newcommand{\kMinusMinusUpL}[3]{
642
643 \def\dxpm{#3};
644
645 \ifx\dxpm\empty
646 \def\dxpm{0};
647 \else
648 \fi
649
650 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
651 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
652 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
653 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
654 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
655 }
656 \newcommand{\kMinusMinusUpA}[3]{
657
658 \def\dxpm{#3};
659
660 \ifx\dxpm\empty
661 \def\dxpm{0};
662 \else
663 \fi
664
665 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
666 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
667 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
668 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
669 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
670 }
671 \newcommand{\kMinusMinusUpB}[3]{
672
673 \def\dxpm{#3};
674
675 \ifx\dxpm\empty
676 \def\dxpm{0};
677 \else
678 \fi
679
680 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
681 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
682 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
683 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
684 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
685 }
686
687
688 \newcommand{\kPlusMinusUp}[3]{
689
690 \def\dxpm{#3};
691
692 \ifx\dxpm\empty
693 \def\dxpm{0};
694 \else
695 \fi
696
697 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
698 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
699 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
700 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
701 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
702 }
703 \newcommand{\kPlusMinusUpB}[3]{
704
705 \def\dxpm{#3};
706
707 \ifx\dxpm\empty
708 \def\dxpm{0};
709 \else
710 \fi
711
712 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype,
713 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
714 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
715 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
716 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
717 }
718 \newcommand{\kPlusMinusUpA}[3]{
719
720 \def\dxpm{#3};
721
722 \ifx\dxpm\empty
723 \def\dxpm{0};
724 \else
725 \fi
726
727 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype,
728 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
729 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
730 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
731 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
732 }
733 \newcommand{\kPlusMinusUpL}[3]{
734
735 \def\dxpm{#3};
736
737 \ifx\dxpm\empty
738 \def\dxpm{0};
739 \else
740 \fi
741
742 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype,
743 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
744 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
745 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
746 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
747 }
748
749 \newcommand{\kPlusPlusUp}[3]{
750
751 \def\dxpm{#3};
752
753 \ifx\dxpm\empty
754 \def\dxpm{0};
755 \else
756 \fi
757
758 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
759 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
760 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
761 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
762 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
763 }
764 \newcommand{\kPlusPlusUpB}[3]{
765
766 \def\dxpm{#3};
767
768 \ifx\dxpm\empty
769 \def\dxpm{0};
770 \else
771 \fi
772
773 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype,
774 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
775 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
776 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
777 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
778 }
779 \newcommand{\kPlusPlusUpA}[3]{
780
781 \def\dxpm{#3};
782
783 \ifx\dxpm\empty
784 \def\dxpm{0};
785 \else
786 \fi
787
788 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype,
789 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
790 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
791 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
792 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
793 }
794 \newcommand{\kPlusPlusUpL}[3]{
795
796 \def\dxpm{#3};
797
798 \ifx\dxpm\empty
799 \def\dxpm{0};
800 \else
801 \fi
802
803 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype,
804 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
805 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
806 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
807 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
808 }
809
810 % up down
811 \newcommand{\kPlusDownPlusUp}[3]{
812
813 \def\dxpm{#3};
814
815 \ifx\dxpm\empty
816 \def\dxpm{0};
817 \else
818 \fi
819
820 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
821 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
822 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
823 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
824 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
825 }
826 \newcommand{\kPlusDownPlusUpB}[3]{
827
828 \def\dxpm{#3};
829
830 \ifx\dxpm\empty
831 \def\dxpm{0};
832 \else
833 \fi
834
835 \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype,
836 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
837 \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
838 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
839 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
840 }
841 \newcommand{\kPlusDownPlusUpA}[3]{
842
843 \def\dxpm{#3};
844
845 \ifx\dxpm\empty
846 \def\dxpm{0};
847 \else
848 \fi
849
850 \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype,
851 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
852 \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
853 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
854 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
855 }
856 \newcommand{\kPlusDownPlusUpL}[3]{
857
858 \def\dxpm{#3};
859
860 \ifx\dxpm\empty
861 \def\dxpm{0};
862 \else
863 \fi
864
865 \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype,
866 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
867 \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
868 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
869 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
870 }
871
872 % left up down
873 \newcommand{\kPlusPlusMinus}[3]{
874
875 \def\dxpm{#3};
876
877 \ifx\dxpm\empty
878 \def\dxpm{0};
879 \else
880 \fi
881
882 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
883 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
884 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
885 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
886 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
887 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
888 }
889 \newcommand{\kPlusPlusMinusB}[3]{
890
891 \def\dxpm{#3};
892
893 \ifx\dxpm\empty
894 \def\dxpm{0};
895 \else
896 \fi
897
898 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
899 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
900 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
901 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
902 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
903 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
904 }
905 \newcommand{\kPlusPlusMinusA}[3]{
906
907 \def\dxpm{#3};
908
909 \ifx\dxpm\empty
910 \def\dxpm{0};
911 \else
912 \fi
913
914 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
915 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
916 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
917 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
918 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
919 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
920 }
921 \newcommand{\kPlusPlusMinusL}[3]{
922
923 \def\dxpm{#3};
924
925 \ifx\dxpm\empty
926 \def\dxpm{0};
927 \else
928 \fi
929
930 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
931 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
932 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
933 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
934 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
935 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
936 }
937
938 \newcommand{\kPlusMinusMinus}[3]{
939
940 \def\dxpm{#3};
941
942 \ifx\dxpm\empty
943 \def\dxpm{0};
944 \else
945 \fi
946
947 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
948 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
949 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
950 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
951 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
952 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
953 }
954 \newcommand{\kPlusMinusMinusL}[3]{
955
956 \def\dxpm{#3};
957
958 \ifx\dxpm\empty
959 \def\dxpm{0};
960 \else
961 \fi
962
963 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
964 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
965 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
966 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
967 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
968 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
969 }
970 \newcommand{\kPlusMinusMinusA}[3]{
971
972 \def\dxpm{#3};
973
974 \ifx\dxpm\empty
975 \def\dxpm{0};
976 \else
977 \fi
978
979 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
980 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
981 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
982 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
983 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
984 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
985 }
986 \newcommand{\kPlusMinusMinusB}[3]{
987
988 \def\dxpm{#3};
989
990 \ifx\dxpm\empty
991 \def\dxpm{0};
992 \else
993 \fi
994
995 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
996 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
997 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
998 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
999 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1000 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1001 }
1002
1003 \newcommand{\kPlusMinusPlus}[3]{
1004
1005 \def\dxpm{#3};
1006
1007 \ifx\dxpm\empty
1008 \def\dxpm{0};
1009 \else
1010 \fi
1011
1012 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
1013 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1014 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1015 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1016 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1017 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1018 }
1019 \newcommand{\kPlusMinusPlusB}[3]{
1020
1021 \def\dxpm{#3};
1022
1023 \ifx\dxpm\empty
1024 \def\dxpm{0};
1025 \else
1026 \fi
1027
1028 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
1029 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1030 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1031 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1032 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1033 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1034 }
1035 \newcommand{\kPlusMinusPlusA}[3]{
1036
1037 \def\dxpm{#3};
1038
1039 \ifx\dxpm\empty
1040 \def\dxpm{0};
1041 \else
1042 \fi
1043
1044 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
1045 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1046 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1047 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1048 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1049 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1050 }
1051 \newcommand{\kPlusMinusPlusL}[3]{
1052
1053 \def\dxpm{#3};
1054
1055 \ifx\dxpm\empty
1056 \def\dxpm{0};
1057 \else
1058 \fi
1059
1060 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
1061 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1062 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1063 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1064 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}};
1065 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1066 }
1067
1068 \newcommand{\kPlusPlusPlus}[3]{
1069
1070 \def\dxpm{#3};
1071
1072 \ifx\dxpm\empty
1073 \def\dxpm{0};
1074 \else
1075 \fi
1076
1077 \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype,
1078 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1079 \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1080 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1081 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1082 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1083 }
1084 \newcommand{\kPlusPlusPlusL}[3]{
1085
1086 \def\dxpm{#3};
1087
1088 \ifx\dxpm\empty
1089 \def\dxpm{0};
1090 \else
1091 \fi
1092
1093 \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype,
1094 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1095 \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1096 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1097 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1098 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1099 }
1100 \newcommand{\kPlusPlusPlusA}[3]{
1101
1102 \def\dxpm{#3};
1103
1104 \ifx\dxpm\empty
1105 \def\dxpm{0};
1106 \else
1107 \fi
1108
1109 \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype,
1110 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1111 \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1112 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1113 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1114 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1115 }
1116 \newcommand{\kPlusPlusPlusB}[3]{
1117
1118 \def\dxpm{#3};
1119
1120 \ifx\dxpm\empty
1121 \def\dxpm{0};
1122 \else
1123 \fi
1124
1125 \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype,
1126 fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {};
1127 \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {};
1128 \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1129 \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1130 \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}};
1131 }
1132
1133
1134 % Circular Gain Block
1135 \newcommand{\kGain}[4][]{
1136 \node [draw=\linecolor, circle, right of= #1, node distance= \horizdist,
1137 minimum size = 1.5em, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1138 font=\textsize] (#2) {\color{\colortext}#3};
1139 }
1140
1141 %% Rectangular TF Block
1142
1143 %% Usage:
1144 %\kTF {current tf node label}[tf text content]
1145 %\kTFCs {coordinates}{current tf node label}[tf text content]
1146
1147 \newcommand{\kTF}[2]{
1148 \node [draw=\linecolor, rectangle, node distance= \horizdist,
1149 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1150 font=\textsize] (#1) {\color{\colortext}#2};
1151 }
1152
1153 \newcommand{\kTFCs}[3]{
1154 \node [draw=\linecolor, rectangle, node distance= \horizdist,
1155 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1156 font=\textsize] (#2) at (#1) {\color{\colortext}#3};
1157 }
1158
1159 %% Usage: [optional shift dimension]{from node label}{to current tf node label}{tf text content}
1160 \newcommand{\kTFRight}[4][]{
1161 \def\dxtf{#1};
1162
1163 \ifx\dxtf\empty
1164 \def\dxtf{0};
1165 \else
1166 \fi
1167
1168 \node [draw=\linecolor, rectangle, right of= #2, node distance= \horizdist + \dxtf,
1169 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1170 font=\textsize] (#3) {\color{\colortext}#4};
1171 }
1172
1173 \newcommand{\kTFLeft}[4][]{
1174 \def\dxtf{#1};
1175
1176 \ifx\dxtf\empty
1177 \def\dxtf{0};
1178 \else
1179 \fi
1180
1181 \node [draw=\linecolor, rectangle, left of= #2, node distance= \horizdist + \dxtf,
1182 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1183 font=\textsize] (#3) {\color{\colortext}#4};
1184 }
1185
1186 \newcommand{\kTFAbove}[4][]{
1187 \def\dytfb{#1};
1188
1189 \ifx\dytfb\empty
1190 \def\dytfb{0};
1191 \else
1192 \fi
1193
1194 \node [draw=\linecolor, rectangle, above of= #2, node distance= \verticdist + \dytfb,
1195 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1196 font=\textsize] (#3) {\color{\colortext}#4};
1197
1198 }
1199
1200 \newcommand{\kTFBelow}[4][]{
1201 \def\dytfb{#1};
1202
1203 \ifx\dytfb\empty
1204 \def\dytfb{0};
1205 \else
1206 \fi
1207
1208 \node [draw=\linecolor, rectangle, below of= #2, node distance= \verticdist + \dytfb,
1209 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1210 font=\textsize] (#3) {\color{\colortext}#4};
1211 }
1212
1213 %% Usage: {vertical shift dimension}{horizontal shift dimension}{from node label}{to current tf node label}{tf text content}
1214
1215 % TF: Right
1216 % Above
1217 \newcommand{\kTFAboveRight}[5]{
1218 \def\dytf{#1};
1219
1220 \ifx\dytf\empty
1221 \def\dytf{0};
1222 \else
1223 \fi
1224
1225 \def\dxtf{#2};
1226
1227 \ifx\dxtf\empty
1228 \def\dxtf{0};
1229 \else
1230 \fi
1231
1232 \node [draw=\linecolor, rectangle, above of= #3, node distance= 1.2cm + \dytf, xshift=1.2cm+\dxtf,
1233 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1234 font=\textsize] (#4) {\color{\colortext}#5};
1235 }
1236 % Line: Right Down
1237 \newcommand{\kTFBelowRight}[5]{
1238 \def\dytf{#1};
1239
1240 \ifx\dytf\empty
1241 \def\dytf{0};
1242 \else
1243 \fi
1244
1245 \def\dxtf{#2};
1246
1247 \ifx\dxtf\empty
1248 \def\dxtf{0};
1249 \else
1250 \fi
1251
1252 \node [draw=\linecolor, rectangle, below of= #3, node distance= 1.2cm + \dytf, xshift=1.2cm+\dxtf,
1253 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1254 font=\textsize] (#4) {\color{\colortext}#5};
1255 }
1256
1257 % TF Left
1258 % Above
1259 \newcommand{\kTFAboveLeft}[5]{
1260 \def\dytf{#1};
1261
1262 \ifx\dytf\empty
1263 \def\dytf{0};
1264 \else
1265 \fi
1266
1267 \def\dxtf{#2};
1268
1269 \ifx\dxtf\empty
1270 \def\dxtf{0};
1271 \else
1272 \fi
1273 \node [draw=\linecolor, rectangle, above of= #3, node distance=1.2cm + \dytf, xshift=-(1.2cm+\dxtf),
1274 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1275 font=\textsize] (#4) {\color{\colortext}#5};
1276 }
1277 % Below
1278 \newcommand{\kTFBelowLeft}[5]{
1279 \def\dytf{#1};
1280
1281 \ifx\dytf\empty
1282 \def\dytf{0};
1283 \else
1284 \fi
1285
1286 \def\dxtf{#2};
1287
1288 \ifx\dxtf\empty
1289 \def\dxtf{0};
1290 \else
1291 \fi
1292
1293 \node [draw=\linecolor, rectangle, below of= #3, node distance=1.2cm + \dytf, xshift=-(1.2cm+\dxtf),
1294 minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark},
1295 font=\textsize] (#4) {\color{\colortext}#5};
1296 }
1297
1298
1299 % Mark Visible Circular Nodes
1300
1301 % Place Node with variable x-y coordinate shift
1302 %% Usage: {node x distance shift}{node y distance shift}{node text label}{from node label}{to current node label}
1303
1304 % Place Node Left
1305 \newcommand{\kMarkNodeLeft}[5]{
1306 \def\dxnlx{#1};
1307 \def\dynly{#2};
1308
1309 \ifx\dxnlx\empty
1310 \def\dxnlx{0};
1311 \else
1312 \fi
1313 \ifx\dynly\empty
1314 \def\dynly{0};
1315 \else
1316 \fi
1317 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em,
1318 left of = #4, node distance= 1.2cm + \dxnlx, yshift=\dynly, label=\textsize{#3}] (#5) {};
1319 }
1320
1321
1322 % Place Node Right
1323 \newcommand{\kMarkNodeRight}[5]{
1324 \def\dxnrx{#1};
1325 \def\dynry{#2};
1326
1327 \ifx\dxnrx\empty
1328 \def\dxnrx{0};
1329 \else
1330 \fi
1331 \ifx\dynry\empty
1332 \def\dynry{0};
1333 \else
1334 \fi
1335 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em,
1336 right of = #4, node distance= 1.2cm + \dxnrx, yshift=\dynry, label=\textsize{#3}] (#5) {};
1337 }
1338
1339 % Place Node Above
1340 \newcommand{\kMarkNodeAbove}[5]{
1341 \def\dxnax{#1};
1342 \def\dynay{#2};
1343
1344 \ifx\dxnax\empty
1345 \def\dxnax{0};
1346 \else
1347 \fi
1348 \ifx\dynay\empty
1349 \def\dynay{0};
1350 \else
1351 \fi
1352 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em,
1353 above of = #4, node distance= 1.2cm + \dxnax, yshift=\dynay, label=\textsize{#3}] (#5) {};
1354 }
1355
1356 % Place Node Below
1357 \newcommand{\kMarkNodeBelow}[5]{
1358 \def\dxnbx{#1};
1359 \def\dynby{#2};
1360
1361 \ifx\dxnbx\empty
1362 \def\dxnbx{0};
1363 \else
1364 \fi
1365 \ifx\dynby\empty
1366 \def\dynby{0};
1367 \else
1368 \fi
1369 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em,
1370 below of = #4, node distance= 1.2cm + \dxnbx, yshift=\dynby, label=\textsize{#3}] (#5) {};
1371 }
1372
1373 % Place Node At Coordinate
1374 %% Usage: {optional x distance shift}{optional y distance shift}{empty text-label}{current node coordinate}
1375 \newcommand{\kMarkNode}[4]{
1376 \def\dxncsx{#1};
1377 \def\dyncsy{#2};
1378
1379 \ifx\dxncsx\empty
1380 \def\dxncsx{0};
1381 \else
1382 \fi
1383 \ifx\dyncsy\empty
1384 \def\dyncsy{0};
1385 \else
1386 \fi
1387
1388 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em,
1389 node distance= 0cm + \dxncsx, yshift=\dyncsy, label=\textsize{#3}] (#4) {};
1390
1391 }
1392
1393
1394 % Place a Reference Invisible Node relative to other nodes
1395 %% Usage: [optional distance shift]{from node label}{to current coordinate label}{direction shift}{coordinate text label}
1396
1397 \newcommand{\kJumpCSRight}[5][]{
1398 \def\dxj{#1};
1399 \ifx\dxj\empty
1400 \def\dxj{0};
1401 \else
1402 \fi
1403
1404 \coordinate (tmpn) at ($(#2.east) + (0,#4)$);
1405 \coordinate[right of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3);
1406 }
1407 \newcommand{\kJumpCSLeft}[5][]{
1408 \def\dxj{#1};
1409 \ifx\dxj\empty
1410 \def\dxj{0};
1411 \else
1412 \fi
1413
1414 \coordinate (tmpn) at ($(#2.west) + (0,#4)$);
1415 \coordinate[left of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3);
1416 }
1417 \newcommand{\kJumpCSAbove}[5][]{
1418 \def\dxj{#1};
1419 \ifx\dxj\empty
1420 \def\dxj{0};
1421 \else
1422 \fi
1423
1424 \coordinate (tmpn) at ($(#2.north) + (#4,0)$);
1425 \coordinate[above of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3);
1426 }
1427 \newcommand{\kJumpCSBelow}[5][]{
1428 \def\dxj{#1};
1429 \ifx\dxj\empty
1430 \def\dxj{0};
1431 \else
1432 \fi
1433
1434 \coordinate (tmpn) at ($(#2.south) + (#4,0)$);
1435 \coordinate[below of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3);
1436 }
1437
1438 % Place a Reference Invisible Node at any specific coordinate
1439 %% Usage: {current coordinate label}{coordinate (x,y)}
1440 \newcommand{\kJumpCS}[2][$(0,0)$]{
1441 \coordinate (#2) at (#1);
1442 }
1443
1444 % Links %% swap, near end,mid, add label text above lines or besides
1445 %% Usage: [optional signal label]{from node label}{to node label}
1446 % Link Left or Right, Up or Down
1447 \newcommand{\kLink}[3][]{
1448 \draw [-latex,\linecolor, \linepathtype] (#2) -- node[auto] {\textsize{#1}} (#3);
1449 }
1450 % no arrow
1451 \newcommand{\kLinkn}[3][]{
1452 \draw [\linecolor, \linepathtype] (#2) -- node[auto,above] {\textsize{#1}} (#3);
1453 }
1454 %% Vector link variant
1455 % Link Left or Right, Up or Down
1456 \newcommand{\kVecLink}[3][]{
1457 \draw [-latex,\linecolor, veclinetype] (#2) -- node[auto] {\textsize{#1}} (#3);
1458 }
1459 % no arrow
1460 \newcommand{\kVecLinkn}[3][]{
1461 \draw [\linecolor, veclinetype] (#2) -- node[auto,above] {\textsize{#1}} (#3);
1462 }
1463
1464 %% Link Directed TODO: investigate use
1465 %% Usage: [optional signal link label]{from node label}{to node label}{from-to node direction shift}
1466 % Directed Link Left or Right, Up or Down
1467 \newcommand{\kLinkdir}[4][]{
1468 \coordinate (tmp) at ($(#2.west) + (0,#4)$);
1469 \draw[-latex, \linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$);
1470 }
1471 % no arrow
1472 \newcommand{\kLinkndir}[4][]{
1473 \coordinate (tmp) at ($(#2.west) + (0,#4)$);
1474 \draw[\linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$);
1475 }
1476
1477 %% Vector link variant
1478 \newcommand{\kVecLinkdir}[4][]{
1479 \coordinate (tmp) at ($(#2.west) + (0,#4)$);
1480 \draw[-latex, \linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$);
1481 }
1482 % no arrow
1483 \newcommand{\kVecLinkndir}[4][]{
1484 \coordinate (tmp) at ($(#2.west) + (0,#4)$);
1485 \draw[\linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$);
1486 }
1487
1488 % Link Horizontal(Right or Left) Vertical(Up or Down)
1489 %% Usage: [optional link label]{from node label}{to current node label}{direction shift y}{direction shift x}{link label position}
1490 % Link: Left Up, Left Down, Right Up, Right Down
1491
1492 \newcommand{\kLinkHV}[7][]{% TODO:DONE
1493 \def\dxpos{#5};
1494 \ifx\dxpos\empty
1495 \def\dxpos{0};
1496 \else
1497 \fi
1498
1499 \def\dypos{#4};
1500 \ifx\dypos\empty
1501 \def\dypos{0};
1502 \else
1503 \fi
1504
1505 \coordinate (fromn) at (#2);% from node coordinate
1506 \coordinate (ton) at (#3);% to node coordinate
1507
1508
1509 % extract x and y coordinates
1510 \newdimen\xf;%
1511 \newdimen\yf;%
1512 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1513 \newdimen\xt;%
1514 \newdimen\yt;%
1515 \path (ton); \pgfgetlastxy{\xt}{\yt};
1516
1517 \newdimen\asumxft;
1518
1519 \tikzmath{
1520 \asumxft = \yt - \yf;
1521 if \asumxft>0 then {let \directn = south;} else {
1522 if \asumxft<0 then {let \directn = north;} else {
1523 let \directn = 0;
1524 };
1525 };
1526 \asumxft = \xt - \xf;
1527 if \asumxft>0 then {let \fdirectn = east;} else {
1528 if \asumxft<0 then {let \fdirectn = west;} else {
1529 let \fdirectn = 0;
1530 };
1531 };
1532 }
1533
1534 % immediate marking of perpendicular edge of VH or HV links
1535 \def\mkpt{#7};
1536 \ifx\mkpt\empty
1537 \else
1538 \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$);
1539 \newdimen\xtohat;
1540 \newdimen\ytohat;%
1541 \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat};
1542 \coordinate (#7) at (\xf,\ytohat); % markpt coordinate
1543 %\coordinate (#1) at (\xf,\yt); % markpt coordinate
1544 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {};
1545 \fi
1546
1547 % label positioning: 10 options (0 - 9)
1548 \def\poslabel{#6};
1549 \ifx\poslabel\empty
1550 \def\poslabel{5};
1551 \else
1552 \fi
1553
1554 % integer register, count0 (0-255)
1555 \count0=\poslabel\relax;
1556
1557 \ifnum\count0=0
1558 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1559 \else
1560 \ifnum\count0=1
1561 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1562 \else
1563 \ifnum\count0=2
1564 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1565 \else
1566 \ifnum\count0=3
1567 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1568 \else
1569 \ifnum\count0=4
1570 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1571 \else
1572 \ifnum\count0=5
1573 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1574 \else
1575 \ifnum\count0=6
1576 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1577 \else
1578 \ifnum\count0=7
1579 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1580 \else
1581 \ifnum\count0=8
1582 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[left,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1583 \else
1584 \ifnum\count0=9
1585 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[right,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1586 \else
1587 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1588 \fi
1589 \fi
1590 \fi
1591 \fi
1592 \fi
1593 \fi
1594 \fi
1595 \fi
1596 \fi
1597 \fi
1598 }
1599
1600
1601 %% vector variant
1602 \newcommand{\kVecLinkHV}[6][]{% TODO:extend changes made here to its other HV variants
1603 \def\dxpos{#5};
1604 \ifx\dxpos\empty
1605 \def\dxpos{0};
1606 \else
1607 \fi
1608
1609 \def\dypos{#4};
1610 \ifx\dypos\empty
1611 \def\dypos{0};
1612 \else
1613 \fi
1614
1615 \coordinate (fromn) at (#2);% from node coordinate
1616 \coordinate (ton) at (#3);% to node coordinate
1617
1618
1619 % extract x and y coordinates
1620 \newdimen\xf;%
1621 \newdimen\yf;%
1622 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1623 \newdimen\xt;%
1624 \newdimen\yt;%
1625 \path (ton); \pgfgetlastxy{\xt}{\yt};
1626
1627 \newdimen\asumxft;
1628
1629 \tikzmath{
1630 \asumxft = \yt - \yf;
1631 if \asumxft>0 then {let \directn = south;} else {
1632 if \asumxft<0 then {let \directn = north;} else {
1633 let \directn = 0;
1634 };
1635 };
1636 \asumxft = \xt - \xf;
1637 if \asumxft>0 then {let \fdirectn = east;} else {
1638 if \asumxft<0 then {let \fdirectn = west;} else {
1639 let \fdirectn = 0;
1640 };
1641 };
1642 }
1643
1644 \ifnum#6=0
1645 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1646 \else
1647 \ifnum#6=1
1648 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1649 \else
1650 \ifnum#6=2
1651 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1652 \else
1653 \ifnum#6=3
1654 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1655 \else
1656 \ifnum#6=4
1657 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1658 \else
1659 \ifnum#6=5
1660 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1661 \else
1662 \ifnum#6=6
1663 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1664 \else
1665 \ifnum#6=7
1666 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1667 \else
1668 \ifnum#6=8
1669 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1670 \else
1671 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1672 \fi
1673 \fi
1674 \fi
1675 \fi
1676 \fi
1677 \fi
1678 \fi
1679 \fi
1680 \fi
1681
1682 }
1683
1684 %% No direction
1685 \newcommand{\kLinknHV}[6][]{% TODO:extend changes made here to its other HV variants
1686 \def\dxpos{#5};
1687 \ifx\dxpos\empty
1688 \def\dxpos{0};
1689 \else
1690 \fi
1691
1692 \def\dypos{#4};
1693 \ifx\dypos\empty
1694 \def\dypos{0};
1695 \else
1696 \fi
1697
1698 \coordinate (fromn) at (#2);% from node coordinate
1699 \coordinate (ton) at (#3);% to node coordinate
1700
1701
1702 % extract x and y coordinates
1703 \newdimen\xf;%
1704 \newdimen\yf;%
1705 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1706 \newdimen\xt;%
1707 \newdimen\yt;%
1708 \path (ton); \pgfgetlastxy{\xt}{\yt};
1709
1710 \newdimen\asumxft;
1711
1712 \tikzmath{
1713 \asumxft = \yt - \yf;
1714 if \asumxft>0 then {let \directn = south;} else {
1715 if \asumxft<0 then {let \directn = north;} else {
1716 let \directn = 0;
1717 };
1718 };
1719 \asumxft = \xt - \xf;
1720 if \asumxft>0 then {let \fdirectn = east;} else {
1721 if \asumxft<0 then {let \fdirectn = west;} else {
1722 let \fdirectn = 0;
1723 };
1724 };
1725 }
1726
1727 \ifnum#6=0
1728 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1729 \else
1730 \ifnum#6=1
1731 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1732 \else
1733 \ifnum#6=2
1734 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1735 \else
1736 \ifnum#6=3
1737 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1738 \else
1739 \ifnum#6=4
1740 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1741 \else
1742 \ifnum#6=5
1743 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1744 \else
1745 \ifnum#6=6
1746 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1747 \else
1748 \ifnum#6=7
1749 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1750 \else
1751 \ifnum#6=8
1752 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1753 \else
1754 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1755 \fi
1756 \fi
1757 \fi
1758 \fi
1759 \fi
1760 \fi
1761 \fi
1762 \fi
1763 \fi
1764
1765 % \def\mkpt{#5};
1766 % \ifx\mkpt\empty
1767 % \else
1768 % \coordinate (#5) at (\xf,\yt); % markpt coordinate
1769 % \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xt,\yf) {};
1770 % \fi
1771 }
1772 %% vector variant
1773 \newcommand{\kVecLinknHV}[6][]{% TODO:extend changes made here to its other HV variants
1774 \def\dxpos{#5};
1775 \ifx\dxpos\empty
1776 \def\dxpos{0};
1777 \else
1778 \fi
1779
1780 \def\dypos{#4};
1781 \ifx\dypos\empty
1782 \def\dypos{0};
1783 \else
1784 \fi
1785
1786 \coordinate (fromn) at (#2);% from node coordinate
1787 \coordinate (ton) at (#3);% to node coordinate
1788
1789
1790 % extract x and y coordinates
1791 \newdimen\xf;%
1792 \newdimen\yf;%
1793 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1794 \newdimen\xt;%
1795 \newdimen\yt;%
1796 \path (ton); \pgfgetlastxy{\xt}{\yt};
1797
1798 \newdimen\asumxft;
1799
1800 \tikzmath{
1801 \asumxft = \yt - \yf;
1802 if \asumxft>0 then {let \directn = south;} else {
1803 if \asumxft<0 then {let \directn = north;} else {
1804 let \directn = 0;
1805 };
1806 };
1807 \asumxft = \xt - \xf;
1808 if \asumxft>0 then {let \fdirectn = east;} else {
1809 if \asumxft<0 then {let \fdirectn = west;} else {
1810 let \fdirectn = 0;
1811 };
1812 };
1813 }
1814
1815 \ifnum#6=0
1816 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1817 \else
1818 \ifnum#6=1
1819 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1820 \else
1821 \ifnum#6=2
1822 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1823 \else
1824 \ifnum#6=3
1825 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1826 \else
1827 \ifnum#6=4
1828 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1829 \else
1830 \ifnum#6=5
1831 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1832 \else
1833 \ifnum#6=6
1834 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1835 \else
1836 \ifnum#6=7
1837 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1838 \else
1839 \ifnum#6=8
1840 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1841 \else
1842 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$);
1843 \fi
1844 \fi
1845 \fi
1846 \fi
1847 \fi
1848 \fi
1849 \fi
1850 \fi
1851 \fi
1852
1853 }
1854
1855
1856 % Link Vertical(Up or Down) Horizontal(Right or Left)
1857 % Link Up Left, Up Right, Down Left, Down Right
1858 \newcommand{\kLinkVH}[7][]{ % TODO:DONE
1859
1860 \def\dypos{#4};
1861 \def\dxpos{#5};
1862 \ifx\dypos\empty
1863 \def\dypos{0};
1864 \else
1865 \fi
1866 \ifx\dxpos\empty
1867 \def\dxpos{0};
1868 \else
1869 \fi
1870
1871 \coordinate (fromn) at (#2);% from node coordinate
1872 \coordinate (ton) at (#3);% to node coordinate
1873
1874
1875 % extract x and y coordinates
1876 \newdimen\xf;%
1877 \newdimen\yf;%
1878 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1879 \newdimen\xt;%
1880 \newdimen\yt;%
1881 \path (ton); \pgfgetlastxy{\xt}{\yt};
1882
1883 \newdimen\asumxft;
1884
1885 \tikzmath{
1886 \asumxft = \xt - \xf;
1887 if \asumxft>0 then {let \directn = west;} else {
1888 if \asumxft<0 then {let \directn = east;} else {
1889 let \directn = 0;
1890 };
1891 };
1892 \asumyft = \yt - \yf;
1893 if \asumyft>0 then {let \fdirectn = north;} else {
1894 if \asumyft<0 then {let \fdirectn = south;} else {
1895 let \fdirectn = 0;
1896 };
1897 };
1898 }
1899
1900
1901 % immediate marking of perpendicular edge of VH or HV links
1902 \def\mkpt{#7};
1903 \ifx\mkpt\empty
1904 \else
1905 \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$);
1906 \newdimen\xtohat;
1907 \newdimen\ytohat;%
1908 \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat};
1909 \coordinate (#7) at (\xf,\ytohat); % markpt coordinate
1910 %\coordinate (#1) at (\xf,\yt); % markpt coordinate
1911 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {};
1912 \fi
1913
1914
1915 % label positioning: 10 options (0 - 9)
1916 \def\poslabel{#6};
1917 \ifx\poslabel\empty
1918 \def\poslabel{5};
1919 \else
1920 \fi
1921
1922 % integer register, count0 (0-255)
1923 \count0=\poslabel\relax;
1924
1925 \ifnum\count0=0
1926 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1927 \else
1928 \ifnum\count0=1
1929 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1930 \else
1931 \ifnum\count0=2
1932 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1933 \else
1934 \ifnum\count0=3
1935 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1936 \else
1937 \ifnum\count0=4
1938 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1939 \else
1940 \ifnum\count0=5
1941 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1942 \else
1943 \ifnum\count0=6
1944 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1945 \else
1946 \ifnum\count0=7
1947 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1948 \else
1949 \ifnum\count0=8
1950 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1951 \else
1952 \ifnum\count0=9
1953 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1954 \else
1955 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
1956 \fi
1957 \fi
1958 \fi
1959 \fi
1960 \fi
1961 \fi
1962 \fi
1963 \fi
1964 \fi
1965 \fi
1966
1967 }
1968
1969 %% vector variant
1970 \newcommand{\kVecLinkVH}[6][]{ % TODO:extend changes made here to its other VH variants
1971
1972 \def\dypos{#4};
1973 \def\dxpos{#5};
1974 \ifx\dypos\empty
1975 \def\dypos{0};
1976 \else
1977 \fi
1978 \ifx\dxpos\empty
1979 \def\dxpos{0};
1980 \else
1981 \fi
1982
1983 \coordinate (fromn) at (#2);% from node coordinate
1984 \coordinate (ton) at (#3);% to node coordinate
1985
1986
1987 % extract x and y coordinates
1988 \newdimen\xf;%
1989 \newdimen\yf;%
1990 \path (fromn); \pgfgetlastxy{\xf}{\yf};
1991 \newdimen\xt;%
1992 \newdimen\yt;%
1993 \path (ton); \pgfgetlastxy{\xt}{\yt};
1994
1995 \newdimen\asumxft;
1996
1997 \tikzmath{
1998 \asumxft = \xt - \xf;
1999 if \asumxft>0 then {let \directn = west;} else {
2000 if \asumxft<0 then {let \directn = east;} else {
2001 let \directn = 0;
2002 };
2003 };
2004 \asumyft = \yt - \yf;
2005 if \asumyft>0 then {let \fdirectn = north;} else {
2006 if \asumyft<0 then {let \fdirectn = south;} else {
2007 let \fdirectn = 0;
2008 };
2009 };
2010 }
2011
2012
2013 \ifnum#6=0
2014 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2015 \else
2016 \ifnum#6=1
2017 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2018 \else
2019 \ifnum#6=2
2020 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2021 \else
2022 \ifnum#6=3
2023 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2024 \else
2025 \ifnum#6=4
2026 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2027 \else
2028 \ifnum#6=5
2029 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2030 \else
2031 \ifnum#6=6
2032 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2033 \else
2034 \ifnum#6=7
2035 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2036 \else
2037 \ifnum#6=8
2038 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2039 \else
2040 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2041 \fi
2042 \fi
2043 \fi
2044 \fi
2045 \fi
2046 \fi
2047 \fi
2048 \fi
2049 \fi
2050
2051 }
2052
2053 %% No Direction
2054 \newcommand{\kLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants
2055
2056 \def\dypos{#4};
2057 \def\dxpos{#5};
2058 \ifx\dypos\empty
2059 \def\dypos{0};
2060 \else
2061 \fi
2062 \ifx\dxpos\empty
2063 \def\dxpos{0};
2064 \else
2065 \fi
2066
2067 \coordinate (fromn) at (#2);% from node coordinate
2068 \coordinate (ton) at (#3);% to node coordinate
2069
2070
2071 % extract x and y coordinates
2072 \newdimen\xf;%
2073 \newdimen\yf;%
2074 \path (fromn); \pgfgetlastxy{\xf}{\yf};
2075 \newdimen\xt;%
2076 \newdimen\yt;%
2077 \path (ton); \pgfgetlastxy{\xt}{\yt};
2078
2079 \newdimen\asumxft;
2080
2081 \tikzmath{
2082 \asumxft = \xt - \xf;
2083 if \asumxft>0 then {let \directn = west;} else {
2084 if \asumxft<0 then {let \directn = east;} else {
2085 let \directn = 0;
2086 };
2087 };
2088 \asumyft = \yt - \yf;
2089 if \asumyft>0 then {let \fdirectn = north;} else {
2090 if \asumyft<0 then {let \fdirectn = south;} else {
2091 let \fdirectn = 0;
2092 };
2093 };
2094 }
2095
2096 \ifnum#6=0
2097 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2098 \else
2099 \ifnum#6=1
2100 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2101 \else
2102 \ifnum#6=2
2103 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2104 \else
2105 \ifnum#6=3
2106 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2107 \else
2108 \ifnum#6=4
2109 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2110 \else
2111 \ifnum#6=5
2112 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2113 \else
2114 \ifnum#6=6
2115 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2116 \else
2117 \ifnum#6=7
2118 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2119 \else
2120 \ifnum#6=8
2121 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2122 \else
2123 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2124 \fi
2125 \fi
2126 \fi
2127 \fi
2128 \fi
2129 \fi
2130 \fi
2131 \fi
2132 \fi
2133
2134 }
2135
2136 %% vector variant
2137 \newcommand{\kVecLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants
2138
2139 \def\dypos{#4};
2140 \def\dxpos{#5};
2141 \ifx\dypos\empty
2142 \def\dypos{0};
2143 \else
2144 \fi
2145 \ifx\dxpos\empty
2146 \def\dxpos{0};
2147 \else
2148 \fi
2149
2150 \coordinate (fromn) at (#2);% from node coordinate
2151 \coordinate (ton) at (#3);% to node coordinate
2152
2153
2154 % extract x and y coordinates
2155 \newdimen\xf;%
2156 \newdimen\yf;%
2157 \path (fromn); \pgfgetlastxy{\xf}{\yf};
2158 \newdimen\xt;%
2159 \newdimen\yt;%
2160 \path (ton); \pgfgetlastxy{\xt}{\yt};
2161
2162 \newdimen\asumxft;
2163
2164 \tikzmath{
2165 \asumxft = \xt - \xf;
2166 if \asumxft>0 then {let \directn = west;} else {
2167 if \asumxft<0 then {let \directn = east;} else {
2168 let \directn = 0;
2169 };
2170 };
2171 \asumyft = \yt - \yf;
2172 if \asumyft>0 then {let \fdirectn = north;} else {
2173 if \asumyft<0 then {let \fdirectn = south;} else {
2174 let \fdirectn = 0;
2175 };
2176 };
2177 }
2178
2179
2180 \ifnum#6=0
2181 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2182 \else
2183 \ifnum#6=1
2184 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2185 \else
2186 \ifnum#6=2
2187 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2188 \else
2189 \ifnum#6=3
2190 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2191 \else
2192 \ifnum#6=4
2193 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2194 \else
2195 \ifnum#6=5
2196 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2197 \else
2198 \ifnum#6=6
2199 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2200 \else
2201 \ifnum#6=7
2202 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2203 \else
2204 \ifnum#6=8
2205 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2206 \else
2207 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$);
2208 \fi
2209 \fi
2210 \fi
2211 \fi
2212 \fi
2213 \fi
2214 \fi
2215 \fi
2216 \fi
2217
2218 }
2219
2220
2221 % Link Full Feedback/FeedForward Horizontal(Right or Left) to Vertical(Up or Down)
2222 % to Horizontal(Right or Left)
2223 %% Usage: [optional link scale]{link label}{from node}{to node}{from node direction shift}{to node direction shift}
2224
2225 \newcommand{\kLinkHVHRight}[6][]{
2226 \def\dxr{#1};
2227 \ifx\dxr\empty
2228 \def\dxr{0};
2229 \else
2230 \fi
2231 \coordinate (tmplr) at ($(#3.east) + (0,#5)$);
2232 \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$);
2233 \draw[-latex, \linecolor, \linepathtype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$);
2234 }
2235 % vector
2236 \newcommand{\kVLinkHVHRight}[6][]{
2237 \def\dxr{#1};
2238 \ifx\dxr\empty
2239 \def\dxr{0};
2240 \else
2241 \fi
2242 \coordinate (tmplr) at ($(#3.east) + (0,#5)$);
2243 \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$);
2244 \draw[-latex, \linecolor, veclinetype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$);
2245 }
2246 \newcommand{\kLinkHVHLeft}[6][]{
2247 \def\dxl{#1};
2248 \ifx\dxl\empty
2249 \def\dxl{0};
2250 \else
2251 \fi
2252 \coordinate (tmpll) at ($(#3.west) + (0,#5)$);
2253 \coordinate (tmp) at ($(#3.west) + (0,#5) + (-0.33-\dxl,0)$);
2254 \draw[-latex, \linecolor, \linepathtype] (tmpll) -| (tmp) node[at end, above left] {\textsize{#2}} |- ($(#4.west) + (0,#6)$);
2255 }
2256
2257 % Link Full Feedback/FeedForward Vertical(Up or Down) to Horizontal(Right or Left) to Vertical(Up or Down)
2258 %% Usage: {optional link shift}{unity link label}{from node}{to node}{from node direction shift}{to node direction shift}
2259
2260 % Above
2261 \newcommand{\kLinkVHHVAbove}[6][]{
2262 \def\dxb{#1};
2263 \ifx\dxb\empty
2264 \def\dxb{0};
2265 \else
2266 \fi
2267 \coordinate (tmpb) at ($(#3.north) + (#5,0)$);
2268 \coordinate (tmpc) at ($(#4.north) + (#6,0)$);
2269
2270 \newdimen\xca;
2271 \newdimen\yca;
2272 \path (tmpb); \pgfgetlastxy{\xca}{\yca};
2273 \newdimen\xcb;
2274 \newdimen\ycb;
2275 \path (tmpc); \pgfgetlastxy{\xcb}{\ycb};
2276
2277 \newdimen\xcr;
2278
2279 \tikzmath{
2280 \xcr = 0.5 * (\xca+\xcb);
2281 }
2282
2283 \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $);
2284 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$);
2285 }
2286
2287 % Below
2288 \newcommand{\kLinkVHHVBelow}[6][]{
2289 \def\dxb{#1};
2290
2291 \ifx\dxb\empty
2292 \def\dxb{0};
2293 \else
2294 \fi
2295 \coordinate (tmpb) at ($(#3.south) + (#5,0)$);
2296 \coordinate (tmpc) at ($(#4.south) + (#6,0)$);
2297
2298 \newdimen\xca;
2299 \newdimen\yca;
2300 \path (tmpb); \pgfgetlastxy{\xca}{\yca};
2301 \newdimen\xcb;
2302 \newdimen\ycb;
2303 \path (tmpc); \pgfgetlastxy{\xcb}{\ycb};
2304
2305 \newdimen\xcr;
2306
2307 \tikzmath{
2308 \xcr = 0.5 * (\xca+\xcb);
2309 }
2310
2311 \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,-1cm-\dxb) $);
2312 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$);
2313 }
2314
2315 % No directions
2316 % Above
2317 \newcommand{\kLinknVHHVAbove}[6][]{
2318 \def\dxb{#1};
2319 \ifx\dxb\empty
2320 \def\dxb{0};
2321 \else
2322 \fi
2323 \coordinate (tmpb) at ($(#3.north) + (#5,0)$);
2324 \coordinate (tmpc) at ($(#4.north) + (#6,0)$);
2325
2326 \newdimen\xca;
2327 \newdimen\yca;
2328 \path (tmpb); \pgfgetlastxy{\xca}{\yca};
2329 \newdimen\xcb;
2330 \newdimen\ycb;
2331 \path (tmpc); \pgfgetlastxy{\xcb}{\ycb};
2332
2333 \newdimen\xcr;
2334
2335 \tikzmath{
2336 \xcr = 0.5 * (\xca+\xcb);
2337 }
2338
2339 \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $);
2340 \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$);
2341 }
2342
2343 % Below
2344 \newcommand{\kLinknVHHVBelow}[6][]{
2345 \def\dxb{#1};
2346
2347 \ifx\dxb\empty
2348 \def\dxb{0};
2349 \else
2350 \fi
2351 \coordinate (tmpb) at ($(#3.south) + (#5,0)$);
2352 \coordinate (tmpc) at ($(#4.south) + (#6,0)$);
2353
2354 \newdimen\xca;
2355 \newdimen\yca;
2356 \path (tmpb); \pgfgetlastxy{\xca}{\yca};
2357 \newdimen\xcb;
2358 \newdimen\ycb;
2359 \path (tmpc); \pgfgetlastxy{\xcb}{\ycb};
2360
2361 \newdimen\xcr;
2362
2363 \tikzmath{
2364 \xcr = 0.5 * (\xca+\xcb);
2365 }
2366
2367 \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,-1cm-\dxb) $);
2368 \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$);
2369 }
2370
2371 % Link Feedback/FeedForward with a TF Block in between
2372 %% Usage: {signal label before tf}{signal label after tf}{from node}{tf node}{to node}{from node direction shift}{tf direction shift}{to node direction shift}
2373 \newcommand{\kLinkVHTFHVBelow}[8]{
2374 \coordinate (tmpb) at ($(#3.south) + (#6,0)$);
2375 \coordinate (tmpu) at ($(#4.east) + (0,#7)$);
2376 \coordinate (tmpv) at ($(#4.west) + (0,#7)$);
2377 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu);
2378 \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.south) + (#8,0)$);
2379 }
2380 \newcommand{\kLinkVHTFHVBelowRight}[8]{
2381 \coordinate (tmpb) at ($(#3.south) + (#6,0)$);
2382 \coordinate (tmpu) at ($(#4.west) + (0,#7)$);
2383 \coordinate (tmpv) at ($(#4.east) + (0,#7)$);
2384 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu);
2385 \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.south) + (#8,0)$);
2386 }
2387 \newcommand{\kLinkVHTFHVAbove}[8]{
2388 \coordinate (tmpb) at ($(#3.north) + (#6,0)$);
2389 \coordinate (tmpu) at ($(#4.east) + (0,#7)$);
2390 \coordinate (tmpv) at ($(#4.west) + (0,#7)$);
2391 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu);
2392 \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.north) + (#8,0)$);
2393 }
2394 \newcommand{\kLinkVHTFHVAboveRight}[8]{
2395 \coordinate (tmpb) at ($(#3.north) + (#6,0)$);
2396 \coordinate (tmpu) at ($(#4.west) + (0,#7)$);
2397 \coordinate (tmpv) at ($(#4.east) + (0,#7)$);
2398 \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu);
2399 \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.north) + (#8,0)$);
2400 }
2401
2402
2403 % Cross Links
2404 \newcommand{\kLinkCrossLeftAbove}[2]{
2405 \coordinate [above of=#1, node distance= \verticdist, xshift=-\horizdist] (tmp);
2406 \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(-\horizdist/2,0) -- ($(#2)-(0,\verticdist)$) -- (#2);
2407 }
2408
2409 \newcommand{\kLinkCrossLeftBelow}[2]{
2410 \coordinate [below of=#1, node distance= \verticdist, xshift=-\horizdist] (tmp);
2411 \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(-\horizdist/2,0) -- ($(#2)+(0,\verticdist)$) -- (#2);
2412 }
2413
2414 \newcommand{\kLinkCrossRightAbove}[2]{
2415 \coordinate [above of=#1, node distance= \verticdist, xshift=\horizdist] (tmp);
2416 \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(\horizdist/2,0) -- ($(#2)-(0,\verticdist)$) -- (#2);
2417 }
2418
2419 \newcommand{\kLinkCrossRightBelow}[2]{
2420 \coordinate [below of=#1, node distance= \verticdist, xshift=\horizdist] (tmp);
2421 \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(\horizdist/2,0) -- ($(#2)+(0,\verticdist)$) -- (#2);
2422 }
2423
2424
2425 % Link Inputs and Outputs Invisible Node
2426 %% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift}
2427
2428 % Marked Link Inputs and Outputs Visible Node
2429 %% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift}{label position}
2430
2431 % Inputs
2432 \newcommand{\kInRight}[5][]{
2433 \def\dxinr{#1};
2434 \ifx\dxinr\empty
2435 \def\dxinr{0};
2436 \else
2437 \fi
2438
2439 % to add to all
2440 \def\dypos{#5};
2441 \ifx\dypos\empty
2442 \def\dypos{0};
2443 \else
2444 \fi
2445
2446 \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$);
2447
2448 \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4};
2449
2450 \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn);
2451 }
2452
2453 \newcommand{\kInLeft}[5][]{
2454 \def\dxinr{#1};
2455 \ifx\dxinr\empty
2456 \def\dxinr{0};
2457 \else
2458 \fi
2459
2460 % to add to all
2461 \def\dypos{#5};
2462 \ifx\dypos\empty
2463 \def\dypos{0};
2464 \else
2465 \fi
2466
2467 \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$);
2468
2469 \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4};
2470
2471 \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn);
2472 }
2473
2474 \newcommand{\kInUp}[5][]{
2475 \def\dxina{#1};
2476 \ifx\dxina\empty
2477 \def\dxina{0};
2478 \else
2479 \fi
2480
2481 \def\dxpos{#5};
2482 \ifx\dxpos\empty
2483 \def\dxpos{0};
2484 \else
2485 \fi
2486
2487 \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$);
2488
2489 \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4};
2490
2491 \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn);
2492 }
2493
2494 \newcommand{\kInDown}[5][]{
2495 \def\dxina{#1};
2496 \ifx\dxina\empty
2497 \def\dxina{0};
2498 \else
2499 \fi
2500
2501 \def\dxpos{#5};
2502 \ifx\dxpos\empty
2503 \def\dxpos{0};
2504 \else
2505 \fi
2506
2507 \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$);
2508
2509 \node[below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4};
2510
2511 \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn);
2512 }
2513
2514 % Marked (visible node) Link Inputs
2515 \newcommand{\kInLeftM}[6][]{
2516 \def\dxinr{#1};
2517 \ifx\dxinr\empty
2518 \def\dxinr{0};
2519 \else
2520 \fi
2521
2522 % to add to all
2523 \def\dypos{#5};
2524 \ifx\dypos\empty
2525 \def\dypos{0};
2526 \else
2527 \fi
2528
2529 \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$);
2530
2531 \ifnum#6=0
2532 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2533 \else
2534 \ifnum#6=1
2535 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2536 \else
2537 \ifnum#6=2
2538 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2539 %
2540 \else
2541 \ifnum#6=3
2542 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2543 \else
2544 \ifnum#6=4
2545 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2546 \else
2547 \ifnum#6=5
2548 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2549 %
2550 \else
2551 \ifnum#6=6
2552 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2553 \else
2554 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2555 \fi
2556 \fi
2557 \fi
2558 \fi
2559 \fi
2560 \fi
2561 \fi
2562 %
2563 \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn);
2564 }
2565
2566 \newcommand{\kInRightM}[6][]{
2567 \def\dxinr{#1};
2568 \ifx\dxinr\empty
2569 \def\dxinr{0};
2570 \else
2571 \fi
2572
2573 % to add to all
2574 \def\dypos{#5};
2575 \ifx\dypos\empty
2576 \def\dypos{0};
2577 \else
2578 \fi
2579
2580 \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$);
2581
2582 \ifnum#6=0
2583 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2584 \else
2585 \ifnum#6=1
2586 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2587 \else
2588 \ifnum#6=2
2589 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2590 %
2591 \else
2592 \ifnum#6=3
2593 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2594 \else
2595 \ifnum#6=4
2596 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2597 \else
2598 \ifnum#6=5
2599 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2600 %
2601 \else
2602 \ifnum#6=6
2603 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2604 \else
2605 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2606 \fi
2607 \fi
2608 \fi
2609 \fi
2610 \fi
2611 \fi
2612 \fi
2613 %
2614 \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn);
2615 }
2616
2617 \newcommand{\kInUpM}[6][]{
2618 \def\dxina{#1};
2619 \ifx\dxina\empty
2620 \def\dxina{0};
2621 \else
2622 \fi
2623
2624 % to add to all
2625 \def\dxpos{#5};
2626 \ifx\dxpos\empty
2627 \def\dxpos{0};
2628 \else
2629 \fi
2630
2631 \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$);
2632
2633 \ifnum#6=0
2634 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize, label=above:\color{\colortext}{#4}] (#3) {};
2635 \else
2636 \ifnum#6=1
2637 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2638 \else
2639 \ifnum#6=2
2640 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2641 %
2642 \else
2643 \ifnum#6=3
2644 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2645 \else
2646 \ifnum#6=4
2647 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2648 \else
2649 \ifnum#6=5
2650 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2651 %
2652 \else
2653 \ifnum#6=6
2654 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2655 \else
2656 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2657 \fi
2658 \fi
2659 \fi
2660 \fi
2661 \fi
2662 \fi
2663 \fi
2664 %
2665 \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn);
2666 }
2667
2668 \newcommand{\kInDownM}[6][]{
2669 \def\dxina{#1};
2670 \ifx\dxina\empty
2671 \def\dxina{0};
2672 \else
2673 \fi
2674
2675 % to add to all
2676 \def\dxpos{#5};
2677 \ifx\dxpos\empty
2678 \def\dxpos{0};
2679 \else
2680 \fi
2681
2682 \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$);
2683
2684 \ifnum#6=0
2685 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2686 \else
2687 \ifnum#6=1
2688 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2689 \else
2690 \ifnum#6=2
2691 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2692 %
2693 \else
2694 \ifnum#6=3
2695 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2696 \else
2697 \ifnum#6=4
2698 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2699 \else
2700 \ifnum#6=5
2701 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2702 %
2703 \else
2704 \ifnum#6=6
2705 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2706 \else
2707 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2708 \fi
2709 \fi
2710 \fi
2711 \fi
2712 \fi
2713 \fi
2714 \fi
2715 %
2716 \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn);
2717 }
2718
2719 % Outputs
2720 \newcommand{\kOutRight}[5][]{
2721 \def\dxoutr{#1};
2722 \ifx\dxoutr\empty
2723 \def\dxoutr{0};
2724 \else
2725 \fi
2726
2727 \coordinate (tmpo) at ($(#2.east) + (0,#5)$);
2728
2729 \node[right of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
2730
2731 \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3);
2732 }
2733
2734 \newcommand{\kOutLeft}[5][]{
2735 \def\dxoutr{#1};
2736 \ifx\dxoutr\empty
2737 \def\dxoutr{0};
2738 \else
2739 \fi
2740
2741 \coordinate (tmpo) at ($(#2.west) + (0,#5)$);
2742
2743 \node[left of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
2744
2745 \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3);
2746 }
2747
2748 \newcommand{\kOutUp}[5][]{
2749 \def\dxoutr{#1};
2750 \ifx\dxoutr\empty
2751 \def\dxoutr{0};
2752 \else
2753 \fi
2754
2755 \coordinate (tmpo) at ($(#2.north) + (#5,0)$);
2756
2757 \node[above of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
2758
2759 \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3);
2760 }
2761
2762 \newcommand{\kOutDown}[5][]{
2763 \def\dxoutr{#1};
2764 \ifx\dxoutr\empty
2765 \def\dxoutr{0};
2766 \else
2767 \fi
2768
2769 \coordinate (tmpo) at ($(#2.south) + (#5,0)$);
2770
2771 \node[below of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
2772
2773 \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3);
2774 }
2775
2776
2777 % Marked (visible node) Link Outputs (Redundant): To Remove this
2778 \newcommand{\kOutLeftM}[6][]{
2779 \def\dxinr{#1};
2780 \ifx\dxinr\empty
2781 \def\dxinr{0};
2782 \else
2783 \fi
2784
2785 % to add to all
2786 \def\dypos{#5};
2787 \ifx\dypos\empty
2788 \def\dypos{0};
2789 \else
2790 \fi
2791
2792 \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$);
2793
2794 \ifnum#6=0
2795 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2796 \else
2797 \ifnum#6=1
2798 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2799 \else
2800 \ifnum#6=2
2801 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2802 %
2803 \else
2804 \ifnum#6=3
2805 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2806 \else
2807 \ifnum#6=4
2808 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2809 \else
2810 \ifnum#6=5
2811 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2812 %
2813 \else
2814 \ifnum#6=6
2815 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2816 \else
2817 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2818 \fi
2819 \fi
2820 \fi
2821 \fi
2822 \fi
2823 \fi
2824 \fi
2825 %
2826 \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3);
2827 }
2828
2829 \newcommand{\kOutRightM}[6][]{
2830 \def\dxinr{#1};
2831 \ifx\dxinr\empty
2832 \def\dxinr{0};
2833 \else
2834 \fi
2835
2836 % to add to all
2837 \def\dypos{#5};
2838 \ifx\dypos\empty
2839 \def\dypos{0};
2840 \else
2841 \fi
2842
2843 \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$);
2844
2845 \ifnum#6=0
2846 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2847 \else
2848 \ifnum#6=1
2849 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2850 \else
2851 \ifnum#6=2
2852 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2853 %
2854 \else
2855 \ifnum#6=3
2856 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2857 \else
2858 \ifnum#6=4
2859 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2860 \else
2861 \ifnum#6=5
2862 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2863 %
2864 \else
2865 \ifnum#6=6
2866 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2867 \else
2868 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2869 \fi
2870 \fi
2871 \fi
2872 \fi
2873 \fi
2874 \fi
2875 \fi
2876 %
2877 \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3);
2878 }
2879
2880 \newcommand{\kOutUpM}[6][]{
2881 \def\dxina{#1};
2882 \ifx\dxina\empty
2883 \def\dxina{0};
2884 \else
2885 \fi
2886
2887 % to add to all
2888 \def\dxpos{#5};
2889 \ifx\dxpos\empty
2890 \def\dxpos{0};
2891 \else
2892 \fi
2893
2894 \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$);
2895
2896 \ifnum#6=0
2897 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2898 \else
2899 \ifnum#6=1
2900 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2901 \else
2902 \ifnum#6=2
2903 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2904 %
2905 \else
2906 \ifnum#6=3
2907 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2908 \else
2909 \ifnum#6=4
2910 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2911 \else
2912 \ifnum#6=5
2913 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2914 %
2915 \else
2916 \ifnum#6=6
2917 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2918 \else
2919 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2920 \fi
2921 \fi
2922 \fi
2923 \fi
2924 \fi
2925 \fi
2926 \fi
2927 %
2928 \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3);
2929 }
2930
2931 \newcommand{\kOutDownM}[6][]{
2932 \def\dxina{#1};
2933 \ifx\dxina\empty
2934 \def\dxina{0};
2935 \else
2936 \fi
2937
2938 % to add to all
2939 \def\dxpos{#5};
2940 \ifx\dxpos\empty
2941 \def\dxpos{0};
2942 \else
2943 \fi
2944
2945 \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$);
2946
2947 \ifnum#6=0
2948 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2949 \else
2950 \ifnum#6=1
2951 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {};
2952 \else
2953 \ifnum#6=2
2954 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {};
2955 %
2956 \else
2957 \ifnum#6=3
2958 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {};
2959 \else
2960 \ifnum#6=4
2961 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {};
2962 \else
2963 \ifnum#6=5
2964 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {};
2965 %
2966 \else
2967 \ifnum#6=6
2968 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {};
2969 \else
2970 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {};
2971 \fi
2972 \fi
2973 \fi
2974 \fi
2975 \fi
2976 \fi
2977 \fi
2978 %
2979 \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3);
2980 }
2981
2982
2983
2984
2985
2986 %% Vector variants
2987 \newcommand{\kVecInRight}[5][]{
2988 \def\dxinr{#1};
2989 \ifx\dxinr\empty
2990 \def\dxinr{0};
2991 \else
2992 \fi
2993
2994 \coordinate (tmpn) at ($(#2.east) + (0,#5)$);
2995
2996 \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4};
2997
2998 \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn);
2999 }
3000
3001 \newcommand{\kVecInLeft}[5][]{
3002 \def\dxinr{#1};
3003 \ifx\dxinr\empty
3004 \def\dxinr{0};
3005 \else
3006 \fi
3007
3008 % to add to all
3009 \def\dypos{#5};
3010 \ifx\dypos\empty
3011 \def\dypos{0};
3012 \else
3013 \fi
3014
3015 \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$);
3016
3017 \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4};
3018
3019 \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn);
3020 }
3021
3022 \newcommand{\kVecInUp}[5][]{
3023 \def\dxina{#1};
3024 \ifx\dxina\empty
3025 \def\dxina{0};
3026 \else
3027 \fi
3028
3029 \coordinate (tmpn) at ($(#2.north) + (#5,0)$);
3030
3031 \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4};
3032
3033 \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn);
3034 }
3035
3036 \newcommand{\kVecInDown}[5][]{
3037 \def\dxinr{#1};
3038 \ifx\dxinr\empty
3039 \def\dxinr{0};
3040 \else
3041 \fi
3042
3043 \coordinate (tmpn) at ($(#2.south) + (#5,0)$);
3044
3045 \node[below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4};
3046
3047 \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn);
3048 }
3049
3050
3051 % Link Outputs Invisible Node
3052 %% Usage: [optional distance shift]{from node label}{to current node label}{out signal label}{direction shift}
3053 \newcommand{\kVecOutRight}[5][]{
3054 \def\dxoutr{#1};
3055 \ifx\dxoutr\empty
3056 \def\dxoutr{0};
3057 \else
3058 \fi
3059
3060 \coordinate (tmpo) at ($(#2.east) + (0,#5)$);
3061
3062 \node[right of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
3063
3064 \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3);
3065 }
3066
3067 \newcommand{\kVecOutLeft}[5][]{
3068 \def\dxoutr{#1};
3069 \ifx\dxoutr\empty
3070 \def\dxoutr{0};
3071 \else
3072 \fi
3073
3074 \coordinate (tmpo) at ($(#2.west) + (0,#5)$);
3075
3076 \node[left of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
3077
3078 \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3);
3079 }
3080
3081 \newcommand{\kVecOutUp}[5][]{
3082 \def\dxoutr{#1};
3083 \ifx\dxoutr\empty
3084 \def\dxoutr{0};
3085 \else
3086 \fi
3087
3088 \coordinate (tmpo) at ($(#2.north) + (#5,0)$);
3089
3090 \node[above of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
3091
3092 \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3);
3093 }
3094
3095 \newcommand{\kVecOutDown}[5][]{
3096 \def\dxoutr{#1};
3097 \ifx\dxoutr\empty
3098 \def\dxoutr{0};
3099 \else
3100 \fi
3101
3102 \coordinate (tmpo) at ($(#2.south) + (#5,0)$);
3103
3104 \node[below of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4};
3105
3106 \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3);
3107 }
3108
3109
3110 % ----------------------------------------------------------------------------------------
3111
3112 % SIGNAL FLOW GRAPHS
3113
3114 \newcommand{\ksfgStart}[3]{
3115 \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em,
3116 node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {};
3117 }
3118
3119 \newcommand{\ksfgNStart}[3]{
3120 \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em,
3121 node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {};
3122 }
3123
3124 \newcommand{\ksfgNodeR}[5][]{
3125 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em,
3126 right of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {};
3127 \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3);
3128 }
3129
3130 \newcommand{\ksfgNodeL}[5][]{
3131 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em,
3132 left of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {};
3133 \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3);
3134 }
3135
3136 \newcommand{\ksfgNodeU}[5][]{
3137 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em,
3138 above of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {};
3139 \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3);
3140 }
3141
3142 \newcommand{\ksfgNodeD}[5][]{
3143 \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em,
3144 below of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {};
3145 \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3);
3146 }
3147
3148
3149 \newcommand{\ksfgLinkSelfR}[2][]{
3150 \draw[\linecolor, \linepathtype, midarrow,looseness=50]
3151 (#2) to [out=45,in=-45] node[right] {\textsize{#1}} (#2);
3152 }
3153
3154 \newcommand{\ksfgLinkSelfL}[2][]{
3155 \draw[\linecolor, \linepathtype, midarrow,looseness=50]
3156 (#2) to [out=-135,in=-135] node[left] {\textsize{#1}} (#2);
3157 }
3158
3159 \newcommand{\ksfgLinkSelfU}[2][]{
3160 \draw[\linecolor, \linepathtype, midarrow,looseness=50]
3161 (#2) to [in=45,out=135] node[above] {\textsize{#1}} (#2);
3162 }
3163
3164 \newcommand{\ksfgLinkSelfD}[2][]{
3165 \draw[\linecolor, \linepathtype, midarrow,looseness=50]
3166 (#2) to [in=225,out=315] node[below] {\textsize{#1}} (#2);
3167 }
3168
3169 \newcommand{\ksfgCLinkFlip}[4][]{
3170 \draw[midarrow, bend right=60] (#2) to node[#4] {\textsize{#1}} (#3);
3171 }
3172 \newcommand{\ksfgCLink}[4][]{
3173 \draw[midarrow, bend left=60] (#2) to node[#4] {\textsize{#1}} (#3);
3174 }
3175 %% node label positioning: at start near start midway near end at end, above below, sloped