4

Thanks to @marmot I have drawn a square lattice of springs in TikZ. See the code appended. However, I would like to encircle that lattice with a polygon of a coloured background (in light-gray let's say) beyond which the network is no longer extended. A similar example is given in the photo. Thank you for the help in advance.

\documentclass[14pt,a4]{article}
\usepackage{tikz}
\usetikzlibrary{svg.path}
\usepackage{fourier-orns}
\usepackage{multido}
\usepackage[mathscr]{euscript}

\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}
\clip (-1,-1) rectangle (11,11);
\foreach \X in {-2,0,...,10}
{\foreach \Y in {-2,0,...,10}
{\draw[decorate,decoration={coil,aspect=0.5,amplitude=1.5mm, segment length=1.5mm}] (\X,\Y) -- ++(0,2) -- ++(2,0);
\node[circle,inner color=black,outer color=white] at (\X,\Y) {$\bullet$};}}
\end{tikzpicture}
\end{document}

3

Something like this?

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}
\draw[gray,decorate,decoration={coil,aspect=0,segment length=4.5mm}] 
plot[smooth cycle,tension=0.3] coordinates {(-0.75,-0.75) (10.75,-0.75)
 (10.75,10.75) (-0.75,10.75)};
\clip decorate [decoration={coil,aspect=0,segment length=4.5mm}] 
{plot[smooth cycle,tension=0.3] coordinates {(-0.75,-0.75) (10.75,-0.75)
 (10.75,10.75) (-0.75,10.75)}};
\foreach \X in {-2,0,...,10}
{\foreach \Y in {-2,0,...,10}
{\draw[decorate,decoration={coil,aspect=0.5,amplitude=1.5mm, segment length=1.5mm}] (\X,\Y) -- ++(0,2) -- ++(2,0);
\node[circle,inner color=black,outer color=white] at (\X,\Y) {$\bullet$};}}
\end{tikzpicture}
\end{document}

enter image description here

Or without wiggles.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}
\draw[gray] 
plot[smooth cycle,tension=0.3] coordinates {(-0.75,-0.75) (10.75,-0.75)
 (10.75,10.75) (-0.75,10.75)};
\clip plot[smooth cycle,tension=0.3] coordinates {(-0.75,-0.75) (10.75,-0.75)
 (10.75,10.75) (-0.75,10.75)};
\foreach \X in {-2,0,...,10}
{\foreach \Y in {-2,0,...,10}
{\draw[decorate,decoration={coil,aspect=0.5,amplitude=1.5mm, segment length=1.5mm}] (\X,\Y) -- ++(0,2) -- ++(2,0);
\node[circle,inner color=black,outer color=white] at (\X,\Y) {$\bullet$};}}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.