weirdes farb artefakte auf den kugeln wenn ein licht zu nah dran ist
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user