Computes the inner product of two SG's, which is equal to Integrate(SGx(v) * SGy(v) * dv).
| 31 | |
| 32 | // Computes the inner product of two SG's, which is equal to Integrate(SGx(v) * SGy(v) * dv). |
| 33 | inline Float3 SGInnerProduct(const SG& x, const SG& y) |
| 34 | { |
| 35 | float umLength = Float3::Length(x.Sharpness * x.Axis + y.Sharpness * y.Axis); |
| 36 | Float3 expo = std::exp(umLength - x.Sharpness - y.Sharpness) * x.Amplitude * y.Amplitude; |
| 37 | float other = 1.0f - std::exp(-2.0f * umLength); |
| 38 | return (2.0f * Pi * expo * other) / umLength; |
| 39 | } |
| 40 | |
| 41 | // Returns an approximation of the clamped cosine lobe represented as an SG |
| 42 | inline SG CosineLobeSG(Float3 direction) |
no test coverage detected