[vtkusers] intersecting 3D mesh with a line

David Doria daviddoria+vtk at gmail.com
Thu Feb 25 08:58:47 EST 2010


On Thu, Feb 25, 2010 at 6:22 AM, Andrea Bottino <andrea.bottino at polito.it>wrote:

>  Hi everybody,
> this is probably a trivial question, but after half an hour of navigation
> into the documentation, I think I got a little bit lost. The point is:
> - I have a vtkPolyData and I want to intersect it with a line
> - I was trying to recycle a similar function I wrote which was cutting the
> mesh with a plane with vtkCutter, but there's no implicit function defining
> a line
>
> can somebody give me a hint, or few lines of code hot to perform this
> operation? (e.g. by defining start-endpoint of the line/segment)
>
> regards,
> a.
>
>
You should load the polydata into some kind of data structure (OBBTree,
KdTree, CellLocator). All of these have an IntersectWithLine function.

Here is an example:

http://www.vtk.org/Wiki/VTK/Examples/OBBTree

Let us know if you have any problems.

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100225/c7a3631b/attachment.htm>


More information about the vtkusers mailing list