meshpro / pygalmesh

:spider_web: A Python interface to CGAL's meshing tools
GNU General Public License v3.0
580 stars 57 forks source link

extra_feature_edges does not seem to have any effect #182

Closed lahwaacz closed 2 years ago

lahwaacz commented 2 years ago

I tried the example for domain combination with extra feature edges (i.e. the second code block in the linked section). However, I've got this mesh:

balls-difference.png

Also the edge length seems to be non-uniform along the circle where the spheres intersected. Any idea what went wrong?

nschloe commented 2 years ago

I'd have to look at it in more detail. I don't have much time these days, so don't hold your breath.

lahwaacz commented 2 years ago

No problem, take your time. I might dig into it myself when I find more time.

lahwaacz commented 2 years ago

I found the problem. In the example, the feature points are sampled based on angles

alpha = np.linspace(0.0, 2 * np.pi, n + 1)

The first element of this array is 0, but the last element is -2.12115048e-16 due to rounding. This has the weird consequence in CGAL effectively not preserving features – probably because the smallest distance between feature points was about 1e-16, but max_edge_size_at_feature_edges was set to 0.15. When I overwrote the last angle with the first, alpha[-1] = alpha[0], I got the expected result with preserved features.

nschloe commented 2 years ago

Thanks for finding this out! I'll fix the readme in a bit.