Is there exists some filters just like vtkSelectedEnclosedPoints but executes base gpu?

I want to evaluate appropriately 1500 points to determine whether they are in an enclosed surface, which has appropriately one million points. because i need to execute 1500 * 200 times evaluating in one second, that need a high performance. So i want to do them base gpu, and is there any filters which are base vtk could help me ? Thanks a lot!

Off of the top of my head I don’t think this exists. With some work you could write some code. My thought would be to use a rasterized volume and in a preprocessing step, mark the points from the volume in/out the surface. Then when high performance is needed, simply probe the volume to determine in/out. Obviously there would be some resolution challenges etc that could be handled in a variety of ways, including falling back on vtkSelectEnclosedPoints, or using local geometric operations etc. This might even be fast enough to run on CPU is desired.

Hello,

GPUs are optimized for matrix/vector/tensor calculations. Spatial searches, if doable, are not the kind of task well suited for doing directly/entirely in GPUs. Performing an inside/outside test with that requirement fast is two-fold: 1) do a fast but innacurate test to flag obviously inside and outside points; 2) Run a slow, but accurate test on the (hopefully) few uncertain points from the previous test to have the definite result.

Given that your enclosed surface has millions of faces, vtkSelectedEnclosedPoints is your accurate, but slow test. Running that 200 * 1.500 times certainly kills performance. Like @will.schroeder proposed, using a volume in the GPU can be your fast, but innacurate test. However, like he said, if your volume is fine enough, the test can yield very few doubtful cases to be confirmed or discarded with vtkSelectedEnclosedPoints. This paper presents a way on how it can be done: Fast and robust GPU-based point-in-polyhedron determination | Request PDF .

Using a volume obviously requires that you first rasterize your closed surface as a filled volume so you have inside voxels with ones/painted in black, outside voxels with zeroes/painted in white and on-face/on-edge/on-vertex voxels with twos/painted in gray. Then simply test whether a point is inside a black voxel (surely inside), a white voxel (surely outside) or a gray voxel (doubt). As you can see, the probability of finding a point inside a gray voxel is very low, depending of the resolution of the volume. Hence, you will end up with possibly 10’s of slow tests with vtkSelectedEnclosedPoints out of millions the naïve way. This can be done fast in a CPU if you wish to keep things simple. I hope this casts some light on the problem.

regards,

Paulo