diff -r d8d596d26f25 -r bf17f9f84c91 src/scene.cc --- a/src/scene.cc Sun Nov 18 11:20:56 2007 +0100 +++ b/src/scene.cc Thu Nov 22 17:53:34 2007 +0100 @@ -165,3 +165,23 @@ dist = t; return true; } + +BBox Triangle::get_bbox() +{ + BBox bbox = BBox(); + bbox.L = A; + if (B.x < bbox.L.x) bbox.L.x = B.x; + if (C.x < bbox.L.x) bbox.L.x = C.x; + if (B.y < bbox.L.y) bbox.L.y = B.y; + if (C.y < bbox.L.y) bbox.L.y = C.y; + if (B.z < bbox.L.z) bbox.L.z = B.z; + if (C.z < bbox.L.z) bbox.L.z = C.z; + bbox.R = A; + if (B.x > bbox.R.x) bbox.R.x = B.x; + if (C.x > bbox.R.x) bbox.R.x = C.x; + if (B.y > bbox.R.y) bbox.R.y = B.y; + if (C.y > bbox.R.y) bbox.R.y = C.y; + if (B.z > bbox.R.z) bbox.R.z = B.z; + if (C.z > bbox.R.z) bbox.R.z = C.z; + return bbox; +};