user3608898
user3608898

Reputation: 39

Convert radiant to degrees

Is there a method JAVA to convert a radiant in degrees (° ' '')? For example radiant = - 272,7’ degrees: 4° 33’ S. Anybody can help me?

Thank for your answers!

Upvotes: 0

Views: 2499

Answers (3)

doctorlove
doctorlove

Reputation: 19272

Note that it is radians not radiants.

A full circle is 360 degrees, or 2 Pi radians.
So a radian is 360/2Pi degrees. So, you could do (radians * 2 * Math.PI) / (2 * 180) i.e. (radians * Math.PI) / (180)

Or use Math.toDegrees(radians) which involves less magic numbers and spells out what you are doing.


Just for clarity, if you have a number in degrees and want to go the other way, converting this to radians, note you have
A full circle is 360 degrees, or 2 Pi radians.
So a degree is 2Pi/360 radians. So, you could do (radians * 2 * 180) / (2 * Math.PI) i.e. (radians * 180) / (Math.PI)

Or use Math.toRadians(degrees) which involves less magic numbers and spells out what you are doing.

Upvotes: 6

Ocracoke
Ocracoke

Reputation: 1768

Use the Math.toDegrees() static function as below:

double deg = Math.toDegrees(2.0); // Returns 114.59155902616465
deg = Math.toDegrees(Math.PI); // Returns 180.0

Upvotes: 3

Beri
Beri

Reputation: 11620

Try using

Math.toDegrees()

Link in stack:

Convert from Radians to Degrees in Java

Upvotes: 0

Related Questions