SV: [vtkusers] Compute distance between line and vtkPolyData

Tron Darvann trd at odont.ku.dk
Wed Nov 15 04:13:21 EST 2006


Hello Che,

I don't know of any way in VTK to get directly the distance between a line and a vtkPolyData.

However, using vtkCellLocator is pretty fast, and running its FindClosestPoint method in a loop on each 

point along the line is probably a good solution.

// Create the Cell Locator.

vtkCellLocator *cellLocator = vtkCellLocator::New();

cellLocator->SetDataSet(Source);

cellLocator->BuildLocator();

// Compute the distance d between the point m and the closest point c on the surface.

cellLocator->FindClosestPoint(m, c, cellId, subId, d);

 

Tron

 
 
Tron Darvann
Research Engineer, PhD, 3D-Laboratory
 
Tel: (+45) 35 32 67 58 (lab) / (+45) 28 20 03 12 (mobile)
E-mail: trd at odont.ku.dk
Skype: tron.darvann
Fax: (+45) 35 32 65 05
Mailing and Visiting Address:
3D-Lab, School of Dentistry
University of Copenhagen
Nørre Alle 20
DK-2200 Copenhagen N
Denmark

________________________________

Fra: vtkusers-bounces+trd=odont.ku.dk at vtk.org på vegne af Chavdar Papazov
Sendt: ma 13-11-2006 16:40
Til: vtkusers at vtk.org
Emne: [vtkusers] Compute distance between line and vtkPolyData



Hi,

I want to compute the distance between a straight line
(ray) and an vtkPolyData-object.

There is an obvious (but bad) solution:
I could compute the distance between every point in
the vtkPolyData-object and the line and then take the
minimum, but this will be very slow...

Is there a function in VTK, that does this maybe in
some better way?

Thanks a lot!

Greetings,
Che




____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
_______________________________________________
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:
http://www.vtk.org/mailman/listinfo/vtkusers


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


More information about the vtkusers mailing list