点到圆心的距离
Mathf.Sqrt(p.x * p.x + p.y * p.y);
极坐标的角度
float a = (Mathf.Atan2(p.y, p.x) + Mathf.PI) / (Mathf.PI * 2);
笛卡尔坐标系转极坐标
float r = Mathf.Sqrt(p.x * p.x + p.y * p.y); float a = (Mathf.Atan2(p.y, p.x) + Mathf.PI) / (Mathf.PI * 2); return new Vector2(r, a);
极坐标转笛卡尔坐标系
float x = Mathf.Sqrt(r) * Mathf.Cos(a * Mathf.PI); float y = Mathf.Sqrt(r) * Mathf.Sin(a * Mathf.PI); return new Vector2(x, y);