SelectEnclosedPoints Tolerance

Dear Forum,
I am looking for help in understanding how the tolerance for vtkSelectEnclosedPoints works please.
I have been using vtkSelectEnclosedPoints to identify which points on a rectilinear grid lie within a vtkPolyData set. It works I expect until the points of the rectilinear grid lie on the facets of the polydata.

I have created a simplified example using a 2 x 2 x 2 Box Source centred on 0,0,0 cleaned with the Clean filter to ensure it is a closed surface as my PolyData (green Surface). The rectilinear grid has 16x16x16 cells with dimensions 4 x 4 centred on 0,0,0 (wireframe). I used the output from vtkSelectEnclosedPoints as a variable on the rectilinear grid and used a Threshold of 0.5 to view my results (Grey Surface with Edges).

With the default tolerance for vtkSelectEnclosedPoints of 0.0001 I get this

With the default tolerance for vtkSelectEnclosedPoints of 0.1 I get this

Tolerance = 1.0 and I get what I expected

Unfortunately on a slightly more complex shape I have a choice of missing cells or outliers. Ship is 100 long, rectilinear cells are cells have 0.5 edge length
Tolerance = 1.0

Can anyone give me any ideas as to how I get the tolerance to behave in the same way for each point please?

Thank You


The comment posted here by @lorensen may be of some help.