Inverse Tan function

C

Carl Gilbert

Hi

I am having difficulty calculating an angle using VB.NET
I have calculated opposite over adjacent but can not get the angle from this
value.

Example on a calculator:

Tan-1(1.234)=51
Tan-1(1.963)=63
Tan-1(84.5)=89
Tan-1(5.25)=79

Where the number in the brackets is opp/adj.

I have put Tan-1 to rather than just Tan as I beleive it has to be inverse.

However, I can not find a VB function to return the figures given above on
the right.
I have tried using Tan, Atan, Atan2, Tanh but always get figures between -2
and 2-3. I think these may be between -Pi and Pi.

Can anyone suggest a solution to get an angle from opp/adj in VB.NET?

Regards, Carl Gilbert
 
K

Ken Tucker [MVP]

Hi,

Remember that tan and atan angles are in radians not degrees.


Dim angle As Double = 45

Dim ToRadians As Double = System.Math.PI / 180

Dim ToDegrees As Double = 180 / System.Math.PI

Dim n As Double = System.Math.Tan(angle * ToRadians)

Dim a As Double = System.Math.Atan(n)

Trace.WriteLine(a * ToDegrees)



Ken

--------------------------

Hi

I am having difficulty calculating an angle using VB.NET
I have calculated opposite over adjacent but can not get the angle from this
value.

Example on a calculator:

Tan-1(1.234)=51
Tan-1(1.963)=63
Tan-1(84.5)=89
Tan-1(5.25)=79

Where the number in the brackets is opp/adj.

I have put Tan-1 to rather than just Tan as I beleive it has to be inverse.

However, I can not find a VB function to return the figures given above on
the right.
I have tried using Tan, Atan, Atan2, Tanh but always get figures between -2
and 2-3. I think these may be between -Pi and Pi.

Can anyone suggest a solution to get an angle from opp/adj in VB.NET?

Regards, Carl Gilbert
 
C

Carl Gilbert

Cheers Ken.

I was getting Atan(opp/adj) but I was not multiplying this by (180/Pi)

Works ok now though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top