BRDFLafortuneFitting.Program.ThetaHalf_index C# (CSharp) Method

ThetaHalf_index() static private method

static private ThetaHalf_index ( double _ThetaHalf ) : int
_ThetaHalf double
return int
        static int ThetaHalf_index( double _ThetaHalf )
        {
            if ( _ThetaHalf <= 0.0 )
                return 0;

            double	ThetaHalf_deg = ((_ThetaHalf / (0.5*Math.PI)) * BRDF_SAMPLING_RES_THETA_H);
            double	temp = ThetaHalf_deg*BRDF_SAMPLING_RES_THETA_H;
                    temp = Math.Sqrt( temp );

            int Index = (int) Math.Floor( temp );
                Index = Math.Max( 0, Math.Min( Index, BRDF_SAMPLING_RES_THETA_H-1 ) );
            return Index;
        }