[vtkusers] Polygon colouring

Gib Bogle g.bogle at auckland.ac.nz
Sun Oct 19 20:27:40 EDT 2014


Thanks Bill.  Following David Gobbi's suggestion, I got something working in a similar way to the ColorCellsWithRGB example.  But I can't say I fully understand it.  Specifically, I don't see why this statement

  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);
or in my code
  polygonPolyData->GetCellData()->SetScalars(colors);

sets the colours.  How is it that the vtkUnsignedCharArray is interpreted as providing colours?

Cheers
Gib
________________________________________
From: Bill Lorensen [bill.lorensen at gmail.com]
Sent: Monday, 20 October 2014 12:39 a.m.
To: Gib Bogle
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Polygon colouring

Gib,

Here are a couple of examples:
http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCellsWithRGB
http://vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ColorCells

Bill

On Sat, Oct 18, 2014 at 10:18 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:
> I'm rendering a shape using vtkPolyData, i.e. as a collection of polygons.
> Is there a way to colour each polygon separately?
>
> polygonPolyData = vtkSmartPointer<vtkPolyData>::New();
> polygonPolyData->SetPoints(points);
> polygonPolyData->SetPolys(polygons);
> hexmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
> hexmapper->SetInput(polygonPolyData);
> hexactor = vtkSmartPointer<vtkActor>::New();
> hexactor->SetMapper(hexmapper);
>
> ren->AddActor(hexactor);
>
>
> Thanks
> Gib
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
>



--
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list