使用 tikz 但不使用 sagetex 绘制 3 阶置换面体

使用 tikz 但不使用 sagetex 绘制 3 阶置换面体

我如何绘制3 阶置换面体在 3 维的 tikz 中如何绘制?我希望获得一个可读的代码,该代码绘制 3D 对象的平面投影,而不是不可读(因此无法维护)的自动生成的输出。这比使用 TikZ 绘制具有半透明和阴影效果的多面体 因为我们希望为嵌入到 3D 对象中的非三角形、非矩形 2D 对象填充颜色。

截至今天,sagetex 在我使用的发行版上不可用,所以我希望不用它。

答案1

您可以为此使用 PGFPlots:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    view={110}{30},
    xmin=1, xmax=3,
    ymin=1, ymax=3,
    zmin=1, zmax=3,
    axis equal image
]
\addplot3 [fill=cyan, fill opacity=0.5] table {
x y z
1 2 3
2 1 3
3 1 2
3 2 1
2 3 1
1 3 2
}--cycle;
\end{axis}
\end{tikzpicture}

\end{document}

相关内容