python 输出 STL 文件的质心(重心)

import numpy as np 
from stl import mesh  # pip install numpy-stl
# Using an existing closed stl file: 
your_mesh = mesh.Mesh.from_file('some_file.stl') 
volume, cog, inertia = your_mesh.get_mass_properties() 
print("Volume = {0}".format(volume)) 
print("Position of the center of gravity (COG) = {0}".format(cog)) 
print("Inertia matrix at expressed at the COG = {0}".format(inertia[0,:])) 
print(" {0}".format(inertia[1,:])) 
print(" {0}".format(inertia[2,:]))

https://www.researchgate.net/post/How-do-I-calculate-center-of-mass-for-STL-files

原文地址:https://www.cnblogs.com/xiangsui/p/14515321.html