#ifndef ZERNIKE_H
#define ZERNIKE_H
/**
@author Richard J. Mathar
@since 2007-03-23
Richard J. Mathar homepage.
*/
#include
#include
using namespace std ;
/** Representation of Noll's radial terms of Zernike polynomials.
* \latexonly
* See \cite{NollJOSA66}.
* \endlatexonly
* The normalization is
* \f$ \int_0^{1/2}x dx [Z_n^m(x)]^2 =1\f$, which implies that
* \f$ Z_n^m(x)= 2\sqrt{2(n+1)}R_n^m(2r)\f$ in Noll's \f$R\f$ notation
* with \f$ x=2r\f$.
* @since 2007-03-23
*/
class Zernike {
public:
/** the quantum number. Also the maximum power of
* the power basis (polynomial) expansion
*/
int n;
Zernike(const int nodaln) ;
double at(const double x, const int m) const ;
#if 0
static double at(const double x, const int n, const int m) ;
#endif
double powcoef(const int m, const int i) const ;
double intgrl(const int m, const double xlo, const double xhi) const ;
double Overl(const int m, const Zernike & oth, const int othm) const ;
double gradOverl(const int m, const Zernike & oth, const int othm) const ;
#if 0
static double powcoef(const int n, const int m, const int i) ;
#endif
protected:
private:
/** the expansion coefficients in a polynomial basis, sorted
* as coef[0]+coef[1]*x+coef[2]*x^2... The first m ones (which are zero)
* are not stored, nor those others which vanish also.
* @warn these refer to the \f$x\f$ interval between 0 and 1/2, not to
* Noll's \f$r\f$ intervall from 0 to 1, where \f$r=2x\f$.
*/
vector > coef ;
static double binom(const int n, int m) ;
} ; /* Zernike */
/** A collection of Zernike polynomials up to some maximum power in the
* radial variable.
* @since 2007-03-23
*/
class ZernikeBase {
public:
/** the set of radial basis functions, Z[0] for n=0, Z[1] for n=1 etc
*/
static vector Z ;
ZernikeBase() ;
double at(const double x, const int n, const int m) ;
double at(const double x, const vector & coe, const int m) ;
double Overl(const int n, const int m, const int nprime, const int mprime) ;
double Overl(const int m, const vector & coe, const int mprime, const vector &coeprime) ;
double gradOverl(const int n, const int m, const int nprime, const int mprime) ;
double gradOverl(const int m, const vector & coe, const int mprime, const vector &coeprime) ;
double powcoef(const int n, const int m, const int i) ;
double intgrl(const int n, const int m, const double xlo, const double xhi) ;
protected:
private:
void growto(const int n) ;
} ; /* ZernikeBase */
#endif /* ZERNIKE_H */