mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
*ScatterDraw: Fixed DataSource problem
git-svn-id: svn://ultimatepp.org/upp/trunk@11783 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7c5280d7a4
commit
21e6dd5438
1 changed files with 5 additions and 1 deletions
|
|
@ -98,6 +98,8 @@ Pointf DataSource::MaxSubDataImp(Getdatafun getdataY, Getdatafun getdataX, int64
|
|||
const Vector<double> &coeff = polyFit.GetCoeff();
|
||||
double b = coeff[1];
|
||||
double a = coeff[2];
|
||||
if (IsNull(a) || a < 1E-10)
|
||||
return Null;
|
||||
return Pointf(-b/2/a, polyFit.f(-b/2/a));
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +161,7 @@ double DataSource::Variance(Getdatafun getdata, double avg) {
|
|||
count++;
|
||||
}
|
||||
}
|
||||
if (count <= 0)
|
||||
if (count <= 1)
|
||||
return Null;
|
||||
return ret/(count - 1);
|
||||
}
|
||||
|
|
@ -647,6 +649,8 @@ void DataSource::GetSpectralMoments(Getdatafun getdataY, Getdatafun getdataX, bo
|
|||
|
||||
bool DataSource::SameX(DataSource &data) {
|
||||
int64 num = GetCount();
|
||||
if (num == 0)
|
||||
return false;
|
||||
if (data.GetCount() != num)
|
||||
return false;
|
||||
for (int64 i = 0; i < num; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue