pub fn uniform_sample_hemisphere(u: &Point2f) -> Vector3f {
    let z: Float = u[XYEnum::X];
    let r: Float = (0.0 as Float).max(1.0 as Float - z * z).sqrt();
    let phi: Float = 2.0 as Float * PI * u[XYEnum::Y];
    Vector3f {
        x: r * phi.cos(),
        y: r * phi.sin(),
        z,
    }
}
/// Uniformly sample rays in a hemisphere. Choose a direction.
Uniformly sample rays in a hemisphere. Choose a direction.
Uniformly sample rays in a hemisphere . Choose a direction .
pub fn uniform_sample_hemisphere(u: &Point2f) -> Vector3f {
    let z: Float = u[XYEnum::X];
    let r: Float = (0.0 as Float).max(1.0 as Float - z * z).sqrt();
    let phi: Float = 2.0 as Float * PI * u[XYEnum::Y];
    Vector3f {
        x: r * phi.cos(),
        y: r * phi.sin(),
        z,
    }
}
pub fn uniform_sample_hemisphere ( u : & Point2f ) -> Vector3f { let z : Float = u [ XYEnum :: X ] ; let r : Float = ( 0.0 as Float ) . max ( 1.0 as Float - z * z ) . sqrt ( ) ; let phi : Float = 2.0 as Float * PI * u [ XYEnum :: Y ] ; Vector3f { x : r * phi . cos ( ) , y : r * phi . sin ( ) , z , } }
Uniformly sample rays in a hemisphere.
Uniformly sample rays in a hemisphere .
u
&Point2f