Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. documentclass[margin=5pt, tikz]{standalone}
  2. usepackage{tikz}
  3. usetikzlibrary{calc}
  4. usetikzlibrary{angles, quotes, babel}
  5. usepackage{amsmath, amssymb}
  6. begin{document}
  7.  
  8. begin{tikzpicture}[x=1cm, y=1cm, z={(4mm,3mm)}, scale=1.5, font=small]
  9. pgfmathsetmacroa{2}
  10. pgfmathsetmacrob{2.5}
  11. pgfmathsetmacroc{3}
  12.  
  13. pgfmathsetmacro{r}{0.5*sqrt(a^2+b^2+c^2)} %
  14.  
  15. pgfmathsetmacro{AC}{sqrt(a^2+b^2)} %
  16. pgfmathsetmacro{PA}{0.5*AC} %
  17.  
  18. pgfmathsetmacro{h}{sqrt(r^2-PA^2)} %
  19.  
  20. % Pyramid
  21. draw (0,0,0) coordinate[label=below:$A$] (A)
  22. --(a,0,0) node[midway, below]{$a$} coordinate[label=below:$B$] (B)
  23. --(a,0,b) node[midway,right=2mm]{$b$} coordinate[label=$C$] (C);
  24.  
  25. draw[densely dashed] (C)--(0,0,b) coordinate[label=left:$D$] (D)--(A);
  26. draw (A)--(0,c,0) node[midway, left]{$c$} coordinate[label=$S$] (S);
  27.  
  28. % Diagonals
  29. draw (A)--(C);
  30. draw ($(A)!0.5!(C)$) coordinate coordinate[label=below:$P$] (P) -- ($(S)!0.5!(C)$) node[midway, left]{$h$} coordinate[label=$M$] (M);
  31. draw (D)--(B);
  32.  
  33. % Point M
  34. draw (S)--(M) node[midway, above]{$r$} -- (C) node[midway, above]{$r$};
  35.  
  36. draw[densely dashed] (D) -- (M);
  37. foreach P in {A,B,C} draw (M) -- (P);
  38.  
  39. node[anchor=north west, align=left, yshift=-7mm] at (A){$begin{array}{l}
  40. a = a ,~ b = b,~ c = c \
  41. |AC| = sqrt{a^2+b^2} = AC \
  42. |PA| = 0.5 |AC| = PA \
  43. h = sqrt{r^2- |PA|^2} = h \
  44. r = 0.5 sqrt{a^2+b^2+c^2} = r
  45. end{array}$
  46. };
  47.  
  48. shade[ball color = gray!40, opacity = 0.4] (M) circle[radius=5mm] node{?};
  49. end{tikzpicture}
  50.  
  51. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement