/** \file polar_ellipse.hpp \brief defing ellipse in polar coordinate \author Junhua Gu */ #ifndef PELLIPSE_MODEL_H_ #define PELLIPSE_MODEL_H_ #define OPT_HEADER #include #include namespace opt_utilities { template class polar_ellipse :public model,std::string> { private: model >* do_clone()const { return new polar_ellipse(*this); } const char* do_get_type_name()const { return "ellipse in polar coordinate system"; } public: polar_ellipse() { this->push_param_info(param_info >("a",1,0,10)); this->push_param_info(param_info >("e",0,0,1)); this->push_param_info(param_info >("theta0",0,0,360)); } public: T do_eval(const T& x,const std::vector& 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_get_information()const { return "polar elliptical\n" //"y=k*x+b\n"; } }; } #endif //EOF