# How to determine the size of triangles I want from vtkdelaunay2d(C++)

Hello all,

Assume I have 4 points(3 are vertices of a triangle, and another one is one point inside that triangle(not on the edge)).

I want to use delaunay2d to get three triangles(Connect that one point with the other three vertices).

However, in some cases, I got only two triangles.

Is there any parameter that I can use to control the number of triangles I want to get from this filter?
I have looked up the constraintedDelaunay but find it prohibits you from having triangles inside a boundary. I also checked alpha and found it not helpful.

This is how I did the triangulation.

``````    vtkNew<vtkPolyData> polyData;
polyData -> SetPoints(points);

// Triangulate the grid
vtkNew<vtkDelaunay2D> delaunay;
delaunay -> SetInputData(polyData);
delaunay->Update();
``````

Since you havenâ€™t shared the data, I can only guess at the situation. Long story short, this size of the triangles is completely determined by the distribution of points (this is the definition of the DT Delaunay Triangulation). It would be far easier to manually connect the four points into three triangles.

Having said that, I think what is happening is that when the interior point is â€ścloseâ€ť to the boundary of the exterior triangle, you are running into effects due to the convex hull property of the incremental insertion algorithm used to generate the DT in the current VTK implementation. The insertion algorithm begins with a bounding mesh, and then incrementally inserts points into this bounding mesh, adjusting the DT to satisfy the Delaunay criterion. (To demonstrate this, try adjusting the Offset data member, and you might want to enable the BoundingTriangulation boolean.) If the interior point is â€ścloseâ€ť to one of the edges of the boundary triangle, this approach can produce a non-convex triangulation etc. By increasing Offset, this effect will be reduced.

1 Like