# Curve::Zernike class reference [Core module]

## Declaration

`#include <Goptical/Curve/Zernike>namespace Goptical { namespace Curve { class Zernike; };};`

This class is a member of the Curve namespace.

## Description

This class enables use of zernikes polynomials to define a surface curve. Zernikes terms can be enabled and disabled individually.

Fitting can be used to get best fit Zernike polynomials coefficients of an other curve.

This implementation uses Zernike polynomials set as described in ISO standard 10110-5.

Based on Zernikes pages by James C Wyant and Michael Koch. http://www.optics.arizona.edu/jcwyant/Zernikes/ZernikePolynomials.htm and http://www.astro-electronic.de/faq2.htm

## Members

### Inherited members

• 5 members inherited from Base

### Static functions

• static double zernike_poly(unsigned int n, const Math::Vector2 &xy)
• static void zernike_poly_d(unsigned int n, const Math::Vector2 &xy, Math::Vector2 &dxdy)

## Members detail

### Zernike(double radius, double unit_scale = 1.0)

Create a Zernike curve defined over the given circle radius.

• unit_scale: Sagitta scale factor used to change units globally

### Zernike(double radius, double coefs[], unsigned int coefs_count, double unit_scale = 1.0)

Create a Zernike curve defined over the given circle radius and initialize coefficients from table.

• coefs: Table of Zernike coefficients starting with z0 (piston)
• coefs_count: Number of coefficients available in the table
• unit_scale: Sagitta scale factor used to change units globally

### virtual void derivative(const Math::Vector2 &xy, Math::Vector2 &dxdy) const

This virtual function overrides the `derivative` virtual function defined in the `Base` base abstract class.

Documentation inherited from base class:

Get curve x and y derivative (gradient) at specified point

### double fit(const Base &c, const Trace::Distribution &d = default_dist)

Compute all zernike coefficient to best fit the given curve. RMS difference is returned. The specified distribution is used to choose sampling points on curve. Terms state is adjusted according to current threshold

### double get_coefficient(unsigned int n) const

Get coefficient associated with zernike term n

### bool get_term_state(unsigned int n)

Get current term enable state

### virtual double sagitta(const Math::Vector2 &xy) const

This virtual function implements the `sagitta` pure function declared in the `Base` base abstract class.

Documentation inherited from base class:

Get curve sagitta at specified point

### void set_coefficient(unsigned int n, double c)

Set coefficient associated with zernike term n and enable term according to current threshold. See set_coefficients_threshold()

### void set_coefficients_scale(double s)

Set coefficients unit scale factor. default is 1 (1 mm).

### void set_coefficients_threshold(double t)

Set new coefficient threshold and adjust all term states (enabled/disabled) depending on new threshold. Term with coefficient absolute value below the specified threshold will be disabled. Disabling useless terms improve performance. Default threshold is 10^-10.

### void set_term_state(unsigned int n, bool enabled)

This functions must be used to enable/disable a zernike term without changing its coefficient

### static const unsigned int term_count

Number of implemented zernike polynomials

### static double zernike_poly(unsigned int n, const Math::Vector2 &xy)

Evaluate zernike polynomial n

### static void zernike_poly_d(unsigned int n, const Math::Vector2 &xy, Math::Vector2 &dxdy)

Evaluate x and y derivatives of zernike polynomial n

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Jan 8 00:47:23 2012 using MkDoc