[vtkusers] IntersectWithLine

N.E. Mackenzie Mackay 9nem at qlink.queensu.ca
Wed Jan 5 17:52:40 EST 2005


Hi,

	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 triangle.

	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[3], float p2[3], float tol, float & t, 
float x[3], float pcoords[3], 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?

Thanks,
Neilson




More information about the vtkusers mailing list