我正在尝试在坐标系中创建一个八面体(多面体)。两个角点应位于其中一个轴上,其中一个轴通过 (0,0,0)。
你可以帮帮我吗?
我不知道如何命名角点(A,..,F)并创建坐标系。
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzstyle{point}=[circle,thick,draw=black,fill=black,inner sep=0pt,minimum width=4pt,minimum height=4pt]
\node (a)[point] at (0,0) {};
\node (b)[point] at (2,0) {};
\node (c)[point] at (3,1) {};
\node (d)[point] at (1,1) {};
\node (e)[point] at (1.5,3) {};
\node (f)[point] at (1.5,-2) {};
\draw (a.center) -- (b.center) -- (c.center) -- (e.center) -- (b.center);
\draw (a.center) -- (e.center);
\draw[dashed] (a.center) -- (d.center) -- (c.center);
\draw[dashed] (d.center) -- (e.center);
\draw (a.center) -- (f.center) -- (b.center);
\draw (f.center) -- (c.center);
\draw[dashed] (f.center) -- (d.center);
\end{tikzpicture}
\end{document}
答案1
使用xelatex
或运行latex->dvips->ps2pdf
:
\documentclass{article}
\usepackage[svgnames]{pstricks}
\usepackage{pst-solides3d}
\begin{document}
\psset{viewpoint=30 10 10 rtp2xyz, lightsrc=10 5 4,Decran=30}
\begin{pspicture}(-3,-3)(5,5)
\psSolid[object=octahedron,a=3,linecolor=blue,fillcolor=Turquoise,action=draw*]%
\axesIIID(3,3,3)(5,4,4)
\end{pspicture}
\end{document}