visualisation/cylinder.tex

changeset 37
d7cd14b8ccc0
child 42
271fba635bce
equal deleted inserted replaced
34:aa6129697116 37:d7cd14b8ccc0
1 \documentclass[tikz]{standalone}
2
3 \input{plotsetup}
4
5 \def\datapath{../res/cylinder}
6
7 \begin{document}
8
9 \begin{tikzpicture}
10 \pgfplotsset{
11 onlyfront/.code = \pgfplotsset{x filter/.expression={%
12 \thisrow{face} == 0 || (%
13 and(\thisrow{face}==2, or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b))
14 ) ? x : nan%
15 },},
16 onlyback/.code = \pgfplotsset{x filter/.expression={%
17 \thisrow{face} == 1 || (%
18 and(\thisrow{face}==2, or(2*pi+\a > \thisrow{angle}, \thisrow{angle} > \b))
19 ) ? x : nan%
20 },},
21 }
22
23 \pgfmathsetmacro{\a}{-pi*5/6}
24 \pgfmathsetmacro{\b}{pi/6}
25
26 \begin{axis}[illustr3d]
27 % Hidden edges
28 \addplot3[edge, domain=\b:(2*pi+\a), samples = 90, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5});
29
30 % Data on hidden faces
31 \addplot3[backdata] table[
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 % Iterates on hidden faces
38 \addplot3[backiter1,onlyback] table[
39 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
40 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
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
54 % Surface
55 \addplot3[
56 surf,
57 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
58 mesh/cols=16, % number of first input coordinate points untils second changes
59 surfstyle,
60 %x filter/.expression = {or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b)},
61 ] table [
62 x expr = cos(deg(\thisrow{angle})),
63 y expr = sin(deg(\thisrow{angle})),
64 z = v,
65 point meta = \thisrow{value},
66 ] {\datapath/side_front.csv};
67 \addplot3[
68 surf,
69 mesh/ordering=x varies, % the second input coordinate stays fixed while first varies
70 mesh/cols=32, % number of first input coordinate points untils second changes
71 surfstyle,
72 ] table [
73 x expr = \thisrow{v} * cos(deg(\thisrow{angle})),
74 y expr = \thisrow{v} * sin(deg(\thisrow{angle})),
75 z expr = 0.5,
76 point meta = \thisrow{value},
77 ] {\datapath/top.csv};
78
79 % Edges
80 \addplot3[edge, domain={0:2*pi}, samples = 60, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {0.5});
81 \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) };
83 \addplot3[edge] coordinates { (cos(deg(\b)), sin(deg(\b)), -0.5) (cos(deg(\b)), sin(deg(\b)), 0.5) };
84
85 % Data
86 \addplot3[data, onlyfront] table[
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}
92
93 \addplot3[origin, onlyfront] table[
94 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
95 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
96 z = z,
97 ] {\datapath/origin.csv};
98 \addlegendentry{Origin}
99
100 % Iterates
101 \addplot3[iter1,onlyfront] table[
102 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
103 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
104 z = z,
105 ] {\datapath/x1_log.csv};
106 \addlegendentry{Iterates 1}
107 \addplot3[iter2,onlyfront] table[
108 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
109 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
110 z = z,
111 ] {\datapath/x2_log.csv};
112 \addlegendentry{Iterates 2}
113 \addplot3[iter3,onlyfront] table[
114 x expr = \thisrow{r} * cos(deg(\thisrow{angle})),
115 y expr = \thisrow{r} * sin(deg(\thisrow{angle})),
116 z = z,
117 ] {\datapath/x3_log.csv};
118 \addlegendentry{Iterates 3}
119 \end{axis}
120 \end{tikzpicture}
121
122 \end{document}

mercurial