zippy84 / vtkbool

A new boolean operations filter for VTK
Apache License 2.0
161 stars 38 forks source link

Erroneous output handling #81

Open mauigna06 opened 2 months ago

mauigna06 commented 2 months ago

Hi Ronald, thanks a lot for your work on this great library

I'd like to propose to use this boolean table below to handle different results so they are always valid. I was going to implement this idea replacing current code in this link but after thinking about it, I think it would be better to have this table implemented inside vtkbool:

----------------------------------------------------------------------------------------------------
    result      |   touching        |   operation   |   do what?
----------------------------------------------------------------------------------------------------
    0       |   0           |   union       |   append
    0       |   1           |   union       |   retry
    1       |   0x          |   union       |   nothing else
    1       |   1x          |   union       |   nothing else
----------------------------------------------------------------------------------------------------
    0       |   0           |   intersect   |   nothing else
    0       |   1           |   intersect   |   retry
    1       |   0x          |   intersect   |   nothing else
    1       |   1x          |   intersect   |   nothing else
----------------------------------------------------------------------------------------------------
    0       |   0           |   diffA-B     |   result is A
    0       |   1           |   diffA-B     |   retry
    1       |   0x          |   diffA-B     |   nothing else
    1       |   1x          |   diffA-B     |   nothing else
----------------------------------------------------------------------------------------------------
    0       |   0           |   diffB-A     |   result is B
    0       |   1           |   diffB-A     |   retry
    1       |   0x          |   diffB-A     |   nothing else
    1       |   1x          |   diffB-A     |   nothing else
----------------------------------------------------------------------------------------------------

NOTES:

Please let me know your thoughts

mauigna06 commented 1 month ago

I can implement this if you would review it, please let me know Ronald :) This would solve problems in the workflow of BoneReconstructionPlanner

mauigna06 commented 1 month ago

Hi @zippy84

It would be really useful if this "fix" could be pushed to vtkbool instead of having it on BoneReconstructionPlanner or Slicer. What do you think?

mauigna06 commented 1 month ago

Hi @zippy84 :)

I've implemented my proposal: https://github.com/PerkLab/SlicerSandbox/pull/33/commits/b2252f562afb12f597b1c572f40229b6d5c5a9ed

Please review when you have time :) It would be great if could make that PR part of vtkbool