public static PointD ToCartesian(RadialPointD location, PointD origin) { PointD p = new PointD(); p.X = location.R * Math.Cos(location.Theta); p.Y = location.R * Math.Sin(location.Theta); return p + origin; }
public static RadialPointD ToPolar(PointD location, PointD origin) { PointD v = location - origin; RadialPointD n = new RadialPointD(); n.m_r = v.Magnitude(); n.m_theta = Math.Atan2(v.Y, v.X); return n; }