[vtkusers] How to replace the scalars of some polydata/mapper?

David Gobbi david.gobbi at gmail.com
Mon Dec 21 18:17:44 EST 2009


On Mon, Dec 21, 2009 at 3:40 PM,  <lynx.abraxas at freenet.de> wrote:
>
> Or   the   perhaps   easier   thing:  How  can  I  replace  the  scalars  from
> smoother.GenerateErrorScalarsOn() by some others? Do I have  to  iterate  over
> all or is there a more elegant way?
> Or can I tell the mapper to use not those but my new ones?
>
> Thanks,
> Lynx

I don't know for sure, but if you can, here's how to do it.

mapper->SetScalarModeToUsePointFieldData();
mapper->SetColorModeToMapScalars();
mapper->SelectColorArray("array"); // use your array name
mapper->SetLookupTable(yourTable);
mapper->UseLookupTableScalarRangeOn(); // Use the range that you set
for the table

This is the "mess" that Berk was talking about earlier.
Counter-intuitively, the "SelectColorArray" method does not require a
color array, it can take a regular scalar array (please, no comments
from the peanut gallery...).

I'm actually pretty happy about the way the mapper colors data.  But I
always wonder "what were they thinking" with regards to some of the
method names and the default settings.

   David



More information about the vtkusers mailing list