Distance of a point to a curve

Dear root experts,

I am fitting a bunch of (double) points in TGraphErrors to a curve. After the fitting, I want to obtain the minimum distance of each point to the curve. How can I do that ?


The “distance of each point to the curve” depends on the curve’s equation.

For examples fitting an ellipse to a set of data points, see:

How about fitting to an exponential ? How will I calculate the minimum distance from data to fit ? Is there a built in method for this ? TF1::DistancetoPrimitive (Int_t px, Int_t py) accepts only integer and TF1::Eval (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) helps calculate only vertical distance.

Is used internally to perform actions on object display the canvas (interactivity)

Should help I guess … ?

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