[PD] zexy 1.1 bugfix (was: cart2sph)

Mathieu Bouchard matju at sympatico.ca
Fri Nov 22 19:52:18 CET 2002


On Fri, 22 Nov 2002, Robert Figura wrote:
> On 21 Nov, bbogart at ryerson.ca wrote:
> PHI is all right, but if:
>   atan2f(a,b) := atan(a/b)

that's almost true, yes.

> then THETA is wrong (wrong parameter order), corrected:

It is wrong only if the documentation says it should be otherwise. But
colatitude is very often used. For example, when I was in 13th grade we
were doing jacobian coordinate transforms, and we learned spherical
coordinates using colatitude instead of latitude.

> BTW: atan2(a,b) is a standard c function? Makes sense in case b is zero.
>      So i had had no need to implement it myself?

atan2 is a standard C function; it's the only inverse trigonometric
function you really need, and all other ones may be derived from it.
Atan2 is so convenient. I remember coding it by hand in terms of ATN()
when i used the BASIC language long ago.

It is true it works even when b is zero, but there's also another neat
feature: it has a 2pi radian range instead of just pi -- it uses both
signs of a and b to compute the result.

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju





More information about the Pd-list mailing list