BRDFLafortuneFitting.Program.BRDFMappingLocalFunctionEval C# (CSharp) Метод

BRDFMappingLocalFunctionEval() защищенный статический Метод

protected static BRDFMappingLocalFunctionEval ( double _Coefficients, object _Params ) : double
_Coefficients double
_Params object
Результат double
        protected static double BRDFMappingLocalFunctionEval( double[] _Coefficients, object _Params )
        {
            BRDFFitEvaluationContext	Context = _Params as BRDFFitEvaluationContext;

            // PATCH: Make sure the coefficient is strictly positive
            if ( _Coefficients[4] < EPS )
                _Coefficients[4] = EPS;

            // Copy current coefficients into the current cosine lobe
            Context.m_Lobes[0].C.Set( _Coefficients[1], _Coefficients[2], _Coefficients[3] );	// Remember those stupid coefficients are indexed from 1!
            Context.m_Lobes[0].N = _Coefficients[4];

            // Sum differences between current lobe estimates and current goal BRDF
            double	Normalizer = 1.0 / ms_BRDFSamples.Length;
            double	SumSquareDifference = ComputeSummedDifferences( ms_BRDFSamples, Normalizer, Context.m_BRDF, Context.m_Lobes );

            // Keep the result for gradient eval
            Context.m_SumSquareDifference = SumSquareDifference;

            return	SumSquareDifference;
        }