Results 1 to 2 of 2
  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2001

    Talking arc tan function

    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?

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Huntingdon Valley, PA 19006

    Atn returns radians.

    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.
    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
    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.

    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.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width