atan2 - or what Squeak called #arcTan:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
cbc
Reply | Threaded
Open this post in threaded view
|

atan2 - or what Squeak called #arcTan:

cbc
Hi all,  Just thought I'd share, mostly.

I'm working on a little project to build vsdx files, and one part of it talks about pulling in the right angle, and was somewhat cryptic "use the ATAN2(Y,X)". So, I looked it up, then went hunting in Squeak to see where it was.

It turns out it it is the arcTan: function.  And after some emperical experimenting, teh X and Y map out to:

ATAN2(y,x) = y arcTan: x

So, found what I need.

That said, the documentation in the various methods are interesting:

Number>>arcTan: denominator
"The receiver is the tangent of an angle. Answer the angle measured in  radians."
[this is the same defintions as Number>>arcTan, which is a slightly different beast]

Float>>arcTan: denominator
"Answer the angle in radians.
Optional. See Object documentation whatIsAPrimitive.
Implementation note: use sign in order to catch cases of negativeZero"
[as far as I can tell, Float>>arcTan: is NOT a primitive]

Complex>>arcTan: denominator 
"Answer the  four quadrants arc tangent of receiver over denominator."

Probably combining these comments into a more comprehensive whole would give better insight into what the methods mean.  If desired, I'd be up for that.

Thanks,
cbc