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 * 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. * refraction that makes it incorrect to track multiple wavelengths together.
*/ */
public @NotNull SampledWavelengths collapse() { public double collapse() {
if (pdf.length < 2 || pdf[1] == 0) return this; if (pdf.length >= 2 || pdf[1] != 0) {
var newPdf = Arrays.copyOf(pdf, pdf.length); Arrays.fill(pdf, 1, pdf.length, 0d);
Arrays.fill(newPdf, 1, newPdf.length, 0d); pdf[0] /= pdf.length;
newPdf[0] /= newPdf.length; }
return new SampledWavelengths(lambdas, newPdf); return lambdas[0];
} }
/* /*

Loading…
Cancel
Save