OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossim2dLinearRegression.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks)
6 //
7 //*************************************************************************
8 // $Id: ossim2dLinearRegression.h 23353 2015-06-01 19:19:10Z dburken $
9 #ifndef ossim2dLinearRegression_HEADER
10 #define ossim2dLinearRegression_HEADER 1
12 #include <ossim/base/ossimDpt.h>
13 #include <vector>
14 #include <iostream>
15 
17 {
18 public:
20  const ossim2dLinearRegression& data)
21  {
22  out << "y = " << data.theSlope << "*x + " << data.theIntercept;
23 
24  return out;
25  }
27  void getEquation(double& slope,
28  double& intercept)
29  {
30  slope = theSlope;
31  intercept = theIntercept;
32  }
33  void addPoint(const ossimDpt& pt)
34  {
35 // thePoints.push_back(pt);
36  ++theNumberOfPoints;
37  theSumX += pt.x;
38  theSumY += pt.y;
39  theSumXX += pt.x*pt.x;
40  theSumYY += pt.y*pt.y;
41  theSumXY += pt.x*pt.y;
42  theSolvedFlag = false;
43  }
44  void clear()
45  {
46 // thePoints.clear();
47  theNumberOfPoints = 0;
48  theSumX = 0.0;
49  theSumXX = 0.0;
50  theSumY = 0.0;
51  theSumYY = 0.0;
52  theIntercept = 0.0;
53  theSlope = 0.0;
54  theSumXY = 0.0;
55  theSolvedFlag = false;
56  }
57  void solve();
59  {
60  return theNumberOfPoints;
61 // return thePoints.size();
62  }
63 protected:
64 // std::vector<ossimDpt> thePoints;
66  double theSumX;
67  double theSumY;
68  double theSumXX;
69  double theSumYY;
70  double theSumXY;
71 
72  double theIntercept;
73  double theSlope;
75 };
76 
77 #endif
double y
Definition: ossimDpt.h:165
ossim_uint32 getNumberOfPoints() const
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
void getEquation(double &slope, double &intercept)
unsigned int ossim_uint32
#define OSSIM_DLL
double x
Definition: ossimDpt.h:164
void addPoint(const ossimDpt &pt)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23