moab
moab::BVHTree::Bucket Class Reference

List of all members.

Public Member Functions

 Bucket ()
 Bucket (const Bucket &f)
 Bucket (const unsigned int sz)
Bucketoperator= (const Bucket &f)

Static Public Member Functions

static unsigned int bucket_index (int num_splits, const BoundBox &box, const BoundBox &interval, const unsigned int dim)

Public Attributes

unsigned int mySize
BoundBox boundingBox

Detailed Description

Definition at line 176 of file BVHTree.hpp.


Constructor & Destructor Documentation

Definition at line 178 of file BVHTree.hpp.

: mySize(0) {}
moab::BVHTree::Bucket::Bucket ( const Bucket f) [inline]

Definition at line 179 of file BVHTree.hpp.

: mySize(f.mySize), boundingBox(f.boundingBox) {}
moab::BVHTree::Bucket::Bucket ( const unsigned int  sz) [inline]

Definition at line 180 of file BVHTree.hpp.

: mySize(sz) {}

Member Function Documentation

unsigned int moab::BVHTree::Bucket::bucket_index ( int  num_splits,
const BoundBox box,
const BoundBox interval,
const unsigned int  dim 
) [inline, static]

Definition at line 281 of file BVHTree.hpp.

    {
//see FastMemoryEfficientCellLocationinUnstructuredGridsForVisualization.pdf 
//around page 9
      
//Paper arithmetic is over-optimized.. this is safer.
      const double min = interval.bMin[dim];
      const double length = (interval.bMax[dim]-min)/(num_splits+1);
      const double center = ((box.bMax[dim] + box.bMin[dim])/2.0)-min;
#ifndef NDEBUG
#ifdef BVH_SHOW_INDEX
      std::cout << "[" << min << " , " 
                << interval.max[dim] << " ]" <<std::endl;
      std::cout << "[" 
                << box.bMin[dim] << " , " << box.bMax[dim] << " ]" <<std::endl;
      std::cout << "Length of bucket" << length << std::endl;
      std::cout << "Center: " 
                << (box.bMax[dim] + box.bMin[dim])/2.0 << std::endl;
      std::cout << "Distance of center from min:  " << center << std::endl;
      std::cout << "ratio: " << center/length << std::endl;
      std::cout << "index: " << std::ceil(center/length)-1 << std::endl;
#endif
#endif
      unsigned int cl = std::ceil(center/length);
      return (cl > 0 ? cl-1 : 0);
    }
Bucket& moab::BVHTree::Bucket::operator= ( const Bucket f) [inline]

Definition at line 184 of file BVHTree.hpp.

                                           {
          boundingBox = f.boundingBox; mySize = f.mySize;
          return *this;
        }

Member Data Documentation

Definition at line 182 of file BVHTree.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines