[vtkusers] Difference between AddArray, SetScalars, SetVectors

Dominik Szczerba dominik at itis.ethz.ch
Thu Oct 22 15:53:01 EDT 2009


'Set' sets the current one, 'add' adds to the list you can chose from 
later. The concept of scalars, vectors and field data (arbitrary arrays) 
is not fully clear to me, but I usually go for the arrays.


David Doria wrote:
> To attach colors to points in a polydata, which one of these should I use?
> 
>   vtkSmartPointer<vtkUnsignedCharArray> Colors =
> vtkSmartPointer<vtkUnsignedCharArray>::New();
>   Colors->SetNumberOfComponents ( 3 );
>   Colors->SetName ( "RGB" );
> 
> 1) polydata->GetPointData()->SetScalars ( Colors ); - this one seems
> to be the most "paraview compatible", as the colors are automatically
> applied without having to go to "Display -> Color by -> RGB" as you do
> if you use the following two
> 2) polydata->GetCellData()->SetVectors ( Colors );
> 3) polydata->GetCellData()->AddArray(Colors);
> 
> This is not scalar data (they are triples):
> 
> unsigned char Red[3] = {255, 0, 0};
> Colors->InsertNextTupleValue ( Red );
> 
> so I don't even understand why this one would work (and it is the "best")?
> 
> Can anyone explain what is actually going on with these functions?
> 
> Thanks,
> 
> David
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list