dilevin / computer-graphics-bounding-volume-hierarchy

Computer Graphics Assignment about Bounding Volume Hierarchies
6 stars 5 forks source link

Doubling up bounding boxes? #46

Closed NPTP closed 4 years ago

NPTP commented 4 years ago

Say for example we have a bounding box B, which encloses a primitive (e.g. a triangle). Now let's say we call the AABBTree() constructor, and let the box attribute of this AABBTree we are just about to construct be called C.

We know a bounding box inherits from Object in our implementation, so we call this constructor and pass in a list of Objects which contains only the bounding box B.

Because this list of Objects contains only one item, we will put it by default into the left or right pointer without bothering to split space. But should we bother to insert B into C? And because it's only one item (and that item is a bounding box), won't this make C and B identical, overlapping bounding boxes? And if so, is this a problem? Obviously if we have two or more bounding boxes in the Objects we pass in, we can build a new box in the AABBTree() constructor to surround them all, but I'm unsure about the case of just 1.

Also, if we have 2 or more objects, we split them into left and right boxes... but then the "box" contained in the new AABBTree we just built should also encompass both of those new left and right boxes, right? So in effect we create 3 new bounding boxes?

Finally, what are all the primitives we have to deal with? I assume only triangles given only insert_triangle_into_box function is in our code. However, I also see cloudpoints mentioned, but no way to insert those into a box without creating a new function?

I guess this is 3 questions altogether. Thank you!

honglin-c commented 4 years ago
NPTP commented 4 years ago

Thanks for your help, much appreciated!