arash at vije.ca
Wed Jan 5 23:11:08 EST 2005
I don't have the complete solution, but try a variation of this idea.
Measure the distance between your point and the vertices of the triangles of
interest. Then draw a sphere with the radius equal to the smallest
point-to-vertex distance. Find the intersection of the sphere with each
triangle on the surface. The longest intersection between the triangles and
the sphere should mark the nearest triangle and its mid point should be the
----- Original Message -----
From: "N.E. Mackenzie Mackay" <9nem at qlink.queensu.ca>
To: <vtkusers at vtk.org>
Sent: Wednesday, January 05, 2005 5:52 PM
Subject: [vtkusers] IntersectWithLine
> I have a point and a surface mesh. I want to find where the closest part
> of the surface to the point. Not the closest point that makes up the
> triangles of the mesh, the closest point that could possibly lie in a
> What I have is the point location (x, y and z) and a bunch of triangles in
> my vtkPolyData.
> My idea was to find the normal at each triangle and create a line using
> the normal and my point in space. With that line I would test if it goes
> through the triangle. If it does I would measure the distance from the
> point to the triangle. After doing that for every poly in the vtkPolyData
> I would take the lowest distance as the closest point.
> I was looking at InersectWithLine in vtkTriangle and it looks like it
> could be used. I just have no idea how to use it.
> The Documentation for the method looks like this:
> IntersectWithLine(float p1, float p2, float tol, float & t, float
> x, float pcoords, int& subId)
> I assume p1 and p2 are the start and end of the line. I don't really know
> what anything else represent. What I was hoping for is to give x,y and z
> of my point and the three points of my triangle and see if the
> Can anyone give some suggestions?
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
More information about the vtkusers