# Thickness or Depth of a polydata along a direction

**URL:** https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076
**Category:** Support
**Created:** [January 28, 2021, 7:37am UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076 "2021-01-28T07:37:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [January 28, 2021, 7:37am UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/1 "2021-01-28T07:37:58Z")

</div>

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

 ![thickness](https://discourse.vtk.org/uploads/default/original/2X/6/6cffae46de018d63aa90f09ba440301d3cb3c859.png)

Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 28, 2021, 5:38pm UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/2 "2021-01-28T17:38:06Z")

</div>

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

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [January 28, 2021, 6:11pm UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/3 "2021-01-28T18:11:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 28, 2021, 6:32pm UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/4 "2021-01-28T18:32:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [January 28, 2021, 6:33pm UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/5 "2021-01-28T18:33:54Z")

</div>

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 )

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [January 28, 2021, 7:05pm UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/6 "2021-01-28T19:05:54Z")

</div>

vtkStaticPointLocator  
vtkStaticCellLocator

Faster to build, but cannot be modified once built.

vtkPointLocator  
vtkCellLocator

Can support incremental insertion etc.

---

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [January 29, 2021, 6:53am UTC](https://discourse.vtk.org/t/thickness-or-depth-of-a-polydata-along-a-direction/5076/7 "2021-01-29T06:53:36Z")

</div>

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
