答案1
欢迎来到 TeX.SE!!!
您将帖子标记为tikz-3d
,因此这是另一个选项,使用 3d 坐标。它需要 Ti钾Z 库perspective
用于调整视图,calc
并可轻松定位顶面相对于底面的位置。
像这样:
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{calc,perspective}
\tikzset
{% some styles
every node/.style={black,fill opacity=1},
axis/.style={black,thick,-latex}
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,white,
isometric view,rotate around z=180]
% COORDINATES
% bottom face
\coordinate (C1) at (0,0.7,0);
\coordinate (D1) at (1.2,0,0);
\coordinate (A1) at ($(D1)+(25:1.6)$);
\coordinate (B1) at ($(A1)+(135:2)$);
% vector A1A2=B1B2=...
\coordinate (V) at (-0.7,0.5,3);
% top face
\foreach\i in {A,B,C,D}
\coordinate (\i2) at ($(\i1)+(V)$);
% AXES (remove them if you want)
\draw[axis] (0,0,0) -- (3,0,0) node[left] {$x$};
\draw[axis] (0,0,0) -- (0,3,0) node[right]{$y$};
\draw[axis] (0,0,0) -- (0,0,4) node[above]{$z$};
% PRISM
% visible lines and color
\foreach\i in {1,2}
\draw[fill=magenta,fill opacity=0.5]
(A1) node[left] {$A$} -- (A2) node[left] {$A'$} -- (D2) node[above] {$D'$} --
(C2) node[above] {$C'$} -- (B2) node[right] {$B'$} -- (B1) node[right] {$B$} -- cycle;
\draw (A2) -- (B2);
% non-visible lines
\draw[dashed,white] (A1) -- (D1) node[below right] {$D$} -- (C1) node[right] {$C$} -- (B1);
\foreach\i in {C,D}
\draw[dashed,white] (\i1) -- (\i2);
\end{tikzpicture}
\end{document}
并产生:
答案2
经过一番修改后,我得出了以下结论:
\begin{tikzpicture}[scale=1.5]
\draw[dashed] (-1,0) -- (0,0.5) edge (0,2.5) -- (1,0) coordinate(BR);
\draw (-1,0) coordinate(BL) rectangle (1,2) coordinate(TR)
-- (0,2.5) coordinate(T) -- (-1,2) coordinate(TL);
\end{tikzpicture}
\begin{tikzpicture}[scale=1.5]
\draw[dashed] (-1,0) -- (-0.5,0.4) -- (0.5,0.5) edge (0.5,2.5) -- (1,0);
\draw [dashed] (-0.5, 2.4) -- (-0.5,0.4);
\draw (-1,0) rectangle (1,2) -- (0.5,2.5) -- (-0.5, 2.4) -- (-1,2);
\end{tikzpicture}
\begin{tikzpicture}[scale=1.5]
\draw [dashed] (-1,0) -- (-0.5,0.4) -- (0.5,0.5) edge (0.8,2.5) -- (1,0);
\draw [dashed] (-0.2, 2.4) -- (-0.5,0.4);
\draw (-1,0) -- (1, 0) -- (1.3, 2) -- (0.8,2.5) -- (-0.2, 2.4) -- (-0.7,2) -- (1.3, 2);
\draw (-0.7, 2) -- (-1, 0);
\end{tikzpicture}
看起来不错: