weirdes farb artefakte auf den kugeln wenn ein licht zu nah dran ist

This commit is contained in:
any
2026-07-30 18:12:19 +02:00
parent 82ab538095
commit 2ebc5f03bb
7 changed files with 31 additions and 4 deletions
+10
View File
@@ -6,6 +6,8 @@
#include <stdlib.h>
#include <math.h>
#include "structs.h"
#include "vectorOp.h"
#define EPSILON 1e-8
vec3 randUnitVector() {
double x1,x2,lengthSquared;
@@ -22,3 +24,11 @@ vec3 randUnitVector() {
1.0 - 2.0 * lengthSquared};
}
int epsilonCheck(vec3 p1, vec3 p2) { //if distance is to small, the test fails (return 0)
vec3 distanceVector = vec3Subtract(p1, p2);
double sumVector = fabs(distanceVector.x) + fabs(distanceVector.y) + fabs(distanceVector.z);
if (sumVector <= EPSILON) {
return 0;
}
return 1;
}