Visualize connection between two slanted TikZ scopes

Using TikZ is it possible to draw a connection between the two green rectangles? The idea is to show that the lower green grid is a more detailed view of the upper one. I'm also open to other ideas ;D

My current result:

What I want is to connect the corners of the rectangle with the corresponding corners of the other rectangle.

LaTeX:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]
\begin{scope}[  % Upper layer
yshift=90,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\fill[white,fill opacity=.9] (0,0) rectangle (5,5);
\draw[step=10mm, green] (1,1) grid (4,4);
\draw[green,very thick] (1,1) rectangle (4,4);
\draw[black,dashed] (0,0) rectangle (5,5);
\end{scope}

\begin{scope}[  % Lower layer
yshift=170,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\fill[white,fill opacity=0.6] (0,0) rectangle (5,5);
\draw[step=10mm, black] (2,2) grid (5,5);
\draw[step=3.33mm, green] (2,2) grid (3,3);
\draw[black,very thick] (2,2) rectangle (5,5);
\draw[black,dashed] (0,0) rectangle (5,5);
\draw[green,very thick] (2.05,2.05) rectangle (3,3);
\end{scope}
\end{tikzpicture}

\end{document}

-

First, the straighforward answer to your question whether it is possible to draw connections between the two green rectangles: It is. You can assign names to the coordinates of the first rectangle's corners using \coordinate, which creates nodes at the given coordinates. These can then be referenced in the second scope:

    \documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]
\begin{scope}[  % Upper layer
yshift=90,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\fill[white,fill opacity=.9] (0,0) rectangle (5,5);
\draw[step=10mm, green] (1,1) grid (4,4);
\draw[green,very thick] (1,1) rectangle (4,4);
\draw[black,dashed] (0,0) rectangle (5,5);
\coordinate (A) at (1,1); \coordinate (B) at (1,4); \coordinate (C) at (4,1); \coordinate (D) at (4,4);
\end{scope}

\begin{scope}[  % Lower layer
yshift=170,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\draw (A) -- (2.05,2.05) (B) -- (2.05,3) (C) -- (3,2.05) (D) -- (3,3);
\fill[white,fill opacity=0.6] (0,0) rectangle (5,5);
\draw[step=10mm, black] (2,2) grid (5,5);
\draw[step=3.33mm, green] (2,2) grid (3,3);
\draw[black,very thick] (2,2) rectangle (5,5);
\draw[black,dashed] (0,0) rectangle (5,5);
\draw[green,very thick] (2.05,2.05) rectangle (3,3);
\end{scope}
\end{tikzpicture}

\end{document}


Concerning "other ideas": You could also use rectangle nodes instead of paths, which saves you the hassle of having to enter the coordinates manually. In order for the connection lines to be behind the top rectangle, you can use layers. I would furthermore put the zoomed in rectangle above the small scale one, rotate everything a little bit, and make the black grid a bit lighter:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}

\pgfdeclarelayer{bottom} \pgfdeclarelayer{top}
\pgfsetlayers{bottom,main,top}
\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]
\begin{pgfonlayer}{bottom}
\begin{scope}[  % Lower layer
yshift=0,every node/.append style={
yslant=0.5,xslant=-1,rotate=-10},yslant=0.5,xslant=-1,rotate=-10
]
\fill[white,fill opacity=0.9] (0,0) rectangle (5,5);
\draw[step=10mm, gray!70] (2,2) grid (5,5);
\draw[step=3.33mm, green] (2,2) grid (3,3);
\draw[gray,very thick] (2,2) rectangle (5,5);
\draw[black,dashed] (0,0) rectangle (5,5);
\node[name=B,draw,scale=0.9,green,very thick,text width=0.95,text height=0.95,inner sep=0pt,] at (2.525,2.525) {};
\end{scope}
\end{pgfonlayer}

\begin{scope}[  % Upper layer
yshift=105,every node/.append style={
yslant=0.5,xslant=-1,rotate=-10},yslant=0.5,xslant=-1,rotate=-10
]
\fill[white,fill opacity=.6] (0,0) rectangle (5,5);
\draw[step=10mm, green] (1,1) grid (4,4);
\node[scale=.9,draw,green,very thick,name=A,text width=3cm,text height=3cm,inner sep=0pt] at (2.5,2.5) {};
\draw[black,dashed] (0,0) rectangle (5,5);
\begin{pgfonlayer}{bottom}
\foreach \i in {north east,north west,south west,south east}
\draw (A.\i) -- (B.\i);
\end{pgfonlayer}
\end{scope}

\end{tikzpicture}

\end{document}


-
Perfekt answer! Regarding the design: yes, you're right, too, was also what I had in mind, but I'm just getting to know tikz and so I didn't bother too much about the design yet ^^ Thank anyway! – Mene Mar 5 '11 at 0:58
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{intersections}
\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]
\begin{scope}[  % Upper layer
yshift=90,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\fill[white,fill opacity=.9] (0,0) rectangle (5,5);
\draw[step=10mm, green] (1,1) grid (4,4);
\draw[green,very thick] (1,1) rectangle (4,4);
\draw[black,dashed,name path =rec1] (0,0) rectangle (5,5);
\coordinate (a) at (0,0);
\end{scope}

\begin{scope}[  % Lower layer
yshift=170,every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\fill[white,fill opacity=0.6] (0,0) rectangle (5,5);
\draw[step=10mm, black] (2,2) grid (5,5);
\draw[step=3.33mm, green] (2,2) grid (3,3);
\draw[black,very thick] (2,2) rectangle (5,5);
\draw[black,dashed,name path=rec2] (0,0) rectangle (5,5);
\draw[green,very thick] (2.05,2.05) rectangle (3,3);
\coordinate (b) at (2.05,2.05);
\end{scope}
\draw (a)--(b);
\end{tikzpicture}

\end{document}


You make the same thing for the other corners

-