BBoxDistanceKdTreeStrategy.h
Go to the documentation of this file.
1 #ifndef GfxTL__BBOXDISTANCEKDTREESTRATEGY_HEADER__
2 #define GfxTL__BBOXDISTANCEKDTREESTRATEGY_HEADER__
3 
4 namespace GfxTL
5 {
6  template< class InheritedStrategyT >
8  {
9  typedef typename InheritedStrategyT::value_type value_type;
10 
11  class CellData
12  : public InheritedStrategyT::CellData
13  {
14  public:
15  typedef typename InheritedStrategyT::CellData BaseType;
16  typedef typename BaseType::value_type value_type;
19 
21  {
22  m_bbox[0] = m_bbox[1] = NULL;
23  }
24 
26  {
27  delete[] m_bbox[0];
28  delete[] m_bbox[1];
29  }
30 
32  {
33  return m_bbox;
34  }
35 
36  const ScalarType* const* BBox() const
37  {
38  return m_bbox;
39  }
40 
41  private:
42  ScalarType* m_bbox[2];
43  };
44 
45  template< class BaseT >
47  : public InheritedStrategyT::template StrategyBase< BaseT >
48  {
49 public:
50  typedef typename InheritedStrategyT::template StrategyBase< BaseT >
52  typedef typename BaseType::CellType CellType;
55  typedef typename BaseType::DereferencedType DereferencedType;
56  typedef typename ScalarTypeConversion< ScalarType,
57  ScalarType >::DifferenceType DiffScalarType;
58 
60  {}
61 
63  {}
64 
65 protected:
66  template< class BuildInformationT >
67  void InitRoot(const BuildInformationT& bi, CellType* cell)
68  {
69  BaseType::InitRoot(bi, cell);
70  cell->BBox()[0] = new ScalarType[BaseType::m_dim];
71  cell->BBox()[1] = new ScalarType[BaseType::m_dim];
72  BaseType::AssignVector(bi.BBox()[0], &cell->BBox()[0]);
73  BaseType::AssignVector(bi.BBox()[1], &cell->BBox()[1]);
74  }
75 
76  template< class BuildInformationT >
77  void InitCell(const CellType& parent,
78  const BuildInformationT& parentInfo, unsigned int childIdx,
79  const BuildInformationT& bi, CellType* cell)
80  {
81  BaseType::InitCell(parent, parentInfo, childIdx, bi, cell);
82  cell->BBox()[0] = new ScalarType[BaseType::m_dim];
83  cell->BBox()[1] = new ScalarType[BaseType::m_dim];
84  BaseType::AssignVector(bi.BBox()[0], &cell->BBox()[0]);
85  BaseType::AssignVector(bi.BBox()[1], &cell->BBox()[1]);
86  }
87 
88  template< class TraversalInformationT >
89  void UpdateCellWithBack(const TraversalInformationT& ti,
90  CellType* cell)
91  {
92  BaseType::UpdateCellWithBack(ti, cell);
93  BaseType::IncludeInAABox(BaseType::back(), cell->BBox());
94  }
95 
96  template< class TraversalInformationT >
97  typename BaseType::template DistanceType
98  <
99  ScalarType,
100  typename ScalarTypeDeferer <
102  >::ScalarType
103  >::Type
104  CellSqrDistance(const CellType& cell, const TraversalInformationT& ti) const
105  {
106  return BaseType::BoxSqrDistance(ti.Global().Point(), cell.BBox()[0],
107  cell.BBox()[1]);
108  }
109  };
110  };
111 };
112 
113 #endif
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::BaseType
InheritedStrategyT::template StrategyBase< BaseT > BaseType
Definition: BBoxDistanceKdTreeStrategy.h:51
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::UpdateCellWithBack
void UpdateCellWithBack(const TraversalInformationT &ti, CellType *cell)
Definition: BBoxDistanceKdTreeStrategy.h:89
GfxTL::ScalarTypeDeferer
Definition: ScalarTypeDeferer.h:12
GfxTL::BBoxDistanceKdTreeStrategy::CellData::BaseType
InheritedStrategyT::CellData BaseType
Definition: BBoxDistanceKdTreeStrategy.h:15
visionx::armem::pointcloud::PointType
PointType
Definition: constants.h:78
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::CellType
BaseType::CellType CellType
Definition: BBoxDistanceKdTreeStrategy.h:52
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::StrategyBase
StrategyBase()
Definition: BBoxDistanceKdTreeStrategy.h:59
GfxTL::BBoxDistanceKdTreeStrategy::CellData
Definition: BBoxDistanceKdTreeStrategy.h:11
GfxTL::BBoxDistanceKdTreeStrategy::CellData::value_type
BaseType::value_type value_type
Definition: BBoxDistanceKdTreeStrategy.h:16
GfxTL::BBoxDistanceKdTreeStrategy::CellData::BBox
const ScalarType *const * BBox() const
Definition: BBoxDistanceKdTreeStrategy.h:36
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::~StrategyBase
~StrategyBase()
Definition: BBoxDistanceKdTreeStrategy.h:62
GfxTL::BBoxDistanceKdTreeStrategy
Definition: BBoxDistanceKdTreeStrategy.h:7
GfxTL::BBoxDistanceKdTreeStrategy::CellData::CellData
CellData()
Definition: BBoxDistanceKdTreeStrategy.h:20
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::ScalarType
ScalarTypeDeferer< value_type >::ScalarType ScalarType
Definition: BBoxDistanceKdTreeStrategy.h:54
GfxTL::BBoxDistanceKdTreeStrategy::value_type
InheritedStrategyT::value_type value_type
Definition: BBoxDistanceKdTreeStrategy.h:9
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::InitRoot
void InitRoot(const BuildInformationT &bi, CellType *cell)
Definition: BBoxDistanceKdTreeStrategy.h:67
armarx::aron::similarity::FloatSimilarity::Type
Type
The Type enum.
Definition: FloatSimilarity.h:8
GfxTL
Definition: AABox.h:8
GfxTL::ScalarTypeConversion
Definition: ScalarTypeConversion.h:7
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::InitCell
void InitCell(const CellType &parent, const BuildInformationT &parentInfo, unsigned int childIdx, const BuildInformationT &bi, CellType *cell)
Definition: BBoxDistanceKdTreeStrategy.h:77
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::CellSqrDistance
BaseType::template DistanceType< ScalarType, typename ScalarTypeDeferer< typename TraversalInformationT::GlobalType::PointType >::ScalarType >::Type CellSqrDistance(const CellType &cell, const TraversalInformationT &ti) const
Definition: BBoxDistanceKdTreeStrategy.h:104
GfxTL::BBoxDistanceKdTreeStrategy::CellData::~CellData
~CellData()
Definition: BBoxDistanceKdTreeStrategy.h:25
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::DiffScalarType
ScalarTypeConversion< ScalarType, ScalarType >::DifferenceType DiffScalarType
Definition: BBoxDistanceKdTreeStrategy.h:57
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase
Definition: BBoxDistanceKdTreeStrategy.h:46
GfxTL::BBoxDistanceKdTreeStrategy::CellData::ScalarType
ScalarTypeDeferer< value_type >::ScalarType ScalarType
Definition: BBoxDistanceKdTreeStrategy.h:18
GfxTL::BBoxDistanceKdTreeStrategy::CellData::BBox
ScalarType ** BBox()
Definition: BBoxDistanceKdTreeStrategy.h:31
GfxTL::BBoxDistanceKdTreeStrategy::StrategyBase::DereferencedType
BaseType::DereferencedType DereferencedType
Definition: BBoxDistanceKdTreeStrategy.h:55