Thickness or Depth of a polydata along a direction

Hello,
I am trying to scalar plot thickness ( or depth ) of a water tight polydata along a direction.

Currently I create a line from a point on polydata and perform vtkOBBTree -> IntersectWithLine, get the distance between point and intersection point as my thickness ( depth value ). But it takes some considerable time when number of points increase, also the plot is not smooth for low poly count.

Is there a filter or a better method that provides this depth value faster and provide higher resolution?

Image for reference

Thanks!

If you use a good locator then this should be very fast, even for hundreds of thousands of points.

Thanks for the reply,
Can you please suggest a locator?

The new static locators should be faster.

Also, in case you are developing in Python: Iterating through each point of a mesh is not something that you want to do in Python, as a hot loop performing very simple operation over hundreds of thousands of items will be 1-2 magnitudes slower in Python than in C++. You may need to implement a filter for this in C++ VTK and wrap it to use from Python.

Thanks again!
I came back to VTK after a while, can you please specify the new locator class name?
Can the locator give all the intersection points? ( if intersection is more than 1 )

vtkStaticPointLocator
vtkStaticCellLocator

Faster to build, but cannot be modified once built.

vtkPointLocator
vtkCellLocator

Can support incremental insertion etc.

1 Like

In terms of resolution improvement, can I create free points ( points that are not indexed on cells ) and set scalar value ( thickness ) to it and color map it?

Thanks