//Converts a cartesian coordinate pair to polar
 private void ConvertFromCartesian(MMUnits units, double x, double y, out double xTheta, out double yR)
 {
     double radiusTemp;
     if (units == MMUnits.mmCartesian)
     {
         xTheta = x;
         yR = y;
     }
     else
     {
         radiusTemp = Math.Sqrt(x * x + y * y);
         xTheta = Math.Atan2(y, x);
         if (units == MMUnits.mmDegrees)
             xTheta *= 180.0 / Math.PI;
         else if (units == MMUnits.mmGradians)
             xTheta *= 200.0 / Math.PI;
         yR = radiusTemp;
     }
 }
 //Converts a graph coordinate pair to cartesian from polar coordinates
 private void ConvertToCartesian(MMUnits units, double xTheta, double yR, out double x, out double y)
 {
     double angleTemp;
     if (units == MMUnits.mmCartesian)
     {
         x = xTheta;
         y = yR;
     }
     else
     {
         angleTemp = xTheta;
         if (units == MMUnits.mmDegrees)
             angleTemp *= Math.PI / 180.0;
         else if (units == MMUnits.mmGradians)
             angleTemp *= Math.PI / 200.0;
         x = yR * Math.Cos(angleTemp);
         y = yR * Math.Sin(angleTemp);
     }
 }