Replies: 2 comments 1 reply
-
Hello! There are variety of issues that may be present in mesh:
MeshLib has function to detect them and fix them
# remove small components first
area = mesh.area()
bigComps = mm.MeshComponents.getLargeByAreaComponents(mesh,area * 0.002,None)
mesh.deleteFaces(mesh.topology.getValidFaces() - bigComps)
tolerance = mesh.computeBoundingBox().diagonal()*1e-2
degFaces = mm.findDegenerateFaces(mesh,1e3)
shortEdges = mm.findShortEdges(mesh,tolerance*1e-2)
degFaces |= mm.getIncidentFaces(mesh.topology,shortEdges)
mm.expand(mesh.topology,degFaces,3)
dSettings = mm.DecimateSettings()
dSettings.strategy = mm.DecimateStrategy.ShortestEdgeFirst
dSettings.maxError = tolerance * 0.1
dSettings.criticalTriAspectRatio = 1e3
dSettings.tinyEdgeLength = tolerance*1e-2
dSettings.stabilizer = mm.ResolveMeshDegenSettings().stabilizer
dSettings.optimizeVertexPos = False
dSettings.region = degFaces
dSettings.maxAngleChange = mm.ResolveMeshDegenSettings().maxAngleChange
mm.decimateMesh(mesh,dSettings)
multipleEdges = mm.findMultipleEdges(mesh.topology) # just find them
# fix possible multiple edges
mm.fixMultipleEdges(mesh)
# remove self-intersections
selfIntersSettings = mm.SelfIntersections.Settings()
selfIntersSettings.method = mm.SelfIntersections.Settings.Method.CutAndFill
selfIntersSettings.maxExpand = 2
selfIntersSettings.relaxIterations = 2
mm.SelfIntersections.fix(mesh,selfIntersSettings)
# fill all holes if needed
for e in mesh.topology.findHoleRepresentiveEdges():
mm.fillHole(mesh,e) Or there is single function that fixes params = mm.RebuildMeshSettings()
params.voxelSize = mm.suggestVoxelSize(mesh,5e6)
params.fwn = mc.FastWindingNumber(mesh) # Enables usage of CUDA (mc = `from meshlib import mrcudapy as mc`)
mesh = mm.rebuildMesh(mesh,params) |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I would like to ask you whether the mesh construction here requires the special construction of meshlib or whether I can use the construction method of other libraries for some surface data |
Beta Was this translation helpful? Give feedback.
-
Specifically, it is to detect whether the model composed of a triangular surface has non-prevalent and self-intersecting conditions, and if so, how to remove them
Beta Was this translation helpful? Give feedback.
All reactions