[vtkusers] Closest point on a streamtube

James C Robinson j.robinson at kepler-systems.com
Tue Aug 16 12:58:10 EDT 2005


Dear All,

 

I have a set of flow vectors associated with the points of an unstructured
grid. I use the following to create a stream tube:

 

 pStreamLine->SetInput(pUnstructuredGrid) ;   // vtkStreamTracer

 pStreamTube->SetInput(pStreamLine->GetOutput()) ; // vtkTubeFilter

 pStreamMapper->SetInput(pStreamTube->GetOutput()) ; // vtkPolyDataMapper

 pStreamActor->SetMapper(pStreamMapper);                 // vtkActor

 

At any given time I wish to find the closest point in the stream tube (say
the closest point in the underlying polyline of the stream tracer) to the
camera (in order to keep the radius of the stream tube fairly constant on
the screen). To this end I do the following:

 

            vtkDataSet* pDataSet =
(vtkDataSet*)((pStreamLine->GetOutput())->GetPoints()) ;

            pClosestStreamPointLocator->SetDataSet(pDataSet) ;  //
vtkPointLocator

            pClosestStreamPointLocator->AutomaticOn() ;

            pClosestStreamPointLocator->BuildLocator() ;

 

I then use 

            pClosestStreamPointLocator->BuildLocator() ; // In case the
stream tube has changed since the locator was last updated.

pClosestStreamPointLocator->FindClosestPoint(camPos) ; // Where camPos is a
float[3] array.

 

when I wish to find the closest point. However, it causes a crash. I am
obviously doing something pretty simple wrong. Please advise...

 

 

Jim

 

James C Robinson, 

*    42 Rivergrove,

         Glanmire,

         Co. Cork,

         Eire

'     +353 21 4822028

         +353 87 2393010

*    jrobinson at eircom.net> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050816/b3dfc8e4/attachment.htm>


More information about the vtkusers mailing list