glu*_*utz 7 c math map-projections mercator
我正在寻找解释为什么在这些网站上讨论了2种不同的mercator公式.
我理解这是正确的墨卡托投影算法:
http://en.wikipedia.org/wiki/Mercator_projection
y = ln|sec(lat) + tan(lat)|
Run Code Online (Sandbox Code Playgroud)
但是,这个网站指的是完全不同的东西:http: //wiki.openstreetmap.org/wiki/Mercator
#include <math.h>
double lat2y(double a) { return 180/M_PI * log(tan(M_PI/4+a*(M_PI/180)/2)); }
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
两个公式都是平等的.
sec(x)+ tan(x)= [1 + sin(x)]/cos(x)
![sec(x)+ tan(x)= [1 + sin(x)]/cos(x)](https://i.stack.imgur.com/K5MPE.gif)
tan(pi/4 + x/2)= sin(pi/4 + x/2)/ cos(pi/4 + x/2)=
= [cos(x/2)+ sin(x/2)]/[cos(x/2) - sin(x/2)] =
= [cos(x/2)+ sin(x/2)] ^ 2/[cos(x/2) - sin(x/2)]/[cos(x/2)+ sin(x/2)] =
= [1 + 2*cos(x/2)*sin(x/2)]/[cos ^ 2(x/2) - sin ^ 2(x/2)] =
= [1 + sin(x)]/cos(x)

后一个公式对于数值计算更方便,因为它只涉及一次三角函数的计算.
| 归档时间: |
|
| 查看次数: |
781 次 |
| 最近记录: |