visualisation/cylinder.tex

changeset 43
5f04fe297b9a
parent 42
271fba635bce
equal deleted inserted replaced
42:271fba635bce 43:5f04fe297b9a
6 6
7 \begin{document} 7 \begin{document}
8 8
9 \begin{tikzpicture} 9 \begin{tikzpicture}
10 \pgfplotsset{ 10 \pgfplotsset{
11 cyl data/.code = \pgfplotsset{%
12 table/x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
13 table/y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
14 table/z = z,
15 },
11 onlyfront/.code = \pgfplotsset{x filter/.expression={% 16 onlyfront/.code = \pgfplotsset{x filter/.expression={%
12 \thisrow{face} == 0 || (% 17 \thisrow{face} == 0 || (%
13 and(\thisrow{face}==2, or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b)) 18 and(\thisrow{face}==2, or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b))
14 ) ? x : nan% 19 ) ? x : nan%
15 },}, 20 },},
26 \begin{axis}[illustr3d] 31 \begin{axis}[illustr3d]
27 % Hidden edges 32 % Hidden edges
28 \addplot3[edge, domain=\b:(2*pi+\a), samples = 90, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5}); 33 \addplot3[edge, domain=\b:(2*pi+\a), samples = 90, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5});
29 34
30 % Data on hidden faces 35 % Data on hidden faces
31 \addplot3[backdata] table[ 36 \addplot3[backdata] table [cyl data] {\datapath/data.csv};
32 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
33 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
34 z = z,
35 ] {\datapath/data.csv};
36 37
37 % Iterates on hidden faces 38 % Iterates on hidden faces
38 \addplot3[backiter1,onlyback] table[ 39 \addplot3[backiter1,onlyback] table [cyl data] {\datapath/x1_log.csv};
39 x expr = \thisrow{r} * cos(deg(\thisrow{angle})), 40 \addplot3[backiter2,onlyback] table [cyl data] {\datapath/x2_log.csv};
40 y expr = \thisrow{r} * sin(deg(\thisrow{angle})), 41 \addplot3[backiter3,onlyback] table [cyl data] {\datapath/x3_log.csv};
41 z = z,
42 ] {\datapath/x1_log.csv};
43 \addplot3[backiter2,onlyback] table[
44 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
45 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
46 z = z,
47 ] {\datapath/x2_log.csv};
48 \addplot3[backiter3,onlyback] table[
49 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
50 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
51 z = z,
52 ] {\datapath/x3_log.csv};
53 42
54 % Surface 43 % Surface
55 \addplot3[ 44 \addplot3[
56 surf, 45 surf,
57 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies 46 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
81 \addplot3[edge, domain={\a:\b}, samples = 60, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5}); 70 \addplot3[edge, domain={\a:\b}, samples = 60, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5});
82 \addplot3[edge] coordinates { (cos(deg(\a)), sin(deg(\a)), -0.5) (cos(deg(\a)), sin(deg(\a)), 0.5) }; 71 \addplot3[edge] coordinates { (cos(deg(\a)), sin(deg(\a)), -0.5) (cos(deg(\a)), sin(deg(\a)), 0.5) };
83 \addplot3[edge] coordinates { (cos(deg(\b)), sin(deg(\b)), -0.5) (cos(deg(\b)), sin(deg(\b)), 0.5) }; 72 \addplot3[edge] coordinates { (cos(deg(\b)), sin(deg(\b)), -0.5) (cos(deg(\b)), sin(deg(\b)), 0.5) };
84 73
85 % Data 74 % Data
86 \addplot3[data, onlyfront] table[ 75 \addplot3[data, onlyfront] table [cyl data] {\datapath/data.csv};
87 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
88 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
89 z = z,
90 ] {\datapath/data.csv};
91 \addlegendentry{Data} 76 \addlegendentry{Data}
92 77
93 % Iterates 78 % Iterates
94 \addplot3[iter1,onlyfront] table[ 79 \addplot3[iter1,onlyfront] table [cyl data] {\datapath/x1_log.csv};
95 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
96 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
97 z = z,
98 ] {\datapath/x1_log.csv};
99 \addlegendentry{Iterates 1} 80 \addlegendentry{Iterates 1}
100 \addplot3[iter2,onlyfront] table[ 81 \addplot3[iter2,onlyfront] table [cyl data] {\datapath/x2_log.csv};
101 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
102 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
103 z = z,
104 ] {\datapath/x2_log.csv};
105 \addlegendentry{Iterates 2} 82 \addlegendentry{Iterates 2}
106 \addplot3[iter3,onlyfront] table[ 83 \addplot3[iter3,onlyfront] table [cyl data] {\datapath/x3_log.csv};
107 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
108 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
109 z = z,
110 ] {\datapath/x3_log.csv};
111 \addlegendentry{Iterates 3} 84 \addlegendentry{Iterates 3}
112 85
113 % Origin 86 % Origin
114 \addplot3[origin, onlyfront] table[ 87 \addplot3[origin, onlyfront] table [cyl data] {\datapath/origin.csv};
115 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
116 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
117 z = z,
118 ] {\datapath/origin.csv};
119 \addlegendentry{Origin} 88 \addlegendentry{Origin}
120 \end{axis} 89 \end{axis}
121 \end{tikzpicture} 90 \end{tikzpicture}
122 91
123 \end{document} 92 \end{document}

mercurial