How to draw a pyramid with height(altitude) and slant heigth with TikZ. According to the figure 
Asked
Active
Viewed 2,147 times
2
casio
- 359
-
2Maybe you can post the code that you have tried so far? – vaettchen Jan 13 '17 at 17:11
-
1@vaettchen Hi, I'm new using tikz, so I do not have codes. :( – casio Jan 13 '17 at 17:47
2 Answers
4
You can do this with tikz-3dplot.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{-20}
\begin{tikzpicture}[tdplot_main_coords,line cap=butt,line join=bevel]
\pgfmathsetmacro{\B}{4}
\pgfmathsetmacro{\H}{4}
\draw[blue,thick] (-\B/2,-\B/2,0) -- (\B/2,-\B/2,0) -- (\B/2,\B/2,0) -- (-\B/2,\B/2,0) -- cycle;
\draw[blue,thick] (\B/2,\B/2,0) -- (0,0,\H)
node[above,font=\large\bfseries]{Regular Pyramid};
\draw[dashed,blue] (0,0,0) -- (0,0,\H) coordinate[midway](aux1);
\draw[blue] (0,0,0.3) -- (0.3,0,0.3) -- (0.3,0,0);
\draw[dashed,blue] (-\B/2,0,0) -- (0,0,\H) coordinate[pos=0.3](aux2);
\draw[blue] ({-\B/2+0.15*(\H/\B)},0,0.3) -- ({-\B/2+0.15*(\H/\B)},-0.3,0.3) --
(-\B/2,-0.3,0);
\coordinate (aux3) at (1,0,0);
\draw[blue,thick,fill=cyan,fill opacity=0.3] (-\B/2,-\B/2,0) -- (0,0,\H) -- (\B/2,-\B/2,0) -- cycle;
\draw[blue,thick,fill=blue,fill opacity=0.3] (-\B/2,-\B/2,0) -- (0,0,\H) -- (-\B/2,\B/2,0) -- cycle;
\begin{scope}[tdplot_screen_coords]
\draw (aux1) -- ++ (2,0.1) node[right,font=\itshape] {Altitude};
\draw (aux2) -- ++ (-1.5,0.3) node[left,font=\itshape] {Slant Height};
\draw (aux3) -- ++ (1,-1) node[below right,font=\itshape] {Base};
\end{scope}
\end{tikzpicture}
\end{document}
2
You can see at the link Pyramid Commutative Diagram for Cones or you can use sketch-lib
**
http://alexdu.github.io/sketch-lib/
** or Drawing polyhedra using TikZ with semi-transparent and shading effect.
Sebastiano
- 54,118
