[squeak-dev] atan2 - or what Squeak called #arcTan:

Chris Cunningham cunningham.cb at gmail.com
Fri Nov 6 21:00:50 UTC 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151106/3e3aeb9c/attachment.htm


More information about the Squeak-dev mailing list