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.

Mesh.boolean does not show the correct intersection with recoSurface mesh.

See original GitHub issue

I generated a mesh from a pointcloud. When trying to intersect it with a sphere i get the results shown in (picture 1). If I however intersect two vedo spheres it shows the correct intersection (picture 2).

Do you have any idea why my code isnt working? Thanks in advance.

Im using Vedo 2022.01. picture1 picture2

from vedo import *

pointcloud_points = Points(hullpoints3d)
pointcloud_points.clean(tol=0.01).legend("smooth cloud")
reco = recoSurface(pointcloud_points, dims=(200,200,200), radius=0.15, holeFilling=True, pad=3).legend("surf. reco")
print("Volume of reconstructed reachability maps 3D-Mesh:")
print(reco.volume())
pts0 = Points(hullpoints3d, r=10).legend("reachability map")


sphere = vedo.shapes.Sphere(pos=(-0.2, -0.2, -0.2), r=0.75, c='r5', alpha=1, res=24, quads=False)
sphere2 = vedo.shapes.Sphere(pos=(0, 0, 0), r=0.75, c='r5', alpha=1, res=24, quads=False)
intersection = reco.boolean("intersect", sphere)
intersection2 = sphere.boolean("intersect", sphere2)

print("The reconstructed mesh is closed: ")
print(reco.isClosed())
print("Intersection volume is: ")
print(sphere.volume() - intersection.volume())

plt = Plotter(shape=(2, 2), interactive=False, axes=3)

plt.show(pts0, "Reach_points", at=0)
plt.show(reco, "Reach_mesh", at=1)
plt.show(sphere, reco, "Sphere", at=2, resetcam=False)
plt.show(intersection, "Intersection", at=3, resetcam=False)

#plt.show(Sphere, "Sphere1", at=0)
#plt.show(Sphere2, "Sphere2", at=1)
#plt.show(Sphere, Sphere2, "sphere", at=2, resetcam=False)
#plt.show(Intersect1, "intersection", at=3, resetcam=False)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MPBAUSERcommented, Apr 5, 2022

Absolute madlad. Thanks dude the reverse() worked!

0reactions
marcomusycommented, Apr 5, 2022

It’s because of the orientation of the polygons (rather than the normals) which is interesting… anyways reverse() seems to do the job:

hullpoints3D.txt

from vedo import *

sphere = Sphere(pos=(0, 0, 0), r=0.6, c='r3', res=24).wireframe()

pointcloud_points = load('data/hullpoints3D.txt')

reco = pointcloud_points.reconstructSurface(
	dims=(200,200,200), radius=0.15, pad=1,
)
reco.reverse()

intersection = reco.boolean("intersect", sphere)
print("Intersection volume is: ",  intersection.volume())

plt = Plotter(N=2, axes=1)
plt.at(0).show(reco, pointcloud_points, sphere, "Reach_points")
plt.at(1).show(intersection, "Intersection")
plt.interactive().close()

Screenshot from 2022-04-05 20-37-12

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Boolean modifier is not working - Blender Stack Exchange
If the modified Mesh has inverted normals, Blender will intersect the target Mesh. If both Meshes use inverted normals, Blender will add both...
Read more >
Boolean modifier problems and how to solve them
Avoid very slight intersections. Also, avoid edges moving alongside each other just a short distance apart. Booleans work best when the meshes don't...
Read more >
5 fixes for Exact Boolean problems in Blender - YouTube
Having problems with Booleans in Blender? ... 5 fixes for Exact Boolean problems in Blender: Most don't know #2! ... Show more. Show...
Read more >
Mesh Boolean Node — Blender Manual
The Mesh Boolean Node allows you to cut, subtract, and join the geometry of two inputs. This node offers the same operations as...
Read more >
vedo
A python module for scientific analysis and visualization of 3D objects.
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