[vtkusers] why doesn't my glyph scale?

Akiko Campbell adcampbell at shaw.ca
Mon Apr 18 19:31:32 EDT 2005


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


More information about the vtkusers mailing list