来自Numpy网格网格坐标的3D点

时间:2018-08-28 15:48:44

标签: python arrays python-2.7 numpy geometry

我有3组3D圆柱体的网格坐标:

X, Y, Z = [p1[i] + v[i] * t1 + r * np.sin(theta2) * n1[i] + r * np.cos(theta2) * n2[i] for i in [0, 1, 2]]

这里p1,v,t1,r和theta2的定义:

r = 3
start = [30, 45, 60]
end = [40, 58, 70]
p1 = np.array(start)
p2 = np.array(end)
v = p2 - p1
mag = scipy.linalg.norm(v)
v = v / mag
not_v = np.array([1, 0, 0])
if (v == not_v).all():
    not_v = np.array([0, 1, 0])
n1 = np.cross(v, not_v)
n1 /= scipy.linalg.norm(n1)
n2 = np.cross(v, n1)
t = np.linspace(0, mag, 100)
theta = np.linspace(0, 2 * np.pi, 100)
t1, theta2 = np.meshgrid(t, theta)

我不知道我是否无法正确理解numpy.meshgrid的工作原理,但是我正在寻找一种获取多面体的(x,y,z)点的方法。

0 个答案:

没有答案