double ratio = (lightNode.getPDF(v) * gle)
/ (eyeNode.getPDF() * eyeNode.getGeometricFactor());
//if (ratio < 0.0) bp();
pdf[s + 1] = pdf[s] * Math.max(ratio, 0.0);
} else if (eyeNode instanceof ScatteringNode) {
ScatteringNode scatNode = (ScatteringNode) eyeNode;
double ratio = scatNode.getSourcePDF()
/ (eyeNode.getPDF() * eyeNode.getGeometricFactor());
//if (ratio < 0.0) bp();
pdf[s + 1] = pdf[s] * Math.max(ratio, 0.0);
}
}
PathNode zjp2 = lightNode;
PathNode zjp1 = eyeNode; // z_{j+1}, j == k - i
for (int i = s + 1; i <= k; i++) {
if (i + 1 > maxLightDepth) {
break;
}
PathNode zj = zjp1.getParent();
double rpdf = 0.0;
if (zjp2 != null) {
Vector3 v = PathUtil.getDirection(zjp2, zjp1);
rpdf = zjp2.isSpecular() ? zjp2.getPDF() : zjp1.getReversePDF(v);
} else if (zjp1 instanceof ScatteringNode) {
ScatteringNode scatNode = (ScatteringNode) zjp1;
Vector3 v = PathUtil.getDirection(zjp1, zj);
rpdf = scatNode.getSourcePDF(v);
}
double ratio = (rpdf * zjp1.getGeometricFactor())
/ (zj.getPDF() * zj.getGeometricFactor());
if (ratio < 0.0) bp();