[vtkusers] AddArray() to polydata

Eric E. Monson emonson at cs.duke.edu
Thu Sep 30 19:40:34 EDT 2010


I think it's a bad idea to change the scalars just to change the color. 

You can add an array that defines the color:

http://www.paraview.org/Wiki/VTK/Examples/Cxx/Visualization/ColorGlyphs
http://www.paraview.org/Wiki/VTK/Examples/Cxx/PolyData/ColoredPoints

You can change the colormap that the scalars are mapped through:

http://www.paraview.org/Wiki/VTK/Examples/Cxx/Utilities/ColorLookupTable
http://www.paraview.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCells
http://www.paraview.org/Wiki/VTK/Examples/Cxx/Meshes/Color_a_mesh_by_height

You can set the actor to a certain color:

http://www.paraview.org/Wiki/VTK/Examples/Cxx/Visualization/ColorAnActor

If you just want each to have a certain solid color I guess I'd choose the last option -- it won't increase the memory usage by adding data to every point.

The output of the mapper is just used for the actor. If you want to view the data in ParaView with the same colors then maybe someone else can remember if you can color objects by a 3-component RGB array in ParaView. One way or another you'll have to write your polydata out in some standard format like the XML-based .vtp or a legacy .vtk file:

http://www.paraview.org/Wiki/VTK/Examples/Cxx/IO/WriteVTP

-Eric


On Sep 30, 2010, at 6:26 PM, ChiaWeng Boon wrote:

> Thanks Eric for your help.  I really appreciate it.
> 
>> From the previous email, the impression is that by SetValue(0,2.0),  I
> will  change the contouring from F(x,y)=0 to F(x,y) =2.0.  Instead
> what I would like is to contour F(x,y)=0 but map it to a different
> color for different implicit functions.  I have many implicit
> functions.  So maybe after contouring F(x,y)=0, I change the scalars I
> stored to 2.0.  How do I do that?
> 
> The next question is how do I write the output of PolyDataMapper?  I
> want to pass it to Paraview.
> 
> 
> Thanks,
> 
> Boon




More information about the vtkusers mailing list