void plot_analytics::plotAnalyze( QCPGraph *target, plotStats *stats, QCPRange keyRange) { QCPGraphDataContainer::const_iterator plotIterator = target->data().data()->findBegin(keyRange.lower,true); QCPGraphDataContainer::const_iterator targetDataEnd = target->data().data()->findEnd(keyRange.upper,true); QCPGraphData currentPoint, prevPoint; //Find the data ranges currentPoint.key = keyRange.lower; prevPoint = QCPGraphData(plotIterator->key, plotIterator->value); while(plotIterator != targetDataEnd && (keyRange.contains(plotIterator->key) || stats->totalData_entrys < 2)) { currentPoint = QCPGraphData(plotIterator->key, plotIterator->value); handlePoints(currentPoint, prevPoint, stats); //Value is weighted to account for datapoints that may not be equally spaced if(!isInvalidData(currentPoint.value) && !isInvalidData(prevPoint.value)) stats->avgValue += currentPoint.value*(currentPoint.key-prevPoint.key); prevPoint = QCPGraphData(plotIterator->key, plotIterator->value); ++plotIterator; } //Divide by total seconds stats->avgValue /= stats->totalData_seconds; }
bool plot_analytics::handlePoints(double targetValue, double referenceValue, double keyDelta, plotStats *stats) { QCPGraphData target(keyDelta, targetValue); QCPGraphData reference(0, referenceValue); return handlePoints(target, reference, stats); }
void PlayerTracker::playerPosCallback2(const pcl::PointCloud<pcl::PointXYZL>::ConstPtr& msg) { handlePoints(msg,0); return; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); gameBoard = new QGameBoard(this); setCentralWidget(gameBoard); connect(ui->actionConnect, SIGNAL(triggered(bool)), this, SLOT(connects(bool))); connect(ui->actionRestart, SIGNAL(triggered()), this, SLOT(restartGame())); connect(&fifo, SIGNAL(pointsReady(std::vector<glm::vec2>)), this, SLOT(handlePoints(std::vector<glm::vec2>))); lastWasEmpty = true; l = r = u = d = 0.0f; timer = new (QTime); }
void PlayerTracker::facesCallback(const pcl::PointCloud<pcl::PointXYZL>::ConstPtr& msg) { handlePoints(msg,MAX_ID+1); return; }