From 84634b94c2765997279edfca2e9184f4bfc5e206 Mon Sep 17 00:00:00 2001 From: Wentao Liu Date: Tue, 17 Oct 2023 10:45:00 +0800 Subject: [PATCH] replace Riemann sum computation in SpectrumToPhotometric() with InnerProduct() --- src/pbrt/util/spectrum.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pbrt/util/spectrum.cpp b/src/pbrt/util/spectrum.cpp index d59f4f898..e31317bd0 100644 --- a/src/pbrt/util/spectrum.cpp +++ b/src/pbrt/util/spectrum.cpp @@ -43,11 +43,7 @@ Float SpectrumToPhotometric(Spectrum s) { if (s.Is()) s = s.Cast()->Illuminant(); - Float y = 0; - for (Float lambda = Lambda_min; lambda <= Lambda_max; ++lambda) - y += Spectra::Y()(lambda) * s(lambda); - - return y; + return InnerProduct(&Spectra::Y(), s); } XYZ SpectrumToXYZ(Spectrum s) {