// /// Calculates the direct illuminance/diffuse radiance ratio
// /// according to Equation 8 and Table 4 of Perez et al. 1990
Calculates the direct illuminance/diffuse radiance ratio
according to Equation 8 and Table 4 of Perez et al. 1990
Calculates the direct illuminance / diffuse radiance ratio according to Equation 8 and Table 4 of Perez et al . 1990
pub fn direct_illuminance_ratio(p_water_content: Float, zenit: Float, sky_brightness: Float, index: usize)->Float{
        if index > 7 {
            panic!("Table 4 of Perez's paper has only 8 sky clearness categories (starting from 0)... received {}", index)
        }
        const TABLE : [(Float, Float, Float, Float); 8] =
        [
            (  57.20, -4.55, -2.98, 117.12 ),
            (  98.99, -3.46, -1.21,  12.38 ),
            ( 109.83, -4.90, -1.71,  -8.81 ),
            ( 110.34, -5.84, -1.99,  -4.56 ),
            ( 106.36, -3.97, -1.75,  -6.16 ),
            ( 107.19, -1.25, -1.51, -26.73 ),
            ( 105.75,  0.77, -1.26, -34.44 ),
            ( 101.18,  1.58, -1.10,  -8.29 )
        ];
        let v = TABLE[index].0 +
        TABLE[index].1*p_water_content +
        TABLE[index].2*(5.73*zenit - 5.).exp() +
        TABLE[index].3* sky_brightness;
        // return
        v.clamp(0., 9e9)
    }
pub fn direct_illuminance_ratio ( p_water_content : Float , zenit : Float , sky_brightness : Float , index : usize ) -> Float { if index > 7 { panic ! ( " " index ) } const TABLE : [ ( Float , Float , Float , Float ) ; 8 ] = [ ( 57.20 , - 4.55 , - 2.98 , 117.12 ) , ( 98.99 , - 3.46 , - 1.21 , 12.38 ) , ( 109.83 , - 4.90 , - 1.71 , - 8.81 ) , ( 110.34 , - 5.84 , - 1.99 , - 4.56 ) , ( 106.36 , - 3.97 , - 1.75 , - 6.16 ) , ( 107.19 , - 1.25 , - 1.51 , - 26.73 ) , ( 105.75 , 0.77 , - 1.26 , - 34.44 ) , ( 101.18 , 1.58 , - 1.10 , - 8.29 ) ] ; let v = TABLE [ index ] . 0 + TABLE [ index ] . 1 * p_water_content + TABLE [ index ] . 2 * ( 5.73 * zenit - 5. ) . exp ( ) + TABLE [ index ] . 3 * sky_brightness ; // return v . clamp ( 0. , 9e9 ) }
Calculates the direct illuminance/diffuse radiance ratio
 according to Equation 8 and Table 4 of Perez et al.
Calculates the direct illuminance / diffuse radiance ratio according to Equation 8 and Table 4 of Perez et al .
p_water_content
Float
zenit
Float
sky_brightness
Float
index
usize