# vtkSelectEnclosedPoints detects wrong Points inside which should be on the border

**URL:** https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641
**Category:** Support
**Created:** [June 25, 2020, 9:10am UTC](https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641 "2020-06-25T09:10:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ElCamino](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/e/8797f3/32.png) [@ElCamino](https://discourse.vtk.org/u/ElCamino)
#### Post date: [June 25, 2020, 9:10am UTC](https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641/1 "2020-06-25T09:10:49Z")

</div>

Hi everybody,  
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/](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:  
 ![grafik](https://discourse.vtk.org/uploads/default/original/2X/e/e6b3b7f2e944ccd581ccca88ca4c25589e579263.png)  
However when I run the script and render the insideId (black) I´m getting this output:  
 ![grafik](https://discourse.vtk.org/uploads/default/original/2X/2/2b473ae813b0d8ed2756d44743233f3ac20ad94b.png)  
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

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 25, 2020, 12:28pm UTC](https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641/2 "2020-06-25T12:28:16Z")

</div>

> [@ElCamino](#):
>
> I´m trying to do a simplified collision detection between two polydata (.stl) objects in Python

This is implemented in [vtkCollisionDetectionFilter](https://vtk.org/doc/nightly/html/classvtkCollisionDetectionFilter.html).

---

<div class="post-metadata">

### Author: ![ElCamino](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/e/8797f3/32.png) [@ElCamino](https://discourse.vtk.org/u/ElCamino)
#### Post date: [June 25, 2020, 1:59pm UTC](https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641/3 "2020-06-25T13:59:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [June 25, 2020, 4:09pm UTC](https://discourse.vtk.org/t/vtkselectenclosedpoints-detects-wrong-points-inside-which-should-be-on-the-border/3641/4 "2020-06-25T16:09:56Z")

</div>

I think vtkCollisionDetectionFilter was added in VTK-8.90, so it should be available in the VTK-9.0 release.
