2

Is it possibile to reproduce this pattern using tikz? enter image description here

5
  • 1
    Yes, it is possible.
    – MS-SPO
    Commented Aug 20, 2022 at 8:32
  • Do you really need a hammersledge like tikz for a coloured rectangle? A simple coloured \rule{width}{height} will do.
    – Bernard
    Commented Aug 20, 2022 at 8:34
  • @Bernard it is a repeated circle segment pattern not a solid fill Commented Aug 20, 2022 at 8:35
  • @DavidCarlisle: unfortunately, this cannot be seen on my screen.
    – Bernard
    Commented Aug 20, 2022 at 8:40
  • It's possible, for example by creating a pic of concentric circles and use nested foreach loops into a clip. What did you try already?
    – SebGlav
    Commented Aug 20, 2022 at 8:44

3 Answers 3

11

Here is one of the approaches using a couple of foreach loops

\documentclass{article}
\usepackage{tikz}

\colorlet{darkBrown}{black!90!brown}
\pagecolor{darkBrown}

\begin{document}

\begin{tikzpicture}[transform canvas={shift={(-7,5)}}]
\foreach \j [evaluate={\p=mod(\j,2)}] in {1,...,30}{
    \foreach \i in {1,...,6}{
        \foreach \s in {1,...,8}{
            \path[fill=darkBrown!70!gray,preaction={draw=darkBrown,line width=5pt}] (4.2*\i-2*\p,-\j) circle (2.25-\s*0.25);
        }
    }
}
\end{tikzpicture}

\end{document}

enter image description here

2
  • Could you explain why do you need transform canvas here?
    – Black Mild
    Commented Sep 29, 2022 at 16:17
  • @BlackMild only to cover the whole page. You can remove this option and you will see how the whole composition is offset.
    – antshar
    Commented Sep 29, 2022 at 23:07
6

A very raw solution, which doesn't allow easy customization but to give you an idea of what is possible. Different enough from previous answer to let you see another approach:

japanese pattern

\documentclass{article}
\usepackage{tikz}

\newcommand{\mypattern}%
    {
    \fill[orange]circle(1);
    \foreach \i in {0.125,0.25,...,1}
        {
        \draw[purple,line width=2pt] (0,0) circle(\i);
        }
    }
\begin{document}
    \begin{tikzpicture}
        \clip (0,0) rectangle (8,-6);
        \foreach \k in {0,1,...,14}
            {
            \pgfmathtruncatemacro{\xs}{(-1)^\k}
            \begin{scope}[yshift=-0.5*\k cm, xshift=0.5*\xs cm]         
                \foreach \j in {0,1,...,4}
                    {
                    \begin{scope}[xshift=2*\j cm]
                        \mypattern
                    \end{scope}     
                    }
            \end{scope}
            }
    \end{tikzpicture}
\end{document}
3

Let me translate TikZ answer of @SebGlav to Asymptote.

enter image description here

// an user-defined pattern
// Run on http://asymptote.ualberta.ca/
// translation from SebGlav
// https://tex.stackexchange.com/a/654632/140722
unitsize(1cm);
size(10cm);
pen penfill=brown;
pen pendraw=lightblue;

picture mypattern(){
picture pic;  
fill(pic,unitcircle,penfill);
for(int i=0; i<8; ++i) 
  draw(pic,circle((0,0),.125i),pendraw+2pt);
return pic;}

for(int k=0; k<16; ++k)
for(int j=0; j<5;  ++j){
int xs=(-1)^k;
transform t=shift(.5xs+2j,-.5k);
add(t*mypattern());  
}
clip(box((0,0),(8,-5)));
 
shipout(bbox(5mm,invisible));

A shorter code:

enter image description here

size(10cm);
picture mypattern(){
picture pic;  
fill(pic,unitcircle,gray);
for(int i=0; i<8; ++i) 
draw(pic,circle((0,0),.125i),yellow+2pt);
return pic;}

for(int k=0; k<16; ++k)
for(int j=0; j<5;  ++j)
add(shift(.5(-1)^k+2j,-.5k)*mypattern());  

clip(box((0,0),(8,-5)));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .