本文整理汇总了C++中PointVector::add方法的典型用法代码示例。如果您正苦于以下问题:C++ PointVector::add方法的具体用法?C++ PointVector::add怎么用?C++ PointVector::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointVector
的用法示例。
在下文中一共展示了PointVector::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findAll
void PeakDetect::findAll(float delta) {
clear();
Point max(-1, -1);
Point min(-1, 65536);
bool findMax = false;
for (index = 0; index < length; index++) {
// check if max/min should be updated
if (y[index] > max.getY()) max = Point(index, y[index]);
if (minima->size()) {
if (y[index] < min.getY()) min = Point(index, y[index]);
} else {
if (y[index] <= min.getY()) min = Point(index, y[index]);
}
// check if max/min are larger than delta
if (findMax) {
if (y[index] < max.getY() - delta) {
maxima->add(max.getX(), max.getY());
min = Point(index, y[index]);
findMax = false;
}
} else {
if (y[index] > min.getY() + delta) {
minima->add(min.getX(), min.getY());
max = Point(index, y[index]);
findMax = true;
}
}
}
// add last minimum
minima->add(min.getX(), min.getY());
if (x != NULL) {
PointVector *maxtemp = new PointVector();
PointVector *mintemp = new PointVector();
for (int i = 0; i < maxima->size(); i++)
maxtemp->add(x[(maxima->get(i))->getX()], (maxima->get(i))->getY());
for (int i = 0; i < minima->size(); i++)
mintemp->add(x[(minima->get(i))->getX()], (minima->get(i))->getY());
delete maxima;
delete minima;
maxima = maxtemp;
minima = mintemp;
}
}