[vtkusers] vtkPointLocator & Collision avoidance

Tim Hutton T.Hutton at eastman.ucl.ac.uk
Fri Oct 11 05:42:01 EDT 2002


Hi Siddu,

Try putting BuildLocator before the call to FindClosestPointsWithinRadius.

(You may also need to do a STLReader->Update() before the call to 
BuildLocator.)

For collision detection a thorough approach would be to tetrahedralize if 
necessary all your objects so they are represented as solids (not just as 
surface meshes) and then use vtkCellLocator::FindClosestPoint to detect if 
each point is inside a cell.

Good luck,

Tim.


At 14:17 10/10/2002 +0100, Mysore Siddu wrote:

>  Hi vtk Users,
>
>  I have two questions:
>
>  <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
>
>1.      From cellLocator->IntersectWithLine I compute the intersection 
>point and its cellID on the STL file. Now I want to find all the points 
>within a radius around the intersection point. I tried using 
>vtkPointLocator::FindPointsWithinRadius(radius, point, vtkIdList *result) 
>But I was not successful with the following code:
>
>                   float p1[] = {2.0, 1.0, 3.0};
>
>float rad = 2.0;
>
>vtkIdList *res;
>
>// Build a locator
>
>vtkPointLocator *pointLocator = vtkPointLocator::New();
>
>pointLocator->SetDataSet(STLReader->GetOutput());
>
>pointLocator->FindPointsWithinRadius(rad,p1,res);
>
>pointLocator->BuildLocator();
>
>  I dont know where I am goofing up the code. As soon as Execute I am 
> getting error as Memory cant be assigned error I debugged the code it is 
> stopping at  vtkIdList.h // Description:
>
>// Reset to an empty state.
>
>void Reset() {this->NumberOfIds = 0;};
>
>*/
>
>
>
>
>
>2.      Is there any vtk class, which I can use for collision avoidance? 
>Basically I have two STL files and I want to check the collision around a 
>particular point.
>
>
>
>Any Help in this regard is very well appreciated.
>
>  Best Regards
>
>Siddu.

---------------------------------------------------------------------------
Tim Hutton,                        http://www.eastman.ucl.ac.uk/~dmi/MINORI
Research Fellow & PhD student,                   T.Hutton at eastman.ucl.ac.uk
MINORI Project, Biomedical Informatics Unit,     Tel: [+44] (0)20 7915 2344
Eastman Dental Institute, UCL,                   Fax: [+44] (0)20 7915 2303
256 Gray's Inn Road, London WC1X 8LD, UK      Mobile: [+44] (0)7748 678 832
---------------------------------------------------------------------------
This email represents the views of the sender alone and must not be 
construed as representing the views of the Eastman Dental Institute. It may 
contain confidential information and may be protected by law as a legally 
privileged document and copyright work. Its content should not be disclosed 
and it should not be given or copied to anyone other than the person(s) 
named or referenced above. If you have received this email in error, please 
contact the sender.





More information about the vtkusers mailing list