0

Attempting to reproduce this picture from an old book (sorry for the resolution)

enter image description here

I used tikz's patterns library to generate the grid, which provides an honorable result.

enter image description here

However, with the default grid patterns, it doesn't seem to be possible to have a grid parallel to the borders of the path, as in this case obtained using a foreach-based grid.

enter image description here

While this solution works fine, it requires potential fine tuning. So, is there a way to define grid patterns for 4 sided paths with parallel borders (of course, this could make no sense for some other shapes) where the grid is parallel to the borders

Here is the code used to generate the pictures

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc,patterns.meta}

\begin{document}
    \begin{tikzpicture}[]

    \draw[pattern={Hatch[distance=5pt]}] (0,0) -- (1,0) to[out=120,in=-95] (1,4) -- (0,4) to[out=-95,in=120] (0,0);
    \begin{scope}[xshift=3cm]
        \coordinate (sw) at (0,0);
        \coordinate (se) at (1,0);
        \coordinate (nw) at (0,4);
        \coordinate (ne) at (1,4);
        \pgfmathsetmacro{\gridstep}{5}
        \path[clip,preaction={draw=black}] (sw) -- (se) to[out=120,in=-95] (ne) -- (nw) to[out=-95,in=120] (sw);
        \draw 
        foreach \xpos in {1,...,10}{($(sw)+(\xpos*\gridstep pt,0)$) to[out=120,in=-95] ($(nw)+(\xpos*\gridstep pt,0)$)}
        foreach \ypos in {1,...,30}{($(-5,0)+(0,\ypos*\gridstep pt)$) -- ($(10,0)+(0,\ypos*\gridstep pt)$)}
        ;
    \end{scope}
    \end{tikzpicture}

\end{document}
BambOo
  • 8,801
  • 2
  • 20
  • 47

0 Answers0