可以绘制滑动数组窗口吗?

可以绘制滑动数组窗口吗?

下面的图看起来像一个 3D 图。

是否可以在 Latex 中绘图?我知道问这个问题很不礼貌,但我真的不知道如何开始,即使我得到了 TikZ 的教程。

我只能画:

    \documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\begin{document}
     
\begin{figure}
\centering
\captionsetup[subfigure]{skip=0pt} % to reduce space above subcaption
\begin{tikzpicture}
    
\draw[step=1cm,gray,very thin] (-2,-2) grid (6,6);

\end{tikzpicture}
\caption{stuff}
\end{figure}
\end{document}

在此处输入图片描述

答案1

我认为以下代码演示了完成图片所需的一切:

\documentclass[tikz, border = 0.5 cm]{standalone}
\usetikzlibrary{3d}
\begin{document}
 \begin{tikzpicture}[x={(1,-0.2)}, y={(0,0.8)}, z={(-0.5,-0.2)}] %adjust these numbers to get your preferred tilt and distance for everything
     \begin{scope}[canvas is zy plane at x=0]
        \fill[green!30] (5,5) rectangle (8,8);
        \draw [gray,very thin] (0,0) grid (8,8); 
        \draw[red,thick] (6,6) rectangle (7,7);
        \fill[green,transparent] (5,5) rectangle (8,8);
     \end{scope}
     \begin{scope}[canvas is zy plane at x=6]
        \fill[green!30] (5,5) rectangle (8,8);
        \draw [gray,very thin] (5,5) grid (8,8);
        \draw[red,thick] (6,6) rectangle (7,7);
    \end{scope}
    \begin{scope}[canvas is zy plane at x=10]
        \draw [gray,very thin] (0,0) grid (8,8); 
        \draw[red,thick] (6,6) rectangle (7,7);
    \end{scope}

\draw[blue,thick] (0,5,8) -- (10,5,8);
\draw[blue,thick] (0,8,5) -- (10,8,5);

\node at (0,6.5,6.5) {6};
\node at (6,6.5,6.5) {0};
\node at (10,6.5,6.5) {-3};
\draw[->] (0,9,9)node[above] {Source pixel} -- (0,7,6.5);
\end{tikzpicture}
\end{document}

三个带有数字的倾斜网格

相关内容