我正在从.obj中解析一个三维网格,它使用pywavefront给出了顶点、人脸和法线。我想通过减去另一个网格来计算剩余的面积。
跟进计算体积,我想知道如何在网格上执行操作,例如相交和减法。
发布于 2020-12-12 15:46:08
发布于 2022-09-30 14:20:17
在现有答案的基础上,还有一个选择是使用具有Python的开源库MeshLib。它可以以波前格式(.obj)读写网格,并在网格上执行布尔操作。
例如,从立方体中减去环面的代码如下:
import meshlib.mrmeshpy as mr
# create a mesh of cube with edge length =1:
cube = mr.makeCube(size = mr.Vector3f( 1, 1, 1 ))
# create a mesh of torus:
torus = mr.makeTorus( primaryRadius = 0.65, secondaryRadius = 0.1 )
# compute the difference between the cube and the torus:
diff = mr.boolean( cube, torus, mr.BooleanOperation.DifferenceAB )
# save the difference in file:
mr.saveMesh(diff.mesh, mr.Path("diff.obj"))在某些网格查看器中打开后的差异网格:

https://stackoverflow.com/questions/61370374
复制相似问题