Skip to content

Commit

Permalink
Merge pull request #390 from w3ntao/fix-2023-10-17
Browse files Browse the repository at this point in the history
replace Riemann sum computation in SpectrumToPhotometric() with InnerProduct()
  • Loading branch information
mmp authored Oct 26, 2024
2 parents a1f4d0f + 84634b9 commit 20d85f0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/pbrt/util/spectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ Float SpectrumToPhotometric(Spectrum s) {
if (s.Is<RGBIlluminantSpectrum>())
s = s.Cast<RGBIlluminantSpectrum>()->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) {
Expand Down

0 comments on commit 20d85f0

Please sign in to comment.