[vtkusers] about the picking of vtkTensorGlyph

lian jiang jl_vtk at yahoo.com
Thu Mar 28 01:52:20 EST 2002


 Hi, Malcolm:
        Thank you for your answer. 
        I tried to use ellipsoids.GetSource() to get the vtkPolyData first. Then I use GetNumberOfCells() to get the number of cells. But I always got 0 as the number. 
        I also tried to use GetCellType() to verify whether I had gotten the correct vtkPolyData, but it also always was 0. 
        What's the matter,  please? 
         If I get the right cell set, could you please tell me which method of vtkPolyData should be used to get Point Id from the Cell Id?  Thank you again.
 
Regards
 
Lian
  Malcolm Drummond <malcolm at geovision.co.za> wrote: Hi Lian If you use cell-picker you can integer-divide the cell-id by the number of cells in the source (use GetNumberOfCells). You'll then have the id of the point & scalar in Dataset associated with the picked glyph. Malcolm ----- Original Message ----- From: lian jiang To: vtkusers at public.kitware.com Sent: Wednesday, March 27, 2002 4:35 PMSubject: [vtkusers] about the picking of vtkTensorGlyph

Hi, all:

        For picking a object in a vtkTensorGlyph, I have gotten the non-zero return value with vtkPointPicker and vtkCellPicker. Which picker should I use to figure out which object I have picked? 

        vtkTensorGlyph seems to be different from Glyph3D, so the methods disscussed before couldn't be used here. How can I export the vtkTensorGlyph to an indexed cell set or point set?  How can I associate a cell or a point with some specific object in the vtkTensorGlyph?  Thanks a lot!

Below is the code building the vtkTensorGlyph.

vtkUnstructuredGrid Dataset=new vtkUnstructuredGrid();
  vtkPoints    pointArray=new vtkPoints();
  vtkDoubleArray  colorArray=new vtkDoubleArray();
  vtkDoubleArray  tensorArray=new vtkDoubleArray();
  vtkSphereSource sphere = new vtkSphereSource();
  vtkTensorGlyph ellipsoids=new vtkTensorGlyph();
  vtkPolyDataMapper ellipMapper = new vtkPolyDataMapper();
  vtkPolyDataNormals ellipNormals=new vtkPolyDataNormals();

  vtkActor    ellipActor=new vtkActor();
  
  tensorArray.SetNumberOfComponents(9);

  for(i=0; i<numObjects; i++)
  {
    pointArray.InsertNextPoint(objectArray[i].centroid);
    tensorArray.InsertNextTuple9(objectArray[i].tensor[0], objectArray[i].tensor[1], objectArray[i].tensor[2],
         objectArray[i].tensor[3], objectArray[i].tensor[4], objectArray[i].tensor[5],
         objectArray[i].tensor[6], objectArray[i].tensor[7], objectArray[i].tensor[8]);
  }

  Dataset.SetPoints(pointArray);
  Dataset.GetPointData().SetTensors(tensorArray);

  sphere.SetThetaResolution(20);
  sphere.SetPhiResolution(20);

  ellipsoids.SetInput(Dataset);
  ellipsoids.SetSource(sphere.GetOutput());
  ellipsoids.ClampScalingOn();

  ellipNormals.SetInput(ellipsoids.GetOutput());
  ellipMapper.SetInput(ellipNormals.GetOutput());

  ellipActor.SetMapper(ellipMapper);   // I get ellipsoid actor
////////////////////////////////////////////////////////////////////////////

 

BEST REGARDS

 

Lian



---------------------------------
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®


---------------------------------
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020327/516ccfb6/attachment.htm>


More information about the vtkusers mailing list