[vtkusers] Assign colors to lines of vtkPolyData with cell type polygon.

Martijn Koopman koopman.mk at gmail.com
Fri Nov 24 15:01:45 EST 2017


Indeed. I did look at the example of the the ContourTriangulator.

I fixed it by re-inserting the line cells to the vtkPolyData after running
the vtkContourTriangulator.
I did not know it was possible to mixed various cell types within one
vtkPolyData. Thought it was only possible for vtkUnstrcuturedGrid.

After that I iterate all cells and assign a color (scalar) to those of type
VTK_LINE.
Now I have constructed polygons whose exterior ring (boundary) and interior
rings (holes) have a different color.

Using vtkFeatureEdges would probably yield the same result.

Thanks

2017-11-24 3:55 GMT+01:00 kenichiro yoshimi <rccm.kyoshimi at gmail.com>:

> Hello Martijn,
>
> The vtkPolyDataConnectivityFilter provides a simple way to assign
> colors to regional rings. I hope the attached example will help you.
> Also here are the examples for reference.
> https://lorensen.github.io/VTKExamples/site/Cxx/
> Modelling/ContourTriangulator/
> https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/
> ExtractOutsideSurface/
>
> Thanks
>
> 2017-11-24 5:52 GMT+09:00 Martijn Koopman <koopman.mk at gmail.com>:
> > Hello,
> >
> > I have a vtkPolyData which cell types are polygons.
> > Is it possible to color individual lines of such a vtkPolyData?
> >
> > I know it is possible to color individual cells by creating a data array,
> > setting it as cell data and calling
> > vtkPolyDataMapper::SetScalarModeToUseCellData().
> >
> > However, the cells of the polydata are polygons, not lines.
> >
> > Some background information:
> > First I read polygons from a file. Each polygon consists of an exterior
> ring
> > and zero or more interior rings.
> > I construct a vtkPolyData with these rings as lines and use
> > vtkContourTriangulator to form the polygons.
> > vtkContourTriangulator returns a vtkPolyData with polygons ofcourse.
> >
> > Afterwards I want to assign a color only to those lines that constitute
> the
> > interior and exterior rings, not the lines that make up the
> triangulation.
> >
> > Thanks in Advance,
> > Martijn
> >
> > _______________________________________________
> > 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
> >
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171124/264bc19b/attachment.html>


More information about the vtkusers mailing list