| 152 | } |
| 153 | |
| 154 | Vector UniformSampleCone(const float u1, const float u2, float costhetamax) { |
| 155 | const float costheta = Lerp(u1, 1.f, costhetamax); |
| 156 | const float u1x = (1.f - costhetamax) * u1; |
| 157 | const float sintheta = sqrtf(Max(0.f, u1x * (2.f - u1x))); |
| 158 | const float phi = u2 * 2.f * M_PI; |
| 159 | return Vector(cosf(phi) * sintheta, sinf(phi) * sintheta, costheta); |
| 160 | } |
| 161 | |
| 162 | Vector UniformSampleCone(const float u1, const float u2, float costhetamax, |
| 163 | const Vector &x, const Vector &y, const Vector &z) { |
no test coverage detected