-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.tex
105 lines (94 loc) · 3.39 KB
/
test.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,spline}
\tikzset{spline debug}
\errorcontextlines8
\newcommand*\showcontrols[1]{%
\foreach \i in {1,2,...,\tikzsplinesegments}{%
\draw[black,-] let \n0={\i+1} in
(#1 K-\i) -- (#1 P-\i)
(#1 Q-\i) -- (#1 K-\n0);
\fill[green!50!black] (#1 P-\i) circle (1pt);
\fill[red] (#1 Q-\i) circle (1pt);
}%
}%
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,3);
\node[draw, circle, outer sep=1pt] (A) at (0,1) {A};
\draw[red, <-, shorten <=1pt] (A) to[spline through={(3,1)(2,3)}] (1.5,0);
\draw[yshift=.2cm,blue] (0,1) to[append after command={[draw,dashed]},spline through={++(3,0)++(-1,2)++(-.5,-3)}] ++(0,0);
\draw[black, ->] (A) edge[closed spline through={+(3,0)+(2,2)+(1.5,-1)}] +(0,0);
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,3);
\node [draw,circle] (A) at (0,1) {A};
\node [draw,rectangle] (B) at (3,1) {B};
\node [draw,circle] (C) at (2,3) {C};
\node [draw,circle] (D) at (1.5,0) {D};
%\draw[blue] (A.center) to[spline through=(B.center)(C.center)] (D.center);
\draw[red,->, shorten >=2pt] (A) to[spline through=(B)(C)(D)]
node foreach \t in {0,.025,...,1.01} [pos=\t,circle,fill,inner sep=1pt,color=blue] {}
(A);
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,3);
\coordinate (start) at (0,1);
\coordinate (end) at (3,1);
\draw[blue, shorten >=2pt]
(start) edge[->>, spline coordinates=S, spline through={(1,0)(1.5,3)(2,1)}] (end);
\showcontrols{S}
%\draw[red] (start)
% .. controls (10.66978pt,5.08085pt) and (21.33955pt,-18.29105pt) .. (28.45274pt,0.00000pt)
% .. controls (35.56593pt,18.29105pt) and (39.12252pt,78.24503pt) .. (42.67911pt,85.35822pt)
% .. controls (46.23570pt,92.47141pt) and (49.79229pt,46.74379pt) .. (56.90548pt,28.45274pt)
% .. controls (64.01866pt,10.16169pt) and (74.68844pt,19.30722pt) .. (end);
\end{tikzpicture}
\begin{tikzpicture}[baseline={(0,0)}]
\draw[help lines] (0,0) grid (3,3);
\draw[blue] (0,0) to[
spline coordinates,
closed spline through={(.5,2)(1,1)(1.5,2)(0,2.5)(1,3)(2,2)(2,0)(3,1)(2.5,3)(0,3)}] ();
\end{tikzpicture}
\quad
\begin{tikzpicture}[baseline={(0,0)}]
\draw[help lines] (0,0) grid (3,3);
\draw[blue] (0,0) to[
spline coordinates,
closed spline through={(.5,2)(1,1)(1.5,2)(0,2.5)(1,3)(2,2)(2,0)(3,1)(2.5,3)(0,3)}] ();
\showcontrols{spline}
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,3);
\draw[blue] (0,0) to[spline through={(1,2)(2,1)}] (2,2)
-- +(1,1);
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,3);
\draw[blue] (0,0) to[closed spline through={(1,2)(2,1)}] ()
-- +(1,0);
\end{tikzpicture}
% \begin{tikzpicture}
% \draw circle (1cm);
% \draw[red, <-] \pgfextra
% \pgfintersectionsortbyfirstpath
% \pgfintersectionofpaths
% {
% \pgfpathmoveto{\pgfpointorigin}
% \pgfpathcurveto{\pgfpointxy{1}{1}}{\pgfpointxy{1}{2}}{\pgfpointxy{0}{3}}
% }
% {
% \pgfpathcircle{\pgfpointorigin}{1cm}
% \pgfgetpath\temppath
% \pgfusepath{stroke}
% \pgfsetpath\temppath
% }
% \pgfintersectiongetsolutiontimes{1}{\segmenta}{\segmentb}
% \pgfpathcurvebetweentime{\segmenta}{1}{\pgfpointorigin}{\pgfpointxy{1}{1}}{\pgfpointxy{1}{2}}{\pgfpointxy{0}{3}}
% \endpgfextra;
% %\pgfsetstrokecolor{black}
% %\pgfpathcircle{\pgfpointintersectionsolution{1}}{2pt}
% %\pgfusepath{stroke}
% \end{tikzpicture}
\end{document}
% vim: set sw=2 sts=2 ts=8 et: