user1873073
user1873073

Reputation: 3660

How do you get the angle from sin?

I have a value for sin:

var opposite = 100;
var hypotenuse = 228;

var sin = opposite/hypotenuse;

I want to know what angle that is. On my calculator I can just do sin^-1(). This thread says to use asin but when I use asin I get 45°. The correct angle is 25°.

Upvotes: 1

Views: 1172

Answers (1)

4pie0
4pie0

Reputation: 29724

Because the arcus sinus returns result in radians and radian is defined as

enter image description here

you should convert result to degrees this way

var opposite = 100;
var hypotenuse = 228;

var sin = opposite/hypotenuse;

var angle = Math.asin(sin)*180/Math.PI;

document.body.innerHTML = angle;

example:

http://jsfiddle.net/o69xjayh/

Upvotes: 1

Related Questions