[Tex/LaTex] How to draw a triangular prism in latex

3ddiagrams

How do draw a right triangular prism in latex in this point of view?
enter image description here

And moreover, how can I add the right angle label like this?
enter image description here

Finally, how to add lines in the same figure?
enter image description here

Thank you so much

Best Answer

\documentclass[tikz,margin=3.14mm]{standalone}
\usetikzlibrary{3d,calc} % 3d is not really needed here but convenient for extensions

\begin{document}

\begin{tikzpicture}[y={(0.5cm,0.5cm)},x={(1cm,0cm)},
z={(0cm,1cm)},font=\sffamily]
\pgfmathsetmacro{\CornerScale}{1.5}
\draw (0,0,0) coordinate[label=below:A] (A) -- ++ (8,0,0)
coordinate[label=below:B] (B) -- ++ (0,5,0)
coordinate[label=below right:C] (C)  -- ++ (0,0,2)
coordinate[label=right:F] (F) -- (B)
(F) -- ++(-8,0,0) coordinate[label=left:E] (E) -- (A) (E) -- (B);
\draw[dashed] (A) -- ++(0,5,0) coordinate[label=left:D] (D) -- (E)
(D) -- (C) (D) -- (B);
\draw[red] (A) ++ ($\CornerScale*(1,0,0)$) --++ ($\CornerScale*(0,0.75,0.3)$) 
-- ++($\CornerScale*(-1,0,0)$)
(C) ++ ($\CornerScale*(0,-0.75,0)$) --++ ($\CornerScale*(0,0,0.6)$) -- 
++ ($\CornerScale*(0,0.75,0)$)
(F) ++ ($\CornerScale*(0,-0.75,-0.3)$) --++ ($\CornerScale*(-1,0,0)$) -- 
++($\CornerScale*(0,0.75,0.3)$);
\end{tikzpicture}
\end{document}

enter image description here

Related Question