我正在寻找一种方法将分段区域连接成一个彼此重叠的区域,如下所示:
对于左图中的灰色区域,我根据这个问题的答案生成了一个五边形:在 TikZ 中创建随机图案。但我怎样才能像右图那样将这些区域连接成一个区域,同时仍然保持距离呢?这是来自 BLICHFELD 定理https://cims.nyu.edu/~regev/teaching/lattices_fall_2004/ln/introduction.pdf
\begin{tikzpicture}[scale=0.45]
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-3,0);
\coordinate (XAxisMax) at (10,0);
\coordinate (YAxisMin) at (0,-2);
\coordinate (YAxisMax) at (0,10);
\draw [thin, black,-latex] (XAxisMin) -- (XAxisMax);% Draw x axis
\draw [thin, black,-latex] (YAxisMin) -- (YAxisMax);% Draw y axis
\clip (0, 0) rectangle (8cm,4cm);
\coordinate (Bone) at (0,2);
\coordinate (Btwo) at (4,2);
%\coordinate (Bthree) at (2, 4);
\draw[style=help lines,dashed] (-14,-14) grid[step=2cm] (14,14);
\foreach \x in {-7,-6,...,7}{% Two indices running over each
\foreach \y in {-7,-6,...,7}{% node on the grid we have drawn
\node[draw,circle,inner sep=2pt,fill] at (4*\x, 4*\x + 2*\y) {};
% Places a dot at those points
}
}
%\draw [ultra thick,-latex,red] (Origin)
% -- (Bthree) node [above, right] {$b_3$};
\fill[fill=gray, fill opacity=0.3, draw=black] (4,2) ellipse (3cm and 1.75cm);
\end{tikzpicture}
答案1
这可能需要一些改进,但您也许可以使用该spy
库:
\documentclass[border=1mm, tikz]{standalone}
\usetikzlibrary{spy}
\begin{document}
\begin{tikzpicture}[scale=0.45, spy using overlays={black!0, height={0.45*2cm}, width={0.45*4cm}, anchor=south west}]
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-3,0);
\coordinate (XAxisMax) at (10,0);
\coordinate (YAxisMin) at (0,-2);
\coordinate (YAxisMax) at (0,10);
\draw [thin, black,-latex] (XAxisMin) -- (XAxisMax);% Draw x axis
\draw [thin, black,-latex] (YAxisMin) -- (YAxisMax);% Draw y axis
\begin{scope}
\clip (0, 0) rectangle (8cm,4cm);
\coordinate (Bone) at (0,2);
\coordinate (Btwo) at (4,2);
%\coordinate (Bthree) at (2, 4);
\draw[style=help lines,dashed] (-14,-14) grid[step=2cm] (14,14);
\foreach \x in {-7,-6,...,7}{% Two indices running over each
\foreach \y in {-7,-6,...,7}{% node on the grid we have drawn
\node[draw,circle,inner sep=2pt,fill] at (4*\x, 4*\x + 2*\y) {};
% Places a dot at those points
}
}
%\draw [ultra thick,-latex,red] (Origin)
% -- (Bthree) node [above, right] {$b_3$};
\fill[fill=gray, fill opacity=0.3, draw=black] (4,2) ellipse (3cm and 1.75cm);
\end{scope}
\spy on (0,0) in node at (2,6);
\spy on ({.45*4},0) in node at (2,6);
\spy on (0,{.45*2}) in node at (2,6);
\spy on ({.45*4},{.45*2}) in node at (2,6);
\end{tikzpicture}
\end{document}
要使间谍图像更大,可以使用选项magnification
。但请注意,由于您不是使用常规圆形或正方形进行间谍操作,因此需要明确说明间谍图像的高度和宽度:
\documentclass[border=1mm, tikz]{standalone}
\usetikzlibrary{spy}
\begin{document}
\begin{tikzpicture}[scale=0.45, spy using overlays={black!0, height={2*0.45*4cm}, width={2*0.45*8cm}, anchor=south west, magnification=2}]
\coordinate (Origin) at (0,0);
\coordinate (XAxisMin) at (-3,0);
\coordinate (XAxisMax) at (10,0);
\coordinate (YAxisMin) at (0,-2);
\coordinate (YAxisMax) at (0,10);
\draw [thin, black,-latex] (XAxisMin) -- (XAxisMax);% Draw x axis
\draw [thin, black,-latex] (YAxisMin) -- (YAxisMax);% Draw y axis
\begin{scope}
\clip (0, 0) rectangle (8cm,4cm);
\coordinate (Bone) at (0,2);
\coordinate (Btwo) at (4,2);
%\coordinate (Bthree) at (2, 4);
\draw[style=help lines,dashed] (-14,-14) grid[step=2cm] (14,14);
\foreach \x in {-7,-6,...,7}{% Two indices running over each
\foreach \y in {-7,-6,...,7}{% node on the grid we have drawn
\node[draw,circle,inner sep=2pt,fill] at (4*\x, 4*\x + 2*\y) {};
% Places a dot at those points
}
}
%\draw [ultra thick,-latex,red] (Origin)
% -- (Bthree) node [above, right] {$b_3$};
\fill[fill=gray, fill opacity=0.3, draw=black] (4,2) ellipse (3cm and 1.75cm);
\end{scope}
\spy on (0,0) in node at (2,6);
\spy on ({.45*4},0) in node at (2,6);
\spy on (0,{.45*2}) in node at (2,6);
\spy on ({.45*4},{.45*2}) in node at (2,6);
\end{tikzpicture}
\end{document}