question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

boolean_union produces a non-manifold mesh

See original GitHub issue

Describe the bug, what’s wrong, and what you expected.

boolean_union produces non-manifold meshes, preventing further processing operations.

Steps to reproduce the bug.

import pyvista

sphere_center = (2.4623486548662186, 15.274176120758057, 2.042705088853836)
cone_center = (1.7672341, 16.30967, 1.2092979)
cone_direction = (-0.4634096920490265, 0.6903295516967773, -0.5556047558784485)

cone = pyvista.Cone(center=cone_center, direction=cone_direction, height=3, radius=1, resolution=8).triangulate()
sphere = pyvista.Sphere(center=sphere_center, radius=1).triangulate()
cylinder = pyvista.Cylinder(center=(sphere_center[0], sphere_center[1]/2, sphere_center[2]), direction=(0, 1, 0), radius=0.5, height=sphere_center[1]).triangulate()

result = sphere.boolean_union(cylinder).triangulate().boolean_union(cone).clean()

result.clip_closed_surface((0, 1, 0), (0, 15.274176120758057, 0)) # This fails due to a non-manifold mesh

Saving the result shows that it is, indeed, non-manifold. See the screenshots section.

System Information

--------------------------------------------------------------------------------
  Date: Tue Jun 14 12:19:43 2022 BST

                OS : Linux
            CPU(s) : 24
           Machine : x86_64
      Architecture : 64bit
       Environment : Python
       GPU Details : error

  Python 3.9.11 (main, Mar 17 2022, 07:20:01)  [GCC 11.2.0]

           pyvista : 0.34.1
               vtk : 9.1.0
             numpy : 1.21.5
           imageio : 2.19.2
           appdirs : 1.4.4
            scooby : 0.5.12
        matplotlib : 3.5.1
             PyQt5 : Version unknown
             scipy : 1.7.3
--------------------------------------------------------------------------------

Screenshots

The result of the above code is this non-manifold mesh:

image

A triangle that should be cut off at the end isn’t, which makes it cut into the interior of the mesh.

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
whophilcommented, Jun 21, 2022

That’s awesome! Will it be possible to install alongside conda-forge vtk/pyvista, or does vtk itself need a custom re-compile?

It installs alongside vtk from conda-forge (it just links against the VTK libs at compile-time).

0reactions
darikgcommented, Jun 21, 2022

I am working on packaging vtkbool for conda on the conda-forge channel. If you are interested in this, you can follow the progress here zippy84/vtkbool#51

That’s awesome! Will it be possible to install alongside conda-forge vtk/pyvista, or does vtk itself need a custom re-compile?

For my application, vtkbool worked better, as cell/point data of the input meshes were passed through without the need for additional bookkeeping. I am sure this can be achieved with the CGAL bindings, but I didn’t have time to look into it.

Yeah the trade-off CGAL has is you can handle cell/point data however you want but you have to implement it yourself by subclassing PMP::Corefinement::Default_visitor. I have an example here for keeping track of which of the two original meshes the corefined face originates from, but I’m not good enough at C++ / too lazy to make it work for all properties in general.

Also of interest is this recent arxiv paper; looks like the authors will be releasing the source code when the paper is published.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boolean Union modifier on manifold object produces non ...
Boolean Union modifier on manifold object produces non-manifold object ... A mesh (vertices, edges, faces) can be manifold or non-manifold because that ...
Read more >
Boolean Modifier Union produces non manifold edges
I'm working on a sculpted model, that will be 3d printed... the problem is, I had 4 objects (the head, the two eyes,...
Read more >
Boolean Union on Structure of Extruded Cubes failed Non ...
yes he was able to select all MeshtoNurb and then BU, in my case i get a boolean union failed and the error...
Read more >
Straightforward boolean operations produce non-manifold ...
Boolean operations will sometimes produce non-manifold errors like missing faces, even if all meshes involved are manifold and share no common vertices, ...
Read more >
Boolean operation of two stls with internal shape
If you really need such a non manifold mesh you need to do the boolean union and boolean intersection in some other application...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found