[vtkusers] Set point color knowing its value

David E DeMarle dave.demarle at kitware.com
Thu Oct 30 10:08:08 EDT 2008


On Wed, Oct 29, 2008 at 4:40 PM, B. C. <butterfly.1688 at yahoo.fr> wrote:
> Hi everyone.
> I have a polydata. I computed its maximum curvatures and stored the values
> in an array.
> Now, i want to do this:
> for each value in the array, if it's <0 set its color to 'red', else to
> 'black'
> I did this:
> vtkIdType nPoints = myArray->GetNumberOfComponents();
> double curveValue;
> for (vtkIdType i=1; i<=nPoints; i++)
> {
>   curveValue = myArray->GetValue(i);
>   if (curveValue<0)
>    //Set the color to 'red'
>   else
>    //Set the color to 'blue'
>  }
>
> Can someone help me to fichish the missing code?
> Thank you for your help
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>

You can either create an RGB array or better use a Lookup table.

Read the VTK User's Guide chapter 5. Or look at the programs in the
Examples directory and to investigate how the rendering portion of VTK
works and can be controlled.

cheers,

-- 
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



More information about the vtkusers mailing list