[vtkusers] scan simulation question - vtkpointpicker

Moti Freiman freiman at cs.huji.ac.il
Wed Dec 8 03:37:24 EST 2004


Hello!
I'm trying to simulate laser scan of an object.
i put the object at window, and try to pick from all pixels of window, 
i've got the coords of the object, but all its (0 0 0).
follow my scanning code, do someone know what the problem? or if there 
another way to do it?

my code:
   fstream file;
   file.open("F:\\Neurobot\\LaserSimulation\\intersectedPoints.txt", 
ios::out);
   double intersectionCoords [3];
   vtkPointPicker * ray = vtkPointPicker::New();
   vtkProp3DCollection * prop3DCollection = vtkProp3DCollection::New();
   int x,y;

//viewer - handle mapper, actor etc for viewing polydata
   viewer.getScreenSize (x,y);
   int intersectionOccured = 0;
   for (int index1=0;index1<x;index1++){
       for (int index2=0;index2<y;index2++){
           intersectionOccured = 
ray->Pick(index1,index2,0,viewer.renderer);
           if (intersectionOccured) {
               
ray->GetProp3Ds()->GetLastProp3D()->GetPosition(intersectionCoords);
               file<<intersectionCoords[0]<<" 
"<<intersectionCoords[1]<<" "<<intersectionCoords[2]<<endl;
           }

       }
   }

   file.close();

-- 

Thanks!

Moti Freiman.
Medical Image Processing and Computer-Assisted Surgery Laboratory.
School of Computer Science and Engineering.
The Hebrew University of Jerusalem Givat Ram, Jerusalem 91904, Israel 
Phone: +(972)-2-658-5371 (laboratory) 
E-mail: freiman at cs.huji.ac.il 
WWW site: http://www.cs.huji.ac.il/~freiman




More information about the vtkusers mailing list