答案1
您可以在 tikz 中使用 3d 坐标。它不是 3d 模型,只是 2d 图片中的三个向量,但它非常方便。
\documentclass[11pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x=(-150:1cm),y=(-30:1cm),z=(90:1cm)]
\draw[->] (0,0,0) -- (1.5,0,0) node[anchor=30]{$x$};
\draw[->] (0,0,0) -- (0,1.5,0) node[anchor=150]{$y$};
\draw[->] (0,0,0) -- (0,0,1.5) node[anchor=-90]{$z$};
%%
\draw[red,fill=gray!30](0,0,0) -- (1,0,0)-- (0,0,1) -- cycle;
\draw[red,fill=gray!30](0,0,0) -- (0,1,0)-- (0,0,1) -- cycle;
\draw[red,fill=gray!30](0,0,0) -- (1,0,0)-- (0,1,0) -- cycle;
\draw[red,fill=gray!30,opacity=0.5](1,0,0) -- (0,1,0)-- (0,0,1) -- cycle;
\end{tikzpicture}
\begin{tikzpicture}[x=(-150:1cm),y=(-30:1cm),z=(90:1cm)]
\draw[->] (0,0,0) -- (1.5,0,0) node[anchor=30]{$x$};
\draw[->] (0,0,0) -- (0,1.5,0) node[anchor=150]{$y$};
\draw[->] (0,0,0) -- (0,0,1.5) node[anchor=-90]{$z$};
%%
\draw[red,fill=gray!30,opacity=0.5](0,0,0) plot[domain=0:1,samples=10,smooth] (\x,\x*\x,0) -- (0,1,0) -- cycle;
\draw[red,fill=gray!30,opacity=0.5](0,0,0) plot[domain=0:1,samples=10,smooth] (\x,\x*\x,0) -- (1,1,0.3) plot[domain=1:0,samples=10,smooth] (\x,\x*\x,0.3) -- (0,0,0);
\draw[red,fill=gray!30,opacity=0.5] (1,1,0) -- (0,1,0) -- (0,1,0.3) -- (1,1,0.3) -- cycle;
\draw[red,fill=gray!30,opacity=0.5] (0,0,0) -- (0,1,0) -- (0,1,0.3) -- (0,0,0.3) -- cycle;
\draw[red,fill=gray!30,opacity=0.5](0,0,0.3) plot[domain=0:1,samples=10,smooth] (\x,\x*\x,0.3) -- (0,1,0.3) -- cycle;
\end{tikzpicture}
\begin{tikzpicture}[x=(-150:1cm),y=(-30:1cm),z=(90:1cm)]
\draw[->] (0,0,0) -- (1.5,0,0) node[anchor=30]{$x$};
\draw[->] (0,0,0) -- (0,1.5,0) node[anchor=150]{$y$};
\draw[->] (0,0,0) -- (0,0,1.5) node[anchor=-90]{$z$};
%%
\newcommand\start{0.03}
\draw[red,fill=gray!30,opacity=0.5] (0,0,0) -- (1,0,0) -- (0,1,0) -- cycle;
\draw[red,fill=gray!30,opacity=0.5] (0,0,0) plot[domain=0:1,samples=100,variable=\y,smooth] (0,\y,{0.5*sqrt(\y)}) -- (0,1,0) -- cycle;
\draw[red,fill=gray!30,opacity=0.5] (1,0,0) plot[domain=0:1,samples=100,smooth] (1-\x,\x,{0.5*sqrt(\x)}) -- (0,1,0) -- cycle;
\fill[fill=gray!30,opacity=0.5] (1-\start,\start,{0.5*sqrt(\start)}) plot[domain=\start:1,samples=100,smooth] (1-\x,\x,{0.5*sqrt(\x)}) plot[domain=1:\start,samples=100,variable=\y,smooth] (0,\y,{0.5*sqrt(\y)}) -- (1-\start,\start,{0.5*sqrt(\start)});
\draw[red] (1,0,0) plot[domain=0:1,samples=100,smooth] (1-\x,\x,{0.5*sqrt(\x)}) plot[domain=1:\start,samples=100,variable=\y,smooth] (0,\y,{0.5*sqrt(\y)});
\end{tikzpicture}
\end{document}
答案2
使用 asymptote 来实现这一点相当简单。下面是一个例子。
\documentclass{standalone}
\usepackage[inline]{asymptote}
\begin{document}
\thispagestyle{empty}
\begin{asy}
import three;
size(200);
currentprojection=perspective(4,5,5);
// axes
real r=1.5;
draw(Label("$x$",1), O--r*X, Arrow3(HookHead3));
draw(Label("$y$",1), O--r*Y, Arrow3(HookHead3));
draw(Label("$z$",1), O--r*Z, Arrow3(HookHead3));
draw(X--Y--Z--X--O--Y--O--Z,red);
\end{asy}
\end{document}