vedo icon indicating copy to clipboard operation
vedo copied to clipboard

boolean minus fails for large meshes

Open SimonRelu opened this issue 1 year ago • 2 comments

Hey,

I've encountered some issues with the boolean cutout. It seems to work great untill the amount of faces becomse large. Then, the output sometimes contains inverted faces and faces from both the original mesh and the mesh from which should be substracted. I've also noticed that the original mesh (m1 in the code example below) has inverted faces after the operation. I believe the original mesh shouldn't be modified which makes me believe that there is a memory issue somewhere

These are the 2 meshes I substract from one another Screenshot 2023-06-15 at 17 17 43 Screenshot 2023-06-15 at 17 17 50

This is the results Screenshot 2023-06-15 at 17 18 17

I've uploaded the files here: https://drive.google.com/drive/folders/16EZM9tz37O0C3X_8oPcLKfvkfx-DoaNb?usp=sharing (the _simp files have less faces and for those it works). Here's the code I used to test:

import vedo


m1 = vedo.load("m1.stl")
m2 = vedo.load("m2.stl")
m1.show().close()
m2.show().close()
m3 = m1.boolean("minus", m2)
m1.show().close()
m2.show().close()
m3.show().close()

SimonRelu avatar Jun 15 '23 15:06 SimonRelu

Hi, unfortunately the booloean filter is one of the few which has always been problematic, you may want to investigate if there pymeshlab can do better on this. In your case the teeth are separated so at least you can check one by one...:

from vedo import *

m1 = Mesh("m1.stl").c("red8")
m2 = Mesh("m2.stl").c("k9")

teeth = m2.split()
teeth = [t.clean().compute_normals() for t in teeth]
show(m1, teeth, axes=7).close()

m3 = m1.boolean("+", teeth[0]).compute_normals()
show(m3, axes=7)

Screenshot from 2023-06-15 18-22-15

sorry I cannot offer a real solution...

marcomusy avatar Jun 15 '23 16:06 marcomusy

Hey, Thank you for the info. I'll try that out

SimonRelu avatar Jun 16 '23 15:06 SimonRelu