[CM] cart to polar
Anders Vinjar
andersvi at notam02.no
Sun Jul 6 03:54:04 PDT 2003
>>>>> "f" == fdowling <fdowling at 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)
More information about the Cmdist
mailing list