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 ?

Thanks.

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:
${ROOTSYS}/tutorials/fit/fitEllipseTGraphRMM.cxx
${ROOTSYS}/tutorials/fit/fitEllipseTGraphDLSF.cxx

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.