alecjacobson/computer-graphics-bounding-volume-hierarchy

point_box_squared_distance question

Closed this issue · 4 comments

Hi, for this function, does "closest point on bounding box" mean any point on the box surface or just vertex?

Any point on the box's surface.

is it the same when point is inside the box?

Do you mean when the query point is inside the bounding box? In that case, think about it this way: the intention of this function is really to provide a lower bound on the distance from the point to any of the objects contained in the box. If the query point is in the box, then it's very likely that the closest object to the query point is inside the box. Given that you're using a priority queue with priorities based on distance, how would you set the distance to make sure that you explore the box containing the point before any other box?

Thanks so much!