public class ZernikePolynomial extends Object implements IParameterizable
Constructor and Description |
---|
ZernikePolynomial(int radialDegree)
Simple constructor.
|
ZernikePolynomial(int radialDegree,
Parameter[][] coefficients)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static int |
arrayIndexToAzimuthalDegree(int radialDegree,
int arrayIndex)
Utility function to convert an array index of the
computeZernikeMonomials(int, double, double) to an azimuthal degree. |
static int |
azimuthalDegreeToArrayIndex(int radialDegree,
int azimuthalDegree)
Utility function to convert an azimuthal degree to the array index of the
computeZernikeMonomials(int, double, double) . |
double[] |
computeDerivatives(double rho,
double azimuth,
Collection<Parameter> params)
Compute the derivatives of this zernike polynomial with respect to the provided parameters.
|
static double[][] |
computeRadialZernikeMonomials(int radialDegree,
double rho)
Compute the radial zernike monomials.
|
double |
computeValue(double rho,
double azimuth)
Compute the value of this zernike polynomial.
|
Pair<Double,double[]> |
computeValueAndDerivatives(double rho,
double azimuth,
Collection<Parameter> params)
Compute the value and partial derivatives.
|
static double[][] |
computeZernikeMonomials(int radialDegree,
double rho,
double azimuth)
Compute the zernike monomials.
|
Parameter |
getCoefficient(int radialDegreeIn,
int azimuthalDegree)
Getter for the required coefficient of the zernike polynomial.
|
ArrayList<Parameter> |
getParameters()
Get the supported parameters.
|
boolean |
supportsParameter(Parameter param)
Check if a parameter is supported.
|
public ZernikePolynomial(int radialDegree)
Note: the parameters are initialized with values of 0.
If their values isn't changed, the computeValue(double, double)
method will return 0.
radialDegree
- The radial degree of the polynomial (azimuthal degree is considered equal to the radial degree)NotPositiveException
- if radialDegree < 0
public ZernikePolynomial(int radialDegree, Parameter[][] coefficients)
radialDegree
- The radial degree of the polynomial (azimuthal degree is considered equal to the radial degree)coefficients
- The coefficients of the polynomial. The 2D array must have the correct size: radialDegree+1
rows
and for the column use azimuthalDegreeToArrayIndex(int, int)
to get the correct indexes.NotPositiveException
- if radialDegree < 0
DimensionMismatchException
- if the coefficients.length != radialDegree + 1
coefficientsN.length != n + 1
NullArgumentException
- if the coefficients array contains a null
elementpublic Parameter getCoefficient(int radialDegreeIn, int azimuthalDegree)
radialDegreeIn
- The coefficient radial degreeazimuthalDegree
- the coefficient azimuthal degreepublic Pair<Double,double[]> computeValueAndDerivatives(double rho, double azimuth, Collection<Parameter> params)
computeValue(double, double)
and
computeDerivatives(double, double, java.util.Collection<fr.cnes.sirius.patrius.math.parameter.Parameter>)
but performs the
heavy computation only once.rho
- The distance variableazimuth
- The angular variable [rad]params
- The collection of parameters for the partial derivatives computationOutOfRangeException
- if rho is outside [0, 1]public double computeValue(double rho, double azimuth)
rho
- The distance variableazimuth
- The angular variable [rad]OutOfRangeException
- if rho is outside [0, 1]public double[] computeDerivatives(double rho, double azimuth, Collection<Parameter> params)
rho
- The distance variableazimuth
- The angular variable [rad]params
- The collection of parametersOutOfRangeException
- if rho is outside [0, 1]public boolean supportsParameter(Parameter param)
supportsParameter
in interface IParameterizable
param
- parameter to checkpublic ArrayList<Parameter> getParameters()
getParameters
in interface IParameterizable
public static int arrayIndexToAzimuthalDegree(int radialDegree, int arrayIndex)
computeZernikeMonomials(int, double, double)
to an azimuthal degree.radialDegree
- The radial degreearrayIndex
- The array indexNotPositiveException
- if radialDegree < 0
arrayIndex < 0
DimensionMismatchException
- if arrayIndex > radialDegree + 1
public static int azimuthalDegreeToArrayIndex(int radialDegree, int azimuthalDegree)
computeZernikeMonomials(int, double, double)
.radialDegree
- The radial degreeazimuthalDegree
- The azimuthal degreezernikeMonomials[radialDegree]
corresponding to the azimuthalDegreeNotPositiveException
- if radialDegree < 0
IllegalArgumentException
- if the azimuthal degree is greater in absolute value to the radial degree
if the difference of the two degrees is not an even numberpublic static double[][] computeZernikeMonomials(int radialDegree, double rho, double azimuth)
The monomials are stored in a 2D array. The row i corresponds to the radial degree i and contains an array of
size i+1, containing the different azimuthal degrees. Use azimuthalDegreeToArrayIndex(int, int)
and
arrayIndexToAzimuthalDegree(int, int)
to switch between azimuthal degrees and array index.
radialDegree
- The radial degreerho
- The distance variableazimuth
- The angular variable [rad]NotPositiveException
- if radialDegree < 0
OutOfRangeException
- if rho is outside [0, 1]public static double[][] computeRadialZernikeMonomials(int radialDegree, double rho)
The radial zernike monomials are 0 when radialDegree-azimuthalDegree is odd. The returned array does not contain
these values.
The row n corresponds to the radial degree n, while each column j corresponds to the azimuthal degree n%2+2j:
radialDegree
- The radial degreerho
- The distance variableNotPositiveException
- if radialDegree < 0
OutOfRangeException
- if rho is outside [0, 1]Copyright © 2023 CNES. All rights reserved.