我有两个列表组,A和O。它们都有来自x、y、z坐标的点。我想计算来自A和B的点之间的距离。我使用了一个for循环,但它只给出了一个结果。它应该给我8个数字的结果。如果有人能看一下,我将不胜感激。这是我项目中的最后一步。
Ax = [-232.34, -233.1, -232.44, -233.02, -232.47, -232.17, -232.6, -232.29, -231.65]
Ay = [-48.48, -49.48, -50.81, -51.42, -51.95, -52.25, -52.83, -53.63, -53.24]
Az = [-260.77, -253.6, -250.25, -248.88, -248.06, -247.59, -245.82, -243.98, -243.76]
Ox = [-302.07, -302.13, -303.13, -302.69, -303.03, -302.55, -302.6, -302.46, -302.59]
Oy = [-1.73, -3.37, -4.92, -4.85, -5.61, -5.2, -5.91, -6.41, -7.4]
Oz = [-280.1, -273.02, -269.74, -268.32, -267.45, -267.22, -266.01, -264.79, -264.96]
distance = []
for xa in A1:
for ya in A2:
for za in A3:
for x1 in o1:
for y1 in o2:
for z1 in o3:
distance += distance
distance = (((xa-x1)**2)+((ya-y1)**2)+((za-z1)**2))**(1/2)
print(distance)
--NotebookApp.iopub_data_rate_limit
。当前值: NotebookApp.iopub_data_rate_limit=1000000.0(字节/秒) NotebookApp.rate_limit_window=3.0(秒)" - Ben Wang