diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-10-13 03:08:47 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-10-13 03:08:47 +0000 |
commit | 0c1f50351a0287252c4b0f7e9edbfb945481e6f7 (patch) | |
tree | e8e58b799cf192dd74569300c20e223c9923a916 /models | |
parent | 896a67e280d41df613092279f76913f8372faba1 (diff) | |
download | opt-utilities-0c1f50351a0287252c4b0f7e9edbfb945481e6f7.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@80 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'models')
-rw-r--r-- | models/polar_ellipse.hpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/models/polar_ellipse.hpp b/models/polar_ellipse.hpp new file mode 100644 index 0000000..0b574a4 --- /dev/null +++ b/models/polar_ellipse.hpp @@ -0,0 +1,49 @@ +#ifndef PELLIPSE_MODEL_H_ +#define PELLIPSE_MODEL_H_ +#define OPT_HEADER +#include <core/fitter.hpp> +#include <cmath> + +namespace opt_utilities +{ + template <typename T> + class polar_ellipse + :public model<T,T,std::vector<T>,std::string> + { + private: + model<T,T,std::vector<T> >* do_clone()const + { + return new polar_ellipse<T>(*this); + } + public: + polar_ellipse() + { + this->push_param_info(param_info<std::vector<T> >("a",1,0,10)); + this->push_param_info(param_info<std::vector<T> >("e",0,0,1)); + this->push_param_info(param_info<std::vector<T> >("theta0",0,0,360)); + } + + public: + T do_eval(const T& x,const std::vector<T>& param) + { + double a=param[0]; + double e=param[1]; + double t0=param[2]; + double t=x-t0; + t=t/180.*3.14159265358979; + return a*(1-e*e)/(1-e*cos(t)); + } + + private: + std::string do_to_string()const + { + return "linear model\n" + "y=k*x+b\n"; + } + }; +} + + + +#endif +//EOF |