# How to draw these polyhedrons?

I need help drawing these two shapes in LaTeX witk TikZ. I got the octahedron one down. Now, I need help on the bipyramid one. Thank you! (and when I copy and paste from LaTeX to here, how do I put all the coding lines 4 spaces in? I had to do it individually for each line, which is a pain.)

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[thick,scale=5]
\coordinate (A1) at (0,0);
\coordinate (A2) at (0.6,0.2);
\coordinate (A3) at (1,0);
\coordinate (A4) at (0.4,-0.2);
\coordinate (B1) at (0.5,0.5);
\coordinate (B2) at (0.5,-0.5);

\begin{scope}[thick,dashed,opacity=0.6]
\draw (A1) -- (A2) -- (A3);
\draw (B1) -- (A2) -- (B2);
\end{scope}

\draw[solid][line width=2pt] (A1) -- (A4) -- (B1);
\draw[solid][line width=2pt] (A1) -- (A4) -- (B2);
\draw[solid][line width=2pt] (A3) -- (A4) -- (B1);
\draw[solid][line width=2pt] (A3) -- (A4) -- (B2);
\draw[solid][line width=2pt] (B1) -- (A1) -- (B2) -- (A3) --cycle;
\end{tikzpicture}

\end{document}

• Welcome, TikZ is a good tool for it. Please share what you got so far and where you got stuck. That leaves less effort to the helpers, as they already hae a starting point. – Johannes_B Feb 28 '17 at 7:26
• For code typing here: insert the code, select all and press Ctrl+k. – Ignasi Feb 28 '17 at 8:18

Here's a fix for your code.

%
\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[thick,scale=5]

\coordinate (A1) at (0,0);
\coordinate (A2) at (0.6,0.2);
\coordinate (A3) at (1,0);
\coordinate (A4) at (0.4,-0.2);
\coordinate (B1) at (0.5,0.5);
\coordinate (B2) at (0.5,-0.5);

\begin{scope}[thick,dashed,,opacity=0.6]
\draw (A1) -- (A2) -- (A3);
\draw (B1) -- (A2) -- (B2);
\end{scope}
\draw[solid][line width=2pt] (A1) -- (A4) -- (B1);
\draw[solid][line width=2pt] (A1) -- (A4) -- (B2);
\draw[solid][line width=2pt] (A3) -- (A4) -- (B1);
\draw[solid][line width=2pt] (A3) -- (A4) -- (B2);
\draw[solid][line width=2pt] (B1) -- (A1) -- (B2) -- (A3) --cycle;

\end{tikzpicture}

\begin{tikzpicture}[thick,scale=5]

\coordinate (C1) at (0.2,0);
\coordinate (C2) at (0.8,-0.1);

\begin{scope}[thick,dashed,,opacity=0.6]
\draw (C1) -- (C2);

\end{scope}
\draw[solid][line width=2pt] (C1) -- (A4) -- (B1);
\draw[solid][line width=2pt] (C1) -- (A4) -- (B2);
\draw[solid][line width=2pt] (C2) -- (A4) -- (B1);
\draw[solid][line width=2pt] (C2) -- (A4) -- (B2);
\draw[solid][line width=2pt] (B1) -- (C1) -- (B2) -- (C2) --cycle;

\end{tikzpicture}

\end{document}


Sample output:

PS. To mass-edit code; mark the code and press this button:

Here your MWE using the coordinate system xyz (and rounded line join and cap):

\documentclass[tikz,margin=1mm]{standalone}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round]
\path
( 1, 0, 0) coordinate (A1)
( 0, 0,-1) coordinate (A2)
(-1, 0, 0) coordinate (A3)
( 0, 0, 1) coordinate (A4)
( 0, 1, 0) coordinate (B1)
( 0,-1, 0) coordinate (B2);

\begin{scope}[very thin,draw=blue!50]
\draw
(A1) -- (A2) -- (A3)
(B1) -- (A2) -- (B2);
\end{scope}

\draw[thick]
(A1) -- (A4) -- (B1)
(A1) -- (A4) -- (B2)
(A3) -- (A4) -- (B1)
(A3) -- (A4) -- (B2)
(B1) -- (A1) -- (B2) -- (A3) --cycle;
\end{tikzpicture}
\end{document}


I used Gonzalo Medina's post to create your polyhdera. You can find his post here.

% DEFINING COLORS COF, PUR, GREEO AND GREET
\definecolor{cof}{RGB}{219,144,71}
\definecolor{pur}{RGB}{186,146,162}
\definecolor{greeo}{RGB}{91,173,69}
\definecolor{greet}{RGB}{52,111,72}
% OCTAHEDRON
\begin{tikzpicture}[thick,scale=3]
\coordinate (A1) at (0,0);
\coordinate (A2) at (0.6,0.2);
\coordinate (A3) at (1,0);
\coordinate (A4) at (0.4,-0.2);
\coordinate (B1) at (0.5,0.5);
\coordinate (B2) at (0.5,-0.5);
%
\begin{scope}[thick,dashed,,opacity=0.6]
\draw (A1) -- (A2) -- (A3);
\draw (B1) -- (A2) -- (B2);
\end{scope}
%
\draw[fill=cof,opacity=0.6] (A1) -- (A4) -- (B1);
\draw[fill=pur,opacity=0.6] (A1) -- (A4) -- (B2);
\draw[fill=greeo,opacity=0.6] (A3) -- (A4) -- (B1);
\draw[fill=greet,opacity=0.6] (A3) -- (A4) -- (B2);
\draw (B1) -- (A1) -- (B2) -- (A3) --cycle;
\end{tikzpicture}

% Bi-pyramid
\begin{tikzpicture}[thick,scale=3]
\coordinate (A1) at (0,0);
\coordinate (A3) at (1,0);
\coordinate (A4) at (0.4,-0.2);
\coordinate (B1) at (0.5,0.5);
\coordinate (B2) at (0.5,-0.5);
%
\begin{scope}[thick,dashed,,opacity=0.6]
\draw (A1)  -- (A3);
\end{scope}
\draw[fill=cof,opacity=0.6] (A1) -- (A4) -- (B1);
\draw[fill=pur,opacity=0.6] (A1) -- (A4) -- (B2);
\draw[fill=greeo,opacity=0.6] (A3) -- (A4) -- (B1);
\draw[fill=greet,opacity=0.6] (A3) -- (A4) -- (B2);
%
\draw (B1) -- (A1) -- (B2) -- (A3) --cycle;
%
\end{tikzpicture}


You will get these two pictures:

Pst-solides3d already comes with some of the platonic bodies included. Examples and alternative approaches for polyhedra were presented here on SE. This may be easier than starting from scratch with Sketch,TeXCAD, Ipe, or LaTeXDraw.