00001 00018 #ifndef LINEARAPPROXIMATOR_H 00019 #define LINEARAPPROXIMATOR_H 00020 #include <vector> 00021 #ifndef Q_MOC_RUN 00022 #include <Eigen/Dense> 00023 #endif 00024 00025 struct ApproximationResult 00026 { 00027 double variance; 00028 double angle; 00029 Eigen::Vector2d approximatedVector; 00030 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00031 }; 00032 00033 class LinearApproximator 00034 { 00035 public: 00036 LinearApproximator() {} 00037 //Calculates the best linear approximation for the given set of points with (0,0) as the startpopint 00038 //returns the variance between the points and the approximation 00039 //double calculateApproximation(std::vector<Eigen::Vector2d> * functionPoints); 00040 00041 ApproximationResult calculateApproximation(Eigen::Vector2d * functionPoints, int startIndex, int endIndex, Eigen::Vector2d centerOffset); 00042 00043 }; 00044 00045 00046 #endif // LINEARAPPROXIMATOR_H