spherical coordinates
Peter Maas
peter.maas at mplusr.de
Wed Apr 14 09:16:42 EDT 2004
Paul McGuire wrote:
>>Peter Maas <peter.maas at mplusr.de> writes:
>>
>>>r = sqrt(x**2 + y**2)
>>>phi = atan(y/x)
>>
>>Better use phi=atan2(y,x) in case x=0. Similarly for the other atan
>
> calls.
>
> These are formulas for cylindrical coordinates.
r and phi are 2D spherical coordinates. You have to add a 3rd coordinate
(usually called z) to get cylindrical coordinates.
> The OP was asking for
> spherical coordinates rho, theta, and phi, where:
The OP was asking for spherical coordinates without mentioning
variables or dimensions. I posted the raw 2D and 3D formulas without
bothering about error handling or other implementation issues.
Mit freundlichen Gruessen,
Peter Maas
--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------
More information about the Python-list
mailing list