1 #ifndef GfxTL__INCREMENTALDISTANCEKDTREESTRATEGY_HEADER__
2 #define GfxTL__INCREMENTALDISTANCEKDTREESTRATEGY_HEADER__
6 template <
class InheritedStrategyT>
9 typedef typename InheritedStrategyT::value_type
value_type;
11 class CellData :
public InheritedStrategyT::CellData
14 typedef typename InheritedStrategyT::CellData
BaseType;
34 template <
class BaseT>
45 template <
class BuildInformationT>
49 BaseType::ComputeSplit(bi, cell);
50 cell->AxisInterval()[0] = bi.CellBBox()[0][cell->SplitAxis()];
51 cell->AxisInterval()[1] = bi.CellBBox()[1][cell->SplitAxis()];
54 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<
93 template <
class TraversalInformationT>
97 BaseType::InitRootTraversalInformation(root, ti);
98 ti->BoxSqrDist() = BaseType::BoxSqrDistance(
99 ti->Global().Point(), BaseType::RootCellBBox()[0], BaseType::RootCellBBox()[1]);
102 template <
class TraversalInformationT>
105 const TraversalInformationT& pTi,
106 unsigned int childIdx,
107 TraversalInformationT* ti)
const
109 BaseType::InitTraversalInformation(parent, pTi, childIdx, ti);
112 if (pTi.Global().Point()[parent.SplitAxis()] < parent.AxisInterval()[0])
113 boxDiff = parent.AxisInterval()[0] - pTi.Global().Point()[parent.SplitAxis()];
114 else if (pTi.Global().Point()[parent.SplitAxis()] > parent.AxisInterval()[1])
115 boxDiff = pTi.Global().Point()[parent.SplitAxis()] - parent.AxisInterval()[1];
119 if (pTi.Global().Point()[parent.SplitAxis()] < parent.AxisInterval()[0])
121 parent.AxisInterval()[0] - pTi.Global().Point()[parent.SplitAxis()];
122 else if (pTi.Global().Point()[parent.SplitAxis()] > parent.SplitValue())
123 cutDiff = pTi.Global().Point()[parent.SplitAxis()] - parent.SplitValue();
127 if (pTi.Global().Point()[parent.SplitAxis()] < parent.SplitValue())
128 cutDiff = parent.SplitValue() - pTi.Global().Point()[parent.SplitAxis()];
129 else if (pTi.Global().Point()[parent.SplitAxis()] > parent.AxisInterval()[1])
131 pTi.Global().Point()[parent.SplitAxis()] - parent.AxisInterval()[1];
134 BaseType::IncrementalBoxSqrDistance(pTi.BoxSqrDist(), boxDiff, cutDiff);
166 template <
class TraversalInformationT>
167 typename TraversalInformationT::DistScalarType
170 return ti.BoxSqrDist();