C# Class BRDFLafortuneFitting.Program

Show file Open project: Patapom/GodComplex

Protected Properties

Property Type Description
ALF double
EPS double
ITMAX int
STPMX double
TOLX double
TOLY double

Protected Methods

Method Description
BRDFMappingGlobalFunctionEval ( double _Coefficients, object _Params ) : double
BRDFMappingGlobalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
BRDFMappingLocalFunctionEval ( double _Coefficients, object _Params ) : double
BRDFMappingLocalFunctionGradientEval ( double _Coefficients, double _Gradients, object _Params ) : void
ENSUREVALID ( double _Coefficients ) : void
LoadBRDF ( FileInfo _BRDFFile ) : double[][]

Loads a MERL BRDF file

SaveAllSlices ( ) : void
dfpmin ( double _Coefficients, double _ConvergenceTolerance, int &_PerformedIterationsCount, BFGSFunctionEval _FunctionEval, BFGSFunctionGradientEval _FunctionGradientEval, object _Params ) : double

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
ComputeSummedDifferences ( BRDFSample _Samples, double _Normalizer, double _GoalBDRF, CosineLobe _LobeEstimates ) : double

Computes the square difference between a current cosine lobe estimate and a goal BRDF given a set of samples

FitBRDF ( double _BRDF, CosineLobe _Lobes, CosineLobe _InitialGuesses, double _BFGSConvergenceTolerance, double _RMS, BRDFMappingFeedback _Delegate ) : double

Performs mapping of a BRDF into N sets of cosine lobes coefficients WARNING: Takes hell of a time to compute !

IsValid ( double _BRDFValue ) : bool
LookupBRDF ( double _BRDF, double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut ) : double

Given a pair of incoming/outgoing angles, look up the BRDF.

Main ( string args ) : void
PhiDiff_index ( double _PhiDiff ) : int
ShowProgress ( double _Progress ) : void
ThetaDiff_index ( double _ThetaDiff ) : int
ThetaHalf_index ( double _ThetaHalf ) : int
half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, System.Vector3 &_In, System.Vector3 &_Out ) : void
half_diff_coords_to_std_coords ( double _ThetaHalf, double _PhiHalf, double _ThetaDiff, double _PhiDiff, double &_ThetaIn, double &_PhiIn, double &_ThetaOut, double &_PhiOut ) : void
std_coords_to_half_diff_coords ( double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut, double &_ThetaHalf, double &_PhiHalf, double &_ThetaDiff, double &_PhiDiff ) : void

Method Details

BRDFMappingGlobalFunctionEval() protected static method

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

BRDFMappingGlobalFunctionGradientEval() protected static method

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

BRDFMappingLocalFunctionEval() protected static method

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

BRDFMappingLocalFunctionGradientEval() protected static method

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

ENSUREVALID() protected static method

protected static ENSUREVALID ( double _Coefficients ) : void
_Coefficients double
return void

LoadBRDF() protected static method

Loads a MERL BRDF file
protected static LoadBRDF ( FileInfo _BRDFFile ) : double[][]
_BRDFFile System.IO.FileInfo
return double[][]

SaveAllSlices() protected static method

protected static SaveAllSlices ( ) : void
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, BFGSFunctionEval _FunctionEval, BFGSFunctionGradientEval _FunctionGradientEval, object _Params ) : double
_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
_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 double

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 static property

protected static double ALF
return double

EPS protected static property

protected static double EPS
return double

ITMAX protected static property

protected static int ITMAX
return int

STPMX protected static property

protected static double STPMX
return double

TOLX protected static property

protected static double TOLX
return double

TOLY protected static property

protected static double TOLY
return double