Convert radians to degrees, minutes, and seconds

怎甘沉沦 提交于 2019-12-01 01:24:10

The asin function returns radians. There are 2 π radians in a circle.

There are 360 degrees in a circle, 60 minutes in a degree, and 60 seconds in a minute. So there are 360*60*60 seconds in a circle.

double radians = asin(opposite / hypotenuse);
int totalSeconds = (int)round(radians * 360 * 60 * 60 / (2 * M_PI));
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int degrees = totalSeconds / (60 * 60);
hawkfalcon

Not sure how to do this with one command like >dms on the ti84, but you can use logic.

  1. The whole units of degrees will remain the same (i.e. in 121.135°
    longitude, start with 121°).
  2. Multiply the decimal by 60 (i.e. .135 * 60 = 8.1).

  3. The whole number becomes the minutes (8').

  4. Take the remaining decimal and multiply by 60. (i.e. .1 * 60 = 6).

  5. The resulting number becomes the seconds (6"). Seconds can remain as a decimal.
  6. Take your three sets of numbers and put them together, using the symbols for degrees (°), minutes (‘), and seconds (") (i.e. 121°8'6" longitude) Source: http://geography.about.com/library/howto/htdegrees.htm

A little bit of searching and i found this in c#: Converting from Decimal degrees to Degrees Minutes Seconds tenths.

double decimal_degrees; 

// set decimal_degrees value here

double minutes = (decimal_degrees - Math.Floor(decimal_degrees)) * 60.0; 
double seconds = (minutes - Math.Floor(minutes)) * 60.0;
double tenths = (seconds - Math.Floor(seconds)) * 10.0;
// get rid of fractional part
minutes = Math.Floor(minutes);
seconds = Math.Floor(seconds);
tenths = Math.Floor(tenths);

But as he said, it will need to be convered from radians to degrees first.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!