我需要使用 tikz/pgf 绘制以下四面体?
我需要将三角形底部的两个顶点(由 AC 给出)放置在 x 轴和 y 轴上,而另一个顶点放置在 xyz 空间上,顶部顶点 V 像往常一样放置在 xyz 空间中,如图所示。我需要在可见的面上填充不同的颜色。
我正在尝试以下代码,但效果不太好,如下图所示,没有绘制 x 轴、y 轴和 z 轴。
\documentclass[12 pt]{amsart}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\begin{tikzpicture}
\path (4,5,1) coordinate (V)
(3,2,1) coordinate (B)
(0,1,0) coordinate (C)
(3,0,0) coordinate (A);
\draw[thick,fill=cyan] (A) -- (C) -- (V) -- cycle;
\draw[thick,fill=black] (A) -- (B) -- (C) -- cycle;
\draw[thick,fill=blue] (B) -- (C) -- (V) -- cycle;
\end{tikzpicture}
\end{document}
请帮忙画出上面的四面体
答案1
你可以尝试一下这个代码。
\documentclass[12 pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{60}{80}
\begin{tikzpicture}[tdplot_main_coords,line join=round]
\path (3,2,5) coordinate (V)
(2,2,0) coordinate (B)
(0,2,0) coordinate (C)
(3,0,0) coordinate (A);
\draw[thick,fill=cyan] (A) -- (C) -- (V) -- cycle;
\draw[thick,fill=blue] (A) -- (B) -- (C) -- cycle;
\draw[thick,fill=gray] (B) -- (C) -- (V) -- cycle;
\foreach \p in {A,B,C,V}
\draw[fill=black] (\p) circle (1pt);
\foreach \p/\g in {V/45,A/135,B/-90, C/150}
\path (\p)+(\g:3mm) node{$\p$};
\end{tikzpicture}
\end{document}
我改变了顶点的坐标来得到另一张图片。我希望你能理解这一点。
\documentclass[12 pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{60}{60}
\begin{tikzpicture}[tdplot_main_coords,line join=round]
\path (0,0,4) coordinate (V)
(0,0,0) coordinate (A)
(3,0,0) coordinate (C)
(0,3,0) coordinate (B);
\draw[thick,fill=cyan] (A) -- (C) -- (V) -- cycle;
\draw[thick,fill=blue] (A) -- (B) -- (C) -- cycle;
\draw[thick,fill=gray] (B) -- (C) -- (V) -- cycle;
\foreach \p in {A,B,C,V}
\draw[fill=black] (\p) circle (1pt);
\foreach \p/\g in {V/45,A/135,B/90, C/-90}
\path (\p)+(\g:3mm) node{$\p$};
\draw[thick,->] (A) -- (5,0,0) node[left]{$x$};
\draw[thick,->] (A) -- (0,5,0) node[left]{$y$};
\draw[thick,->] (A) -- (0,0,5) node[left]{$z$};
\end{tikzpicture}
\end{document}