[vtkusers] scalar array

Gala Wind wind at climate.gsfc.nasa.gov
Wed Oct 23 16:33:05 EDT 2002


Here's how:

first of all you need to make a vtkScalars object out of  your data. 
Here's how to do that:
in this case the scalars are floating point numbers, stored in the 
array eff_rad.

     vtkFloatArray* scalars = vtkFloatArray::New();
     scalars->SetNumberOfValues(data_size);
         for (int i=0; i<data_size; i++)
             scalars->SetValue(i, eff_rad[i]);

once you get your scalars in such shape, do this:

say your polydata is called p_data.

p_data->SetScalars(scalars);

I needed to do that for this visualization I was doing. I wanted to 
warp a plane using one set of scalars and color it using another set of 
scalars, so I did what I just told you on the output of vtkWarpScalars, 
which is polydata. That changed the colors quite nicely.

-- Gala


On Wednesday, October 23, 2002, at 01:16  PM, Stefan Ulbrich wrote:

> hello,
>
> how can I associate a scalar array with a polydata so that I can use 
> scalars to be mapped as colors?
>
> thanx
>
> stefan
>
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
>
>
Gala Wind
(301) 614-6221
wind at climate.gsfc.nasa.gov
Code 913, Climate and Radiation
L-3 Comm/ Emergent East
NASA/GSFC
Greenbelt, MD 20771

/*--------------------------------------------------------------------
   -- There's always a way, you just have to find it.
			( B. Hambly "Children of the Jedi" )
----------------------------------------------------------------------*/




More information about the vtkusers mailing list