[vtkusers] How to triangulate two non-intersecting polylines (in 2D)

David Gobbi david.gobbi at gmail.com
Fri Feb 23 14:31:31 EST 2018


Hi Normanius,

Put them through vtkAppendPolyData and then through vtkContourTriangulator:
https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/ContourTriangulator

It is also possible to do this with vtkDelaunay2D, but it is more
complicated.

The vtkTriangleFilter does something quite different from this.

 - David


On Fri, Feb 23, 2018 at 12:22 PM, normanius <juch at zhaw.ch> wrote:

> Let's be given two polylines in a plane as shown in the figure below. I
> assume that these two lines are not intersecting, but can have a generic
> shape (so they may be non-convex). Note that the number of points varies
> between the two lines. (In my example, the objects have been created using
> vtkRegularPolygonSource)
>
> Do you have an idea how I can triangulate the ring that is defined by the
> inner and outer polyline in vtk? (See second image, for an idea)
>
> Combining the polylines with vtkAppendPolyData does not work, because
> vtkTriangleFilter then would triangulate the two polylines separately. I
> guess the right way would be to create a polygon object that is composed of
> the two lines in a "clever way" and then to call vtkTriangleFilter on this
> data, but I could not manage.
>
> Many thanks for your inputs!
>
> <http://vtk.1045678.n5.nabble.com/file/t341102/Screen_Shot_
> 2018-02-23_at_19.png>
> <http://vtk.1045678.n5.nabble.com/file/t341102/triangulated.png>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180223/e4f37f3e/attachment.html>


More information about the vtkusers mailing list