标签:
剧情提要:正剧开始:
星历2016年04月27日 16:54:19, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[球面上的几何]。
<span style="font-size:18px;">#圆的切线的长度
def tmp():
x_p, y_p, x_o, y_o = -5, 0, 0, 0;
#过P点
P = [x_p, y_p];
#圆心O
O = [x_o, y_o];
#半径R
R = 1;
#切点S, 切线长PS
PS = (distance2D(P, O)**2-R**2)**0.5;
return PS;
#两点距离
def distance2D(A, B):
return ((A[0]-B[0])**2+(A[1]-B[1])**2)**0.5;
if __name__ == '__main__':
a = tmp();
print(a);</span>
<span style="font-size:18px;">>>>
4468.042885105484
5585.0536063818545
14521.139376592822
#球面距离
def tmp2():
#球面角
spereAngle = 40;
R = 6400;
#目标角
angle = [0, 90, -90];
for i in range(len(angle)):
print(math.pi*R*abs(spereAngle-angle[i])/180);
</span>
<span style="font-size:18px;">>>>
三个角分别是(弧度): 1.5768176634063322 1.574631971632919 1.6132289095085366
三个角分别是(角度): 90.34499717486287 90.21976626092983 92.43120790333136
#已知三边求三角
def tmp3():
#a, b, c为球面三角形的三条边
a = 0.2;
b = 0.133;
c = 0.3;
cosa = math.cos(a);
sina = math.sin(a);
cosb = math.cos(b);
sinb = math.sin(b);
cosc = math.cos(c);
sinc = math.sin(c);
A = math.acos(cosa-cosb*cosc-sinb*sinc);
B = math.acos(cosb-cosc*cosa-sinc*sina);
C = math.acos(cosc-cosa*cosb-sina*sinb);
print('三个角分别是(弧度):', A, B, C);
print('三个角分别是(角度):', A*180/math.pi, B*180/math.pi, C*180/math.pi);
</span>
本节到此结束,欲知后事如何,请看下回分解。
标签:
原文地址:http://blog.csdn.net/mwsister/article/details/51262432