[vtkusers] Tristrips in different colors

Sebastien BARRE seb-ml-vtk at barre.nom.fr
Sun Sep 10 09:39:38 EDT 2000


At 21:47 09/09/00 -0500, Kent Vander Velden a écrit:

>   Would anyone happen to have example code that demonstrates how to color
>each tristrip in an object a different color?  I would like to get a feeling
>for how well the objects are being tristriped.

See Bill answer, but if you just want to have a look at the strips quickly, 
use the IdFilter to give a scalar value to each cell (strip) corresponding 
to its unique cell ID, then show the scalars.

Tcl :

     vtkSphereSource s
     s SetThetaResolution 10
     s SetPhiResolution 10

     vtkStripper sstrip
     sstrip SetInput [s GetOutput]
     set input sstrip

     vtkIdFilter sidf
     sidf PointIdsOff
     sidf CellIdsOn
     sidf SetInput [$input GetOutput]

     vtkPolyDataMapper sm
     sm SetInput [sidf GetOutput]
     sm ScalarVisibilityOn

You have to change the range of the mapper, something like this :

         sidf Update
         eval sm SetScalarRange 0 [expr [[sidf GetOutput] 
GetNumberOfStrips] -1]





More information about the vtkusers mailing list