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)
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.
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.
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.