我可以绘制以下内容:
\documentclass[11pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x={(170:1cm)},y={(45:1cm)},z={(90:1cm)}]
\coordinate (O) at (-7,-6,0);
\coordinate (R) at (-3.5,-5,4);
\coordinate (A) at (2.5,-2.5,-1);
\coordinate (B) at (2.5,2.5,-1);
\coordinate (C) at (-2.5,2.5,-1);
\coordinate (D) at (-2.5,-2.5,-1);
\draw[->] (O) --++ (2.5,0,0) node[below] {$X_1$};
\draw[->] (O) --++ (0,-3,0) node[below] {$X_2$};
\draw[->] (O) --++ (0,0,2.5) node[right] {$X_3$};
\filldraw[color=gray!30]
(2.5,-2.5,-1)
to[bend left=25] (2.5,2.5,-1)
to[bend left=25] coordinate (mp) (-2.5,2.5,-1)
to[bend right=25] (-2.5,-2.5,-1)
to[bend right=25] coordinate (mm) (2.5,-2.5,-1)
-- cycle;
\draw[very thin]
(A)
to[bend left=25] (B)
to[bend left=25] coordinate (mp) (C)
to[bend right=25] (D)
to[bend right=25] coordinate (mm) (A)
-- cycle;
\end{tikzpicture}
\end{document}
上述代码的结果是
请问,有人可以帮我修改图片(添加 4 层或更多厚度)如下吗?
答案1
在这种情况下,这相当容易,因为你的形状非常好。
更新:带有彩色层。
\documentclass[11pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x={(170:1cm)},y={(45:1cm)},z={(90:1cm)}]
\coordinate (O) at (-7,-6,0);
\coordinate (R) at (-3.5,-5,4);
\coordinate (A) at (2.5,-2.5,-1);
\coordinate (B) at (2.5,2.5,-1);
\coordinate (C) at (-2.5,2.5,-1);
\coordinate (D) at (-2.5,-2.5,-1);
\draw[->] (O) --++ (2.5,0,0) node[below] {$X_1$};
\draw[->] (O) --++ (0,-3,0) node[below] {$X_2$};
\draw[->] (O) --++ (0,0,2.5) node[right] {$X_3$};
\foreach \Z/\Col [count=\X] in {-1.4/blue,-1.3/red,-1.2/green,-1.1/yellow}
{ \filldraw[color=\Col]
(-2.5,2.5,-1) --
(-2.5,2.5,\Z)
to[bend right=25] ({-2.5-0.05*(5-\X)},{-2.5-0.05*(5-\X)},\Z)
to[bend right=25] (2.5,-2.5,\Z)
-- (2.5,-2.5,-1);
}
\filldraw[color=gray!30]
(2.5,-2.5,-1)
to[bend left=25] (2.5,2.5,-1)
to[bend left=25] coordinate (mp) (-2.5,2.5,-1)
to[bend right=25] (-2.5,-2.5,-1)
to[bend right=25] coordinate (mm) (2.5,-2.5,-1)
-- cycle;
\draw[very thin]
(A)
to[bend left=25] (B)
to[bend left=25] coordinate (mp) (C)
to[bend right=25] (D)
to[bend right=25] coordinate (mm) (A)
-- cycle;
\end{tikzpicture}
\end{document}
比较一下:使用 tikz-3dplot。不一定更好,但可能更容易改变视角等。
\documentclass[11pt,tikz,border=3.14pt]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{-20}
\begin{tikzpicture}[tdplot_main_coords]
\coordinate (O) at (-7,-6,0);
\coordinate (R) at (-3.5,-5,4);
\coordinate (A) at (2.5,-2.5,-1);
\coordinate (B) at (2.5,2.5,-1);
\coordinate (C) at (-2.5,2.5,-1);
\coordinate (D) at (-2.5,-2.5,-1);
\draw[->] (O) --++ (2.5,0,0) node[below] {$X_1$};
\draw[->] (O) --++ (0,-3,0) node[below] {$X_2$};
\draw[->] (O) --++ (0,0,2.5) node[right] {$X_3$};
\foreach \Z/\Col [count=\X] in {-1.4/blue,-1.3/red,-1.2/green,-1.1/yellow}
{ \filldraw[color=\Col]
(-2.5,2.5,-1) --
(-2.5,2.5,\Z)
to[bend left=25] ({-2.5-0.02*(5-\X)},{-2.5-0.02*(5-\X)},\Z)
to[bend left=25] (2.5,-2.5,\Z)
-- (2.5,-2.5,-1) to[bend left=25] (2.5,2.5,-1)
-- cycle;
}
\filldraw[color=gray!30]
(2.5,-2.5,-1)
to[bend right=25] (2.5,2.5,-1)
to[bend right=25] coordinate (mp) (-2.5,2.5,-1)
to[bend left=25] (-2.5,-2.5,-1)
to[bend left=25] coordinate (mm) (2.5,-2.5,-1)
-- cycle;
\draw[very thin]
(A)
to[bend right=25] (B)
to[bend right=25] coordinate (mp) (C)
to[bend left=25] (D)
to[bend left=25] coordinate (mm) (A)
-- cycle;
\end{tikzpicture}
\end{document}