# ProbeFilter and Tolerance

Hello,
I am confused at how the `vtkProbeFilter` works for probing an unstructured grid onto an image, especially with respect to the tolerance.
Here is a simple example:

``````import vtk

# parameters
L = 1.
M = 4 # Subdivision for the mesh
n = 1                  # Subdivision for the image, this ensures that one point of the image is a the corner of the mesh
N = int((M/2)*(2*n+1)) # Subdivision for the image, this ensures that one point of the image is a the corner of the mesh

# Create the image
imageData = vtk.vtkImageData()
imageData.SetDimensions(N, N, 1)
imageData.SetSpacing(L/N, L/N, 1.)
imageData.SetOrigin(L/N/2, L/N/2, 0.)

# Create the mesh
points = vtk.vtkPoints()
points.InsertNextPoint(  L/2,   L/2, 0.0)
points.InsertNextPoint(  L/M,   L/M, 0.0)
points.InsertNextPoint(L-L/M,   L/M, 0.0)
points.InsertNextPoint(  L/M, L-L/M, 0.0)
points.InsertNextPoint(L-L/M, L-L/M, 0.0)

cells = vtk.vtkCellArray()

triangle = vtk.vtkTriangle()
triangle.GetPointIds().SetId(0, 0)
triangle.GetPointIds().SetId(1, 1)
triangle.GetPointIds().SetId(2, 2)
cells.InsertNextCell(triangle)

triangle.GetPointIds().SetId(0, 0)
triangle.GetPointIds().SetId(1, 3)
triangle.GetPointIds().SetId(2, 1)
cells.InsertNextCell(triangle)

triangle.GetPointIds().SetId(0, 0)
triangle.GetPointIds().SetId(1, 2)
triangle.GetPointIds().SetId(2, 4)
cells.InsertNextCell(triangle)

triangle.GetPointIds().SetId(0, 0)
triangle.GetPointIds().SetId(1, 4)
triangle.GetPointIds().SetId(2, 3)
cells.InsertNextCell(triangle)

uGrid = vtk.vtkUnstructuredGrid()
uGrid.SetPoints(points)
uGrid.SetCells(vtk.VTK_TRIANGLE, cells)

# Write the mesh
writer = vtk.vtkXMLUnstructuredGridWriter()
writer.SetInputData(uGrid)
writer.SetFileName("test_probe_tolerance.vtu")
writer.Write()

# Create, configure and run the vtkProbeFilter
probeFilter = vtk.vtkProbeFilter()
probeFilter.SetSourceData(uGrid)
probeFilter.SetInputData(imageData)
print(probeFilter.GetComputeTolerance())
probeFilter.ComputeToleranceOn()
print(probeFilter.GetComputeTolerance())
probeFilter.SetTolerance(1e-12)
print(probeFilter.GetComputeTolerance())
probeFilter.Update()

# Write the image
writer = vtk.vtkXMLImageDataWriter()
writer.SetInputData(probeFilter.GetOutput())
writer.SetFileName("test_probe_tolerance.vti")
writer.Write()
``````

When varying `n`, the image grid changes (though you always have image nodes located on the mesh boundary), and round off approximations are apparent (the boundary image nodes are quite randomly marked as “inside” or “outside” the mesh), but the tolerance option does not have any effect (I tried with very large, very small, etc.). Any idea?