FreeFem/FreeFem-sources

Triangulate command does not work properly

abaikin opened this issue · 2 comments

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.

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.

@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?