fixup color framework

feature/spectral
jbb01 5 months ago
parent 00fbf4e4f1
commit 791ee606c4

@ -58,12 +58,12 @@ public final class SampledWavelengths {
* Terminates the secondary wavelengths. This method should be called after a wavelength-dependent operation like
* refraction that makes it incorrect to track multiple wavelengths together.
*/
public @NotNull SampledWavelengths collapse() {
if (pdf.length < 2 || pdf[1] == 0) return this;
var newPdf = Arrays.copyOf(pdf, pdf.length);
Arrays.fill(newPdf, 1, newPdf.length, 0d);
newPdf[0] /= newPdf.length;
return new SampledWavelengths(lambdas, newPdf);
public double collapse() {
if (pdf.length >= 2 || pdf[1] != 0) {
Arrays.fill(pdf, 1, pdf.length, 0d);
pdf[0] /= pdf.length;
}
return lambdas[0];
}
/*

Loading…
Cancel
Save