FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
746 stars 187 forks source link

Triangulate command does not work properly #264

Open abaikin opened 1 year ago

abaikin commented 1 year ago

Dear FF developers,

I tried to run the following code that makes the triangulation of the set of point.

real[int] xp =  [-2.5, -2.15475054099667, -1.25, -2.380952390876986, -1.561972650353577];

real[int] yp =  [0.5, -0.9500478486996595, 0.5, 0, 0];

mesh Thxy=triangulate(xp, yp);

plot(Thxy);

But it raised the error

Assertion fail : (area > 0)
        line :303, in file ../femlib/fem.hpp

I also tried scipy and it works ok for this set of points.

frederichecht commented 1 year ago

The problem is due to roundoff error objet in no convex

if the change by

`real[int] xp = [-2.5, -2.15475054099667-1e-8, -1.25, -2.380952390876986, -1.561972650353577];

real[int] yp = [0.5, -0.9500478486996595, 0.5, 0, 0]; `

it works.

abaikin commented 1 year ago

@frederichecht Thank you for your reply!

This set of points is just an example. Is there a way to fix the issue for a general case?