|
![](/i/fill.gif) |
Le_Forgeron <lef### [at] free fr> wrote:
> Both sphere & plane reimplement Intersect_BBox for their class as
> "always true". (instead of ObjectBase::Intersect_BBox from which they
> inherit). And that seems rather counter productive, as it seems to me
> (but am I wrong ?) that the ObjectBase's implementation is fine
> (it checks the direction & side of the box).
Calculating the intersection between a ray and a sphere is faster than
calculating the intersection of a ray and a (axis-aligned) box. Hence it
would make no sense to first check if the ray hits the bounding box of
the sphere and then if it hits the sphere. This would only make rendering
slower. It's much faster to just ignore the bounding box and always test
against the sphere directly.
As for a plane, it would have an "infinite" bounding box, which would be
the plane itself. Hence checking if the ray hits this "bounding box" would
be completely identical to checking if the ray hits the plane itself. Hence
the useless "bounding box" check would only slow down the rendering of the
plane (because, basically, it would be calculating the ray-plane intersection
twice, when once would suffice).
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |