[vtkusers] vtkGlyph2D range question

Charles Boivin Charles.Boivin at rwdiwest.com
Fri Sep 3 13:38:04 EDT 2004


Hmm.. I know I am answering my own question, but...

Going through the source code, I saw that there is a scalar value being
in the output that contains the magnitude of the vectors is
SetColorModeToColorByVector() was chosen. I was able to get the range
from there using something like:

	pGlyph->Update();
	pGlyph->GetOutput()->GetPointData()->GetScalars()->GetRange(dGlyphRange);

And then using that range in the mapper to make sure the vectors are
colored properly. Is that the way to go here or is there a better way?
Is it just me or is this not documented? Regardless, I thought I'd post
this so that others looking for a similar solution can find it.

Thanks,

Charles

>>> "Charles Boivin" <Charles.Boivin at rwdiwest.com> 09/03/04 11:19am
>>>
Hello everyone, yet another question from me... 

This one seems like it should not be too hard, but for some reason, so
far, it has eluded me. 

I have a vtkGlyph2D that I am using to display velocity vectors (using
a vtkGlyphSource2D class). It displays (and scales) them fine, except
for the color map. I am having trouble getting the range of values for
the magnitude of the vectors.

I have the following code..:

	pGlyph->SetVectorModeToUseVector();
	pGlyph->SetScaleModeToScaleByVector();
	pGlyph->SetColorModeToColorByVector();

So I would expect the vectors to be colored according to their
magnitude. They are, in a way, but the lookup does not get the full
range of values. For example, I know for a fact that magnitudes will
vary from 0.0 to about 3.8 in the example I am looking at. However, I
always get a range of [0..1] from GetRange() :

	pGlyph->Update();
	pGlyph->GetRange(dGlyphRange);

And the way that the velocity vectors are colored reflects just that.
I
can access the ranges for scalars (and individual components of the
velocity vectors) just fine, but can't get the range for the magnitude
of the vectors. Am I wrong in assuming that VTK should compute this
for
me? Or is this a case where I need to go through my data and compute
that myself?

Thank you in advance for your answers, I appreciate all the help. Will
try to help whenever I can, but still a relative newbie to VTK.

Charles
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list