| 81 | } |
| 82 | |
| 83 | Vector UniformSampleSphere(const float u1, const float u2) { |
| 84 | const float z = 1.f - 2.f * u1; |
| 85 | const float r = sqrtf(Max(0.f, 1.f - z * z)); |
| 86 | const float phi = 2.f * M_PI * u2; |
| 87 | const float x = r * cosf(phi); |
| 88 | const float y = r * sinf(phi); |
| 89 | return Vector(x, y, z); |
| 90 | } |
| 91 | |
| 92 | float UniformSpherePdf() { |
| 93 | return 1.f / (4.f * M_PI); |
no test coverage detected