diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/kblocks/kblocks.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/kblocks/kblocks.sty | 2265 |
1 files changed, 2179 insertions, 86 deletions
diff --git a/Master/texmf-dist/tex/latex/kblocks/kblocks.sty b/Master/texmf-dist/tex/latex/kblocks/kblocks.sty index 54ea69c2166..49ff9bfca88 100644 --- a/Master/texmf-dist/tex/latex/kblocks/kblocks.sty +++ b/Master/texmf-dist/tex/latex/kblocks/kblocks.sty @@ -1,6 +1,9 @@ +% some LaTeX code % kblocks.sty % TikZ-based block-diagram package for control theory applications +% version 2.0 (February 2021) % version 1.0 (October 2019) +% % Author: Somefun Oluwasegun {oasomefun@futa.edu.ng} % Change Log: % significant improvements and introduction of new macros and annotation @@ -10,7 +13,7 @@ % (2005): motivated by the TikZ-bloques package by Alejandro Garces {Alejandro Garcesalejandrogarces@gmail.com} % -% Copyright (c) 2019 by Oluwasegun Somefun <oasomefun@futa.edu.ng>. +% Copyright (c) 2021 by Oluwasegun Somefun <oasomefun@futa.edu.ng>. % MIT LICENSE % Permission is hereby granted, free of charge, to any person obtaining a copy of this software @@ -33,7 +36,7 @@ \typeout{kblocks: A package to easily typeset Control Block Diagrams and Signal Flow Graphs with TikZ/PGF.} -\typeout{(c) 2019. Oluwasegun Somefun} +\typeout{(c) 2021. Oluwasegun Somefun} \typeout{*} @@ -47,7 +50,8 @@ Flow Graphs with TikZ/PGF.} \RequirePackage{tikz,circuitikz} \usepgflibrary{shapes.misc} \usetikzlibrary{math,calc,arrows,decorations.pathmorphing,decorations.markings, -arrows.meta,backgrounds,fit,shadows} +arrows.meta,backgrounds,fit,shadows,matrix,chains,scopes,positioning, + decorations.pathreplacing,decorations.text,shapes.multipart,graphs,external} % Helpful @@ -64,6 +68,10 @@ arrows.meta,backgrounds,fit,shadows} \newcommand{\linetype}{very thick} \newcommand{\linepathtype}{semithick} +\newcommand{\kmT}[1]{$\:\bm{#1}\:$} % block math text with 1 left-right border spacing + +\newcommand{\kmTw}[1]{$\:\:\: \bm{#1} \:\:\:$} %block math text with wider left-right border spacing + \newcommand{\kShadow}{\renewcommand{\dark}{1}} \newcommand{\kColorB}[1]{\renewcommand{\backgroundcolor}{#1}} \newcommand{\kColorT}[1]{\renewcommand{\colortext}{#1}} @@ -77,6 +85,9 @@ arrows.meta,backgrounds,fit,shadows} \renewcommand{\horizdist}{1.5cm * #1} } +% to add very very thick width for vector lines +\tikzset{veclinetype/.style={line width=2.0pt}} + % Global variables for Coordinate Calculations \newdimen\xc \newdimen\yc @@ -117,7 +128,7 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} % Area Cover Rectangle -%% Usage [colour]{ref node}{north shift}{south shift}{west shift}{east shift} +%% Usage [colour]{ref node}{north shift dimension}{south shift dimension}{west shift dimension}{east shift dimension} \newcommand{\kCoverRect}[6][black]{ @@ -273,7 +284,7 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} % Arithmetic Summer Blocks %% Usage: {from node label}{to current sum node label}{optional horizontal position shift} - +% left down \newcommand{\kMinusPlusDown}[3]{ \def\dxpm{#3}; @@ -289,6 +300,51 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } +\newcommand{\kMinusPlusDownL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kMinusPlusDownA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kMinusPlusDownB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} \newcommand{\kMinusMinusDown}[3]{ @@ -305,6 +361,51 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kMinusMinusDownL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kMinusMinusDownA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kMinusMinusDownB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} \newcommand{\kPlusMinusDown}[3]{ @@ -321,8 +422,114 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kPlusMinusDownL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusDownA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusDownB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} \newcommand{\kPlusPlusDown}[3]{ + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusDownL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusDownA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusDownB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} + +\newcommand{\kPlusMinusDownPlaceAbove}[3]{ + \def\dxpm{#3}; \ifx\dxpm\empty @@ -330,13 +537,31 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \else \fi - \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; - \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; - \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kPlusMinusDownPlaceBelow}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} + + +% left up \newcommand{\kMinusPlusUp}[3]{ \def\dxpm{#3}; @@ -352,6 +577,52 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } +\newcommand{\kMinusPlusUpL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kMinusPlusUpA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kMinusPlusUpB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} + \newcommand{\kMinusMinusUp}[3]{ \def\dxpm{#3}; @@ -367,6 +638,52 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kMinusMinusUpL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kMinusMinusUpA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kMinusMinusUpB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} + \newcommand{\kPlusMinusUp}[3]{ @@ -383,6 +700,51 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kPlusMinusUpB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusUpA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusUpL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} \newcommand{\kPlusPlusUp}[3]{ @@ -399,6 +761,115 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } +\newcommand{\kPlusPlusUpB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusUpA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusUpL}[3]{ + +\def\dxpm{#3}; + +\ifx\dxpm\empty +\def\dxpm{0}; +\else +\fi + +\node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, +fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; +\node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; +\node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +\node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} + +% up down +\newcommand{\kPlusDownPlusUp}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusDownPlusUpB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusDownPlusUpA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusDownPlusUpL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} + +% left up down \newcommand{\kPlusPlusMinus}[3]{ \def\dxpm{#3}; @@ -415,6 +886,55 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kPlusPlusMinusB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusPlusMinusA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusPlusMinusL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} + \newcommand{\kPlusMinusMinus}[3]{ \def\dxpm{#3}; @@ -431,6 +951,54 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } +\newcommand{\kPlusMinusMinusL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusMinusA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} +\newcommand{\kPlusMinusMinusB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; +} \newcommand{\kPlusMinusPlus}[3]{ @@ -448,6 +1016,54 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } +\newcommand{\kPlusMinusPlusB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusMinusPlusA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusMinusPlusL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} \newcommand{\kPlusPlusPlus}[3]{ @@ -465,6 +1081,55 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } +\newcommand{\kPlusPlusPlusL}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusPlusA}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} +\newcommand{\kPlusPlusPlusB}[3]{ + + \def\dxpm{#3}; + + \ifx\dxpm\empty + \def\dxpm{0}; + \else + \fi + + \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, + fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; + \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; + \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; + \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; +} + % Circular Gain Block \newcommand{\kGain}[4][]{ @@ -632,60 +1297,100 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} % Mark Visible Circular Nodes -%% Usage: [optional distance shift]{optional node label}{from node label}{to current node label} -% Place Node Right -\newcommand{\kMarkNodeRight}[4][]{ - \def\dxnr{#1}; +% Place Node with variable x-y coordinate shift +%% Usage: {node x distance shift}{node y distance shift}{node text label}{from node label}{to current node label} - \ifx\dxnr\empty - \def\dxnr{0}; +% Place Node Left +\newcommand{\kMarkNodeLeft}[5]{ + \def\dxnlx{#1}; + \def\dynly{#2}; + + \ifx\dxnlx\empty + \def\dxnlx{0}; \else - \fi - \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, - right of = #3, node distance= 1.2cm + \dxnr] (#4) {\textsize{#2}}; - + \fi + \ifx\dynly\empty + \def\dynly{0}; + \else + \fi + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, + left of = #4, node distance= 1.2cm + \dxnlx, yshift=\dynly, label=\textsize{#3}] (#5) {}; } -% Place Node Left -\newcommand{\kMarkNodeLeft}[4][]{ - \def\dxnl{#1}; - \ifx\dxnl\empty - \def\dxnl{0}; +% Place Node Right +\newcommand{\kMarkNodeRight}[5]{ + \def\dxnrx{#1}; + \def\dynry{#2}; + + \ifx\dxnrx\empty + \def\dxnrx{0}; \else - \fi - \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, - left of = #3, node distance= 1.2cm + \dxnl] (#4) {\textsize{#2}}; - + \fi + \ifx\dynry\empty + \def\dynry{0}; + \else + \fi + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, + right of = #4, node distance= 1.2cm + \dxnrx, yshift=\dynry, label=\textsize{#3}] (#5) {}; } -% Place Node Above -\newcommand{\kMarkNodeAbove}[4][]{ - \def\dxna{#1}; - \ifx\dxna\empty - \def\dxna{0}; +% Place Node Above +\newcommand{\kMarkNodeAbove}[5]{ + \def\dxnax{#1}; + \def\dynay{#2}; + + \ifx\dxnax\empty + \def\dxnax{0}; \else - \fi - \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, - above of = #3, node distance= 1.2cm + \dxna] (#4) {\textsize{#2}}; - \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, - above of = #3, node distance= 1.2cm + \dxna] (#4) {\textsize{#2}}; - + \fi + \ifx\dynay\empty + \def\dynay{0}; + \else + \fi + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, + above of = #4, node distance= 1.2cm + \dxnax, yshift=\dynay, label=\textsize{#3}] (#5) {}; } -% Place Node Below -\newcommand{\kMarkNodeBelow}[4][]{ - \def\dxnb{#1}; - \ifx\dxnb\empty - \def\dxnb{0}; +% Place Node Below +\newcommand{\kMarkNodeBelow}[5]{ + \def\dxnbx{#1}; + \def\dynby{#2}; + + \ifx\dxnbx\empty + \def\dxnbx{0}; \else - \fi - \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, - below of = #3, node distance= 1.2cm + \dxnb] (#4) {\textsize{#2}}; + \fi + \ifx\dynby\empty + \def\dynby{0}; + \else + \fi + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, + below of = #4, node distance= 1.2cm + \dxnbx, yshift=\dynby, label=\textsize{#3}] (#5) {}; +} + +% Place Node At Coordinate +%% Usage: {optional x distance shift}{optional y distance shift}{empty text-label}{current node coordinate} +\newcommand{\kMarkNode}[4]{ + \def\dxncsx{#1}; + \def\dyncsy{#2}; + + \ifx\dxncsx\empty + \def\dxncsx{0}; + \else + \fi + \ifx\dyncsy\empty + \def\dyncsy{0}; + \else + \fi + + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, + node distance= 0cm + \dxncsx, yshift=\dyncsy, label=\textsize{#3}] (#4) {}; } + % Place a Reference Invisible Node relative to other nodes %% Usage: [optional distance shift]{from node label}{to current coordinate label}{direction shift}{coordinate text label} @@ -732,38 +1437,790 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} % Place a Reference Invisible Node at any specific coordinate %% Usage: {current coordinate label}{coordinate (x,y)} -\newcommand{\kJumpCS}[2]{ - \coordinate (#1) at (#2); +\newcommand{\kJumpCS}[2][$(0,0)$]{ + \coordinate (#2) at (#1); } % Links %% swap, near end,mid, add label text above lines or besides %% Usage: [optional signal label]{from node label}{to node label} - % Link Left or Right, Up or Down \newcommand{\kLink}[3][]{ - \draw [-latex,\linecolor, \linepathtype] (#2) -- node[auto,above] {\textsize{#1}} (#3); + \draw [-latex,\linecolor, \linepathtype] (#2) -- node[auto] {\textsize{#1}} (#3); } % no arrow \newcommand{\kLinkn}[3][]{ \draw [\linecolor, \linepathtype] (#2) -- node[auto,above] {\textsize{#1}} (#3); } -% Link Horizontal(Right or Left) Vertical(Up or Down) -%% Usage: [optional link label]{from node label}{to current node label}{direction}{direction shift} +%% Vector link variant +% Link Left or Right, Up or Down +\newcommand{\kVecLink}[3][]{ + \draw [-latex,\linecolor, veclinetype] (#2) -- node[auto] {\textsize{#1}} (#3); +} +% no arrow +\newcommand{\kVecLinkn}[3][]{ + \draw [\linecolor, veclinetype] (#2) -- node[auto,above] {\textsize{#1}} (#3); +} + +%% Link Directed TODO: investigate use +%% Usage: [optional signal link label]{from node label}{to node label}{from-to node direction shift} +% Directed Link Left or Right, Up or Down +\newcommand{\kLinkdir}[4][]{ + \coordinate (tmp) at ($(#2.west) + (0,#4)$); + \draw[-latex, \linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); +} +% no arrow +\newcommand{\kLinkndir}[4][]{ + \coordinate (tmp) at ($(#2.west) + (0,#4)$); + \draw[\linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); +} +%% Vector link variant +\newcommand{\kVecLinkdir}[4][]{ + \coordinate (tmp) at ($(#2.west) + (0,#4)$); + \draw[-latex, \linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); +} +% no arrow +\newcommand{\kVecLinkndir}[4][]{ + \coordinate (tmp) at ($(#2.west) + (0,#4)$); + \draw[\linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); +} + +% Link Horizontal(Right or Left) Vertical(Up or Down) +%% Usage: [optional link label]{from node label}{to current node label}{direction shift y}{direction shift x}{link label position} % Link: Left Up, Left Down, Right Up, Right Down -\newcommand{\kLinkHV}[5][]{ - \def\direct{#4}; - \draw[-latex, \linecolor, \linepathtype] (#2) -| node[near end, above left] {\textsize{#1}} ($(#3.\direct) + (0,#5)$); +\newcommand{\kLinkHV}[7][]{% TODO:DONE + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \def\dypos{#4}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \yt - \yf; + if \asumxft>0 then {let \directn = south;} else { + if \asumxft<0 then {let \directn = north;} else { + let \directn = 0; + }; + }; + \asumxft = \xt - \xf; + if \asumxft>0 then {let \fdirectn = east;} else { + if \asumxft<0 then {let \fdirectn = west;} else { + let \fdirectn = 0; + }; + }; + } + + % immediate marking of perpendicular edge of VH or HV links + \def\mkpt{#7}; + \ifx\mkpt\empty + \else + \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$); + \newdimen\xtohat; + \newdimen\ytohat;% + \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat}; + \coordinate (#7) at (\xf,\ytohat); % markpt coordinate + %\coordinate (#1) at (\xf,\yt); % markpt coordinate + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {}; + \fi + + % label positioning: 10 options (0 - 9) + \def\poslabel{#6}; + \ifx\poslabel\empty + \def\poslabel{5}; + \else + \fi + + % integer register, count0 (0-255) + \count0=\poslabel\relax; + + \ifnum\count0=0 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=1 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=2 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=3 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=4 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=5 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=6 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=7 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=8 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[left,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \ifnum\count0=9 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[right,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \else + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + + +%% vector variant +\newcommand{\kVecLinkHV}[6][]{% TODO:extend changes made here to its other HV variants + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \def\dypos{#4}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \yt - \yf; + if \asumxft>0 then {let \directn = south;} else { + if \asumxft<0 then {let \directn = north;} else { + let \directn = 0; + }; + }; + \asumxft = \xt - \xf; + if \asumxft>0 then {let \fdirectn = east;} else { + if \asumxft<0 then {let \fdirectn = west;} else { + let \fdirectn = 0; + }; + }; + } + +\ifnum#6=0 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=1 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=2 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=3 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=4 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=5 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=6 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=7 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=8 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + +} + +%% No direction +\newcommand{\kLinknHV}[6][]{% TODO:extend changes made here to its other HV variants + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \def\dypos{#4}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \yt - \yf; + if \asumxft>0 then {let \directn = south;} else { + if \asumxft<0 then {let \directn = north;} else { + let \directn = 0; + }; + }; + \asumxft = \xt - \xf; + if \asumxft>0 then {let \fdirectn = east;} else { + if \asumxft<0 then {let \fdirectn = west;} else { + let \fdirectn = 0; + }; + }; + } + +\ifnum#6=0 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=1 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=2 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=3 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=4 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=5 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=6 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=7 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=8 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + + % \def\mkpt{#5}; + % \ifx\mkpt\empty + % \else + % \coordinate (#5) at (\xf,\yt); % markpt coordinate + % \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xt,\yf) {}; + % \fi +} +%% vector variant +\newcommand{\kVecLinknHV}[6][]{% TODO:extend changes made here to its other HV variants + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \def\dypos{#4}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \yt - \yf; + if \asumxft>0 then {let \directn = south;} else { + if \asumxft<0 then {let \directn = north;} else { + let \directn = 0; + }; + }; + \asumxft = \xt - \xf; + if \asumxft>0 then {let \fdirectn = east;} else { + if \asumxft<0 then {let \fdirectn = west;} else { + let \fdirectn = 0; + }; + }; + } + +\ifnum#6=0 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=1 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=2 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=3 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=4 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=5 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=6 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=7 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\ifnum#6=8 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\else +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + } + + % Link Vertical(Up or Down) Horizontal(Right or Left) % Link Up Left, Up Right, Down Left, Down Right -\newcommand{\kLinkVH}[5][]{ - \def\direct{#4}; - \draw[-latex, \linecolor, \linepathtype] (#2) |- node[near end, below] {\textsize{#1}} ($(#3.\direct) + (0,#5)$); -} +\newcommand{\kLinkVH}[7][]{ % TODO:DONE + + \def\dypos{#4}; + \def\dxpos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \xt - \xf; + if \asumxft>0 then {let \directn = west;} else { + if \asumxft<0 then {let \directn = east;} else { + let \directn = 0; + }; + }; + \asumyft = \yt - \yf; + if \asumyft>0 then {let \fdirectn = north;} else { + if \asumyft<0 then {let \fdirectn = south;} else { + let \fdirectn = 0; + }; + }; + } + + + % immediate marking of perpendicular edge of VH or HV links + \def\mkpt{#7}; + \ifx\mkpt\empty + \else + \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$); + \newdimen\xtohat; + \newdimen\ytohat;% + \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat}; + \coordinate (#7) at (\xf,\ytohat); % markpt coordinate + %\coordinate (#1) at (\xf,\yt); % markpt coordinate + \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {}; + \fi + + + % label positioning: 10 options (0 - 9) + \def\poslabel{#6}; + \ifx\poslabel\empty + \def\poslabel{5}; + \else + \fi + + % integer register, count0 (0-255) + \count0=\poslabel\relax; + + \ifnum\count0=0 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=1 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=2 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=3 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=4 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=5 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=6 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=7 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=8 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \ifnum\count0=9 + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \else + \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + +} + +%% vector variant +\newcommand{\kVecLinkVH}[6][]{ % TODO:extend changes made here to its other VH variants + + \def\dypos{#4}; + \def\dxpos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \xt - \xf; + if \asumxft>0 then {let \directn = west;} else { + if \asumxft<0 then {let \directn = east;} else { + let \directn = 0; + }; + }; + \asumyft = \yt - \yf; + if \asumyft>0 then {let \fdirectn = north;} else { + if \asumyft<0 then {let \fdirectn = south;} else { + let \fdirectn = 0; + }; + }; + } + + +\ifnum#6=0 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=1 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=2 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=3 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=4 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=5 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=6 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=7 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=8 +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + +} + +%% No Direction +\newcommand{\kLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants + + \def\dypos{#4}; + \def\dxpos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + -%% Usage: {optional link scale}{link label}{from node}{to node}{from node direction shift}{to node direction shift} + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \xt - \xf; + if \asumxft>0 then {let \directn = west;} else { + if \asumxft<0 then {let \directn = east;} else { + let \directn = 0; + }; + }; + \asumyft = \yt - \yf; + if \asumyft>0 then {let \fdirectn = north;} else { + if \asumyft<0 then {let \fdirectn = south;} else { + let \fdirectn = 0; + }; + }; + } + +\ifnum#6=0 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=1 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=2 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=3 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=4 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=5 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=6 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=7 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=8 +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + +} + +%% vector variant +\newcommand{\kVecLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants + + \def\dypos{#4}; + \def\dxpos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (fromn) at (#2);% from node coordinate + \coordinate (ton) at (#3);% to node coordinate + + + % extract x and y coordinates + \newdimen\xf;% + \newdimen\yf;% + \path (fromn); \pgfgetlastxy{\xf}{\yf}; + \newdimen\xt;% + \newdimen\yt;% + \path (ton); \pgfgetlastxy{\xt}{\yt}; + + \newdimen\asumxft; + + \tikzmath{ + \asumxft = \xt - \xf; + if \asumxft>0 then {let \directn = west;} else { + if \asumxft<0 then {let \directn = east;} else { + let \directn = 0; + }; + }; + \asumyft = \yt - \yf; + if \asumyft>0 then {let \fdirectn = north;} else { + if \asumyft<0 then {let \fdirectn = south;} else { + let \fdirectn = 0; + }; + }; + } + + +\ifnum#6=0 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=1 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=2 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=3 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=4 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=5 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=6 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=7 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\ifnum#6=8 +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\else +\draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi +\fi + +} + + +% Link Full Feedback/FeedForward Horizontal(Right or Left) to Vertical(Up or Down) +% to Horizontal(Right or Left) +%% Usage: [optional link scale]{link label}{from node}{to node}{from node direction shift}{to node direction shift} \newcommand{\kLinkHVHRight}[6][]{ \def\dxr{#1}; @@ -775,6 +2232,17 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$); \draw[-latex, \linecolor, \linepathtype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$); } +% vector +\newcommand{\kVLinkHVHRight}[6][]{ + \def\dxr{#1}; + \ifx\dxr\empty + \def\dxr{0}; + \else + \fi + \coordinate (tmplr) at ($(#3.east) + (0,#5)$); + \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$); + \draw[-latex, \linecolor, veclinetype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$); +} \newcommand{\kLinkHVHLeft}[6][]{ \def\dxl{#1}; \ifx\dxl\empty @@ -785,7 +2253,8 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \coordinate (tmp) at ($(#3.west) + (0,#5) + (-0.33-\dxl,0)$); \draw[-latex, \linecolor, \linepathtype] (tmpll) -| (tmp) node[at end, above left] {\textsize{#2}} |- ($(#4.west) + (0,#6)$); } -% Link Full Feedback/FeedForward Horizontal(Right or Left) Vertical(Up or Down) + +% Link Full Feedback/FeedForward Vertical(Up or Down) to Horizontal(Right or Left) to Vertical(Up or Down) %% Usage: {optional link shift}{unity link label}{from node}{to node}{from node direction shift}{to node direction shift} % Above @@ -814,6 +2283,7 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$); } + % Below \newcommand{\kLinkVHHVBelow}[6][]{ \def\dxb{#1}; @@ -842,6 +2312,62 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$); } +% No directions +% Above +\newcommand{\kLinknVHHVAbove}[6][]{ + \def\dxb{#1}; + \ifx\dxb\empty + \def\dxb{0}; + \else + \fi + \coordinate (tmpb) at ($(#3.north) + (#5,0)$); + \coordinate (tmpc) at ($(#4.north) + (#6,0)$); + + \newdimen\xca; + \newdimen\yca; + \path (tmpb); \pgfgetlastxy{\xca}{\yca}; + \newdimen\xcb; + \newdimen\ycb; + \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; + + \newdimen\xcr; + + \tikzmath{ + \xcr = 0.5 * (\xca+\xcb); + } + + \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $); + \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$); +} + +% Below +\newcommand{\kLinknVHHVBelow}[6][]{ + \def\dxb{#1}; + + \ifx\dxb\empty + \def\dxb{0}; + \else + \fi + \coordinate (tmpb) at ($(#3.south) + (#5,0)$); + \coordinate (tmpc) at ($(#4.south) + (#6,0)$); + + \newdimen\xca; + \newdimen\yca; + \path (tmpb); \pgfgetlastxy{\xca}{\yca}; + \newdimen\xcb; + \newdimen\ycb; + \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; + + \newdimen\xcr; + + \tikzmath{ + \xcr = 0.5 * (\xca+\xcb); + } + + \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,-1cm-\dxb) $); + \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$); +} + % Link Feedback/FeedForward with a TF Block in between %% 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} \newcommand{\kLinkVHTFHVBelow}[8]{ @@ -896,17 +2422,28 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} } -% Link Inputs Invisible Node +% Link Inputs and Outputs Invisible Node %% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift} +% Marked Link Inputs and Outputs Visible Node +%% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift}{label position} + +% Inputs \newcommand{\kInRight}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi - \coordinate (tmpn) at ($(#2.east) + (0,#5)$); + \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; @@ -920,7 +2457,14 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \else \fi - \coordinate (tmpn) at ($(#2.west) + (0,#5)$); + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; @@ -934,7 +2478,13 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \else \fi - \coordinate (tmpn) at ($(#2.north) + (#5,0)$); + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; @@ -942,22 +2492,231 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} } \newcommand{\kInDown}[5][]{ - \def\dxinr{#1}; - \ifx\dxinr\empty - \def\dxinr{0}; + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; \else \fi + + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); - \coordinate (tmpn) at ($(#2.south) + (#5,0)$); - - \node[below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; + \node[below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn); } - -% Link Outputs Invisible Node -%% Usage: [optional distance shift]{from node label}{to current node label}{out signal label}{direction shift} +% Marked (visible node) Link Inputs +\newcommand{\kInLeftM}[6][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); +} + +\newcommand{\kInRightM}[6][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); +} + +\newcommand{\kInUpM}[6][]{ + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; + \else + \fi + + % to add to all + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); + + \ifnum#6=0 + \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) {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); +} + +\newcommand{\kInDownM}[6][]{ + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; + \else + \fi + + % to add to all + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); +} + +% Outputs \newcommand{\kOutRight}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty @@ -1014,69 +2773,403 @@ mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3); } + +% Marked (visible node) Link Outputs (Redundant): To Remove this +\newcommand{\kOutLeftM}[6][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); +} + +\newcommand{\kOutRightM}[6][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); +} + +\newcommand{\kOutUpM}[6][]{ + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; + \else + \fi + + % to add to all + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); +} + +\newcommand{\kOutDownM}[6][]{ + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; + \else + \fi + + % to add to all + \def\dxpos{#5}; + \ifx\dxpos\empty + \def\dxpos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); + + \ifnum#6=0 + \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}] {}; + \else + \ifnum#6=1 + \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}] {}; + \else + \ifnum#6=2 + \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}] {}; + % + \else + \ifnum#6=3 + \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}] {}; + \else + \ifnum#6=4 + \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}] {}; + \else + \ifnum#6=5 + \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}] {}; + % + \else + \ifnum#6=6 + \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}] {}; + \else + \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}] {}; + \fi + \fi + \fi + \fi + \fi + \fi + \fi + % + \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); +} + + + + + +%% Vector variants +\newcommand{\kVecInRight}[5][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.east) + (0,#5)$); + + \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); +} + +\newcommand{\kVecInLeft}[5][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + % to add to all + \def\dypos{#5}; + \ifx\dypos\empty + \def\dypos{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); + + \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); +} + +\newcommand{\kVecInUp}[5][]{ + \def\dxina{#1}; + \ifx\dxina\empty + \def\dxina{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.north) + (#5,0)$); + + \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); +} + +\newcommand{\kVecInDown}[5][]{ + \def\dxinr{#1}; + \ifx\dxinr\empty + \def\dxinr{0}; + \else + \fi + + \coordinate (tmpn) at ($(#2.south) + (#5,0)$); + + \node[below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); +} + + +% Link Outputs Invisible Node +%% Usage: [optional distance shift]{from node label}{to current node label}{out signal label}{direction shift} +\newcommand{\kVecOutRight}[5][]{ + \def\dxoutr{#1}; + \ifx\dxoutr\empty + \def\dxoutr{0}; + \else + \fi + + \coordinate (tmpo) at ($(#2.east) + (0,#5)$); + + \node[right of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); +} + +\newcommand{\kVecOutLeft}[5][]{ + \def\dxoutr{#1}; + \ifx\dxoutr\empty + \def\dxoutr{0}; + \else + \fi + + \coordinate (tmpo) at ($(#2.west) + (0,#5)$); + + \node[left of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); +} + +\newcommand{\kVecOutUp}[5][]{ + \def\dxoutr{#1}; + \ifx\dxoutr\empty + \def\dxoutr{0}; + \else + \fi + + \coordinate (tmpo) at ($(#2.north) + (#5,0)$); + + \node[above of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); +} + +\newcommand{\kVecOutDown}[5][]{ + \def\dxoutr{#1}; + \ifx\dxoutr\empty + \def\dxoutr{0}; + \else + \fi + + \coordinate (tmpo) at ($(#2.south) + (#5,0)$); + + \node[below of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; + + \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); +} + + % ---------------------------------------------------------------------------------------- % SIGNAL FLOW GRAPHS -\newcommand{\sfgStart}[3]{ +\newcommand{\ksfgStart}[3]{ \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em, node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {}; } -\newcommand{\sfgNStart}[3]{ +\newcommand{\ksfgNStart}[3]{ \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em, node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {}; } -\newcommand{\sfgNodeR}[5][]{ +\newcommand{\ksfgNodeR}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, right of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } -\newcommand{\sfgNodeL}[5][]{ +\newcommand{\ksfgNodeL}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, left of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } -\newcommand{\sfgNodeU}[5][]{ +\newcommand{\ksfgNodeU}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, above of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } -\newcommand{\sfgNodeD}[5][]{ +\newcommand{\ksfgNodeD}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, below of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } -\newcommand{\sfgLinkSelfR}[2][]{ +\newcommand{\ksfgLinkSelfR}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [out=45,in=-45] node[right] {\textsize{#1}} (#2); } -\newcommand{\sfgLinkSelfL}[2][]{ +\newcommand{\ksfgLinkSelfL}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [out=-135,in=-135] node[left] {\textsize{#1}} (#2); } -\newcommand{\sfgLinkSelfU}[2][]{ +\newcommand{\ksfgLinkSelfU}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [in=45,out=135] node[above] {\textsize{#1}} (#2); } -\newcommand{\sfgLinkSelfD}[2][]{ +\newcommand{\ksfgLinkSelfD}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [in=225,out=315] node[below] {\textsize{#1}} (#2); } -\newcommand{\sfgCLinkFlip}[4][]{ +\newcommand{\ksfgCLinkFlip}[4][]{ \draw[midarrow, bend right=60] (#2) to node[#4] {\textsize{#1}} (#3); } -\newcommand{\sfgCLink}[4][]{ +\newcommand{\ksfgCLink}[4][]{ \draw[midarrow, bend left=60] (#2) to node[#4] {\textsize{#1}} (#3); } %% node label positioning: at start near start midway near end at end, above below, sloped |