SphereTree.cc

Go to the documentation of this file.
00001 #include <esg/spacesorting/SphereTree.h>
00002 
00003 using namespace esg;
00004 
00005 bool SphereTree::_enlarge_bv(Geometry** dst, Geometry& src)
00006 {
00007     if (!(*dst)) { *dst = (Geometry*) src.clone(); return true; }
00008 
00009     if ((((Vector3)(src.centroid() - (*dst)->centroid())).length()
00010          + src.radius()) <= (*dst)->radius())
00011         return false;
00012 
00013     Geometry* pG = new Sphere(**dst, src);
00014     delete *dst;
00015     *dst = pG;
00016     
00017     return true;
00018 }
00019 
00020 Geometry* SphereTree::_create_bv(List<SceneGraphObject>& list)
00021 {
00022     return (Geometry*) new Sphere(list);
00023 }
00024 
00025 Geometry* SphereTree::_create_bv(Geometry& bv1, Geometry& bv2)
00026 {
00027     return (Geometry*) new Sphere(bv1, bv2);
00028 }
00029 
00030 Geometry* SphereTree::_create_bv(SceneGraphObject& obj)
00031 {
00032     return (Geometry*) new Sphere(obj);
00033 }
00034 
00035 BVList* SphereTree::_create_list()
00036 {
00037     return new BVList(FDH14::DIRS, FDH14::FDHMat);
00038 }
00039 
00040 void SphereTree::_duplicate_attributes(const SDS& src)
00041 {
00042     BVH::_duplicate_attributes(src);
00043 }
00044 
00045 //------- public -----------
00046 
00047 SDS* SphereTree::clone() const
00048 {
00049     SphereTree* ret = new SphereTree();
00050     ret->_duplicate_attributes(*this);
00051     return ret;
00052 }

Generated on Wed Jun 28 12:24:32 2006 for esg by  doxygen 1.4.6