Przemek
Przemek

Reputation: 3975

Java angle of line segment

In situation like above, I want to check an angle between b and c.
Mathematically it's just

asin(a/c)

but in Java I have stumbled upon a little problem. That's how I'm trying to achieve the same:

Math.asin(Math.toRadians(a/c));

I read that Math.asin() expects an argument in radians, and that's why I perform a conversion. But it doesn't seem to work as expected. I want to get result in degrees.

Upvotes: 1

Views: 705

Answers (1)

Marko Topolnik
Marko Topolnik

Reputation: 200148

The arcsine function returns radians, it doesn't accept them as argument. Convert your return value to degrees.

Upvotes: 4

Related Questions