[Tex/LaTex] Drawing a mapping between arbitrary domains

mappingtikz-pgf

I would like to draw a kind of diagram for mapping $\varphi:D\to D'$. Domains $D$ and $D'$ should look rather arbitrarily. I consider doing it with tikz but I do not know how to produce such nice curves for boundaries of domains.

enter image description here

After a while I got solution like this

\documentclass{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
\begin{document}
\begin{tikzpicture}
\draw plot [smooth cycle] coordinates {(5,0.25) (6,0.35) (6.5, 0.2) (7,0.5) (7,1.65) (6.5,2.75) (5.8,2.75) (5.3,1.45) (4.8,0.85) } node at (6,1.7) {$D'$};
\path[->] (3.1,1.7) edge [bend left] node[above] {$\varphi$} (5.0,1.7);
\draw plot [smooth cycle] coordinates {(1.0,.1)(1.5,.2)(2.8,.5)(2.9,1.5)(2.8,2.8)(1.4,2.5)(0.5,0.5)} node at (1.8,1.7) {$D$};
\end{tikzpicture}
\end{document}

enter image description here

Best Answer

Without TikZ. The shape is not exactly identical to your sketch above but I think it does not matter, doesn't it?

enter image description here

\documentclass[pstricks]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[showgrid=false](4,3)
    \psccurve(.5,.1)(1.4,.5)(1,2)(.6,2.9)(.2,2.5)(.2,1)
    \psccurve(2.7,.1)(3.8,.5)(3.5,1.5)(3.8,2.8)(2.6,2.5)(2.6,0.5)
    \pnode(.8,1.5){D}
    \rput[r](D){$D$}
    \pnode(2.7,1.5){D'}
    \rput[l](D'){$D'$}
    \pcarc[arcangle=30,nodesep=.5]{->}(D)(D')
    \naput{$\varphi$}
\end{pspicture}
\end{document}