[vtkusers] Problem traversing vtkPolyData

Audrius Stundzia adv_biologic at hotmail.com
Mon Dec 4 12:00:32 EST 2000


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





More information about the vtkusers mailing list