I have a TGraph2D that contains a set of points, the boundary is not a circle or square but an irregular shape. When I use TGraph2D::Interpolation, due to the triangle interpolation some out-of-range position will be interpolated which is not what I expected, is there any way to disable it? I attach the view of the boundary and the unexpected region.
Thank you for the reply, my question is not about drawing points. I want to do interpolation when I give a position which inside the boundary, but I donât want to interpolate out of the boundary as I showed above (since itâs not âinterpolationâ). The problem is TGraph2D::Interpolate() is using Delaunay triangulation so somewhere like (1, 0.5) in the graph above will give a strange interpolation result. Can I somehow disable the interpolation only for the region that out of boundary?
If the point is out of a triangle itâs 0, thatâs fine. But when Itâs in a triangle but out of boundary like (10, 5), it returns an unexpected interpolated value. If you draw the plot by TRI option you can see it. The reason is that region near (10,5) should not be interpolated but extrapolated.
I see . There is no duplicates. The algorithm does the triangulation this way. It cannot find out that you do not expect these triangles to not be part of the data set. It always defines as many triangles as it could.
Sorry I have a small question of the source code of TGraph2D::Interpolate: 1243,
if (!TestBit(kOldInterpolation) )
May I ask what does this line mean and when it will return true? I found if this returns true ROOT will find TGraphDelaunay2D which should not make triangles out of the concave curve as described here
Ah I see, TGraph2D is doing an unconstrained Delaunay Triangulation since no edges is passed to it. Is there a way to pass edges to let TGraph2D make a constrained triangulation?
The Delaunay triangulation is done ultimately by the CDT package call by Delaunay2D. May be CDT can be instructed to use a constrained triangulation. This need to be checked.
In my case, the points are actually a grid with constant interval (0.1 x 0.1), so I can delete triangles that circumscribed circles that radius larger than sqrt(0.1x0.1 + 0.1x0.1) to get rid of triangles out of boundary. I see CDT have functions to erase triangles, but seems there is no accessor in the Delaunay2D?