1 #ifndef GfxTL__INCREMENTALDISTANCEKDTREESTRATEGY_HEADER__
2 #define GfxTL__INCREMENTALDISTANCEKDTREESTRATEGY_HEADER__
6 template<
class InheritedStrategyT >
9 typedef typename InheritedStrategyT::value_type
value_type;
12 :
public InheritedStrategyT::CellData
15 typedef typename InheritedStrategyT::CellData
BaseType;
33 template<
class BaseT >
35 :
public InheritedStrategyT::template
StrategyBase< BaseT >
47 template<
class BuildInformationT >
50 BaseType::ComputeSplit(bi, cell);
51 cell->AxisInterval()[0] = bi.CellBBox()[0][cell->SplitAxis()];
52 cell->AxisInterval()[1] = bi.CellBBox()[1][cell->SplitAxis()];
55 template<
class BuildInformationT >
58 bool retVal = BaseType::AlternateSplit(bi, cell);
61 cell->AxisInterval()[0] = bi.CellBBox()[0][cell->SplitAxis()];
62 cell->AxisInterval()[1] = bi.CellBBox()[1][cell->SplitAxis()];
67 template<
class BaseTraversalT >
72 typedef typename BaseType::template DistanceType
92 template<
class TraversalInformationT >
94 TraversalInformationT* ti)
const
96 BaseType::InitRootTraversalInformation(root, ti);
97 ti->BoxSqrDist() = BaseType::BoxSqrDistance(ti->Global().Point(),
98 BaseType::RootCellBBox()[0], BaseType::RootCellBBox()[1]);
101 template<
class TraversalInformationT >
103 const TraversalInformationT& pTi,
unsigned int childIdx,
104 TraversalInformationT* ti)
const
106 BaseType::InitTraversalInformation(parent, pTi, childIdx, ti);
109 if (pTi.Global().Point()[parent.SplitAxis()]
110 < parent.AxisInterval()[0])
111 boxDiff = parent.AxisInterval()[0]
112 - pTi.Global().Point()[parent.SplitAxis()];
113 else if (pTi.Global().Point()[parent.SplitAxis()]
114 > parent.AxisInterval()[1])
115 boxDiff = pTi.Global().Point()[parent.SplitAxis()]
116 - parent.AxisInterval()[1];
120 if (pTi.Global().Point()[parent.SplitAxis()]
121 < parent.AxisInterval()[0])
122 cutDiff = parent.AxisInterval()[0]
123 - pTi.Global().Point()[parent.SplitAxis()];
124 else if (pTi.Global().Point()[parent.SplitAxis()]
125 > parent.SplitValue())
126 cutDiff = pTi.Global().Point()[parent.SplitAxis()]
127 - parent.SplitValue();
131 if (pTi.Global().Point()[parent.SplitAxis()]
132 < parent.SplitValue())
133 cutDiff = parent.SplitValue()
134 - pTi.Global().Point()[parent.SplitAxis()];
135 else if (pTi.Global().Point()[parent.SplitAxis()]
136 > parent.AxisInterval()[1])
137 cutDiff = pTi.Global().Point()[parent.SplitAxis()]
138 - parent.AxisInterval()[1];
140 ti->BoxSqrDist() = BaseType::IncrementalBoxSqrDistance(
141 pTi.BoxSqrDist(), boxDiff, cutDiff);
173 template<
class TraversalInformationT >
175 const CellType& cell,
const TraversalInformationT& ti)
const
177 return ti.BoxSqrDist();