drufat / triangle

Python bindings to the triangle library
GNU Lesser General Public License v3.0
229 stars 53 forks source link

Refine mesh #79

Open steve725 opened 4 months ago

steve725 commented 4 months ago

What is the right way to refine a mesh inside a given region (polygon)? Is it necessary to create an additional area-file that is used with the "r"-switch or is it possible to refine a mesh e.g. with the "regions" key ?

steve725 commented 4 months ago

I already found a solution:

1) First triangulate without refinement

2) Create a list with the area of each triangle; e.g tri_max_area = [10, 10, 10, 30, 30 ...] where tri_max_area[i] is the max area of triangle i

3) Add the following key-value-pair to the input dictionary: "triangle_max_area": tri_max_area

4) Perform a second triangulation with the additional arguments "ra" while there is no following maximum triangle area after the "a" switch