"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "uppsrc/ScatterDraw/DataSource.cpp" between
upp-x11-src-13648.tar.gz and upp-x11-src-13659.tar.gz

About: Ultimate++ is a C++ cross-platform rapid application development framework. Stable release.

DataSource.cpp  (upp-x11-src-13648):DataSource.cpp  (upp-x11-src-13659)
skipping to change at line 70 skipping to change at line 70
continue; continue;
double d1 = Membercall(getdataY)(ii); double d1 = Membercall(getdataY)(ii);
if (d >= d_1 && d > d1) { if (d >= d_1 && d > d1) {
if (id.GetCount() == 0 || if (id.GetCount() == 0 ||
(Membercall(getdataX)(i) - Membercall(getdataX)(i d.GetCount() - 1) >= width)) (Membercall(getdataX)(i) - Membercall(getdataX)(i d.GetCount() - 1) >= width))
id << i; id << i;
} }
} }
} }
Pointf DataSource::MaxSubDataImp(Getdatafun getdataY, Getdatafun getdataX, int64 Pointf DataSource::MaxSubDataImp(Getdatafun getdataY, Getdatafun getdataX, int64
maxId, int64 width) maxId, int64 width) {
{
Vector<Pointf> p; Vector<Pointf> p;
int iw; int iw;
int64 idMin, idMax; int64 idMin, idMax;
iw = 0; iw = 0;
for (idMin = maxId - 1; idMin >= 0 && iw < width; idMin--) { for (idMin = maxId - 1; idMin >= 0 && iw < width; idMin--) {
if (IsNull(Membercall(getdataY)(idMin)) || IsNull(Membercall(getd ataX)(idMin))) if (IsNull(Membercall(getdataY)(idMin)) || IsNull(Membercall(getd ataX)(idMin)))
continue; continue;
iw++; iw++;
} }
skipping to change at line 124 skipping to change at line 123
if (!IsNull(d)) { if (!IsNull(d)) {
ret += d; ret += d;
count++; count++;
} }
} }
if (count == 0) if (count == 0)
return Null; return Null;
return ret/count; return ret/count;
} }
int64 DataSource::Closest(Getdatafun getdata, double dat) {
double minD = DBL_MAX;
int64 minDat;
for (int64 i = 0; i < GetCount(); ++i) {
double d = Membercall(getdata)(i);
if (!IsNull(d)) {
if (minD > abs(d - dat)) {
minD = abs(d - dat);
minDat = i;
}
}
}
if (minD == DBL_MAX)
return Null;
return minDat;
}
int64 DataSource::Closest(Getdatafun getdataX, Getdatafun getdataY, double x, do
uble y) {
double minD = DBL_MAX;
int64 minDat;
for (int64 i = 0; i < GetCount(); ++i) {
double dx = Membercall(getdataX)(i);
double dy = Membercall(getdataY)(i);
if (!IsNull(dx) && !IsNull(dy)) {
double d = sqr(dx - x) + sqr(dy - y);
if (minD > d) {
minD = d;
minDat = i;
}
}
}
if (minD == DBL_MAX)
return Null;
return minDat;
}
double DataSource::RMS(Getdatafun getdata) { double DataSource::RMS(Getdatafun getdata) {
double ret = 0; double ret = 0;
int count = 0; int count = 0;
for (int64 i = 0; i < GetCount(); ++i) { for (int64 i = 0; i < GetCount(); ++i) {
double d = Membercall(getdata)(i); double d = Membercall(getdata)(i);
if (!IsNull(d)) { if (!IsNull(d)) {
ret += d*d; ret += d*d;
count++; count++;
} }
} }
 End of changes. 2 change blocks. 
3 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)