Add generalized bvh for pbrt

This commit is contained in:
hal8174 2025-09-11 22:33:10 +02:00
parent 807168f787
commit 6403aabc11
Signed by: hal8174
SSH key fingerprint: SHA256:NN98ZYwnrreQLSOV/g+amY7C3yL/mS1heD7bi5t6PPw
5 changed files with 360 additions and 43 deletions

View file

@ -49,6 +49,14 @@ impl AABB {
self.max
}
pub fn center(self) -> Pos3 {
Pos3::new(
(self.min.x + self.max.x) * 0.5,
(self.min.y + self.max.y) * 0.5,
(self.min.z + self.max.z) * 0.5,
)
}
pub fn contains_point(self, pos: Pos3) -> bool {
self.min.x <= pos.x
&& pos.x <= self.max.x