[vtkusers] Multiple scalars in vtkPolyData

Charles Boivin Charles.Boivin at rwdiwest.com
Mon Aug 23 18:57:42 EDT 2004


Hello all,

I am writing a reader for my own data format; I am using a polygonal
data set. I have been reading the various material in the VTK books (in
particular, chapter 5 in "The Visualization Toolkit"), but I am missing
some information here.

I have no problems reading the geometry/topology from my files and
displaying them properly. However, I am struggling a bit with loading
point and cell data. In particular, the examples in chapter 5 always
only deal with one scalar for the point or cell data. How do I load
multiple scalars? And this also begs another question: how can I select
which one I want to display once I have been able to load several ones?

Similarly, can multiple vectors be loaded?

It seems as if functions SetActiveScalars(name) and GetScalars(name)
are to be used here... but in what order should I use them? Do I have to
specify how many scalars I have before I start making calls to
vtkPolyData::GetPointData()->SetScalars()? I am a bit confused here... 

I would have thought that something along the lines of:

Loop over all scalars
   SetActiveScalars(ScalarName[i])
   Set the values for the scalar for every point
   GetPointData()->SetScalars(...)
end loop over scalars

would work, but I can't get things to display quite properly. Could
anyone confirm whether this approach makes sense, or point towards an
example where multiple scalars are being defined? I guess I might also
have errors elsewhere in the code...

I apologize if things sound a bit unorganized, but I am a bit confused
with this at the moment. Any help would be appreciated.

Thank you,

Charles Boivin



More information about the vtkusers mailing list