// angle is in radians for faster calculations srecord PolarPt(double length, double angle) { Pt toPt() { ret pt(length*cos(angle), length*sin(angle)); } *(Pt p) { angle = atan2(p.x, p.y); length = p.length(); } }