How to rotate with respect to a specific point in Asymptote?
According to what I find it suffices to change the order. (I hope you do not mind me switching to ayspictureB
, you only need to compile with pdflatex -shell-escape
.)
\documentclass{article}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=robo}
size(5cm);
path p = circle((0,3),1);
for(int i=0; i<=10; ++i)
{
draw(
rotate(
(i*pi/18),(0,0)
)*p
);
}
\end{asypicture}
\end{document}
In order to arrive at something reminiscent of your screen shot, supply units. (It appears to me that otherwise the units are taken to be pt, and the angle conventions seem to be as unfortunate as in TikZ, even though I thought this was not the case. At least if I use degrees, the result is consistent.)
\documentclass{article}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=robo}
size(5cm);
path p = circle((0,3cm),1cm);
for(int i=0; i<=10; ++i)
{
draw(
rotate(
(i*10),(0,0)
)*p
);
}
\end{asypicture}
\end{document}
You don't actually need asypictureB (or the more modern asymptote.sty package) or even the LaTeX commands if you run this example directly with asy.
The point of specifying size(5cm); is so you don't have to specify the units. You can instead specify unitsize(1cm); if you are working in cm. Here is a simplified version, rotating through 9 increments each of 10 degrees:
size(5cm);
path p=circle((0,3),1);
for(int i=0; i < 10; ++i)
draw(rotate((i*10),(0,0))*p);