4

Is there a way to draw irregular, closed (2D) shapes, i.e. patatoids, using tikz? Something like these: enter image description here

The ability to access the tangential and perpendicular directions to them at any given point, as well as to scale their sizes, would also be useful.

The shapes must not change as the document is compiled multiple times.

Thank you for your effort, it is very appreciated.

1 Answer 1

6
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{hobby, decorations.markings, arrows.meta}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut]
\newcommand{\curve}{(-2,-1) .. (1,-2) .. (2,2) .. (0,1)}
\draw[
closed,
decoration={
  markings,
  mark=at position 0.2 with {\draw[red, thick, -Stealth] (0,0) -- (0.6,0); \draw[thick, -Stealth] (0,0) -- (0,0.6);},
  mark=at position 0.3 with {\draw[red, thick, -Stealth] (0,0) -- (0.6,0); \draw[thick, -Stealth] (0,0) -- (0,0.6);},
  mark=at position 0.7 with {\draw[red, thick, -Stealth] (0,0) -- (0.6,0); \draw[thick, -Stealth] (0,0) -- (0,0.6);},
 },  
postaction={decorate},
] \curve;
\draw[closed, scale=0.8] \curve;
\draw[closed, scale=0.6] \curve;
\draw[closed, scale=0.4] \curve;
\end{tikzpicture}
\end{document}

Concentric curves with tangent arrows

1
  • Thank you for the fast answer! Commented Jan 13, 2022 at 22:18

You must log in to answer this question.

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