admin管理员组文章数量:1425761
I need to calculate an angle of a triangle by using the tan^-1
function. On my calculator I can do this:
tan^-1(3/4)
// 3 and 4 are triangle side lengths
And it outputs 36 degrees. What is the alternative to this function in JavaScript? I tried Math.tan(3/4)
, Math.atan(3/4)
and all of the other tan functions I saw in the list, but none of them outputs the result in degrees I need (36).
Thank you.
I need to calculate an angle of a triangle by using the tan^-1
function. On my calculator I can do this:
tan^-1(3/4)
// 3 and 4 are triangle side lengths
And it outputs 36 degrees. What is the alternative to this function in JavaScript? I tried Math.tan(3/4)
, Math.atan(3/4)
and all of the other tan functions I saw in the list, but none of them outputs the result in degrees I need (36).
Thank you.
- 2 javascript works in radians – Jaromanda X Commented Sep 29, 2015 at 11:51
- By the way it should be 36.8698976, not 36. Math.atan(3/4) * 180 / Math.PI – Jaromanda X Commented Sep 29, 2015 at 11:54
1 Answer
Reset to default 8There is no build in function for that, since 1 radian = 180/pi degrees
you can do the following using Math.atan()
and Math.PI
var degree = Math.atan(3 / 4) * (180 / Math.PI);
document.write(degree);
本文标签: How do i use inversed tan in javascriptStack Overflow
版权声明:本文标题:How do i use inversed tan in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745417697a2657760.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论