Implement BVH

This commit is contained in:
CJSatnarine
2024-07-08 17:31:04 -04:00
parent 5ca33d1762
commit 80f3aff65d
18 changed files with 81908 additions and 351689 deletions

View File

@@ -12,6 +12,12 @@ class interval {
interval(double min, double max) : min(min), max(max) {}
interval(const interval& a, const interval& b) {
// Create the interval tightly enclosing the two input intervals.
min = a.min <= b.min ? a.min : b.min;
max = a.max >= b.max ? a.max : b.max;
}
double size() const {
return max - min;
}
@@ -30,6 +36,11 @@ class interval {
return x;
}
interval expand(double delta) const {
auto padding = delta / 2;
return interval(min - padding, max + padding);
}
static const interval empty, universe;
};