TGraph2D Interpolate returns 0

Dear experts,

I am struggling with the Interpolate() method of TGraph2D.
There are some coordinates that for some reason returns 0.0. These coordinates are completely valid because in the plot I can see that they have non-zero value.

This is how my graph looks like drawn with “colz” option:

To reproduce the problem, please download the root file attached and execute:

root yield_graphs.root
graph_yield_nom->Interpolate(750, 500) // this returns a non-zero value
graph_yield_nom->Interpolate(760, 500) // this returns zero
graph_yield_nom->Interpolate(770, 500) // this returns zero
graph_yield_nom->Interpolate(780, 500) // this returns zero
graph_yield_nom->Interpolate(790, 500) // this returns a non-zero value
graph_yield_nom->Interpolate(800, 500) // this returns zero

I cannot really make sense why some coordinates return zero when they should be interpolatable by Delaunay triangle.
I hope the experts here can help.

Thanks!

Best regards,
Yosse

yield_graphs.root (4.8 KB)

_ROOT Version: v6-24-08

I do not see the same “0” but I see some too with root master on Mac

The computation is done here:

There is an atempt to avoid 0 . It seems a known issue. May Be @moneta has some ideas about it ?

Indeed, as suggested in the code I posted, Interpolate might fail if the point is on/near a edge. Adding an epsilon helps:

graph_yield_nom->Interpolate(800, 500.001)

I think this is a bug and it needs to be fixed. The workaround showed above seems to not work in some cases. Can you please open a GitHub issue on this ?
Thank you,

Lorenzo

Thank you for the suggestion! I have open an issue on this problem: TGraph2D's Interpolate() returns 0 · Issue #12535 · root-project/root · GitHub

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.