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