问题描述
我正在尝试计算模拟液滴的体积。我正在使用scipy的ConvexHull完成此操作。
我需要计算y轴上方和下方的液滴部分的体积。这是我的功能:
def calculate_vol_partition(points):
top_points = []
bottom_points = []
for point in points:
if point[1] > 0:
top_points.append(point)
if point[1] <= 0:
bottom_points.append(point)
top_hull = ConvexHull(top_points)
bottom_hull = ConvexHull(bottom_points)
top_vol = top_hull.volume
bottom_vol = bottom_hull.volume
total_vol = ConvexHull(points).volume
return top_vol,bottom_vol,total_vol
其中点是(x,y,z)元组的列表。但是,以给定的液滴形状运行时,top_vol + bottom_vol的总和小于total_vol。
使用一组生成的点进行输出:
Volume of total hull: 1.0938835409441485
Top half of hull plus bottom half of hull: 1.0863473956202554
这是预期结果吗?有没有更好的方法可以使体积在复杂形状的平面上方/下方?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)