~tex-sx/tex-sx/development

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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
\immediate\write18{tex spath.dtx}
\immediate\write18{tex knots.dtx}
\documentclass[border=10]{standalone}
\usepackage{tikz}
\usepackage{knots}
\begin{document}
\begin{tikzpicture}
\tikzset{knot/only when rendering/.style={draw=white, double=red}}
\node at (0,1) {\begin{tikzpicture}
    \begin{knot}
        \strand (1,0) to (0,1);
        \strand (0,0) to (1,1);
    \end{knot}
\end{tikzpicture}};
\node at (0,0) {\begin{tikzpicture}
    \node at (0,0) {hello};
\end{tikzpicture}};
\end{tikzpicture}
\end{document}

\documentclass{article}
\usepackage{tikz}
\usepackage{knots}
\begin{document}
\begin{tikzpicture}
\node (A) at (0,4) [draw,minimum width=30pt,minimum height=10pt,thick] {};
\begin{knot}[
%  draft mode=crossings,
  background colour=red,
  clip width=5,
%  consider self intersections,
]
\strand [thick,knot/only when rendering/.style={dashed}] (0,0)
to [out=up, in=down] (-1,1)
to [out=up, in=down] (0,2)
to [out=up, in=down] (-1.2,4)
to [out=up, in=down, looseness=0.7] (0,5.5)
to [out=up, in=down] (-2,7);
\strand [thick] (-1,0)
to [out=up, in=down] (1,2)
to [out=up, in=down] (A.south);
\strand [thick] (1,0)
to [out=up, in=down] (-1,2)
to [out=up, in=down] (1.5,4)
to [out=up, in=right] (0,5.5)
to [out=left, in=up] (-2,4)
to [out=down, in=up] (-2,0);
\strand [thick] (A.150)
to [out=up, in=down] (0.7,5.5)
to [out=up, in=down] (0,7);
\strand [thick] (A.30)
to [out=up, in=down] (-1,6)
to [out=up, in=down] (2,7);
\flipcrossings{6,2,9,5,11}
%\redraw{3}{(0,5.5)}
\end{knot}
\end{tikzpicture}
\end{document}
%% \documentclass{article}
%% \usepackage{tikz}
%% \usepackage{knots}
%% \begin{document}
%% \tikzset{knot/only when rendering/.style={draw=white, double=red}}
%% \newsavebox{\firstbox}
%% \sbox{\firstbox}{\begin{tikzpicture}[remember picture]
%%     \begin{knot}
%%         \strand (1,0) to (0,1);
%%         \strand (0,0) to (1,1);
%%     \end{knot}
%% \end{tikzpicture}}
%% \newsavebox{\secondbox}
%% \sbox{\secondbox}{\begin{tikzpicture}[remember picture]
%%     \node at (0,0) {hello};
%% \end{tikzpicture}}
%% \begin{tikzpicture}
%% \node at (0,0) {\usebox\firstbox};
%% \node at (1,0) {\usebox\secondbox};
%% \end{tikzpicture}
%% \end{document}
\documentclass{article}
\usepackage{nopageno,tikz,knots,geometry}
\geometry{landscape}

\definecolor{SafetyOrange}{rgb}{1,0.4,0}
\definecolor{LuminousOrange}{rgb}{1,0.137255,0.00392157}

\begin{document}

\hspace{-0.75in}
\noindent
\newcommand{\motif}[1]{ 
  to ++(180+#1:0.50) arc (270+#1:150+#1:0.15) 
  to ++( 60+#1:0.50) arc (-30+#1:150+#1:0.15) 
  to ++(240+#1:0.25) arc (150+#1:330+#1:0.25)
  to ++( 60+#1:0.55) arc (150+#1: 30+#1:0.20)
}
\newcommand{\celticknot}{\motif{0}\motif{120}\motif{240}}
\begin{tikzpicture}
\begin{knot}[
  line width=6pt,
  line join=round,
  clip width=1.5,
  clip radius=16pt,
  end tolerance=20pt,
  scale=8,
  consider self intersections,
  ignore endpoint intersections=false,
  background color=red,
  intersection 12/.style={/tikz/knot/clip radius=13pt},
  every strand/.style={draw=none},
  only when rendering/.style={draw=red,double=white,line cap=round,double distance=6pt},
]
\strand (0,0) \celticknot;
\flipcrossings{1,3,6,8,10}
\end{knot}
\end{tikzpicture}

\vfill

\end{document}

\documentclass{article}
\usepackage{tikz,knots}


\newcommand{\motif}[1]{ to ++(180+#1:0.5) arc (270+#1:150+#1:0.15) to ++(60+#1:0.5) arc (-30+#1:150+#1:0.15) to ++(240+#1:0.25) arc (150+#1:330+#1:0.25) to ++(60+#1:0.5) arc (150+#1:30+#1:0.2) }
\newcommand{\celticknot}{\motif{0}\motif{120}\motif{240}}
\begin{document}
\begin{tikzpicture}[line width=3,line join=round,scale=2]
\path[draw=none] (0,0) -- (2,0);
\begin{knot}[
  clip width=1.5pt,
  clip radius=10pt,
  end tolerance=10pt,
%  background colour=red,
  scale=2,
%  draft mode=crossings,
  consider self intersections=no splits,
  ignore endpoint intersections=false,
  draft/crossing label/.style={text opacity=1,text=blue,anchor=south east,append after command={(\tikzlastnode.center) edge[blue,->,thin] (\tikzlastnode.south east)}},
]
\strand[draw=none,knot/only when rendering/.style={draw,double}] (0,0) \celticknot;
\flipcrossings{9,7,5,2,4,11,12}
\end{knot}
\end{tikzpicture}
\end{document}
\begin{tikzpicture}
\begin{knot}[
  consider self intersections,
]
\strand (0,0) .. controls +(2,1) and +(-2,1) .. (1,0);
\end{knot}
\end{tikzpicture}
\end{document}
\documentclass{article}
\usepackage{tikz}
\usepackage{knots}
\begin{document}
\begin{tikzpicture}
\braid[
  rotate=90,
  ultra thick,
  style strands={1}{red},
  style strands={2}{black},
  style strands={3}{blue},
  style strands={4}{green},
] a_1 a_1 a_2^{-1} a_2^{-1} a_1^{-1} a_1^{-1} a_2 a_2 a_2 a_3^{-1} a_3^{-1} a_2^{-1} a_2^{-1} a_2^{-1} a_1 a_1 a_2 a_2 a_1^{-1} a_1^{-1} a_2 a_3 a_3 a_2^{-1};
\end{tikzpicture}
\end{document}
%% \usepackage{tikz}
%% \usepackage{knots}
%% \begin{document}
%% \begin{tikzpicture}
%% \draw (0,0) -- (1,0);
%% \begin{scope}[line width=2pt,scale=2,rotate=45]%,shift={(1cm,2cm)}]
%% \begin{knot}[draft mode=crossings]
%% \strand[red] (0,0) -- (2,2);
%% \strand[blue] (2,0) -- (0,2);
%% \end{knot}
%% \end{scope}
%% \end{tikzpicture}
%% \end{document}



\begin{tikzpicture}[line width=6,line join=round,scale=1.5]
%\def\x{1.5}
%\def\y{1.5}
\def\x{1}
\def\y{1}
\begin{knot}[clip width=1.5]
\strand[red  ] (0*\x,0.0*\y) to (14*\x,0*\y);
\strand[blue ] (0*\x,1.0*\y) to (14*\x,1*\y);
\strand[green] (0*\x,2.0*\y) to (14*\x,2*\y);
\strand[black] (0*\x,0.5*\y) to[out=right,in=left] ++(\x,0)
  to ++(0,-1*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 2*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-2*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 2*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-1*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 2*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-2*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 1*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-2*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 2*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-2*\y) to[out=down,in=down] ++(\x,0)
  to ++(0, 3*\y) to[out=up  ,in=up  ] ++(\x,0)
  to ++(0,-2*\y) to[out=right,in=left] ++(\x,0)
;
\flipcrossings{1,4,5,8,9,12,15,18,21,24}
\end{knot}
\draw
( 1.5*\x,-0.5*\y)     node {\LARGE$a$}
( 2.5*\x, 1.5*\y)     node {\LARGE$b$}
( 3.5*\x,-0.5*\y+0.1) node {\LARGE$a^{-1}$}
( 4.5*\x, 1.5*\y-0.1) node {\LARGE$b^{-1}$}
( 6.5*\x, 2.5*\y)     node {\LARGE$c$}
( 8.5*\x, 1.5*\y)     node {\LARGE$b$}
( 9.5*\x,-0.5*\y)     node {\LARGE$a$}
(10.5*\x, 1.5*\y-0.1) node {\LARGE$b^{-1}$}
(11.5*\x,-0.5*\y+0.1) node {\LARGE$a^{-1}$}
(12.5*\x, 2.5*\y-0.1) node {\LARGE$c^{-1}$}
;
\end{tikzpicture}

\vfill

\end{document}
%\documentclass[border=10]{standalone}
\begin{tikzpicture}
\begin{knot}[knot/draft mode]
\strand[red,ultra thick]  (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\strand[blue,ultra thick] (0,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1);
\crossing{1-2-1}{1}
\crossing{1-2-2}{2}
\crossing{1-2-3}{1}
\crossing{1-2-4}{2}
\end{knot}
\end{tikzpicture}

\begin{tikzpicture}
\begin{knot}[knot/draft mode=false]
\strand[red,ultra thick]  (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\strand[blue,ultra thick] (0,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1);
\crossing{1-2-1}{1}
\crossing{1-2-2}{2}
\crossing{1-2-3}{1}
\crossing{1-2-4}{2}
\end{knot}
\end{tikzpicture}
\end{document}

\begin{tikzpicture}
\draw[ultra thick, red,save path=\toppath] (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\draw[ultra thick, blue,save path=\botpath] (0,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1);
%\pgfintersectionsortbyfirstpath
\pgfintersectionofpaths{\pgfsetpath\toppath}{\pgfsetpath\botpath}
\foreach \intsect in {1,...,\pgfintersectionsolutions} {
  \pgfpointintersectionsolution{\intsect}
  \pgfgetlastxy{\intsectx}{\intsecty}
  \node[circle,fill=white] at (\intsectx,\intsecty) {\intsect};
}
\begin{scope}[yshift=-3cm]
\draw[ultra thick, red] (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\draw[ultra thick, blue] (0,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1);
\foreach \intsect in {1,...,\pgfintersectionsolutions} {
  \begin{scope}
  \pgfpointintersectionsolution{\intsect}
  \pgfgetlastxy{\intsectx}{\intsecty}
  \clip  (\intsectx,\intsecty) circle[radius=10pt];
\ifodd\intsect
\draw[ultra thick,double=red,double distance=1.6pt,white] (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\fi
\draw[ultra thick,double=blue,double distance=1.6pt,white] (0,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1);
\ifodd\intsect
\else
\draw[ultra thick,double=red,double distance=1.6pt,white] (0,0) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1) .. controls +(1,0) and +(-1,0) .. ++(2,-1) .. controls +(1,0) and +(-1,0) .. ++(2,1);
\fi
\end{scope}
}
\end{scope}
\end{tikzpicture}
\end{document}

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{spath}

\makeatletter
\def\splitcurveto#1#2\pgfsyssoftpath@curvetosupportatoken#3#4\pgfsyssoftpath@curvetosupportbtoken#5#6\pgfsyssoftpath@curvetotoken#7#8{%
  \pgfmathsetmacro{\knot@ax}{#1/28}
  \pgfmathsetmacro{\knot@bx}{#3/28}
  \pgfmathsetmacro{\knot@cx}{#5/28}
  \pgfmathsetmacro{\knot@dx}{#7/28}
  \pgfmathsetmacro{\knot@ay}{#2/28}
  \pgfmathsetmacro{\knot@by}{#4/28}
  \pgfmathsetmacro{\knot@cy}{#6/28}
  \pgfmathsetmacro{\knot@dy}{#8/28}
  \message{Got (\knot@ax,\knot@ay), (\knot@bx,\knot@by), (\knot@cx,\knot@cy), (\knot@cx,\knot@cy)}
  \pgfmathsetmacro{\splittimenum}{%
    ( (\knot@ay - 3 * \knot@by + 3 * \knot@cy - \knot@dy) * (3 * \knot@cx - 3 * \knot@dx)
    - (\knot@ax - 3 * \knot@bx + 3 * \knot@cx - \knot@dx) * (3 * \knot@cy - 3 * \knot@dy) )}
  \pgfmathsetmacro{\splittimeden}{%
    ( (\knot@ax - 3 * \knot@bx + 3 * \knot@cx - \knot@dx) * (3 * \knot@by - 6 * \knot@cy + 3 * \knot@dy)
    - (\knot@ay - 3 * \knot@by + 3 * \knot@cy - \knot@dy) * (3 * \knot@bx - 6 * \knot@cx + 3 * \knot@dx) )}
  \pgfmathsetmacro{\splittime}{.5*\splittimenum/\splittimeden}
  \pgfpointcurveattime{\splittime}{\pgfqpoint{#1}{#2}}{\pgfqpoint{#3}{#4}}{\pgfqpoint{#5}{#6}}{\pgfqpoint{#7}{#8}}
  \global\pgf@xa=\pgf@x
  \global\pgf@ya=\pgf@y
}
\def\splitit{\message{split it}}
\def\nosplitit{\message{don't split it}}
\makeatother

\begin{document}
\begin{tikzpicture}
\makeatletter
\draw[save path=\tmppath] (0,0) .. controls +(3,3) and +(2,-2) .. (0,1);
\draw[save path=\tmppath] (0,0) .. controls (2,1) and (-1,1) .. (1,0);
\begingroup
\let\pgfsyssoftpath@movetotoken=\splitcurveto
\tmppath
\endgroup
\fill (\the\pgf@xa,\the\pgf@ya) circle[radius=2pt];
\makeatother

\end{tikzpicture}
\end{document}
\begin{tikzpicture}
\makeatletter
\foreach \k in {0,...,-10} {
\begin{scope}[yshift=\k cm]
\draw[save path=\tmppath] (0,0) .. controls +(3,3) and +(2,-2) .. (\k,1);
\draw[red] (0,0) -- (3,3) -- (\k + 2,-1) -- (\k,1);
\begingroup
\let\pgfsyssoftpath@movetotoken=\splitcurveto
\tmppath
\endgroup
\end{scope}
\fill (\the\pgf@xa,\the\pgf@ya) circle[radius=2pt];
}
\makeatother



\end{tikzpicture}
\end{document}
\draw[save path=\tmppath] (0,0) -- (1,1) .. controls +(1,1) and +(1,-1) .. (1,0) -- (0,1);
\pgfintersectionofpaths{\pgfsetpath\tmppath}{\pgfsetpath\tmppath}
\foreach \ints in {1,...,\pgfintersectionsolutions} {
      \pgfpointintersectionsolution{\ints}
      \pgfgetlastxy{\intsectx}{\intsecty}
  \fill (\intsectx,\intsecty) circle[radius=2pt];
}
\end{tikzpicture}
\end{document}


% Local Variables:
% tex-output-type: "pdf18"
% End: