[vtkusers] Problem traversing vtkPolyData

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Mon Dec 4 13:26:03 EST 2000


Why not use a vtkCellLocator and IntersectWithLine. It'll give much faster 
results than Traversal of lists because a spatial sort on Data is done.

Also, Watch out that Tolerance is fraction of BBox diagonal by default on 
some tests, some have AbsoluteTolerance. Extreme caution is advised.

JB




>Dear vtk users,
>
>My end goal in the following code fragment is find the triangle in
>a vtkPolyData surface that intersect with a given line. To speed
>this operation I'm trying to use the InitTraversal method as per
>the online manual recommendation. However, it's not working
>(comments in code below), so I'm not using it correctly.
>
>The code fragment is included below. Insight would be most appreciated.
>
>Regards,
>
>Audrius Stundzia
>
>//-----Code fragment
>
>   (vtk objects all defined)
>
>   nTriangles = isoSurfacePolyData->GetNumberOfPolys();
>
>   if (nTriangles == 0) return;
>
>   triangleCellArray = isoSurfacePolyData->GetPolys();
>   triangleCellArray->InitTraversal();
>
>   //-----
>
>   triangleGenericCell = vtkGenericCell::New();
>
>   //-----
>
>   for (int iTriangle = 0; iTriangle < nTriangles; iTriangle++)
>   {
>      triangleCellID
>      = triangleCellArray
>        ->GetNextCell( nTrianglePoints,trianglePointIndex );
>
>      if (triangleCellID == 0) continue;
>
>//----- The triangleCellID value returned is always 1. Am I
>//----- misunderstanding this vtkCellArray method GetNextCell?
>
>      isoSurfacePolyData
>      ->GetCell( triangleCellID , triangleGenericCell );
>
>      intersectStatus
>      = triangleGenericCell
>        ->IntersectWithLine(  referenceLinePointOne
>                           ,  referenceLinePointTwo
>                           ,  0.1  //----- Tolerance [mm]
>                           ,  t
>                           ,  testIntersectPoint
>                           ,  pIntersectPoint
>                           ,  subCellID );
>
>
>_____________________________________________________________________________________
>Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com
>
>
>_______________________________________________
>This is the private VTK discussion list. Please keep messages on-topic. 
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list