[vtkusers] Distance between PolyData and a point along a direction

David Doria daviddoria at gmail.com
Thu Mar 29 07:24:58 EDT 2012


On Thu, Mar 29, 2012 at 4:17 AM, emreturkoz <emreturkoz at gmail.com> wrote:
> I have a point, and a point normal defined to it. Suppose I also have a
> polydata, which doesn't include or span this point.
>
> I want to find the distance from this point to the polydata along the
> polydata normal. By distance, I mean how far should I translate the point so
> that it "touches" the surface defined by polydata.
>
> Is this possible to do with vtk??

Is your polydata a mesh? If so, then you can use this:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/DataStructures/ModifiedBSPTree_IntersectWithLine

You have to build the tree. Then you have to defined a second point
along your line (it is an intersection with a line segment, not an
actual infinite ray). Then you can do the intersection and get the
distance between the query point and the intersection.

David



More information about the vtkusers mailing list