pyvista / pyvista-support

[moved] Please head over to the Discussions tab of the PyVista repository
https://github.com/pyvista/pyvista/discussions
59 stars 4 forks source link

Algorithm in sample function? #523

Closed alexkaiser closed 2 years ago

alexkaiser commented 2 years ago

Description

Is there documentation or could anyone tell me about the algorithm behind the sample method please? Following the example and doing result = mesh_orig.sample(data_to_probe)
where data_to_probe contains cell_array data, gives a point_array in result.

Is this new data computed from by nearest neighbor values, average of all points of data_to_probe that lie within each cell of mesh_orig, weighted average of the fraction of cells that lie within the new cells, linear interpolation onto the nodes of mesh_orig, or something else entirely?

I reviewed vtkResampleWithDataSet.cxx, but it was not at all obvious what was happening with all the inheritance and it does not appear that any actual resampling happens within this file.

There is relevant information within the following discussions: https://github.com/pyvista/pyvista/pull/842 https://github.com/pyvista/pyvista-support/issues/203#issuecomment-662228805