[Tex/LaTex] Drawing curves with LaTeX

drawgraphicstechnical-drawingtikz-pgf

Using LaTeX how can I draw a generic smooth closed curve (in 2D) and one other generic smooth curve joining two points on the first curve? I also need to write labels for the curves and each of the domains in which they divide the space.


The most I can do with LaTeX (with respect to drawings) is plotting cirlces, ellipses and circle arcs as follows

\usepackage{tikz}
\draw (2,2) circle (3cm);
\draw (2,2) ellipse (3cm and 1cm);
\draw (3,0) arc (0:75:3cm);
\begin{tikzpicture}
\end{tikzpicture}

Example of closed curve:

Example of Jordan curve (closed) – from Mathworld:

Best Answer

There is a dedicated library for that, hobby. However, something similar to your curves can be drawn with plain TikZ. Note that I didn't attempt to reproduce them very precisely since you seem to want generic curves.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[set mark/.style args={#1 at #2}{postaction={decorate,
decoration={markings,mark=at position #2 with #1}}}]
 \begin{scope}[local bounding box=Jordan]
  \draw plot[smooth cycle] coordinates {(-2.5,0.5) (-1.5,0.5) (-1.5,-0.5)
  (-2,-0.5) (-2,0)};
  \draw plot[smooth cycle,tension=1.1] coordinates {(60:1) (-70:1) (-120:1) (110:1)};
 \end{scope}
 \node[anchor=north] at (Jordan.south) {Jordan curves};
 %
 \begin{scope}[local bounding box=nonJordan,xshift=5cm]
  \draw (-1.5,1) to[out=-110,in=180] (-1.2,-1) to[out=0,in=-70] (-0.9,1);
  \draw (-0.3,1) to[out=-110,in=0] (0,-1) to[out=180,in=-70] (0.3,1);
  \draw (1.3,-1) to[out=90,in=-90] (2.1,1) to[out=90,in=90,looseness=1.5] (1.5,1)
  to[out=-90,in=90] (1.9,-1) to[out=-90,in=-90,looseness=1.5] cycle;
 \end{scope}
 \node[anchor=north] at (nonJordan.south) {Non--Jordan curves};
 %
 \begin{scope}[xshift=10cm]
   \draw[set mark={{\node at (0,0.3) {1};}} at 0,set mark={\coordinate (1);} at 0.25,
  set mark={{\node at (0,0.3) {2};}} at 0.5,set mark={\coordinate (2);} at 0.75] plot[smooth cycle,tension=1.1] coordinates {(60:1) (-70:1) (-120:1) (110:1)};
  \draw (1) to[out=30,in=150] node[midway,below right] {3} (2);
 \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

On the very right you see how one may connect two points on the curve by another curve, and how they can be labeled.

Related Question