SV: [vtkusers] Compute distance between line and vtkPolyData

John Biddiscombe biddisco at cscs.ch
Wed Nov 15 08:06:11 EST 2006


> locator->IntersectWithLine (...)

Sorry. I misunderstood what you wanted to do - this only gives you what 
you want if you already know where to look. Your original approach is 
probably a better starting point

apologies

JB

>>
>> 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 <mailto: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
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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
>>   
>
>


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82





More information about the vtkusers mailing list