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

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

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

            // Copy current coefficients into the current cosine lobes
            for ( int LobeIndex=0; LobeIndex < Context.m_Lobes.Length; LobeIndex++ )
            {
                CosineLobe	Lobe = Context.m_Lobes[LobeIndex];
                int			CoeffOffset = 1+4*LobeIndex;	// Remember those stupid coefficients are indexed from 1!
                Lobe.C.Set( _Coefficients[CoeffOffset+0], _Coefficients[CoeffOffset+1], _Coefficients[CoeffOffset+2] );
                Lobe.N = _Coefficients[CoeffOffset+3];
            }

            // 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;
        }