回答
asin
函数返回弧度。圆圈内有2π弧度。
有360度的圆圈,60度的度数和60秒的一分钟。所以360 * 60 * 60秒在一个圆圈内。
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);
他仍然需要将其转换为DMS ,但好点! – hawkfalcon 2012-04-28 04:35:07
不知道如何用一个命令喜欢上了ti84> DMS做到这一点,但您可以使用逻辑。
- 度整个单元将保持不变(即,在121.135°
经度,开始与121°)。 将小数乘以60(即.135 * 60 = 8.1)。
整数成为分钟(8')。
取剩余的小数点后乘以60.(即.1 * 60 = 6)。
- 所得数成为秒(6" )。秒可以保持作为 小数。
- 取号码您的三组,并把它们放在一起,使用 为度(°),分钟符号(” )和秒( “)(即 121°8'6” 经度) 来源: http://geography.about.com/library/howto/htdegrees.htm
搜索的一点点,我发现这个在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);
但是正如他所说,它需要先从弧度转换为度数。
是啊,我刚刚在http://geography.about.com/library/howto/htdegrees.htm上找到了答案..虽然答案很好:) – CoreCode 2012-04-28 05:41:33
只是想帮助:) – hawkfalcon 2012-04-28 05:42:57
这是一个C问题,而不是Objective-C问题。我已经编辑了它。 – 2012-04-28 04:29:24