[vtkusers] about the picking of vtkTensorGlyph

lian jiang jl_vtk at yahoo.com
Wed Mar 27 09:35:30 EST 2002


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®
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020327/cc772bcb/attachment.htm>


More information about the vtkusers mailing list