Disclaimer
This is the first picture I ever made using asymptote
, so please comment.
I adapted a tikz
answer I gave once here: Plot basic complex transformation in LaTeX
TikZ Code
\documentclass[tikz]{standalone}\usetikzlibrary{decorations.markings}\tikzset{ arrow inside/.style = { postaction = { decorate, decoration={ markings, mark=at position 0.5 with {\arrow{>}} } } }}\begin{document}\begin{tikzpicture}[>=latex,scale=1.5] \begin{scope} % Axes \draw (0,0) node[below left] {$O$} (-0.5,0) -- (4,0) node[below] {$x$} (0,-0.5) -- (0,3) node[left] {$y$}; % Ticks \draw (1,0) -- (1,-0.1) node[below] {$a$} (3,0) -- (3,-0.1) node[below] {$b$} (0,1) -- (-0.1,1) node[left] {$c$} (0,2) -- (-0.1,2) node[left] {$d$}; % Square \draw[thick] (1,1) node[below left] {$A$} -- (3,1) node[below right] {$B$} -- (3,2) node[above right] {$C$} -- (1,2) node[above left] {$D$} -- cycle; \draw[arrow inside] (1.5,1) -- (1.5,2); \end{scope} \begin{scope}[xshift=6cm] % Axes \draw (0,0) node[below left] {$O$} (-0.5,0) -- (4,0) node[below] {$u$} (0,-0.5) -- (0,3) node[left] {$v$}; %Help Lines \draw (0,0) -- (30:3) (0,0) -- (70:3); % Angles \draw[->] (0.6,0) arc[start angle=0, end angle=70, radius=0.6] node[above right] {\small $\phi = d$}; \draw[->] (0.8,0) node[above right] {\small$\phi = c$} arc[start angle=0, end angle=30, radius=0.8]; % Transformation \draw[thick] (30:1.5) node[right] {$A'$} -- (30:3) node[below right] {$B'$} arc[start angle=30, end angle=70, radius=3] (70:3) node[above right] {$C'$} -- (70:1.5) node[above left] {$D'$} arc[start angle=70, end angle=30, radius=1.5]; \draw[arrow inside] (30:1.9) arc[start angle=30, end angle=70, radius=1.9]; \end{scope}\end{tikzpicture}\end{document}
Asymptote Code
\documentclass{standalone}\usepackage[inline]{asymptote}\begin{document}\begin{asy} import geometry; settings.outformat = "pdf"; unitsize(1.5cm); picture realpane; unitsize(realpane,1.5cm); real x = 4.0, y = 3.0; real a = 1.0, b = 3.0, c = 1.0, d = 2.0; // Axes label(realpane, "$O$", (0,0), align=SW); draw(realpane, (-0.5,0) -- (x,0), L=Label("$x$", align=S, position=EndPoint)); draw(realpane, (0,-0.5) -- (0,y), L=Label("$y$", align=W, position=EndPoint)); // Ticks draw(realpane, (a,0) -- (a,-0.1), L=Label("$a$",align=S)); draw(realpane, (b,0) -- (b,-0.1), L=Label("$b$",align=S)); draw(realpane, (0,c) -- (-0.1,c), L=Label("$c$",align=W)); draw(realpane, (0,d) -- (-0.1,d), L=Label("$d$",align=W)); // Square draw(realpane, box((a,c),(b,d)), p=linewidth(2)); label(realpane, "$A$", (a,c), align=SW); label(realpane, "$B$", (b,c), align=SE); label(realpane, "$C$", (b,d), align=NE); label(realpane, "$D$", (a,d), align=NW); draw(realpane, (a+0.5,c) -- (a+0.5,d), arrow=MidArrow()); picture complexpane; unitsize(complexpane,1.5cm); pair A = 1.5*dir(30), B = 3*dir(30), C = 3*dir(70), D = 1.5*dir(70); // Axes label(complexpane, "$O$", (0,0), align=SW); draw(complexpane, (-0.5,0) -- (x,0), L=Label("$u$", align=S, position=EndPoint)); draw(complexpane, (0,-0.5) -- (0,y), L=Label("$v$", align=W, position=EndPoint)); // Help Lines draw(complexpane, (0,0) -- B); draw(complexpane, (0,0) -- C); // Angles draw(complexpane, arc((x,0),(0,0),D,0.6), L=Label("$\phi = d$", align=NE, position=EndPoint), arrow=Arrow()); draw(complexpane, arc((x,0),(0,0),A,0.8), L=Label("$\phi = c$", align=E, position=MidPoint), arrow=Arrow()); // Transformation draw(complexpane, A -- B -- arc(B,(0,0),C,3) -- C -- D -- arc(D,(0,0),A,1.5), p=linewidth(2)); label(complexpane, "$A'$", A, align=E); label(complexpane, "$B'$", B, align=SE); label(complexpane, "$C'$", C, align=NE); label(complexpane, "$D'$", D, align=NW); draw(complexpane, arc(B,(0,0),C,1.9), arrow=MidArrow()); add(realpane.fit(),(0,0),W); add(complexpane.fit(),(0,0),E);\end{asy}\end{document}
Corrected Asymptote code
Thanks to Charles Staats comments, I was able to improve the code and get rid of the extra picture
stuff.
\documentclass{standalone}\usepackage[inline]{asymptote}\begin{document}\begin{asy} import geometry; settings.outformat = "pdf"; unitsize(1.5cm); pen thick = linewidth(1.6pt); real x = 4.0, y = 3.0; real a = 1.0, b = 3.0, c = 1.0, d = 2.0; // Axes label("$O$", (0,0), align=SW); draw((-0.5,0) -- (x,0), L=Label("$x$", align=S, position=EndPoint)); draw((0,-0.5) -- (0,y), L=Label("$y$", align=W, position=EndPoint)); // Ticks draw((a,0) -- (a,-0.1), L=Label("$a$",align=S)); draw((b,0) -- (b,-0.1), L=Label("$b$",align=S)); draw((0,c) -- (-0.1,c), L=Label("$c$",align=W)); draw((0,d) -- (-0.1,d), L=Label("$d$",align=W)); // Square draw(box((a,c),(b,d)), p=thick); label("$A$", (a,c), align=SW); label("$B$", (b,c), align=SE); label("$C$", (b,d), align=NE); label("$D$", (a,d), align=NW); draw((a+0.5,c) -- (a+0.5,d), arrow=MidArrow()); currentpicture = shift(-6,0)*currentpicture; pair A = 1.5*dir(30), B = 3*dir(30), C = 3*dir(70), D = 1.5*dir(70); // Axes label("$O$", (0,0), align=SW); draw((-0.5,0) -- (x,0), L=Label("$u$", align=S, position=EndPoint)); draw((0,-0.5) -- (0,y), L=Label("$v$", align=W, position=EndPoint)); // Help Lines draw((0,0) -- B); draw((0,0) -- C); // Angles draw(arc((x,0),(0,0),D,0.6), L=Label("$\phi = d$", align=N+1.5E, position=EndPoint), arrow=ArcArrow()); draw(arc((x,0),(0,0),A,0.8), L=Label("$\phi = c$", align=E, position=MidPoint), arrow=ArcArrow()); // Transformation draw(A -- B -- arc(B,(0,0),C,3) -- C -- D -- arc(D,(0,0),A,1.5), p=thick); label("$A'$", A, align=SE); label("$B'$", B, align=SE); label("$C'$", C, align=NE); label("$D'$", D, align=NW); draw(arc(B,(0,0),C,1.9), arrow=MidArcArrow()); add(realpane.fit(),(0,0),W); add(complexpane.fit(),(0,0),E);\end{asy}\end{document}