0
A
回答
1
// Function: latlon_bearing_great_circle
// Desc: This function calculates the initial bearing you need to travel
// from Point A to Point B, along a great arc. Repeated calls to this
// could calculate the bearing at each step of the way.
function latlon_bearing_great_circle($lat_a, $lon_a, $lat_b, $lon_b) {
// Convert our degrees to radians:
list($lat1, $lon1, $lat2, $lon2) =
_deg2rad_multi($lat_a, $lon_a, $lat_b, $lon_b);
// Run the formula and store the answer (in radians)
$rads = atan2(
sin($lon2 - $lon1) * cos($lat2),
(cos($lat1) * sin($lat2)) -
(sin($lat1) * cos($lat2) * cos($lon2 - $lon1)));
// Convert this back to degrees to use with a compass
$degrees = rad2deg($rads);
// If negative subtract it from 360 to get the bearing we are used to.
$degrees = ($degrees < 0) ? 360 + $degrees : $degrees;
return $degrees;
}
// Function: _deg2rad_multi
// Desc: A quick helper function. Many of these functions have to convert
// a value from degrees to radians in order to perform math on them.
function _deg2rad_multi() {
// Grab all the arguments as an array & apply deg2rad to each element
$arguments = func_get_args();
return array_map('deg2rad', $arguments);
}
http://fil.ya1.ru/PHP_5_in_Practice/index.htm#page=0768667437/ch02lev1sec6.html
+0
我会试试这个 – NCoder 2013-03-01 01:27:51
相关问题
- 1. 从地图坐标过滤adsense坐标
- 2. 从鼠标坐标到世界坐标通过glUnproject
- 3. 目标C:确定'点击'的坐标
- 4. 从标准化设备坐标到屏幕坐标的关系?
- 5. 通过坐标
- 6. 算法从坐标确定矩形
- 7. 从ios应用程序精确坐标
- 8. 坐标转换困境,用户坐标到设备坐标?
- 9. OpenGL坐标映射到设备坐标
- 10. MotionEvent坐标到场景坐标
- 11. OpeNni:颜色坐标到深度坐标
- 12. 逻辑坐标到设备坐标Opengl
- 13. MKMap坐标映射到图像坐标
- 14. 笛卡尔坐标到极坐标
- 15. 从CloudKit到MKPointAnnotation的坐标
- 16. 从坐标(php)
- 17. 从坐标
- 18. SceneBuilder坐标与JavaFX坐标
- 19. 坐标到图
- 20. 从GPS坐标列表中确定最大和最小GPS坐标
- 21. 坐标由地理坐标向球形坐标的转换
- 22. 带坐标和横坐标的坐标系
- 23. 将坐标调查坐标转换为有效的esri坐标
- 24. 如何从一个坐标拖放到另一个坐标C#
- 25. 从像素坐标转换到相机坐标?
- 26. 我应该如何从平铺坐标转到地图坐标?
- 27. SVG - 从窗口坐标到视图框坐标
- 28. 转换视图点击坐标从世界坐标到本地?
- 29. 从一个坐标到另一个坐标
- 30. 从直角坐标转换到对数极坐标
我看着在正上方的一个链接,但在弧度产生一个结果,我真的需要在一些程度感谢 – NCoder 2013-03-01 01:27:00