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