mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ScatterDraw: Added error checking in MaxSubDataImp()
git-svn-id: svn://ultimatepp.org/upp/trunk@11785 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e25c9f8feb
commit
da9bf720aa
1 changed files with 3 additions and 2 deletions
|
|
@ -94,11 +94,12 @@ Pointf DataSource::MaxSubDataImp(Getdatafun getdataY, Getdatafun getdataX, int64
|
|||
}
|
||||
VectorPointf pf(p);
|
||||
PolynomialEquation2 polyFit;
|
||||
polyFit.Fit(pf);
|
||||
if (ExplicitEquation::NoError != polyFit.Fit(pf))
|
||||
return Null;
|
||||
const Vector<double> &coeff = polyFit.GetCoeff();
|
||||
double b = coeff[1];
|
||||
double a = coeff[2];
|
||||
if (IsNull(a) || a < 1E-10)
|
||||
if (IsNull(a) || fabs(a) < 1E-10)
|
||||
return Null;
|
||||
return Pointf(-b/2/a, polyFit.f(-b/2/a));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue