C# Class SphericalHarmonics.SHFunctions

The functions gathered here allow to work with Spherical Harmonics and Zonal Harmonics =============================================================================== The convention for transformation between spherical and cartesian coordinates is : ( sinθ cosϕ, sinθ sinϕ, cosθ ) → (x, y, z) _ Azimuth ϕ is zero on +X and increases CCW (i.e. PI/2 at +Y, PI at -X and -PI/2 at -Y) _ Elevation θ is zero on +Z and PI on -Z Z θ=0 | | | ϕ=-PI/2 -Y - - - -o------+Y ϕ=PI/2 /. / . +X . ϕ=0 . -Z θ=PI So cartesian to polar coordinates is computed this way: θ = acos( Z ); ϕ = atan2( Y, X );
Mostra file Open project: Patapom/GodComplex

Protected Properties

Property Type Description
ALF double
EPS double
FACTORIAL double[]
ITMAX int
SQRT2 double
STPMX double
TOLX double
TOLY double

Public Methods

Method Description
BuildRotationMatrix ( float3x3 _Rotation, double _Matrix, int _Order ) : void

Builds the matrix to apply the SH coefficients to make them rotate by the specified matrix

CartesianToSpherical ( float3 _Direction, double &, double & ) : void

Converts a cartesian UNIT vector into spherical coordinates (θ,ϕ)

ComputeClebschGordan ( int j1, int j2, int m1, int m2, int j, int m ) : double
ComputeRotatedZHCoefficients ( double _ZHCoefficients, float3 _TargetAxis, double _RotatedSHCoefficients ) : void

Computes the SH coefficients of originaly Y-aligned Zonal Harmonics coefficients rotated to match the provided axis

Be careful the returned coefficients are SH coefficients, hence the _RotatedSHCoefficients vector should be N² if rotating an order N Zonal Harmonics vector

ComputeSHWindowedCos ( int l, int m, double , double , int _Order ) : double
ComputeSHWindowedSinc ( int l, int m, double , double , int _Order ) : double
ComputeSigmaFactorCos ( int l, double h ) : double
ComputeSigmaFactorCos ( int l, int _Order ) : double

Sigma factor using a cardinal sine for windowing From "Real-time Soft Shadows in Dynamic Scenes using Spherical Harmonic Exponentiation" by Ren et al. (2006) Therefore, you should no longer use ComputeSH( l, m ) when reconstructing SH but ComputeSigmaFactorCos( l ) * ComputeSH( l, m )

ComputeSigmaFactorSinc ( int l, int _Order ) : double

Sigma factor using a cardinal sine for windowing From "A Quick Rendering Method Using Basis Functions for Interactive Lighting Design" by Dobashi et al. (1995) Therefore, you should no longer use ComputeSH( l, m ) when reconstructing SH but ComputeSigmaFactorSinc( l ) * ComputeSH( l, m )

ComputeZH ( int l, double ) : double
ComputeZH ( int l, float3 _Direction ) : double
Convolve ( float3 _Vector0, float3 _Vector1, int _Order ) : SharpMath.float3[]

Computes the convolution of 2 3-vectors of SH coefficients of the specified order using Clebsch-Gordan coefficients

This method is quite time-consuming as the convolution is computed using 5 loops but, as an optimisation, we can notice that most Clebsh-Gordan are 0 and a vector of non-null coefficients could be precomputed as only the vectors' coefficients change

EncodeIntoSH ( double _Coefficients, int _SamplesCountTheta, int _SamplesCountPhi, int _RandomSeed, int _Order, EvaluateFunctionSH _Delegate ) : void

Encodes a function evaluated by the provided delegate into a series of ZH coefficients

EncodeIntoSH ( float3 _Coefficients, int _SamplesCountTheta, int _SamplesCountPhi, int _RandomSeed, int _Order, EvaluateFunctionSHVector3 _Delegate ) : void

Encodes a function evaluated by the provided delegate into a series of ZH coefficients

EncodeIntoZH ( double _Coefficients, int _SamplesCount, int _RandomSeed, EvaluateFunctionZH _Delegate ) : void

Attempts to encode a function evaluated by the provided delegate into a series of ZH coefficients

EvaluateSH ( double _Coefficients, double , double , int _Order ) : double

Evaluates the amplitude encoded by the SH coefficients in the provided direction

EvaluateSH ( double _Coefficients, float3 _Direction, int _Order ) : double

Evaluates the amplitude encoded by the SH coefficients in the provided direction

EvaluateZH ( double _Coefficients, double ) : double

Evaluates the amplitude encoded by the Y-aligned ZH coefficients in the provided direction

EvaluateZH ( double _Coefficients, float3 _Direction ) : double

Evaluates the amplitude encoded by the Y-aligned ZH coefficients in the provided direction

FilterGaussian ( float _SH, int w ) : void
FilterGaussian ( float3 _SH, int w ) : void
FilterHanning ( float _SH, int w ) : void
FilterHanning ( float3 _SH, int w ) : void
FilterLanczos ( float _SH, int w ) : void
FilterLanczos ( float3 _SH, int w ) : void
InitializeSHCoefficients ( int _Order, double , double , double _Coefficients ) : void

Initializes the provided vector with the SH coefficients corresponding to the specified direction

InitializeSHCoefficients ( int _Order, double , double , float3 _Coefficients ) : void

Initializes the provided vector with the SH coefficients corresponding to the specified direction

InitializeSHCoefficients ( int _Order, float3 _Direction, double _Coefficients ) : void

Initializes the provided vector with the SH coefficients corresponding to the specified direction

InitializeSHCoefficients ( int _Order, float3 _Direction, float3 _Coefficients ) : void

Initializes the provided vector with the SH coefficients corresponding to the specified direction

K ( int l, int m ) : double
MapSHIntoZH ( double _SHCoefficients, int _Order, float2 _ZHAxes, double _ZHCoefficients, int _HemisphereResolution, int _FunctionSamplingResolution, double _BFGSConvergenceTolerance, double &_RMS, ZHMappingFeedback _Delegate ) : void

Performs mapping of a set of SH coefficients into N sets of ZH coefficients WARNING: Takes hell of a time to compute !

MirrorY ( double _Vector, double _MirroredVector, int _Order ) : void

Applies a simple mirroring on the Y axis

MirrorY ( float3 _Vector, float3 _MirroredVector, int _Order ) : void

Applies a simple mirroring on the Y axis

P ( int l, int m, double x ) : double
P0 ( int l, double x ) : double
Product3 ( double a, double b ) : double[]

Computes the product of 2 SH vectors of order 3 (code from John Snyder "Code Generation and Factoring for Fast Evaluation of Low-order Spherical Harmonic Products and Squares")

ProductClebschGordan ( double _Vector0, double _Vector1, int _Order, ProductDelegate _Delegate ) : double[]

Computes the product and re-projection in SH of 2 vectors of SH coefficients of the specified order using Clebsch-Gordan coefficients

This method is quite time-consuming as the convolution is computed using 5 loops but, as an optimisation, we can notice that most Clebsh-Gordan are 0 and a vector of non-null coefficients could be precomputed as only the SH vectors' coefficients change

Rotate ( double _Vector, double _RotationMatrix, double _RotatedVector, int _Order ) : void

Applies rotation to the specified SH vector using the specified rotation matrix yielded by the above "BuildRotationMatrix()" method

Rotate ( float3 _Vector, double _RotationMatrix, float3 _RotatedVector, int _Order ) : void

Applies rotation to the specified 3-vector using the specified rotation matrix returned by the "BuildRotationMatrix()" method

RotateY ( double _Vector, double , double _RotatedVector, int _Order ) : void

Applies a simple fast rotation about the Y axis

RotateY ( float3 _Vector, double , float3 _RotatedVector, int _Order ) : void

Applies a simple fast rotation about the Y axis

SphericalToCartesian ( double , double ) : float3

Converts spherical coordinates (θ,ϕ) into a cartesian UNIT vector

SphericalToCartesian ( double , double , float3 _Direction ) : void

Converts spherical coordinates (θ,ϕ) into a cartesian UNIT vector

Ylm ( int l, int m, double , double ) : double
Ylm ( int l, int m, float3 _Direction ) : double

Protected Methods

Method Description
ComputeP ( int _a, int _b, int _i, int _l, double _Matrix ) : double

Factored code used to compute U,V,W coefficients needed for rotation matrix inference

ComputeRho ( int j1, int j2, int j ) : double
ComputeSigma ( int j1, int j2, int j, int m1, int m2, int m ) : double
ComputeSummedDifferences ( SHSamplesCollection _SamplesCollection, double _Normalizer, double _GoalSHEvaluation, double _SHEstimate, int _Order ) : double

Computes the square difference between a current SH estimate and a goal SH function given a set of samples

ComputeTau ( int j1, int j2, int j, int m1, int m2 ) : double
Factorial ( int _Value ) : double

Computes the factorial of the given integer value

ZHMappingGlobalFunctionEval ( double _Coefficients, object _Params ) : double
ZHMappingGlobalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
ZHMappingLocalFunctionEval ( double _Coefficients, object _Params ) : double
ZHMappingLocalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
dfpmin ( double _Coefficients, double _ConvergenceTolerance, int &_PerformedIterationsCount, double &_Minimum, BFGSFunctionEval _FunctionEval, BFGSFunctionGradientEval _FunctionGradientEval, object _Params ) : void

Performs BFGS function minimzation on a quadratic form function evaluated by the provided delegate

lnsrch ( int n, double xold, double fold, double g, double p, double x, double &f, double stpmax, int &check, BFGSFunctionEval _FunctionEval, object _Params ) : void

Private Methods

Method Description
Filter ( float _SH, int l, float a ) : void
Filter ( float3 _SH, int l, float a ) : void
Ylm ( float3 _direction, double _SH ) : void

Computes the 9 Ylm coefficients for order 2 SH evaluated in the requested direction

Method Details

BuildRotationMatrix() public static method

Builds the matrix to apply the SH coefficients to make them rotate by the specified matrix
public static BuildRotationMatrix ( float3x3 _Rotation, double _Matrix, int _Order ) : void
_Rotation SharpMath.float3x3 The 3x3 rotation matrix to infer the SH rotation matrix from
_Matrix double The resulting _Order² x _Order² rotation matrix
_Order int The order of the SH vectors that will be rotated using the matrix
return void

CartesianToSpherical() public static method

Converts a cartesian UNIT vector into spherical coordinates (θ,ϕ)
public static CartesianToSpherical ( float3 _Direction, double &, double & ) : void
_Direction SharpMath.float3 The cartesian unit vector to convert
double The polar elevation
double The azimuth
return void

ComputeClebschGordan() public static method

public static ComputeClebschGordan ( int j1, int j2, int m1, int m2, int j, int m ) : double
j1 int
j2 int
m1 int
m2 int
j int
m int
return double

ComputeP() protected static method

Factored code used to compute U,V,W coefficients needed for rotation matrix inference
protected static ComputeP ( int _a, int _b, int _i, int _l, double _Matrix ) : double
_a int
_b int
_i int
_l int
_Matrix double The source rotation matrix
return double

ComputeRho() protected static method

protected static ComputeRho ( int j1, int j2, int j ) : double
j1 int
j2 int
j int
return double

ComputeRotatedZHCoefficients() public static method

Computes the SH coefficients of originaly Y-aligned Zonal Harmonics coefficients rotated to match the provided axis
Be careful the returned coefficients are SH coefficients, hence the _RotatedSHCoefficients vector should be N² if rotating an order N Zonal Harmonics vector
public static ComputeRotatedZHCoefficients ( double _ZHCoefficients, float3 _TargetAxis, double _RotatedSHCoefficients ) : void
_ZHCoefficients double The ZH coefficients to rotate
_TargetAxis SharpMath.float3 The target axis to match (the original axis being positive Y)
_RotatedSHCoefficients double The rotated SH coefficients
return void

ComputeSHWindowedCos() public static method

public static ComputeSHWindowedCos ( int l, int m, double , double , int _Order ) : double
l int
m int
double
double
_Order int
return double

ComputeSHWindowedSinc() public static method

public static ComputeSHWindowedSinc ( int l, int m, double , double , int _Order ) : double
l int
m int
double
double
_Order int
return double

ComputeSigma() protected static method

protected static ComputeSigma ( int j1, int j2, int j, int m1, int m2, int m ) : double
j1 int
j2 int
j int
m1 int
m2 int
m int
return double

ComputeSigmaFactorCos() public static method

public static ComputeSigmaFactorCos ( int l, double h ) : double
l int
h double
return double

ComputeSigmaFactorCos() public static method

Sigma factor using a cardinal sine for windowing From "Real-time Soft Shadows in Dynamic Scenes using Spherical Harmonic Exponentiation" by Ren et al. (2006) Therefore, you should no longer use ComputeSH( l, m ) when reconstructing SH but ComputeSigmaFactorCos( l ) * ComputeSH( l, m )
public static ComputeSigmaFactorCos ( int l, int _Order ) : double
l int Current band
_Order int Max used SH order
return double

ComputeSigmaFactorSinc() public static method

Sigma factor using a cardinal sine for windowing From "A Quick Rendering Method Using Basis Functions for Interactive Lighting Design" by Dobashi et al. (1995) Therefore, you should no longer use ComputeSH( l, m ) when reconstructing SH but ComputeSigmaFactorSinc( l ) * ComputeSH( l, m )
public static ComputeSigmaFactorSinc ( int l, int _Order ) : double
l int Current band
_Order int Max used SH order
return double

ComputeSummedDifferences() protected static method

Computes the square difference between a current SH estimate and a goal SH function given a set of samples
protected static ComputeSummedDifferences ( SHSamplesCollection _SamplesCollection, double _Normalizer, double _GoalSHEvaluation, double _SHEstimate, int _Order ) : double
_SamplesCollection SHSamplesCollection The collection of samples to use for the computation
_Normalizer double The normalizer for the final result
_GoalSHEvaluation double The goal SH function's evaluations for each sample
_SHEstimate double The estimate SH function's coefficients
_Order int The SH order
return double

ComputeTau() protected static method

protected static ComputeTau ( int j1, int j2, int j, int m1, int m2 ) : double
j1 int
j2 int
j int
m1 int
m2 int
return double

ComputeZH() public static method

public static ComputeZH ( int l, double ) : double
l int
double
return double

ComputeZH() public static method

public static ComputeZH ( int l, float3 _Direction ) : double
l int
_Direction SharpMath.float3
return double

Convolve() public static method

Computes the convolution of 2 3-vectors of SH coefficients of the specified order using Clebsch-Gordan coefficients
This method is quite time-consuming as the convolution is computed using 5 loops but, as an optimisation, we can notice that most Clebsh-Gordan are 0 and a vector of non-null coefficients could be precomputed as only the vectors' coefficients change
public static Convolve ( float3 _Vector0, float3 _Vector1, int _Order ) : SharpMath.float3[]
_Vector0 SharpMath.float3 First 3-vector
_Vector1 SharpMath.float3 Second 3-vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return SharpMath.float3[]

EncodeIntoSH() public static method

Encodes a function evaluated by the provided delegate into a series of ZH coefficients
public static EncodeIntoSH ( double _Coefficients, int _SamplesCountTheta, int _SamplesCountPhi, int _RandomSeed, int _Order, EvaluateFunctionSH _Delegate ) : void
_Coefficients double The coefficients supposed to best fit the provided function (the length of the vector must be _Order²)
_SamplesCountTheta int
_SamplesCountPhi int
_RandomSeed int The random seed to initialize the RNG with when drawing random sample position
_Order int The order of the SH vector to encode
_Delegate EvaluateFunctionSH The delegate that will be called to evaluate the function to encode
return void

EncodeIntoSH() public static method

Encodes a function evaluated by the provided delegate into a series of ZH coefficients
public static EncodeIntoSH ( float3 _Coefficients, int _SamplesCountTheta, int _SamplesCountPhi, int _RandomSeed, int _Order, EvaluateFunctionSHVector3 _Delegate ) : void
_Coefficients SharpMath.float3 The coefficients supposed to best fit the provided function (the length of the vector must be _Order²)
_SamplesCountTheta int
_SamplesCountPhi int
_RandomSeed int The random seed to initialize the RNG with when drawing random sample position
_Order int The order of the SH vector to encode
_Delegate EvaluateFunctionSHVector3 The delegate that will be called to evaluate the function to encode
return void

EncodeIntoZH() public static method

Attempts to encode a function evaluated by the provided delegate into a series of ZH coefficients
public static EncodeIntoZH ( double _Coefficients, int _SamplesCount, int _RandomSeed, EvaluateFunctionZH _Delegate ) : void
_Coefficients double The coefficients supposed to best fit the provided function (the length of the vector will also provide the ZH/SH order)
_SamplesCount int The amount of samples to use to fit the function
_RandomSeed int The random seed to initialize the RNG with when drawing random sample position
_Delegate EvaluateFunctionZH The delegate that will be called to evaluate the function to encode
return void

EvaluateSH() public static method

Evaluates the amplitude encoded by the SH coefficients in the provided direction
public static EvaluateSH ( double _Coefficients, double , double , int _Order ) : double
_Coefficients double The SH coefficients encoding an amplitude in various directions
double The elevation of the direction of the SH sampling
double The azimuth of the direction of the SH sampling
_Order int The order of the SH vector
return double

EvaluateSH() public static method

Evaluates the amplitude encoded by the SH coefficients in the provided direction
public static EvaluateSH ( double _Coefficients, float3 _Direction, int _Order ) : double
_Coefficients double The SH coefficients encoding an amplitude in various directions
_Direction SharpMath.float3 The direction where to evalute the SH
_Order int The order of the SH vector
return double

EvaluateZH() public static method

Evaluates the amplitude encoded by the Y-aligned ZH coefficients in the provided direction
public static EvaluateZH ( double _Coefficients, double ) : double
_Coefficients double The SH coefficients encoding an amplitude in various directions
double The elevation of the direction of the ZH sampling
return double

EvaluateZH() public static method

Evaluates the amplitude encoded by the Y-aligned ZH coefficients in the provided direction
public static EvaluateZH ( double _Coefficients, float3 _Direction ) : double
_Coefficients double The SH coefficients encoding an amplitude in various directions
_Direction SharpMath.float3 The direction where to evalute the ZH
return double

Factorial() protected static method

Computes the factorial of the given integer value
protected static Factorial ( int _Value ) : double
_Value int The value to compute the factorial of
return double

FilterGaussian() public static method

public static FilterGaussian ( float _SH, int w ) : void
_SH float
w int
return void

FilterGaussian() public static method

public static FilterGaussian ( float3 _SH, int w ) : void
_SH SharpMath.float3
w int
return void

FilterHanning() public static method

public static FilterHanning ( float _SH, int w ) : void
_SH float
w int
return void

FilterHanning() public static method

public static FilterHanning ( float3 _SH, int w ) : void
_SH SharpMath.float3
w int
return void

FilterLanczos() public static method

public static FilterLanczos ( float _SH, int w ) : void
_SH float
w int
return void

FilterLanczos() public static method

public static FilterLanczos ( float3 _SH, int w ) : void
_SH SharpMath.float3
w int
return void

InitializeSHCoefficients() public static method

Initializes the provided vector with the SH coefficients corresponding to the specified direction
public static InitializeSHCoefficients ( int _Order, double , double , double _Coefficients ) : void
_Order int The order of the SH vector
double The elevation of the direction of the SH sampling
double The azimuth of the direction of the SH sampling
_Coefficients double The array of coefficients to fill up
return void

InitializeSHCoefficients() public static method

Initializes the provided vector with the SH coefficients corresponding to the specified direction
public static InitializeSHCoefficients ( int _Order, double , double , float3 _Coefficients ) : void
_Order int The order of the SH vector
double The elevation of the direction of the SH sampling
double The azimuth of the direction of the SH sampling
_Coefficients SharpMath.float3 The array of coefficients to fill up
return void

InitializeSHCoefficients() public static method

Initializes the provided vector with the SH coefficients corresponding to the specified direction
public static InitializeSHCoefficients ( int _Order, float3 _Direction, double _Coefficients ) : void
_Order int The order of the SH vector
_Direction SharpMath.float3 The direction of the SH sampling
_Coefficients double The array of coefficients to fill up
return void

InitializeSHCoefficients() public static method

Initializes the provided vector with the SH coefficients corresponding to the specified direction
public static InitializeSHCoefficients ( int _Order, float3 _Direction, float3 _Coefficients ) : void
_Order int The order of the SH vector
_Direction SharpMath.float3 The direction of the SH sampling
_Coefficients SharpMath.float3 The array of coefficients to fill up
return void

K() public static method

public static K ( int l, int m ) : double
l int
m int
return double

MapSHIntoZH() public static method

Performs mapping of a set of SH coefficients into N sets of ZH coefficients WARNING: Takes hell of a time to compute !
public static MapSHIntoZH ( double _SHCoefficients, int _Order, float2 _ZHAxes, double _ZHCoefficients, int _HemisphereResolution, int _FunctionSamplingResolution, double _BFGSConvergenceTolerance, double &_RMS, ZHMappingFeedback _Delegate ) : void
_SHCoefficients double The SH coefficients to map into ZH
_Order int The order of the SH coefficients vector
_ZHAxes float2 The double array of resulting ZH axes (i.e. [θ,ϕ] couples)
_ZHCoefficients double The double array of resulting ZH coefficients (the dimension of the outter array gives the amount of requested ZH lobes while the dimension of the inner arrays should be of size "_Order")
_HemisphereResolution int The resolution of the hemisphere used to perform initial guess of directions (e.g. using a resolution of 100 will test for 20 * (4*20) possible lobe orientations)
_FunctionSamplingResolution int The resolution of the sphere used to perform function sampling and measuring the error (e.g. using a resolution of 100 will estimate the function with 100 * (2*100) samples)
_BFGSConvergenceTolerance double The convergence tolerance for the BFGS algorithm (the lower the tolerance, the longer it will compute)
_RMS double The resulting array of RMS errors for each ZH lobe
_Delegate ZHMappingFeedback An optional delegate to pass the method to get feedback about the mapping as it can be a lengthy process (!!)
return void

MirrorY() public static method

Applies a simple mirroring on the Y axis
public static MirrorY ( double _Vector, double _MirroredVector, int _Order ) : void
_Vector double The vector to mirror
_MirroredVector double The mirrored vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

MirrorY() public static method

Applies a simple mirroring on the Y axis
public static MirrorY ( float3 _Vector, float3 _MirroredVector, int _Order ) : void
_Vector SharpMath.float3 The vector to mirror
_MirroredVector SharpMath.float3 The mirrored vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

P() public static method

public static P ( int l, int m, double x ) : double
l int
m int
x double
return double

P0() public static method

public static P0 ( int l, double x ) : double
l int
x double
return double

Product3() public static method

Computes the product of 2 SH vectors of order 3 (code from John Snyder "Code Generation and Factoring for Fast Evaluation of Low-order Spherical Harmonic Products and Squares")
public static Product3 ( double a, double b ) : double[]
a double
b double
return double[]

ProductClebschGordan() public static method

Computes the product and re-projection in SH of 2 vectors of SH coefficients of the specified order using Clebsch-Gordan coefficients
This method is quite time-consuming as the convolution is computed using 5 loops but, as an optimisation, we can notice that most Clebsh-Gordan are 0 and a vector of non-null coefficients could be precomputed as only the SH vectors' coefficients change
public static ProductClebschGordan ( double _Vector0, double _Vector1, int _Order, ProductDelegate _Delegate ) : double[]
_Vector0 double First vector
_Vector1 double Second vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
_Delegate ProductDelegate
return double[]

Rotate() public static method

Applies rotation to the specified SH vector using the specified rotation matrix yielded by the above "BuildRotationMatrix()" method
public static Rotate ( double _Vector, double _RotationMatrix, double _RotatedVector, int _Order ) : void
_Vector double The vector to rotate
_RotationMatrix double The SH rotation matrix
_RotatedVector double The rotated vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

Rotate() public static method

Applies rotation to the specified 3-vector using the specified rotation matrix returned by the "BuildRotationMatrix()" method
public static Rotate ( float3 _Vector, double _RotationMatrix, float3 _RotatedVector, int _Order ) : void
_Vector SharpMath.float3 The 3-vector to rotate
_RotationMatrix double The SH rotation matrix
_RotatedVector SharpMath.float3 The rotated vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

RotateY() public static method

Applies a simple fast rotation about the Y axis
public static RotateY ( double _Vector, double , double _RotatedVector, int _Order ) : void
_Vector double The vector to rotate
double The rotation angle
_RotatedVector double The rotated vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

RotateY() public static method

Applies a simple fast rotation about the Y axis
public static RotateY ( float3 _Vector, double , float3 _RotatedVector, int _Order ) : void
_Vector SharpMath.float3 The vector to rotate
double The rotation angle
_RotatedVector SharpMath.float3 The rotated vector
_Order int The order of the vectors (i.e. vectors must have a length of Order²)
return void

SphericalToCartesian() public static method

Converts spherical coordinates (θ,ϕ) into a cartesian UNIT vector
public static SphericalToCartesian ( double , double ) : float3
double The polar elevation
double The azimuth
return SharpMath.float3

SphericalToCartesian() public static method

Converts spherical coordinates (θ,ϕ) into a cartesian UNIT vector
public static SphericalToCartesian ( double , double , float3 _Direction ) : void
double The polar elevation
double The azimuth
_Direction SharpMath.float3 The unit vector in cartesian coordinates
return void

Ylm() public static method

public static Ylm ( int l, int m, double , double ) : double
l int
m int
double
double
return double

Ylm() public static method

public static Ylm ( int l, int m, float3 _Direction ) : double
l int
m int
_Direction SharpMath.float3
return double

ZHMappingGlobalFunctionEval() protected static method

protected static ZHMappingGlobalFunctionEval ( double _Coefficients, object _Params ) : double
_Coefficients double
_Params object
return double

ZHMappingGlobalFunctionGradientEval() protected static method

protected static ZHMappingGlobalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
_Coefficients double
_Gradients double
_Params object
return void

ZHMappingLocalFunctionEval() protected static method

protected static ZHMappingLocalFunctionEval ( double _Coefficients, object _Params ) : double
_Coefficients double
_Params object
return double

ZHMappingLocalFunctionGradientEval() protected static method

protected static ZHMappingLocalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
_Coefficients double
_Gradients double
_Params object
return void

dfpmin() protected static method

Performs BFGS function minimzation on a quadratic form function evaluated by the provided delegate
protected static dfpmin ( double _Coefficients, double _ConvergenceTolerance, int &_PerformedIterationsCount, double &_Minimum, BFGSFunctionEval _FunctionEval, BFGSFunctionGradientEval _FunctionGradientEval, object _Params ) : void
_Coefficients double The array of initial coefficients (indexed from 1!!) that will also contain the resulting coefficients when the routine has converged
_ConvergenceTolerance double The tolerance error to accept as the minimum of the function
_PerformedIterationsCount int The amount of iterations performed to reach the minimum
_Minimum double The found minimum
_FunctionEval BFGSFunctionEval The delegate used to evaluate the function to minimize
_FunctionGradientEval BFGSFunctionGradientEval The delegate used to evaluate the gradient of the function to minimize
_Params object Some user params passed to the evaluation functions
return void

lnsrch() protected static method

protected static lnsrch ( int n, double xold, double fold, double g, double p, double x, double &f, double stpmax, int &check, BFGSFunctionEval _FunctionEval, object _Params ) : void
n int
xold double
fold double
g double
p double
x double
f double
stpmax double
check int
_FunctionEval BFGSFunctionEval
_Params object
return void

Property Details

ALF protected_oe static_oe property

protected static double ALF
return double

EPS protected_oe static_oe property

protected static double EPS
return double

FACTORIAL protected_oe static_oe property

protected static double[] FACTORIAL
return double[]

ITMAX protected_oe static_oe property

protected static int ITMAX
return int

SQRT2 protected_oe static_oe property

protected static double SQRT2
return double

STPMX protected_oe static_oe property

protected static double STPMX
return double

TOLX protected_oe static_oe property

protected static double TOLX
return double

TOLY protected_oe static_oe property

protected static double TOLY
return double