I want to do the formula A= arc tan (b/c).
I'm not sure on the formula in VB. Qbasic says: atn(tan(pi/4).
If that is it, where do I put my answer from b/c?
Printable View
I want to do the formula A= arc tan (b/c).
I'm not sure on the formula in VB. Qbasic says: atn(tan(pi/4).
If that is it, where do I put my answer from b/c?
The VB Atn function returns radians. Pi radians equals 180 degrees. Note that arctan(infinity) = 90 degrees or Pi/2 radians. You have to worry about the quotient you are using.
You need code something like the following.For most of my applications, I use two functions which I call Latitude and Longitude. Each accepts Rise and Run as arguments and returns an angle in radians.Code:Public Const Pi As Double = 3.14159 26535 89793
Dim AngleRadians As Double
Dim AngleDegrees As Double
Dim Rise As Double 'Y coordinate or side opposite angle
Dim Run As Double 'X coordinate or side adjacent to angle
'Rise & Run could be sides of a right triangle, not the hypotenuse
'Rise and Run could be XY-coordinates.
AngleRadians = Atn(Rise / Run)
AngleDegrees = AngleRadians * 180 / Pi
Longitude always returns an angle in the range zero to 2*Pi (0 to 360 degrees), while Latitude returns an angle in the range Plus Pi/2 to minus Pi/2 (Plus 90 to minus 90 degrees).
Internally, the functions take into account the signs of Rise & Run, and avoid division by zero when Run = zero.