答案1
这当然不是一个完整的答案,但目的是使绘制连续的图变得更容易,然后可以将它们拼凑在一起,例如这里。如果你使用 asymptote,这样的修补是没有必要的,但使用 Ti钾Z 和其他的意味着没有 3d 引擎。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\tikzset{3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args={#1:#2}{\def\xmin{#1}\def\xmax{#2}},
surface segment/.is family,
surface segment/.cd,
x/.initial=0:1,
y/.initial=0:1,
function/.initial=f,
plane/.initial=0
}
\tikzset{set surface segment/.code=\tikzset{3d stuff/surface segment/.cd,#1},
surface stretch/.style={/utils/exec=
\pgfkeys{/tikz/3d stuff/parse domain/.expanded=\pgfkeysvalueof{/tikz/3d stuff/surface segment/y}}
\edef\ymin{\xmin}
\edef\ymax{\xmax}
\pgfkeys{/tikz/3d stuff/parse domain/.expanded=\pgfkeysvalueof{/tikz/3d stuff/surface segment/x}},
insert path={%
\ifcase\pgfkeysvalueof{/tikz/3d stuff/surface segment/plane} %xy
plot[variable=\x,smooth,domain=\xmin:\xmax]
(\x,\ymin,{#1(\x,\ymin)})
-- plot[variable=\y,smooth,domain=\ymin:\ymax]
(\xmax,\y,{#1(\xmax,\y)})
--plot[variable=\x,smooth,domain=\xmax:\xmin]
(\x,\ymax,{#1(\x,\ymax)})
-- plot[variable=\y,smooth,domain=\ymax:\ymin]
(\xmin,\y,{#1(\xmin,\y)})
--cycle
\or%xz
plot[variable=\x,smooth,domain=\xmin:\xmax]
(\x,{#1(\x,\ymin)},\ymin)
-- plot[variable=\y,smooth,domain=\ymin:\ymax]
(\xmax,{#1(\xmax,\y)},\y)
--plot[variable=\x,smooth,domain=\xmax:\xmin]
(\x,{#1(\x,\ymax)},\ymax)
-- plot[variable=\y,smooth,domain=\ymax:\ymin]
(\xmin,{#1(\xmin,\y)},\y)
--cycle
\or%yz
plot[variable=\x,smooth,domain=\xmin:\xmax]
({#1(\x,\ymin)},\x,\ymin)
-- plot[variable=\y,smooth,domain=\ymin:\ymax]
({#1(\xmax,\y)},\xmax,\y)
--plot[variable=\x,smooth,domain=\xmax:\xmin]
({#1(\x,\ymax)},\x,\ymax)
-- plot[variable=\y,smooth,domain=\ymax:\ymin]
({#1(\xmin,\y)},\xmin,\y)
--cycle
\fi
}}}
\begin{document}
\tdplotsetmaincoords{60}{150}
\begin{tikzpicture}[tdplot_main_coords,declare function={%
f(\x,\y)=0.3*sin(deg(\x);
g(\x,\y)=-3*sin(deg(2.2*\x);}]
\draw[set surface segment={x=-pi:0,y=0:2},surface stretch=f];
\draw[set surface segment={x=0:0.2*pi,y=0:2},surface stretch=g];
\draw[fill=white,fill opacity=0.5,set surface segment={x=0:pi,y=0:2},surface stretch=f];
\draw[fill=white,fill opacity=0.5,set surface segment={x=-0.2*pi:0,y=0:2},surface stretch=g];
\end{tikzpicture}
\end{document}