Fri, 28 Mar 2025 08:38:05 -0500
bump version
37 | 1 | \documentclass[tikz]{standalone} |
2 | ||
3 | \input{plotsetup} | |
4 | ||
5 | \def\datapath{../res/cylinder} | |
6 | ||
7 | \begin{document} | |
8 | ||
9 | \begin{tikzpicture} | |
10 | \pgfplotsset{ | |
43 | 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 | }, | |
37 | 16 | onlyfront/.code = \pgfplotsset{x filter/.expression={% |
17 | \thisrow{face} == 0 || (% | |
18 | and(\thisrow{face}==2, or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b)) | |
19 | ) ? x : nan% | |
20 | },}, | |
21 | onlyback/.code = \pgfplotsset{x filter/.expression={% | |
22 | \thisrow{face} == 1 || (% | |
23 | and(\thisrow{face}==2, or(2*pi+\a > \thisrow{angle}, \thisrow{angle} > \b)) | |
24 | ) ? x : nan% | |
25 | },}, | |
26 | } | |
27 | ||
28 | \pgfmathsetmacro{\a}{-pi*5/6} | |
29 | \pgfmathsetmacro{\b}{pi/6} | |
30 | ||
31 | \begin{axis}[illustr3d] | |
32 | % Hidden edges | |
33 | \addplot3[edge, domain=\b:(2*pi+\a), samples = 90, samples y = 0] ({cos(deg(x))}, {sin(deg(x))}, {-0.5}); | |
34 | ||
35 | % Data on hidden faces | |
43 | 36 | \addplot3[backdata] table [cyl data] {\datapath/data.csv}; |
37 | 37 | |
38 | % Iterates on hidden faces | |
43 | 39 | \addplot3[backiter1,onlyback] table [cyl data] {\datapath/x1_log.csv}; |
40 | \addplot3[backiter2,onlyback] table [cyl data] {\datapath/x2_log.csv}; | |
41 | \addplot3[backiter3,onlyback] table [cyl data] {\datapath/x3_log.csv}; | |
37 | 42 | |
43 | % Surface | |
44 | \addplot3[ | |
45 | surf, | |
46 | mesh/ordering=x varies, % the second input coordinate stays fixed while first varies | |
47 | mesh/cols=16, % number of first input coordinate points untils second changes | |
48 | surfstyle, | |
49 | %x filter/.expression = {or(2*pi+\a <= \thisrow{angle}, \thisrow{angle} <= \b)}, | |
50 | ] table [ | |
51 | x expr = cos(deg(\thisrow{angle})), | |
52 | y expr = sin(deg(\thisrow{angle})), | |
53 | z = v, | |
54 | point meta = \thisrow{value}, | |
55 | ] {\datapath/side_front.csv}; | |
56 | \addplot3[ | |
57 | surf, | |
58 | mesh/ordering=x varies, % the second input coordinate stays fixed while first varies | |
59 | mesh/cols=32, % number of first input coordinate points untils second changes | |
60 | surfstyle, | |
61 | ] table [ | |
62 | x expr = \thisrow{v} * cos(deg(\thisrow{angle})), | |
63 | y expr = \thisrow{v} * sin(deg(\thisrow{angle})), | |
64 | z expr = 0.5, | |
65 | point meta = \thisrow{value}, | |
66 | ] {\datapath/top.csv}; | |
67 | ||
68 | % Edges | |
69 | \addplot3[edge, domain={0:2*pi}, 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}); | |
71 | \addplot3[edge] coordinates { (cos(deg(\a)), sin(deg(\a)), -0.5) (cos(deg(\a)), sin(deg(\a)), 0.5) }; | |
72 | \addplot3[edge] coordinates { (cos(deg(\b)), sin(deg(\b)), -0.5) (cos(deg(\b)), sin(deg(\b)), 0.5) }; | |
73 | ||
74 | % Data | |
43 | 75 | \addplot3[data, onlyfront] table [cyl data] {\datapath/data.csv}; |
37 | 76 | \addlegendentry{Data} |
77 | ||
78 | % Iterates | |
43 | 79 | \addplot3[iter1,onlyfront] table [cyl data] {\datapath/x1_log.csv}; |
37 | 80 | \addlegendentry{Iterates 1} |
43 | 81 | \addplot3[iter2,onlyfront] table [cyl data] {\datapath/x2_log.csv}; |
37 | 82 | \addlegendentry{Iterates 2} |
43 | 83 | \addplot3[iter3,onlyfront] table [cyl data] {\datapath/x3_log.csv}; |
37 | 84 | \addlegendentry{Iterates 3} |
42 | 85 | |
86 | % Origin | |
43 | 87 | \addplot3[origin, onlyfront] table [cyl data] {\datapath/origin.csv}; |
42 | 88 | \addlegendentry{Origin} |
37 | 89 | \end{axis} |
90 | \end{tikzpicture} | |
91 | ||
92 | \end{document} |