# [vtkusers] Sampling cell-data along a line

Timofey Mukha timofey.mukha at it.uu.se
Fri Nov 25 10:07:23 EST 2016

```Dear Bill,

Thank you for the example, it's a nice illustration.

I have ultimately arrived to another solution to my problem. A somewhat
important detail is that my data is 2d. What I do then is take a slice
of the data with vtkCutter, so that the cut goes along the line that I
need. A given cell center of the cutter is located exactly in the middle
of the segment obtained by cutting a given cell by the desired line. So
the cell data of the cutter gives me my profile along a line!

In a 3d setting I suppose one can to the same, but one needs two cutters
the intersection of which would give the desired line!

Best,

Timofey

On 2016-11-24 18:46, Bill Lorensen wrote:
> Timofey,
>
> Motivated by your email. I just added this wiki example:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/VisualizationAlgorithms/FindCellIntersections
>
> I realize it does not solve your problem, but it does illustrate how
> to use the FindCellsAlongLine method. You might try it with one of
> your datasets.
>
> Bill
>
>
> On Tue, Nov 22, 2016 at 5:07 AM, Timofey Mukha <timofey.mukha at it.uu.se> wrote:
>> Dear all,
>>
>> I have some large cell-data from a CFD simulation. I would like to view
>> profiles along a line.
>> Currently I understand that I can do this with a probeFilter to which I feed
>> a line with a given resolution.
>>
>> The problem is that given a complicated mesh the sampling points on the line
>> will probably miss some cells or, on the other hand, some points might fall
>> into the same cell.
>>
>> Is there a way to sample along a line in such a way that the returned
>> profile will contain data from all the cells that the line intersects? For
>> each cell a sampling point should then be generated somewhere in between the
>> point where the line enters the cell and where it exists it.
>>
>> I tried playing around with the vtkCellLocator, that can find which cells
>> are intersected by a given line using the FindCellsAlongLine method.
>> However, that does not give the locations of the sampling points, only the
>> coordinates of the cell-centers that are intersected by the line. There is
>> also the subtle issue of handling cases when the sampling line lies on a
>> boundary between two or more cells.
>>
>> All in all it seems like a more complicated problem than at first glance,
>> but I am wondering if someone has already dealt with it before me?
>>
>> Best,
>>
>> Timofey
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>
>

```

More information about the vtkusers mailing list