IonicWind Software

Creative Basic => GUI Programs => Topic started by: GWS on February 26, 2008, 12:27:20 PM

Title: Arctan(x,y) DLL
Post by: GWS on February 26, 2008, 12:27:20 PM
Here's another little routine which I always have to scratch my head about to get the angles correct ..  :)

This is a version of the trigonometry function ArcTan(x,y) which takes two decimal arguments of points in the x - y plane, and calculates the full angle in degress, clockwise from the 12 o'clock position.

(If you want to put integer x,y values into it (as for screen co-ordinates, remember to define the variables x,y as Float - then it's happy if you just enter integers.  If you forget this, you'll get weird answers.  :))

This also relates to the complex number Argand diagram, where z = (x + iy) = |z| * exp(iΘ) and |z| = sqrt(x^2+y^2))

Θ is the angle given by this routine in degrees ..


Attached is the DLL 'argxy.dll', a small test program, and the EBasic code for the dll ..


all the best, :)

Graham