Python 3.x 有计算六面体质心的函数吗

Python 3.x 有计算六面体质心的函数吗,python-3.x,Python 3.x,我想计算六面体的质心。我有一组八个坐标。我试着使用函数ndimage.measurements.center\u of_mass(coords\u vol),但它似乎不起作用。有什么建议吗? 这是我的代码: coords = np.array([ [0.,0.,0.],\ [10.,0.,0.],\ [10.,10.,0.],\ [10.,10.,10.],\ [0.,10.,10.],\

我想计算六面体的质心。我有一组八个坐标。我试着使用函数ndimage.measurements.center\u of_mass(coords\u vol),但它似乎不起作用。有什么建议吗? 这是我的代码:

coords = np.array([
          [0.,0.,0.],\
          [10.,0.,0.],\
          [10.,10.,0.],\
          [10.,10.,10.],\
          [0.,10.,10.],\
          [0.,0.,10.],\
          [0.,10.,0.],\
          [10.,0.,10.],\
          ])

CM = ndimage.measurements.center_of_mass(coords_vol)