Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calculating arc tangent of 0.12 degrees

Community Beginner ,
May 01, 2006 May 01, 2006
ActionScript really does know to be annoyed sometimes!

I'm trying to calculate arc tangent of a number.
I'm using the following code:

arctg_mi = Math.atan(Math.PI/180 * 0.12)

As you can see, I need to calculate arc tangent of 0.12 degrees. Problem is that it just cannot be done. I'm not an expert of mathematics, but it seems that radian system does not behave like degrees system when it comes to arc tangent!
I used Windows' Calculator, and arc tangent of 0.12 in degrees system is about 6.84, which is right. But when I switch to radian system, then convert 0.12 degrees to radians, and then try to calculate, I get the wrong value. Totally wrong!
Solution? Either I am so stupid that I missed some ordinary procedure in all of this, or these two systems are not comparable.
Or do I need to convert the value I get back to degrees system somehow?

The easiest thing to do would be to switch Flash to degrees system, but that can't be done, so...

Help, please...
TOPICS
ActionScript
743
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 01, 2006 May 01, 2006
It comes out to 6.84 in Flash too, if you do it right. First off, degrees
per radian is 180/Pi not Pi/180. And you want to get the arctangent of the
value, which comes out in radians, then convert to degrees - you don't want
to take the arctangent of the degrees....

So:
var degreesPerRadian = 180.0 / Math.PI;
trace(Math.atan(0.12) * degreesPerRadian)

6.84277341263094


HTH


--
Dave -
Adobe Community Expert
www.blurredistinction.com
www.macromedia.com/support/forums/team_macromedia/


Translate
LEGEND ,
May 01, 2006 May 01, 2006
It comes out to 6.84 in Flash too, if you do it right. First off, degrees
per radian is 180/Pi not Pi/180. And you want to get the arctangent of the
value, which comes out in radians, then convert to degrees - you don't want
to take the arctangent of the degrees....

So:
var degreesPerRadian = 180.0 / Math.PI;
trace(Math.atan(0.12) * degreesPerRadian)

6.84277341263094


HTH


--
Dave -
Adobe Community Expert
www.blurredistinction.com
www.macromedia.com/support/forums/team_macromedia/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 01, 2006 May 01, 2006
LATEST
As I said, I missed an ordinary procedure. Well, not that, but I definitely screwed up!

Thanks, Dave!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines