[vtk-developers] VTK_POLYHEDRON problem is non-convex faces

Michael Migliore michael.migliore at kitware.com
Thu Dec 20 06:45:20 EST 2018


Hi Markos,
In order to correctly render polygons in OpenGL, we need to cut them
into triangles.
While it is straightforward for convex polygons (choose an edge and
construct triangles with other points), it is another story for
concaves.
For information, the code is here:
https://github.com/Kitware/VTK/blob/d8011ccc51fb1cd99d2bbce57b8f76715f116bb5/Rendering/OpenGL2/vtkOpenGLIndexBufferObject.cxx#L496
As far as I know, when trying to render a polygon, VTK expects it to be convex.

Regards,
Michael

On Thu, Dec 20, 2018 at 10:03 AM Markos Kopanos <mkopano at gmail.com> wrote:
>
> I have a question regarding the VTK_POLYHEDRON. When all the faces are convex faces the rendering is ok.
>
> When one of the faces is non-convex the result is wrong
>
>
>
>
> The corresponding code is this
>
>
>
> vtkSmartPointer<vtkUnstructuredGrid> ugrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
>
>        ugrid->SetPoints(points);
>
>        ugrid->InsertNextCell(VTK_POLYHEDRON, 10, dodechedronPointsIds, 6, Faces->GetPointer());
>
>
>
> When I use wireframe representation for both convex and non-convex polygons the results are ok (the second attached file)
>
>
>
> SetRepresentationToWireframe();
>
>
>
> When I use rendering  representation for convex faces is ok but for non-convex the representation is wrong
>
>
>
> tmpCustomActor->GetProperty()->SetRepresentationToSurface()
>
>
> Thanks
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtk-developers
>


-- 
Michael Migliore
R&D Engineer, Scientific Visualization Team
Kitware SAS


More information about the vtk-developers mailing list