0

I am trying to make a mapping like this picture

enter image description here

enter image description here

I tried
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
    \tdplotsetmaincoords{110}{70}
        \begin{tikzpicture}[tdplot_main_coords ,declare function={a=6;b=2;h=1;
        }]
        \path
        (0,0,0) coordinate (A)
        (a,0,0) coordinate (B)
        (a,b,0) coordinate (C)
        (0,b,0) coordinate (D)
        (0,0,h) coordinate (E)
        (a,0,h) coordinate (F)
        (a,b,h) coordinate (G)
        (0,b,h) coordinate (H)
        ;
        \draw  (E)-- (F) -- (G) -- (H) --cycle  (A) -- (E)--(H) -- (D) --  (C) -- (G) -- (H) (A) -- (D);
        \end{tikzpicture}
\end{document}

enter image description here

How to create a mapping like the above figure?

2 Answers2

3

I am not sure if this answers the question but the screen shot appears to be in the isometric view, which is predefined in the perspective library.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{perspective}
\begin{document}
        \begin{tikzpicture}[isometric view ,declare function={a=6;b=4;h=2;
        }]
        \path
         foreach \X in {-1,...,7}
            {foreach \Y in {-1,...,5}
            {foreach \Z in {-1,...,3}
            {(\X,\Y,\Z)node[circle,inner sep=1pt,fill]{}}}}
         (0,0,0) coordinate (A)
        (a,0,0) coordinate (B)
        (a,b,0) coordinate (C)
        (0,b,0) coordinate (D)
        (0,0,h) coordinate (E)
        (a,0,h) coordinate (F)
        (a,b,h) coordinate (G)
        (0,b,h) coordinate (H)
        ;
        \draw  (E)-- (F) -- (G) -- (H) --cycle 
         (E) -- (A) -- (D) -- (H)
         (A) -- (B) -- (F)
        ;
        \end{tikzpicture}
\end{document}

enter image description here

1

Adding \draw[pattern= dots] (-1,0) rectangle +(12,2); before \end{tikzpicture} will produce a background of dots, but they are not as thick as the one in your image. You may be able to change that.

Full code

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{patterns}

\begin{document} \tdplotsetmaincoords{110}{70} \begin{tikzpicture}[tdplot_main_coords ,declare function={a=6;b=2;h=1; }] \path (0,0,0) coordinate (A) (a,0,0) coordinate (B) (a,b,0) coordinate (C) (0,b,0) coordinate (D) (0,0,h) coordinate (E) (a,0,h) coordinate (F) (a,b,h) coordinate (G) (0,b,h) coordinate (H) ; \draw (E)-- (F) -- (G) -- (H) --cycle (A) -- (E)--(H) -- (D) -- (C) -- (G) -- (H) (A) -- (D); \draw[pattern= dots] (-1,0) rectangle +(12,2); \end{tikzpicture} \end{document}

Output

enter image description here

LCM
  • 56