绘制 3D 区域(积分区域)

绘制 3D 区域(积分区域)

是否有任何直接/简单的方法来绘制积分区域,或者我不应该使用 LaTeX 而只需从另一个程序创建图像?

样本:

公式 1

(以 x=0、y=0、z=0 和 x+y+z=1 为界)

三角形

公式 2

(以 z=0、z=2、x=0、y=2 和 y=x^2 为界)

片

公式 3

(以 z=0、x+y=1、x=0、z=sqrt(y) 为界)

复杂的

答案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}

在此处输入图片描述

相关内容