- 积分
- 16
- 注册时间
- 2006-6-3
- 仿真币
-
- 最后登录
- 1970-1-1
|
发表于 2008-3-20 12:08:08
|
显示全部楼层
来自 美国
原帖由 shamohu 于 2008-3-19 22:56 发表
由经纬度来计算两点间的距离,用的哪个公式?
For given points, p1=(latitude1, longitude1) and p2=(latitude2, longitude2) on a ball, there are two ways to measure their distance. First, find a great cycle passing through both points, use the length L of a piece of arc on the great cycle connecting these points. Second, use the angle A between p1 and p2 by looking at them as vectors. These two methods are equivalent because L=A*R, where R is the radius of the great cycle.
We use the second method. We first rewrite two vectors in R^3 space and normalize it(dividing by R):
V_i= ( cos(latitude_i)*cos(longitude_i), cos(latitude_i)*sin(longitude_i), sin(latitude_i) ) , where i=1,2.
Note that here longitude and latitude are measured by RAD rather than degree.
We calculate the length of the projection of one vector onto the other as v=<V1,V2>, where <,> denote the inner product. Explicitly, <(a1,a2,a3),(b1,b2,b3)>=a1*b1+a2*b2+a3*b3.
Since V1 and V2 are normalized, cos(A)=v. In other words, A=acos(v).
[ 本帖最后由 pcqsl 于 2008-3-21 19:23 编辑 ] |
评分
-
1
查看全部评分
-
|