161.2.14
by Andrew Stacey
Added routines for drawing celtic knots |
1 |
\documentclass{article} |
2 |
\usepackage{tikz} |
|
3 |
\usetikzlibrary{knots} |
|
4 |
||
5 |
\tikzset{ |
|
6 |
basic strand/.style={
|
|
7 |
draw=red, |
|
8 |
double=white, |
|
9 |
double distance=9pt, |
|
10 |
},
|
|
11 |
crossing strand/.style={
|
|
12 |
line width=13pt, |
|
13 |
only when rendering/.style={% |
|
14 |
draw=white,%
|
|
15 |
line width=9pt, |
|
16 |
double=none, |
|
17 |
}
|
|
18 |
}
|
|
19 |
}
|
|
20 |
||
21 |
\begin{document} |
|
22 |
||
23 |
\def\x{-569} % xshift |
|
24 |
\def\y{-341} %yshift |
|
25 |
||
26 |
\begin{tikzpicture}[scale=0.8] |
|
27 |
||
28 |
\draw[color=black!20!white] (0,0) grid[step=1] (20,12); |
|
29 |
\draw[line width=3] (0,0) -- (20,0) -- (20,12) -- (0,12) -- (0,0)% Rahmen |
|
30 |
(0,4)--(2,4)% Horizontal
|
|
31 |
(0,8)--(2,8)%
|
|
32 |
(2,6)--(4,6)%
|
|
33 |
(5,7)--(7,7)%
|
|
34 |
(5,5)--(7,5)%
|
|
35 |
(8,6)--(12,6)%
|
|
36 |
(9,9)--(11,9)%
|
|
37 |
(9,3)--(11,3)%
|
|
38 |
(13,7)--(15,7)%
|
|
39 |
(13,5)--(15,5)%
|
|
40 |
(16,6)--(18,6)%
|
|
41 |
(18,8)--(20,8)%
|
|
42 |
(18,4)--(20,4)%
|
|
43 |
(3,1)--(3,5)% Vertikal
|
|
44 |
(3,7)--(3,11)%
|
|
45 |
(6,2)--(6,4)%
|
|
46 |
(6,8)--(6,10)%
|
|
47 |
(10,0)--(10,2)%
|
|
48 |
(10,4)--(10,8)%
|
|
49 |
(10,10)--(10,12)%
|
|
50 |
(14,2)--(14,4)%
|
|
51 |
(14,8)--(14,10)%
|
|
52 |
(17,1)--(17,5)%
|
|
53 |
(17,7)--(17,11)%
|
|
54 |
; |
|
55 |
||
56 |
\begin{knot}[consider self intersections=no splits, |
|
57 |
end tolerance=1pt,%
|
|
58 |
line width=2pt ,%
|
|
59 |
line join=round,%
|
|
60 |
clip width=1,%
|
|
61 |
ignore endpoint intersections=true,%
|
|
62 |
background color=red,%
|
|
63 |
every intersection/.style={
|
|
64 |
crossing strand |
|
65 |
},
|
|
66 |
only when rendering/.style={
|
|
67 |
basic strand |
|
68 |
},
|
|
69 |
] |
|
70 |
||
71 |
\strand (0.5,1) to [out=north, in=south] (2.5,4) to [out=north, in=south] (0.5,7) -- (0.5,7) -- (0.5,7.5) -- (1,7.5) to [out=east, in=west] (3,6.5) to [out=east, in=225] (4.5,7.5) to [out=45, in=south] (5.5,9) to [out=north, in=-45] (4.5,10.5) to [out=135,in=east] (3,11.5) to [out=west, in=45] (1.5,10.5) to [out=225,in=north] (0.5,9) -- (0.5,8.5) -- (1,8.5) to [out=east, in=south] (2.5,10) to [out=north, in=east](1,11.5) -- (0.5,11.5) -- (0.5,11) to [out=south, in=north] (2.5,8) to [out=south, in=north] (0.5,5) -- (0.5,4.5) -- (1,4.5) to [out=east, in=west] (3,5.5) to [out=east, in=135] (4.5,4.5) to [out=-45, in=north] (5.5,3) to [out=south, in=45] (4.5,1.5) to [out=225, in=east] (3,0.5) to [out=west, in=-45] (1.5,1.5) to [out=135, in=south] (0.5,3) -- (0.5,3.5) -- (1,3.5) to [out=east, in=north] (2.5,2) to [out=south, in=east] (1,0.5) -- (0.5,0.5) -- (0.5,1);
|
|
72 |
||
73 |
\strand[xscale=-1, xshift=\x] (0.5,1) to [out=north, in=south] (2.5,4) to [out=north, in=south] (0.5,7) -- (0.5,7) -- (0.5,7.5) -- (1,7.5) to [out=east, in=west] (3,6.5) to [out=east, in=225] (4.5,7.5) to [out=45, in=south] (5.5,9) to [out=north, in=-45] (4.5,10.5) to [out=135,in=east] (3,11.5) to [out=west, in=45] (1.5,10.5) to [out=225,in=north] (0.5,9) -- (0.5,8.5) -- (1,8.5) to [out=east, in=south] (2.5,10) to [out=north, in=east](1,11.5) -- (0.5,11.5) -- (0.5,11) to [out=south, in=north] (2.5,8) to [out=south, in=north] (0.5,5) -- (0.5,4.5) -- (1,4.5) to [out=east, in=west] (3,5.5) to [out=east, in=135] (4.5,4.5) to [out=-45, in=north] (5.5,3) to [out=south, in=45] (4.5,1.5) to [out=225, in=east] (3,0.5) to [out=west, in=-45] (1.5,1.5) to [out=135, in=south] (0.5,3) -- (0.5,3.5) -- (1,3.5) to [out=east, in=north] (2.5,2) to [out=south, in=east] (1,0.5) -- (0.5,0.5) -- (0.5,1); |
|
74 |
||
75 |
\strand (10,8.5) to [out=west, in=45] (8.5,7.5) to (7.5,6.5) to [out=225, in=east] (6,5.5) to [out=west, in=-45] (4.5,6.5) to [out=135, in=south] (3.5,8) to [out=north, in=225] (4.5,9.5) to (5.5,10.5) to [out=45, in=west] (7,11.5) to [out=east, in=135] (8.5,10.5) to [out=-45, in=west] (10,9.5) to [out=east, in=225] (11.5,10.5) to[out=45, in=west] (13,11.5) to [out=east, in=135] (14.5,10.5) to (15.5,9.5) to [out=-45, in=north] (16.5,8) to [out=south, in=45] (15.5,6.5) to [out=225, in=east] (14,5.5) to [out=west, in=-45] (12.5,6.5) to (11.5,7.5) to [out=135, in=east] (10,8.5);
|
|
76 |
||
77 |
\strand[yscale=-1, yshift=\y] (10,8.5) to [out=west, in=45] (8.5,7.5) to (7.5,6.5) to [out=225, in=east] (6,5.5) to [out=west, in=-45] (4.5,6.5) to [out=135, in=south] (3.5,8) to [out=north, in=225] (4.5,9.5) to (5.5,10.5) to [out=45, in=west] (7,11.5) to [out=east, in=135] (8.5,10.5) to [out=-45, in=west] (10,9.5) to [out=east, in=225] (11.5,10.5) to[out=45, in=west] (13,11.5) to [out=east, in=135] (14.5,10.5) to (15.5,9.5) to [out=-45, in=north] (16.5,8) to [out=south, in=45] (15.5,6.5) to [out=225, in=east] (14,5.5) to [out=west, in=-45] (12.5,6.5) to (11.5,7.5) to [out=135, in=east] (10,8.5); |
|
78 |
||
79 |
\strand (3.5,10) to [out=north, in=west] (5,11.5) to [out=east, in=135] (6.5,10.5) to (8.5,8.5) to [out=-45, in=north] (9.5,7) -- (9.5,6.5) -- (9,6.5) to [out=west, in=-45] (7.5,7.5) to [out=135, in=south] (6.5,9) to [out=north, in=225] (7.5,10.5) to [out=45, in=west] (9,11.5) -- (9.5,11.5) -- (9.5,11) to [out=south, in=45] (8.5,9.5) to (7.5,8.5) to [out=225, in=east] (6,7.5) to [out=west, in=-45] (4.5,8.5) to [out=135, in=south] (3.5,10);
|
|
80 |
||
81 |
\strand[xscale=-1, xshift=\x] (3.5,10) to [out=north, in=west] (5,11.5) to [out=east, in=135] (6.5,10.5) to (8.5,8.5) to [out=-45, in=north] (9.5,7) -- (9.5,6.5) -- (9,6.5) to [out=west, in=-45] (7.5,7.5) to [out=135, in=south] (6.5,9) to [out=north, in=225] (7.5,10.5) to [out=45, in=west] (9,11.5) -- (9.5,11.5) -- (9.5,11) to [out=south, in=45] (8.5,9.5) to (7.5,8.5) to [out=225, in=east] (6,7.5) to [out=west, in=-45] (4.5,8.5) to [out=135, in=south] (3.5,10); |
|
82 |
||
83 |
\strand[yscale=-1, yshift=\y] (3.5,10) to [out=north, in=west] (5,11.5) to [out=east, in=135] (6.5,10.5) to (8.5,8.5) to [out=-45, in=north] (9.5,7) -- (9.5,6.5) -- (9,6.5) to [out=west, in=-45] (7.5,7.5) to [out=135, in=south] (6.5,9) to [out=north, in=225] (7.5,10.5) to [out=45, in=west] (9,11.5) -- (9.5,11.5) -- (9.5,11) to [out=south, in=45] (8.5,9.5) to (7.5,8.5) to [out=225, in=east] (6,7.5) to [out=west, in=-45] (4.5,8.5) to [out=135, in=south] (3.5,10); |
|
84 |
||
85 |
\strand[xscale=-1, xshift=\x, yscale=-1, yshift=\y] (3.5,10) to [out=north, in=west] (5,11.5) to [out=east, in=135] (6.5,10.5) to (8.5,8.5) to [out=-45, in=north] (9.5,7) -- (9.5,6.5) -- (9,6.5) to [out=west, in=-45] (7.5,7.5) to [out=135, in=south] (6.5,9) to [out=north, in=225] (7.5,10.5) to [out=45, in=west] (9,11.5) -- (9.5,11.5) -- (9.5,11) to [out=south, in=45] (8.5,9.5) to (7.5,8.5) to [out=225, in=east] (6,7.5) to [out=west, in=-45] (4.5,8.5) to [out=135, in=south] (3.5,10); |
|
86 |
||
87 |
\flipcrossings{2,3,6,8,10,12,14,16,18,21,22,24,26,28,30,32,34,36,38,39,40,42,44,48,50,51,55,57,59,60,61,63,65,67,70,72,74} |
|
88 |
||
89 |
\end{knot} |
|
90 |
\end{tikzpicture} |
|
91 |
\end{document} |