T1 AABB Box (MS1)
Add a new public method expand() for class interval in interval.h
class interval {
public:
// ...
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// merge two intervals into one
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;
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// ...
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
interval expand(double delta) const {
auto padding = delta/2;
return interval(min - padding, max + padding);
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// ...
};Add a new aabb class for the axis aligned bounding box

Add a bounding_box virtual interface in hittable
Revise sphere.h to add the bounding box
Creating Bounding Box for List of Objects
Add a bvh_node class
create bvh.h, write class bvh_node to inherit from the hittable abstract class
add random_int() in rtweekend.h
Revise main.cpp
Build and Run

PreviousLab B04 Axis-Aligned Bounding Box, Texture Mapping and Light SourcesNextT2 Texture Mapping (MS2)
Last updated