|
![](/i/fill.gif) |
In article <3df273e6@news.povray.org>, Warp <war### [at] tag povray org>
wrote:
> Have you actually made the math, which shape "wastes" more space when
> bounding (optimally) a regular tetrahedron ("regular" meaning all sides
> have the same length), the sphere or the box?
Ok, for a tetrahedron with these corners:
<-1, 1,-1>
< 1, 1, 1>
<-1,-1, 1>
< 1,-1,-1>
(regular tetrahedron, every point equidistant from the other three)
The radius of a perfect bounding sphere is sqrt(3). Volume is pi*3/4*r^3
= 21.763 cubic units. The volume of the perfect axis-aligned bounding
box is 8 cubic units, though it will increase for other orientations (I
think the worst case makes for a bounding box sqrt(8)xsqrt(8)x2, 16
cubic units.
I think the "average visible area" would make a better measurement than
volume, though much harder to compute. And the difference is bigger than
I expected, but I can't find anything wrong with my math, please
re-check it.
> Also I think that a ray-sphere intersection is faster than a ray-box
> intersection, so the sphere is in that sense a better bounding object.
Hmm...the bounding box calculation is very well optimized, I think it
only requires 3 intersections with axis-aligned planes and some code for
clipping that. A sphere is fast, but I think a bounding box is faster.
However, I'm not too sure how the bounded_by keyword fits in with the
bounding box heirarchy...it looks like a bounding box is always used,
which bounds the bounding shapes (multiple?), which bound the object.
Much of the bounding code seems to be very per-object...it's pretty
disorganized, and probably not as fast as it could be.
--
Christopher James Huff <cja### [at] earthlink net>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tag povray org
http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |