[apps/regression] Add a method to data model

Change-Id: Ic08de61e87a0886dfb2520bf9292ba1176b3d84a
This commit is contained in:
Émilie Feral
2016-12-30 12:19:11 +01:00
parent a1b14762b2
commit 2aea72d228
2 changed files with 6 additions and 0 deletions

View File

@@ -177,6 +177,10 @@ float Data::yIntercept() {
return yMean() - slope()*xMean();
}
float Data::yValueForXValue(float x) {
return slope()*x+yIntercept();
}
float Data::maxXValue() {
float max = -FLT_MAX;
for (int k = 0; k < m_numberOfPairs; k++) {
@@ -219,6 +223,7 @@ float Data::minYValue() {
void Data::initCursorPosition() {
m_xCursorPosition = (m_xMin+m_xMax)/2.0f;
m_yCursorPosition = yValueForXValue(m_xCursorPosition);
}
void Data::initWindowParameters() {

View File

@@ -44,6 +44,7 @@ public:
float covariance();
float slope();
float yIntercept();
float yValueForXValue(float x);
constexpr static int k_maxNumberOfPairs = 500;
private: