PCC
Cube4

Description

This is a LaTeX code that produces a 3D diagram using the TikZ package.

First, it loads the TikZ and tikz-3dplot packages and the patterns library. Then, it sets the main coordinate system using the tdplotsetmaincoords command.

Next, it defines the values of three variables: \BigSide, \SmallSide, and \CalcSide. These variables are used to create the vertices of a triangular pyramid.

After that, it sets the coordinates of three points (sxl, syl, and szl) using the \coordinate command.

Then, it draws the x, y, and z axes, which are dashed lines that intersect at the origin. Each axis is labeled with an arrow and a letter.

Finally, it draws the triangular pyramid by connecting the vertices with thick lines using the \draw command. The resulting 3D diagram shows the triangular pyramid from different angles.

Keywords

tikz, tikz-3dplot, patterns, coordinate, draw, dashed, arrow, thick, node, anchor.

Source Code

PCC

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{patterns}
 
\begin{document}
 
\tdplotsetmaincoords{70}{120}
\begin{tikzpicture}[tdplot_main_coords]
\def\BigSide{5}
\def\SmallSide{1.5}
\pgfmathsetmacro{\CalcSide}{\BigSide-\SmallSide}
 
% The vertex at V
\tdplotsetcoord{P}{sqrt(3)*\BigSide}{55}{45}
 
\coordinate (sxl) at (\BigSide,\CalcSide,\BigSide);
\coordinate (syl) at (\CalcSide,\CalcSide,\BigSide);
\coordinate (szl) at (\CalcSide,\BigSide,\BigSide);
 
\draw[dashed] 
  (0,0,0) -- (Px)
  (0,0,0) -- (Py)
  (0,0,0) -- (Pz);
\draw[->] 
  (Px) -- ++ (1,0,0) node[anchor=north east]{$x$};
\draw[->]
   (Py) -- ++(0,1,0) node[anchor=north west]{$y$};
\draw[->] 
  (Pz) -- ++(0,0,1) node[anchor=south]{$z$};
 
\draw[thick]
  (Pxz) -- (P) -- (Pxy) -- (Px) -- (Pxz) -- (Pz) -- (Pyz) -- (P); 
\draw[thick]
  (Pyz) -- (Py) -- (Pxy);
 
 
\end{tikzpicture}
 
\end{document}
Deploy to Overleaf