I´m trying to do a simplified collision detection between two polydata (.stl) objects in Python. I want to know if one object is inside the other object. I followed the “CellsInsideObject” Example: “https://lorensen.github.io/VTKExamples/site/Python/PolyData/CellsInsideObject/” to extract 3 meshes and check if there are points inside the object at the border or outside.
When I run vtkSelectEnclosedPoints() for my objects and split it in three meshes, cells which should be on the border are marked inside the object.
In reality my two Objects (red & black) shouldn´t have Points inside because they have just one attached area:
However when I run the script and render the insideId (black) I´m getting this output:
Actually the black area is on the border and shouldn be inside the object.
I´ve seen that some people had a similar Problem and solved it with varying the Tolerance, but that didn´t work in my case. Even when I set the Tolerance to 0.00000000000000001 it still gives me the same output.
Does somebody know how to solve this Problem or if there is another method beside vtkSelectEnclosedPoints() to get the collision of the two objects? Important for me is that Points/Cells on the border should not be marked as a collision.
Thanks in advance
This is implemented in vtkCollisionDetectionFilter.
Thanks for the note. When I try to use vtkCollisonDetectionFilter I get the error: "AttributeError: module ‘vtkmodules.all’ has no attribute “vtkCollisionDetectionFilter”. Since I think the CollisionDetectionFilter is part of the default vtk built do you have any solutions for this problem?
I´m using vtk version 8.2.0 and python (windows) version 3.7.3.
I think vtkCollisionDetectionFilter was added in VTK-8.90, so it should be available in the VTK-9.0 release.