movemesh.edp (148 Bytes)

I am trying to transfer cartesian coordinate to polar by using movemesh, I am getting error due to inverse tan function for (0,0). How to resolve the issue? Please help.

Shall I need to define atan(y/x) for (0,0) and (0,y) separately? If so how?

int n=64;

border C(t=0,2*pi){x=cos(t);y=sin(t);}

mesh Th=buildmesh(C(n));

mesh Sh=movemesh(Th,[atan(y/x), sqrt(x^2+y^2)]);

plot(Sh,wait=true);