pub fn cos_theta(w: &Vector3f) -> Float
Utility function to calculate cosine via spherical coordinates.