How to modify TikZ patterns

The Task: Draw a ground for a tank.

My solution: Using TikZ patterns library (see page 171 of the TikZ & PGF manual).

MWE:

\documentclass{scrartcl}
\usepackage{stanli}% loads TikZ, see: https://ctan.org/pkg/stanli

\usetikzlibrary{patterns}

\begin{document}

\begin{tikzpicture}

% ground
\draw
[very thick] (0, 0) -- (5, 0);
% for comparison
\support{3}{0, 0};% stanli
\filldraw         % tikz
[pattern = north east lines] (1, 0) rectangle (5, -.4);
% tank
\draw
(5, 0)     .. controls (5, 1) and (5.1, 1.1)
.. (5.5, 1.1)
(5.5, 1.4) .. controls (5.1, 1.4) and (5, 1.5)
.. (5, 2.5) -- (5, 5)
(5, 4) -- (0, 4)
(0, 5) -- (0, 0);
% atmospheric pressure
\node at (6, 5) {$p_0$};
% density
\node at (1, 3) {$\varrho$};
% inflow
\draw
[->] (-.5, 5.5) .. controls (-.25, 5.5) and (.25, 5.5)
.. node[sloped, above] {Zufluss}
(.5, 4.25);
\draw
(4, 4) -- (4.15, 4.3) -- (3.85, 4.3) -- cycle
(3.85, 3.9) -- (4.15, 3.9)
(3.90, 3.8) -- (4.10, 3.8)
(3.95, 3.7) -- (4.05, 3.7);
% velocity
% v_1
\draw
[->] (2.5,4) node[above] {1} -- node[sloped, above, at end] {$v_1$} (2.5, 3);
%v_2
\draw
[->] (5.5, 1.25) node[above = 5pt] {2} -- node[above, at end] {$v_2$} (6.5, 1.25);
% flow line
\draw
[dashed] (2.5, 2.9) .. controls (3, 2) and (5, 1.25)
.. (5.4, 1.25);
% coordinate system
\support{3}{7.5, 1.25};
\draw
[->,dashed] (7, 1.25) -- node[sloped, above, at end] {$z$} (7, 2.5);
% height
\dimensioning{2}{8, 1.25}{8, 4}{8}[$h$];

\end{tikzpicture}

\end{document}

The result: Right is the ground drawn by Tikz. That isn't nice (my opinion). Can I somehow modify the north east lines pattern, so that the ground for the tank looks like a ground drawn by the stanli package (for example \support{3}{coordinates}). The ground comes with the stanli package, if observe strictly, isn't a ground, but I like it and would use it here, but it has fixed length.

An completely different solution, which gives the same result for the ground like done by the stanli package (even with different length) is welcome too. Any suggestions?

P. S. Any other optimizations or criticism are welcome too!

Thank you for your help and effort in advance!

• Your result image has no anti-aliasing. If I just compile the tikZ-part with the north east lines to PDF it looks fine and smooth. So maybe the problem is your compile method or the viewer software. – dexteritas Sep 20 '18 at 13:53
• I agree with @dexteritas and would like to draw your attention to this cool answer in which flexible north east lines were introduced: you can adjust the distances etc. – user121799 Sep 20 '18 at 14:03
• Hello @dexteritas! Thank you for your comment! This is strange. I use Adobe Acrobat Pro DC 15.010.20059.40980 and have on my both computers this aliasing effect, even if I zoom up to 800%. – Su-47 Sep 21 '18 at 11:17

All I did was to copy the flexible hatch pattern from this answer and to adjust two parameters.

\documentclass{scrartcl}
\usepackage{stanli}% loads TikZ, see: https://ctan.org/pkg/stanli

\usetikzlibrary{patterns}
% from https://tex.stackexchange.com/a/29367/121799
\tikzset{
hatch distance/.store in=\hatchdistance,
hatch distance=10pt,
hatch thickness/.store in=\hatchthickness,
hatch thickness=2pt
}

\makeatletter
\pgfdeclarepatternformonly[\hatchdistance,\hatchthickness]{flexible hatch}
{\pgfqpoint{0pt}{0pt}}
{\pgfqpoint{\hatchdistance}{\hatchdistance}}
{\pgfpoint{\hatchdistance-1pt}{\hatchdistance-1pt}}%
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\hatchthickness}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{\hatchdistance}{\hatchdistance}}
\pgfusepath{stroke}
}
\makeatother

\begin{document}

\begin{tikzpicture}

% ground
\draw
[very thick] (0, 0) -- (5, 0);
% for comparison
\support{3}{0, 0};% stanli
\filldraw         % tikz
[pattern=flexible hatch,
hatch distance=5pt,
hatch thickness=0.3pt] (1, 0) rectangle (5, -.4);
% tank
\draw
(5, 0)     .. controls (5, 1) and (5.1, 1.1)
.. (5.5, 1.1)
(5.5, 1.4) .. controls (5.1, 1.4) and (5, 1.5)
.. (5, 2.5) -- (5, 5)
(5, 4) -- (0, 4)
(0, 5) -- (0, 0);
% atmospheric pressure
\node at (6, 5) {$p_0$};
% density
\node at (1, 3) {$\varrho$};
% inflow
\draw
[->] (-.5, 5.5) .. controls (-.25, 5.5) and (.25, 5.5)
.. node[sloped, above] {Zufluss}
(.5, 4.25);
\draw
(4, 4) -- (4.15, 4.3) -- (3.85, 4.3) -- cycle
(3.85, 3.9) -- (4.15, 3.9)
(3.90, 3.8) -- (4.10, 3.8)
(3.95, 3.7) -- (4.05, 3.7);
% velocity
% v_1
\draw
[->] (2.5,4) node[above] {1} -- node[sloped, above, at end] {$v_1$} (2.5, 3);
%v_2
\draw
[->] (5.5, 1.25) node[above = 5pt] {2} -- node[above, at end] {$v_2$} (6.5, 1.25);
% flow line
\draw
[dashed] (2.5, 2.9) .. controls (3, 2) and (5, 1.25)
.. (5.4, 1.25);
% coordinate system
\support{3}{7.5, 1.25};
\draw
[->,dashed] (7, 1.25) -- node[sloped, above, at end] {$z$} (7, 2.5);
% height
\dimensioning{2}{8, 1.25}{8, 4}{8}[$h$];

\end{tikzpicture}

\end{document} To an ordinary marmot's eye they are almost indistinguishable. Notice that at lower zoom the pattern does indeed look a bit weird on preview and even on acroread, but as @dexteritas points out, these are viewer issues that go away once one zooms in.

• Hellp @marmot! Thank you for your answer! The adviced answer provided many acknowledgement! At least one thing: How can I delete the frame around the flexible hatch pattern? – Su-47 Sep 21 '18 at 11:18
• @Su-47 Instead of \filldraw just say \fill or \path (in this case) n order to only fill put not draw. – user121799 Sep 21 '18 at 12:03