[CM] cart to polar

Anders Vinjar andersvi@notam02.no
06 Jul 2003 12:54:04 +0200


>>>>> "f" == fdowling  <fdowling@tcd.ie> writes:

    f> Hi, Is there a function that returns the polar value from
    f> cartesian co-ords?  Cheers, Fergal Dowling.

> (defun cartesian-to-polar (coords)
   (let* ((x (car coords))
          (y (cadr coords))
          (r (sqrt (+ (expt x 2) (expt y 2))))
          (ang (- (atan y x))))
     (list r ang)))


CARTESIAN-TO-POLAR

> (cartesian-to-polar (list 1 1))

(1.4142135 -0.7853982)