我目前正在用python进行球面光学计算,宁可不要转换到笛卡尔,因为计算会变得复杂。在python中是否有以极坐标创建向量并进行向量运算(交叉、点、卷曲)的库?
我建议使用复数。它使极坐标的操作变得更加简单。例如,你可以在不部署任何三角的情况下在单位圈内移动。
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np
rot = 5
ang = 70
x = []
y = []
rotator = np.exp(1j*np.deg2rad(ang))
location = rotator
for i in range(int(rot * 365/ang)):
location *= rotator
x.append(location.real)
y.append(location.imag)
fig = plt.figure()
ax = plt.axes()
ax.plot(x,y,marker='o');