Computing heading
Jack Johnson
fragment at nas.com
Sun Jan 4 08:41:19 UTC 2004
I was messing around with EToys and grabbed an arrow morph and a couple
of ellipses and wanted to have the arrow morph automatically place
itself between the two ellipses and point from one to the other.
The placement was easy, but I had trouble computing the heading. I did
come across a formula used for computing a bearing based on two map
coordinates:
tc1=mod(atan2(sin(lon1-lon2)*cos(lat2),cos(lat1)*sin(lat2)-
sin(lat1)*cos(lat2)*cos(lon1-lon2)),2*pi)
which would work just fine, but being relatively new to Squeak I'm at a
loss for how to implement it, or how to even find out if/how Squeak
implements the atan2 function.
Any pointers or suggestions?
-Jack
More information about the Squeak-dev
mailing list
|