Hello,

I have recently been testing libcsironn (the version from plplot).

I have come across 2 errors :

1) in trunk/lib/nn/delaunay.c : delaunay_circles_find()

line 679 : if (tid < 0 || tid == nn) {

should be changed to

line 679 : if (tid < 0 || i == nn) {

This bug leads to "random" results, ie: the result of the interpolation depended on the search just before.

2) in trunk/lib/nn/nncommon.c : circle_contains()

line 90 : return hypot(c->x - p->x, c->y - p->y) <= c->r;

should be changed to

line 90 : return hypot(c->x - p->x, c->y - p->y) < c->r + 0.000001;

This is just a standard floating point equality checking bug. It surfaces when asking to interpolate on one of the given x,y coordinates. It gives the result of delaunay_xytoi returning a certain triangle for the point, but then the circle_contains() function says this point is no part of the circumcircle.

I don't know if there is any "upstream" version of this library left that maintains this code ?

Kind regards,

Pieter-Jan Busschaert

I have recently been testing libcsironn (the version from plplot).

I have come across 2 errors :

1) in trunk/lib/nn/delaunay.c : delaunay_circles_find()

line 679 : if (tid < 0 || tid == nn) {

should be changed to

line 679 : if (tid < 0 || i == nn) {

This bug leads to "random" results, ie: the result of the interpolation depended on the search just before.

2) in trunk/lib/nn/nncommon.c : circle_contains()

line 90 : return hypot(c->x - p->x, c->y - p->y) <= c->r;

should be changed to

line 90 : return hypot(c->x - p->x, c->y - p->y) < c->r + 0.000001;

This is just a standard floating point equality checking bug. It surfaces when asking to interpolate on one of the given x,y coordinates. It gives the result of delaunay_xytoi returning a certain triangle for the point, but then the circle_contains() function says this point is no part of the circumcircle.

I don't know if there is any "upstream" version of this library left that maintains this code ?

Kind regards,

Pieter-Jan Busschaert