/* * bivariatePolynomials.h * * Created on: July, 2015 * Author: sauvage */ #ifndef __BIVARIATEPOLYNOMIALS_H__ #define __BIVARIATEPOLYNOMIALS_H__ #include #include #include //#include //#include //#include namespace CGoGN { namespace Utils { template class BivariatePolynomials { private : const int degree ; // (bi-)degree of the polynomial (=4) const int nb_coefs ; // number of coefs (=15) Tcoef* coefs; // table of coefficients public : // construction, destruction and initialization BivariatePolynomials(); BivariatePolynomials(BivariatePolynomials const &); ~BivariatePolynomials(); int get_degree () { return degree; } int get_nb_coefs () { return nb_coefs; } // evaluation Tcoef evaluate_at (Tscalar u, Tscalar v) const; Tcoef evaluate_at (const Geom::Vec3& tu, const Geom::Vec3& tv, const Geom::Vec3& n, const Geom::Vec3& eval_dir) const; // I/O const Tcoef& get_coef (int du, int dv) const {assert ((du>=0 && dv <=degree && dv>=0 && dv <=degree) || !" bi-degree is incorrect"); return get_coef(index(l,m));} Tcoef& get_coef (int du, int dv) {assert ((du>=0 && dv <=degree && dv>=0 && dv <=degree) || !" bi-degree is incorrect"); return get_coef(index(l,m));} Tcoef* get_coef_tab () {return coefs;} template friend std::ostream & operator<< (std::ostream & os, const BivariatePolynomials & sh); // operators // void operator= (const BivariatePolynomials&); // void operator+= (const BivariatePolynomials&); // BivariatePolynomials operator+ (const BivariatePolynomials&) const; // void operator-= (const BivariatePolynomials &); // BivariatePolynomials operator- (const BivariatePolynomials&) const; // void operator*= (Tscalar); // BivariatePolynomials operator* (Tscalar) const; // void operator/= (Tscalar); // BivariatePolynomials operator/ (Tscalar) const; std::string CGoGNnameOfType() const { return "BivariatePolynomials"; } // fitting // template // void fit_to_data(int n, Tdirection* t_theta, Tdirection* t_phi, Tchannel* t_R, Tchannel* t_G, Tchannel* t_B, double lambda); // template // void fit_to_data(int n, Tdirection* t_x, Tdirection* t_y, Tdirection* t_z, Tchannel* t_R, Tchannel* t_G, Tchannel* t_B, double lambda); private : static int index (int du, int dv) {int n=du+dv; return n*(n+1)/2 + dv;} // order of coefs : 1,u,v,u2, uv, v2, u3, u2v, uv2, v3, u4, u3v, u2v2, uv3, v4 // Thus i = n*(n+1)/2 + dv where n = const Tcoef& get_coef (int i) const {assert ((i>=0 && i=0 && i // void fit_to_data(int n, Eigen::Matrix& mM, Tchannel* t_R, Tchannel* t_G, Tchannel* t_B, double lambda); }; } // namespace Utils } // namespace CGoGN #include "Utils/bivariatePolynomials.hpp" #endif /* __BIVARIATEPOLYNOMIALS_H__ */