vedo icon indicating copy to clipboard operation
vedo copied to clipboard

Function intersect_with takes very large amounts of memory (several GigaBytes)

Open goncalo-pt opened this issue 2 years ago • 1 comments

When I call this function it takes amounts of memory that quickly amount to several Gigabytes and the computer ends up freezing/crashing. Notes: This doesn't always happen. Changing the value of tolerance may solve the problem for a particular pair meshes but may not work for another pair of meshes. The problem can be reproduced using the file at: https://github.com/goncalo-pt/goncalo_moniz_public

goncalo-pt avatar Jul 18 '23 14:07 goncalo-pt

Hi, It seems to me that the mesh must have some strange problem.. it's for sure non-manifold but I don't manage to fix it neither with non_manifold_faces(remove=True) nor with pymeshfix...

import numpy as np
import vedo

my_mesh = vedo.Mesh('data/my_vedo_mesh.obj')

print(my_mesh.is_manifold())
my_mesh.non_manifold_faces(remove=False)
my_mesh.cmap("Spectral_r", "NonManifoldCell", on="cells")
print(my_mesh.is_manifold())

my_mesh.compute_normals()

# import pymeshfix
# meshfix = pymeshfix.MeshFix(my_mesh.points(), my_mesh.faces())
# meshfix.repair()
# my_mesh = vedo.Mesh(meshfix.mesh)

pt = np.array([2.43196056, 2.        , 0.57248911])
sphere = vedo.Sphere(pt, r=1.1, res=12).alpha(0.2)
inter = None #sphere.intersect_with(my_mesh, tol=0.005)
vedo.show(my_mesh, sphere, inter)

Screenshot from 2023-07-18 16-44-54 (notice the white faces on the left)

marcomusy avatar Jul 18 '23 14:07 marcomusy