I'm looking for a way to downsample a point cloud based on the proximity of points to their neighbors (from what I can tell, this is synonymous with "decimation"). While I am currently using PyVista as my main library, I'm not seeing any class/methods that seem to achieve what I am looking for since the decimate
method that does belong to the PolyDataFilter class is only for points that have been meshed (and I want to decimate my point cloud before meshing).
Without developing my own method from scratch, how can I achieve this decimation?
PyVista developer here ;)
I think you may want to try the
clean()
filter in PyVista (sort of only available forPolyData
types -- which your point cloud would be). We actually have a snippet of code internal to theglyph()
filter that demonstrates this when needing to downslample points in this fashion for glyphing many geometries as a representative sample of large vector field. The example in our docs demonstrates this with a toy data set. But you aren't glyphing! So below is a snippet that hopefully works for your use case. The key here is going to be themerge_tol
argument for determining proximity. Please refer to our active documentation for using this.Then plot it of course, cuz this is PyVista!
Hm, the terminology here is definitely confusing. In PyVista, decimation is currently reserved for reducing the number of triangles in a mesh. I think "downsampling" is the best term for this and agree that it is not obvious the "clean" filter would be what you need (PRs for improving our documentation are always welcome)