[vtkusers] Scaling and colouring glyphs with different scalar arrays

John Platt jcplatt at lineone.net
Wed Mar 30 10:52:02 EST 2005


Hi Paul,

If you are using vtkGlyph3D, I seem to recall that it does not pass all
the input attribute data. I think you may find that "tag" is not present
in the output.

The trick is to use point scalars with 2 components. The 1st component
can be used for scaling and the 2nd component passed on to the glyph
mapper for colour mapping. You must use
vtkGlyph3D::SetColorModeToColorByScalar() to copy the input scalars to
the output.

In your glyph mapper, colour by component 1 -

	ScalarVisibilityOn();
      ColorByArrayComponent( "radius", 1 );

HTH

John.

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
Behalf Of Paul Cochrane
Sent: 30 March 2005 08:34
To: vtkusers at vtk.org
Subject: [vtkusers] Scaling and colouring glyphs with different scalar
arrays

Hi all,

I'm trying to colour and scale spherical glyphs using two different
scalar
arrays in an unstructured grid.  Unfortunately, what I seem to be able
to do
is to colour *and* scale according to the one scalar array (the one that
is
the currently active scalar) but not be able to scale by one scalar and
colour by the other.  I've searched through the mailing list archives
and
the docs, and have seen similar problems discussed, but when I tried the
solutions I haven't been able to make my problem work.  I've reduced the
problem down to a smallish script (attached) which illustrates the
problem.

I have two named arrays "radius" and "tag" and want to scale the
spherical
glyphs according to the radius, and colour according to the tag, but
when I
call SelectColorArray("tag") on the mapper object, nothing happens; I
get
the colouring being associated with the radius scalar data.  I've tried
setting SetScalarModeToUsePointFieldData() (which is supposed to work
better
with SelectColorArray()) however, this doesn't give me any colouring at
all.

What am I doing wrong?  Any ideas or help would be greatly appreciated.

Paul

-- 
Paul Cochrane
Computational Scientist/Software Developer
Earth Systems Science Computational Centre
University of Queensland
Brisbane
Queensland 4072
Australia

E: cochrane at esscc.uq.edu.au
P: +61 7 3346 9797
F: +61 7 3365 7347





More information about the vtkusers mailing list