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.

Weird issues when checking for intersection between meshes

See original GitHub issue


I have the following situation/error and i haven’t been able to figure out why it happens. I can’t post the data, since it’s work product.

I have a lot of meshes, all of them being just a planar “square” made by two triangles joined at one side, rotated in axis z and x, and centered in different positions in the space (x,y,z). Now, i’m checking for intersections between those meshes, using two nested loops that iterate pivoting over each one of them and checking for intersections with the rest using the intersectWith() method.

Now, the weird behaviour is the following: Sometimes when checking two meshes for intersections, python crashes, without any error or warning, it just crashes. I tried to debug/guess what was happening and i was able to find out that when two meshes have the EXACT same midpoint position (the x,y,z of the center) the intersectWith() method crashed (no idea why). I tried to quick-fix it by adding noise to the planes center coordinates, which so far fixed it for those cases, but i’m still getting the same error in other planes where apparently there is nothing related to that.

I’m asking here in case it’s a known issue; i suspect that something like… idk, when 2 vertices are exactly the same or something similar happens, the function crashes, but i don’t have a better clue about it.

This is an example of two planes that were crashing python when trying to calculate the intersection:

newplot (27)

Any help or suggestion is more than welcome!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

ManuGraiphcommented, Sep 23, 2022

Yeah. I’m still convinced it’s related to the internal vertex lines intersecting or ‘numerically intersecting’ (passing too close to each other). For a 2-elements mesh, each one can intersect the other mesh at 2 points, resulting in 4 intersection points, if the mid-arist intersect each other, the 2 ‘central’ intersection points are gonna be too close, and my guess is, if that distance is lower than the tolerance, it crashes. Maybe it assumes both are the same point and then the output doesn’t have the expected length or similar.

marcomusycommented, Sep 23, 2022

I tested on vtk9.2.0rc2 but my guess is that the bug is there in all versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python crashing when checking intersection between meshes ...
I'm having a really weird behaviour when using vedo 's intersectWith() function to check intersection between meshes.
Read more >
3D Print Toolbox Intersection Check Problems
The intersection checking function in 3D Print Toolbox seems to give a lot of false positives at the moment. An easily replicable example...
Read more >
Possible bug in triangle-triangle intersection algorithm #261
A user-provided mesh was flagging some triangles as self-intersecting. Based on visual inspection, the triangles do not appear to intersect.
Read more >
Identifying and Repairing Common Mesh Errors - Simplify3D
There are two very useful tools in the software to help you locate any potential problems within the mesh. The first is called...
Read more >
Check if two meshes intersect - Unity Forum
You can always read the meshData, create your own triangles and check for collisions between them. Triangle x Triangle intersection code can be ......
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 Post

No results found

github_iconTop Related Hashnode Post

No results found