[vtkusers] why use SetScalars instead of SetVectors for coloring

David Doria daviddoria at gmail.com
Thu Jan 12 10:27:19 EST 2012


On Sun, Oct 16, 2011 at 1:37 PM, Yifei Li <yifli82 at gmail.com> wrote:
> Hi,
>
> I saw examples using SetScalars(colors) to color cells/points, where
> 'colors' is a vtkUnsignedCharArray with 3 components in each tuple.
>
> A (r, g, b) color can be considered as a vector, I don't understand why vtk
> treast color as scalar data instead of vector data. Why can't I use
> SetVectors?
>
> Can someone please  explain the reason?
>
> Thanks
>
> Yifei

I think the idea is that VTK treats "vectors" only as "things that
indicate a direction", rather than "something with multiple elements".
For example, normals to a surface (normal vectors) are "vectors", the
gradient of an image would be "vectors", but colors, though they have
3 components, do not represent a direction so they are "scalars".

David



More information about the vtkusers mailing list