[vtkusers] why doesn't my glyph scale?

Malcolm Drummond malcolm at geovision.co.za
Tue Apr 19 04:36:54 EDT 2005


Hi Akiko

I think Glyph3D only works on point-data - so your problem could be due to scalars being in cell-data.

HTH
Malcolm Drummond
GeoVision cc
  ----- Original Message ----- 
  From: Akiko Campbell 
  To: vtkusers at vtk.org 
  Sent: Tuesday, April 19, 2005 1:31 AM
  Subject: [vtkusers] why doesn't my glyph scale?


  Hello,

   

  I have a set of points I’d like to visualize with glyphs but glyphs don’t seem to scale at all. I read in point’s vector components into a float array (eigenVector_1) and corresponding magnitude data into another float array (eigenValue_1).  Since magnitude information is stored in a separate array as scalars, I would like to use SetScaleModeToScaleByScalar() to scale glyphs but all glyphs are exactly the same shape and are directed in the same direction.  I am wondering if something I’m doing is wrong here.  Could someone give me an insight?  Thank you!

   

  vtkPolyData *points = reader->GetOutput();

  const unsigned int numberOfPoints = vpoints->GetNumberOfPoints();

  vtkFloatArray *eigenVector_1 = vtkFloatArray::New();

  eigenVector_1->SetNumberOfComponents( 3 );

  eigenVector_1->SetNumberOfTuples( numberOfPoints );

  vtkFloatArray *eigenValue_1 = vtkFloatArray::New();

  eigenValue_1->SetNumberOfTuples( numberOfPoints );

  //************************************************

  A brief version of loop to populate the arrays:

   

  for (unsigned int ctr=0; ctr < numberOfPoints; ctr++){

   eigenVector_1->SetComponent( ctr, 0, voxelValue_1_X[X] );

   eigenVector_1->SetComponent( ctr, 1, voxelValue_1_Y[Y] );

   eigenVector_1->SetComponent( ctr, 2, voxelValue_1_Z[Z] );

   

   eigenValue_1->SetValue( ctr, pixelValue[X] );

  }

  //************************************************

   

  //Set the vectors and scalars 

  points->GetPointData()->SetVectors( eigenVector_1 ); 

  points->GetCellData()->SetScalars( eigenValue_1 );

   

  vtkSphereSource *source = vtkSphereSource::New();

  source->SetThetaResolution( 6 );

  source->SetPhiResolution( 5 );

  source->SetRadius( 0.5 );

  vtkGlyph3D *glyph = vtkGlyph3D::New();

  glyph->SetInput(points);

  glyph->SetSource(source->GetOutput());

  glyph->ScalingOff(); // I read somewhere I need to set this off…even with ScalingOn(), no scaling happens. 

  glyph->OrientOn();

  glyph->SetVectorModeToUseVector();

  glyph->SetScaleModeToScaleByScalar();

  glyph->SetColorModeToColorByScalar();

  glyph->Update();



  --
  No virus found in this outgoing message.
  Checked by AVG Anti-Virus.
  Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 2005-04-18




------------------------------------------------------------------------------


  _______________________________________________
  This is the private VTK discussion list. 
  Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
  Follow this link to subscribe/unsubscribe:
  http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050419/47b3015b/attachment.htm>


More information about the vtkusers mailing list