# Distance scalar computation between surface and polyline

**URL:** https://discourse.vtk.org/t/distance-scalar-computation-between-surface-and-polyline/9225
**Category:** Support
**Created:** [August 27, 2022, 9:42am UTC](https://discourse.vtk.org/t/distance-scalar-computation-between-surface-and-polyline/9225 "2022-08-27T09:42:29Z")
**Posts on this page:** 2
**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: [August 27, 2022, 9:42am UTC](https://discourse.vtk.org/t/distance-scalar-computation-between-surface-and-polyline/9225/1 "2022-08-27T09:42:29Z")

</div>

Hello all!

I have a polydata with triangle cells (surface) and another polydata with polyline cells. I need scalar distance values on surface computed from polyline.

I tried these,

**vtkDistancePolyDataFilter** - Works only for two surfaces.

**vtkSelectPolyData** - Inputs are points and very slow for large data set as it computes topological distance. Ideally suitable for a polyline that lies on the surface.

**vtkStaticCellLocatior** - Build with polyline for distance computation, iterate over all the points of the surface mesh and create a FloatArray for distance scalar. This operation is also bit slow, is there a way to improve the iteration of distance calculation with vtkSMPTools? Is there a SMP iteration method available for vtkPoints structure?

Thanks!

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [August 28, 2022, 1:49pm UTC](https://discourse.vtk.org/t/distance-scalar-computation-between-surface-and-polyline/9225/2 "2022-08-28T13:49:23Z")

</div>

Hi,

> [@DFlyer](#):
>
> **vtkDistancePolyDataFilter** - Works only for two surfaces.

You can try creating a narrow surface from your polyline by using `vtkLinearExtrusionFilter`. Then you can use `vtkDistancePolyDataFilter` on the output to get results close to what the actual polyline would yield.

regards,

Paulo
