• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

/home/hauberg/Dokumenter/Capture/humim-tracker-0.1/src/OpenTissue/OpenTissue/collision/bvh/bvh_bv_node.h

Go to the documentation of this file.
00001 #ifndef OPENTISSUE_COLLISION_BVH_BVH_BV_NODE_H
00002 #define OPENTISSUE_COLLISION_BVH_BVH_BV_NODE_H
00003 //
00004 // OpenTissue Template Library
00005 // - A generic toolbox for physics-based modeling and simulation.
00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
00007 //
00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
00009 //
00010 #include <OpenTissue/configuration.h>
00011 
00012 #include <cassert>
00013 
00014 namespace OpenTissue
00015 {
00016   namespace bvh
00017   {
00018 
00019     template <typename V, typename G,typename T>  class BoundingVolumeHierarchy; 
00020 
00030     template <typename B, typename  T>
00031     class BV : public T
00032     {
00033     public:
00034 
00035       typedef B                                         bvh_type;
00036       typedef typename bvh_type::volume_type            volume_type;
00037       typedef typename bvh_type::geometry_type          geometry_type;
00038 
00039       typedef typename bvh_type::bvh_weak_ptr           bvh_weak_ptr;
00040       typedef typename bvh_type::bvh_const_weak_ptr     bvh_const_weak_ptr;
00041       typedef typename bvh_type::bvh_const_ptr          bvh_const_ptr;
00042       typedef typename bvh_type::bv_weak_ptr            bv_weak_ptr;
00043       typedef typename bvh_type::bv_const_weak_ptr      bv_const_weak_ptr;
00044       typedef typename bvh_type::bv_const_ptr           bv_const_ptr;
00045 
00046       typedef typename bvh_type::bv_ptr_container       bv_ptr_container;
00047       typedef typename bvh_type::bv_iterator            bv_iterator;
00048       typedef typename bvh_type::bv_const_iterator      bv_const_iterator;
00049       typedef typename bvh_type::bv_ptr_iterator        bv_ptr_iterator;
00050       typedef typename bvh_type::bv_const_ptr_iterator  bv_const_ptr_iterator;
00051 
00052     public:
00053 
00054       friend class BoundingVolumeHierarchy<volume_type,geometry_type,T>;
00055 
00056     protected:
00057 
00058       bvh_weak_ptr     m_owner;              
00059       bv_weak_ptr      m_parent;             
00060       bv_ptr_container m_children;           
00061       volume_type      m_volume;             
00062       bool             m_has_geometry;       
00063 
00064     public:
00065 
00066       BV()
00067         : m_owner()
00068         , m_parent()
00069         , m_children()
00070         , m_volume()
00071         , m_has_geometry(false)
00072       {}
00073 
00074     public:
00075 
00076       bv_iterator       child_begin()       { return bv_iterator(m_children.begin());       }
00077       bv_iterator       child_end()         { return bv_iterator(m_children.end());         }
00078       bv_const_iterator child_begin() const { return bv_const_iterator(m_children.begin()); }
00079       bv_const_iterator child_end()   const { return bv_const_iterator(m_children.end());   }
00080 
00081       bv_ptr_iterator       child_ptr_begin()       { return m_children.begin(); }
00082       bv_ptr_iterator       child_ptr_end()         { return m_children.end();   }
00083       bv_const_ptr_iterator child_ptr_begin() const { return m_children.begin(); }
00084       bv_const_ptr_iterator child_ptr_end()   const { return m_children.end();   }
00085 
00086     public:
00087 
00088       size_t const size()     const { return m_children.size(); }
00089       size_t const children() const { return this->size(); }
00090       size_t const degree()   const { return this->size(); }
00091 
00092       bvh_const_ptr owner()  const { return m_owner.lock(); }
00093       bv_const_ptr  root()   const { return m_owner.lock()->root(); }
00094       bv_const_ptr  parent() const { return m_parent.lock(); }
00095 
00096       volume_type const & volume() const { return m_volume; }
00097       volume_type       & volume()       { return m_volume; }
00098 
00099       bool is_leaf()      const { return ( m_children.empty() ); }
00100       bool is_root()      const { assert( !m_owner.expired() ); return ( m_parent.expired() ); }
00101       bool has_geometry() const { return m_has_geometry; }
00102 
00103     };
00104 
00105   } // namespace bvh
00106 } // namespace OpenTissue
00107 
00108 //OPENTISSUE_COLLISION_BVH_BVH_BV_NODE_H
00109 #endif

Generated on Thu Dec 1 2011 12:50:43 for HUMIM Tracker by  doxygen 1.7.1