首页 > 编程语言 > 详细

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

时间:2021-03-11 10:25:50      阅读:51      评论:0      收藏:0      [点我收藏+]
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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!