[vtkusers] Raycast

Sebastien_MARAUX maraux at ondim.fr
Fri Jun 14 09:11:09 EDT 2002


Yes there is :

try to read about cell locator, and point locator

here is a snippet :

//------------------------------------------------------------------------------------------------------
// here i got a xyz surface, y=height. I want to find height at a specified point of yourpolydata

 vtkCellLocator *cellLocator = vtkCellLocator::New();
 cellLocator->SetDataSet(yourpolydata);
 cellLocator->CacheCellBoundsOn();
 cellLocator->SetTolerance(0.0);
 cellLocator->AutomaticOn();
 cellLocator->BuildLocator();
 
 float myPoint[3]={yourx,whatever, yourz};
 float a0[3], a1[3], x[3], pcoords[3];

  // from a0
  a0[0]=myPoint[0];
  a0[1]=-10000;
  a0[2]=myPoint[2];
  
  // to a1
  a1[0]=myPoint[0];
  a1[1]=10000;
  a1[2]=myPoint[2];
  
  // ray cast
  cellLocator->IntersectWithLine(a0,a1,0.0,t,x,pcoords,subId);

  //get new altitude for this point
  myPoint[1]=x[1];

//-----------------------------------------------------------------------------------------------------------------------------------------

  ----- Original Message ----- 
  From: alexandre gouaillard 
  To: vtkusers at public.kitware.com 
  Sent: Friday, June 14, 2002 2:38 PM
  Subject: [vtkusers] Raycast


  hi everyone

  I have an origin point, a direction (vector), and I 'd like to find the first intersection with a given mesh (polydata).

  I tried to take a look at raycasting method in vtk , but they all deal with volume rendering issues.

  Is there anything allready written in VTK to do this , or any class/method which could give me a hint on how to do this ?

  thanks in advance.

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


More information about the vtkusers mailing list