Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Home
- Animate
- Discussions
- How to convert radians to degrees while using Math...

- How to convert radians to degrees while using Math...

/t5/animate-discussions/how-to-convert-radians-to-degrees-while-using-math-asin/td-p/12407306
Sep 27, 2021
Sep 27, 2021

Copy link to clipboard

Copied

If

trace(Math.sin((Math.PI/6))); // .499999 Correct

trace(Math.asin((.499999))); // .523597 Correct

but

trace(Math.sin(30*Math.PI/180)); // 0.49999 Correct

trace(Math.asin(.49999*Math.PI/180)); // 0.008726 Wrong

else

trace(Math.asin(.49999*180/Math.PI)); // 30.000 Correct ?

My Math.asin function should use the radian to degrees conversion factor of Math.PI/180 but appears to be 180/Math.PI.

Can anyone explain why this is?

TOPICS

Code
,
How to

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Adobe Community Professional
,
Sep 27, 2021
Sep 27, 2021

the trig functions are the inverse of the arc trig functions. the trig functions have an argument that's an angle (in radians) and yield a number. the arc functions have a number for an argument and yield an angle (in radians). so yes, if you want the sin of 30 degrees, use: Math.sin(30*Math.PI/180); // converted angle to radians if you want the angle (in degrees) whose sin is .5, use: Math.asin(.5)*180/Math.PI and while our brains are perfectly capable of working with radians withou...

3
Replies
3

/t5/animate-discussions/how-to-convert-radians-to-degrees-while-using-math-asin/m-p/12407385#M347763
Sep 27, 2021
Sep 27, 2021

Copy link to clipboard

Copied

to convert rad to deg, multiply by 180/Math.PI

Math.asin(.5)*180/Math.PI; // should be 30 (degrees)

i don't know if you have typos in this forum (ie, your parenthesis are misplaced), but some of what you posted (adjusting the argument in asin) is non-sense from a mathematical point of view.

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

PATurmel12
AUTHOR

Participant
,

/t5/animate-discussions/how-to-convert-radians-to-degrees-while-using-math-asin/m-p/12407431#M347767
Sep 27, 2021
Sep 27, 2021

Copy link to clipboard

Copied

Thanks for the reply, it is interesting the code I posted has always worked for sin, cos, and tan, but maybe there's something funny about the parenthesis as you suggest.

If anyone could elaborate on this, I don't see exactly what is wrong.

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Adobe Community Professional
,

LATEST
/t5/animate-discussions/how-to-convert-radians-to-degrees-while-using-math-asin/m-p/12407551#M347769
Sep 27, 2021
Sep 27, 2021

Copy link to clipboard

Copied

the trig functions are the inverse of the arc trig functions. the trig functions have an argument that's an angle (in radians) and yield a number. the arc functions have a number for an argument and yield an angle (in radians).

so yes, if you want the sin of 30 degrees, use:

Math.sin(30*Math.PI/180); // converted angle to radians

if you want the angle (in degrees) whose sin is .5, use:

Math.asin(.5)*180/Math.PI

and while our brains are perfectly capable of working with radians without degree conversion, when it comes to digital computers, that doesn't work so well. a digital computer isn't go to tell you asin(PI/4) = sqrt(2)/2. and while i've seen the decimal output of that so many times, i know .707...is sqrt(2)/2, i would not recognize the radian equivalent of 35 degrees. (and i have a phd in math.)

Community guidelines

Using the Community
Experience League
Terms of Use
Privacy Policy
Cookie preferences
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語コミュニティ
- Português
- 한국어

Copyright © 2022 Adobe. All rights reserved.