How to generate less triangles for polygon triangulation?

Given a set of planar points in 3d space(vector3d), I can make a polygon.
To triangulate the polygon, there are many options. I used vtkTriangleFilter. It’s quite fast and robust, the only problem is that output of vtkTriangulation is not uniform, somewhat like below.

Now when I subdivide this triangulation, there will be more triangle generated. My question is: how can I control the generated cells cnt while maintaing a relative uniform triangulation?

I know I can use delaunay triangulation, but delaunay is much slower and seems like an overkill, as I don’t need the triangles to meet delaunay criterion.

As @Jens_Munk_Hansen mentioned, I can make the triangulation more uniform by using vtkAdaptiveSubdivisionFilter. By setting maximum edge length/maximum triangle area of this filter, triangulation will be more uniform. The problem is, since this filter does not set minimum edge length/minimum triangle area, it may generate more triangles than I want.
If I do

vtkNew<vtkAdaptiveSubdivisionFilter> sf;
sf -> SetMaximumEdgeLength (double)
sf -> SetMaximumNumberOfTriangles (vtkIdType)

there might be holes inside sf->GetOutput()

Have you tried, vtkAdaptiveSubdivisionFilter?

thanks for quick reply! I just realized I didn’t specify my questions accurately, my apologies. I’ve updated the question.
I tried this filter. The problem is, I want to make the triangulation more uniform while controlling the number of triangles under some count(so that it will be faster to process in later stages). vtkAdaptiveSubdivisionFilter is good in terms of uniform triangulation, but since I can’t set minimum edge length/triangle area, there might be a lot of new triangles generated.

I don’t think any of the VTK filters can do a good-quality uniform remeshing, but instead you could use the ACVD algorithm. This algorithm is conveniently available in the VTK-based (via pyvista) pyacvd Python package.

Thanks for reply. I’m using c++ and I think it might be easier to use the c++ version (GitHub - valette/ACVD: Fast simplification of 3D surface meshes) of ACVD?
btw, while I’m searching I found that there’s already a post regarding integrating ACVD in vtk(Feature request: add ACVD uniform remeshing filter). Any idea when it will be integrated into vtk?

FYI @Charles_Gueunet

I tried ACVD c++ version but it didn’t work in my case. ACVD/vtkSurface.h at 18209c905194fd4ecd3c2b469568c157d7f2a1fe · valette/ACVD · GitHub here it generates surface from .wrl, .vtk and .ply files(also illustrated in example code: ACVD/ACVD.cxx at 18209c905194fd4ecd3c2b469568c157d7f2a1fe · valette/ACVD · GitHub), whereas in my case I want to generate surface from polygon polydata.

If the input is any kind of polygonal mesh then ACVD will work well. You may need to apply VTK triangle and subdivide filters on your mesh before passing it to ACVD.

1 Like

oh thanks for pointing out. I realized I was looking at vtkSurface class, who inherits vtkSurfaceBase, and in the base class it has function to create from polydata, and that solved my problem. Thank you very much!

I should have thought of that. I use ACVD in a couple of my projects. For sure some of the content qualify for being a part of VTK. The quadics are awesome.