BRDFLafortuneFitting.Program.LookupBRDF C# (CSharp) Method

LookupBRDF() static private method

Given a pair of incoming/outgoing angles, look up the BRDF.
static private LookupBRDF ( double _BRDF, double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut ) : double
_BRDF double One of the R,G,B BRDFs
_ThetaIn double
_PhiIn double
_ThetaOut double
_PhiOut double
return double
        static double LookupBRDF( double[] _BRDF, double _ThetaIn, double _PhiIn, double _ThetaOut, double _PhiOut )
        {
            // Convert to half angle / difference angle coordinates
            double ThetaHalf, PhiHalf, ThetaDiff, PhiDiff;
            std_coords_to_half_diff_coords(	_ThetaIn, _PhiIn, _ThetaOut, _PhiOut,
                                            out ThetaHalf, out PhiHalf, out ThetaDiff, out PhiDiff );

            // Find index (note that PhiHalf is ignored, since isotropic BRDFs are assumed)
            int TableIndex = PhiDiff_index( PhiDiff );
                TableIndex += (BRDF_SAMPLING_RES_PHI_D / 2) * ThetaDiff_index( ThetaDiff );
                TableIndex += (BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D / 2) * ThetaHalf_index( ThetaHalf );

            double	Result = _BRDF[TableIndex];
            //					Result *= _ComponentScale;
            return Result;
        }