-
Notifications
You must be signed in to change notification settings - Fork 1
/
connections.tex
83 lines (77 loc) · 2.01 KB
/
connections.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
%
% connections.tex
% Copyright 2011, Stefan Beller <[email protected]>
% Copyright 2011, Jessica Tölke <[email protected]>
%
% This file is part of texbox.
%
% This program is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the Free
% Software Foundation; either version 2 of the License, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
% more details.
%
% You should have received a copy of the GNU General Public License along with
% this program. If not, see <http://www.gnu.org/licenses/>.
%
% arguments
% #1 coordinate
% #2 coordinate
% draws a direct connection between given coordinates
\newcommand{\CONNECT}[2]
{
\draw [-] (#1) -- (#2);
}
% arguments
% #1 coordinate
% #2 coordinate
% draws a rectangular connection between given coordinates,
% first in vertical direction, then horizontal
\newcommand{\CONNECTVH}[2]
{
\draw
let
\p1=(#1),
\p2=(#2)
in
[-] (\x1, \y1) -- (\x1, \y2) -- (\x2, \y2);
}
% arguments
% #1 coordinate
% #2 coordinate
% draws a rectangular connection between given coordinates,
% first in horizontal direction, then vertical
\newcommand{\CONNECTHV}[2]
{
\draw
let
\p1=(#1),
\p2=(#2)
in
[-] (\x1, \y1) -- (\x2, \y1) -- (\x2, \y2);
}
% arguments
% #1 coordinate
% #2 name
% a filled dot that can be connected
\newcommand{\DOT}[2]
{
\filldraw (#1) circle (0.03);
\path (#1) coordinate(#2);
}
% arguments
% #1 coordinate
% #2 name
% an empty dot that can be connected at N, S, W, E
\newcommand{\OPENCONNECTOR}[2]
{
\draw (#1) circle (0.03);
\path(#1) ++ (0,0.03) coordinate(#2_N);
\path(#1) ++ (0,-0.03) coordinate(#2_S);
\path(#1) ++ (-0.03,0) coordinate(#2_W);
\path(#1) ++ (0.03,0) coordinate(#2_E);
}