TGraph2D problems with retrieving values

Hello I’m trying to retrieve values from a TGraph2D and have come across 2 problems.

There is apparently no GetPoint() operator or any other way to directly access the point arrays that I could find.

The Interpolate() command appears to fail if you are exactly on a point.

Are these oversights or intentional?

Hi,
I use V 5.34.36
1.
To access points of the TGraph2D use:
Double_t * x = g2->GetX(); etc.
2.
Interpolate returns 0 for points on the edge of the TGraph2D.
For points inside it works if they coincide with points of the TGraph2D.
See macro below.

Cheers
Otto

void tg2() { TGraph2D *g2 = new TGraph2D(5); g2->SetPoint(0, 1, 1, 2); g2->SetPoint(1, 3, 1, 2); g2->SetPoint(2, 3, 3, 2); g2->SetPoint(3, 1, 3, 2); g2->SetPoint(4, 2, 2, 3); g2->Draw("surf2"); Double_t * x = g2->GetX(); cout << "x[2] " << x[2] << endl; cout << g2->Interpolate(2, 2) << endl; cout << g2->Interpolate(1.5, 2.5) << endl; cout << g2->Interpolate(1, 1) << endl; }

Hi Otto,

With the new triangulation software the point on edge does not return 0 (point (1,1) in your example).
With the master version of ROOT you macro gives me:

root [0] 
Processing tg2.C...
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
x[2] 3
3
2.5
2