Revised: Help with vtkCellLocator (vtk 3.1)

Audrius Stundzia adv_biologic at hotmail.com
Tue Mar 21 16:37:07 EST 2000


Dear vtker's,

I'm using vtk3.1 nightly release 16.Feb.2000.

I'm not having any success in locating a cell (any cell!) in a
surface described by a vtkPolyData set "myPolyData" where I've loaded points 
and vertices via SetPoints() and SetVerts(). I display the (closed) surface 
so I know that the point surface looks OK and where a line should intersect

Below is a code fragment

   float firstPoint[_3D];
   float secondPoint[_3D];

   firstPoint[X] = 0.0;
   firstPoint[Y] = 0.0;
   firstPoint[Z] = 0.0;

   secondPoint[X] = 200.0;
   secondPoint[Y] = 200.0;
   secondPoint[Z] = 200.0;

   float tolerance = 100.0;

   float t;

   float intersectionPoint[_3D];
   float pointCoords[_3D];

   int subID;

   int pickedCellID;

   myCellLocator = vtkCellLocator::New();
   myCellLocator->SetDataSet( myPolyData);
   myCellLocator->AutomaticOn();
   myCellLocator->CacheCellBoundsOn();
   myCellLocator->SetTolerance( tolerance);
   myCellLocator->BuildLocator();

   returnState
   = myCellLocator->IntersectWithLine( firstPoint
                                     , secondPoint
                                     , tolerance
                                     , t
                                     , intersectionPoint
                                     , parametricCoords
                                     , subCellID
                                     , cellID );

If I understand this correctly, then

firstPoint, secondPoint are the endpoints of the line segment thats
intersecting with myPolyData surface

tolerance is the maximum distance (units ?) within which a cell
must be located

t (returned) is the parametric value on the line where the (projected) 
intersection occurs

intersectionPoint (returned) are the global coordinate values
of the intersection point

parametricCoords are the parametric coordinates of the cell where
the intersection occurs

Why is subCellID returned? What is it and why do I need this?

cellID is the id of the intersected cell

Now

t, subID, and returnState are returned as 0 irrespective of
my choice of intersecting line and tolerance and intersectionPoints
and parametricCoords are (0, 0, 0).
What am I goofing up? What's a good choice for the tolerance?

Any help would be most appreciated. Thanks.

Regards,

Audrius


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list