POV-Ray : Newsgroups : povray.beta-test : Wondering about Intersect_BBox : Re: Wondering about Intersect_BBox Server Time
30 Jun 2024 13:04:13 EDT (-0400)
  Re: Wondering about Intersect_BBox  
From: Warp
Date: 10 Oct 2010 04:06:21
Message: <4cb173fd@news.povray.org>
Le_Forgeron <lef### [at] freefr> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.