How can I reduce my code to draw this polydedron?

by minhthien_2016   Last Updated February 11, 2019 08:23 AM

I am trying to draw this picture enter image description here My code

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot} 
\usepackage{fouriernc}
\usetikzlibrary{folding}
\begin{document}
\tdplotsetmaincoords{60}{135}
    \begin{tikzpicture}[tdplot_main_coords,scale=1,line join = round, line cap = round]
\pgfmathsetmacro\a{4}
\pgfmathsetmacro{\b}{\a/2}
\path
coordinate (A) at (\b,0,-\a) 
coordinate (B) at (0,\b,-\a) 
coordinate (C) at (-\b,0,-\a)
coordinate (D) at (0,-\b,-\a)
coordinate (I) at (\b,\a,0) 
coordinate (J) at (0,\a,-\b)
coordinate (K) at (-\b,\a,0) 
coordinate (L) at (0,\a,\b)
coordinate (P) at (\a,-\b,0) 
coordinate (Q) at (\a,0,-\b)
coordinate (R) at (\a,\b,0) 
coordinate (S) at (\a,0,\b)

coordinate (A') at ($(A)+ (0,0,2*\a)$) 
coordinate (B') at ($(B)+ (0,0,2*\a)$)  
coordinate (C') at ($(C)+ (0,0,2*\a)$) 
coordinate (D') at ($(D)+ (0,0,2*\a)$)

coordinate (I') at ($(I)+ (0,-2*\a,0)$) 
coordinate (J') at ($(J)+ (0,-2*\a,0)$)  
coordinate (K') at ($(K)+ (0,-2*\a,0)$) 
coordinate (L') at ($(L)+ (0,-2*\a,0)$)

coordinate (P') at ($(P)+ (-2*\a,0,0)$)
coordinate (Q') at ($(Q)+ (-2*\a,0,0)$)
coordinate (R') at ($(R)+ (-2*\a,0,0)$)
coordinate (S') at ($(S)+ (-2*\a,0,0)$);

\draw [ultra thick] 
(A) --(B)--(J)--(I) -- (R) -- (Q) --cycle
(I) --(J)--(K) --(L)--cycle
(K) --(L)--(B') --(C')--(S')--(R')--cycle 
(A') --(B')--(C')--(D') --cycle
(P) --(Q)--(R)--(S) --cycle
(S) --(P)--(I')--(L')--(D') --(A')--cycle
;

\draw [dashed]  (A) --(D) -- (C) --(B)
(C) -- (Q') -- (P') --(K')--(J') --(D)
(J') --(I') (K')-- (L') (P') --(S') (Q') --(R')

;
\foreach \point/\position in {A/below,B/below,C/below,D/left,I/below,J/below,K/right,L/above,P/right,Q/above,R/left,S/below,I'/below,J'/below,K'/right,L'/above,P'/right,Q'/above,R'/left,S'/below,A'/below,B'/below,C'/below,D'/left}
{\fill (\point) circle (0.0pt);
    %\node[\position=2pt] at (\point) {$\point$};
}

\end{tikzpicture}
\end{document}

How can I reduce my code?



Related Questions


Updated July 06, 2019 20:23 PM

Updated November 20, 2018 12:23 PM

Updated July 06, 2018 21:23 PM

Updated April 04, 2017 13:23 PM

Updated July 19, 2019 09:23 AM