Skip to content

Commit 5a1a784

Browse files
committed
[SpatialPartitioning] Rename KdTreeImplBase to KdTreeBase
1 parent 24a9de6 commit 5a1a784

File tree

14 files changed

+47
-47
lines changed

14 files changed

+47
-47
lines changed

Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestQueries.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class KdTreeKNearestQueryBase : public KdTreeQuery<Traits>, public QueryType
2525
using QueryAccelType = KdTreeQuery<Traits>;
2626
using Iterator = IteratorType<typename Traits::IndexType, typename Traits::DataPoint>;
2727

28-
inline KdTreeKNearestQueryBase(const KdTreeImplBase<Traits>* kdtree, IndexType k, typename QueryType::InputType input) :
28+
inline KdTreeKNearestQueryBase(const KdTreeBase<Traits>* kdtree, IndexType k, typename QueryType::InputType input) :
2929
KdTreeQuery<Traits>(kdtree), QueryType(k, input) { }
3030

3131
public:

Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeNearestQueries.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class KdTreeNearestQueryBase : public KdTreeQuery<Traits>, public QueryType
2525
using QueryAccelType = KdTreeQuery<Traits>;
2626
using Iterator = IteratorType<typename Traits::IndexType>;
2727

28-
KdTreeNearestQueryBase(const KdTreeImplBase<Traits>* kdtree, typename QueryType::InputType input) :
28+
KdTreeNearestQueryBase(const KdTreeBase<Traits>* kdtree, typename QueryType::InputType input) :
2929
KdTreeQuery<Traits>(kdtree), QueryType(input){}
3030

3131
public:

Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeQuery.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "../../../Common/Containers/stack.h"
1111

1212
namespace Ponca {
13-
template <typename Traits> class KdTreeImplBase;
13+
template <typename Traits> class KdTreeBase;
1414

1515
template <typename Traits>
1616
class KdTreeQuery
@@ -21,7 +21,7 @@ class KdTreeQuery
2121
using Scalar = typename DataPoint::Scalar;
2222
using VectorType = typename DataPoint::VectorType;
2323

24-
explicit inline KdTreeQuery(const KdTreeImplBase<Traits>* kdtree) : m_kdtree( kdtree ), m_stack() {}
24+
explicit inline KdTreeQuery(const KdTreeBase<Traits>* kdtree) : m_kdtree( kdtree ), m_stack() {}
2525

2626
protected:
2727
/// \brief Init stack for a new search
@@ -30,7 +30,7 @@ class KdTreeQuery
3030
m_stack.push({0,0});
3131
}
3232

33-
const KdTreeImplBase<Traits>* m_kdtree { nullptr };
33+
const KdTreeBase<Traits>* m_kdtree { nullptr };
3434
Stack<IndexSquaredDistance<IndexType, Scalar>, 2 * Traits::MAX_DEPTH> m_stack;
3535

3636
template<typename LeafPreparationFunctor,

Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeRangeQueries.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class KdTreeRangeQueryBase : public KdTreeQuery<Traits>, public QueryType
3030
friend Iterator;
3131

3232
public:
33-
KdTreeRangeQueryBase(const KdTreeImplBase<Traits>* kdtree, Scalar radius, typename QueryType::InputType input) :
33+
KdTreeRangeQueryBase(const KdTreeBase<Traits>* kdtree, Scalar radius, typename QueryType::InputType input) :
3434
KdTreeQuery<Traits>(kdtree), QueryType(radius, input){}
3535

3636
public:

Ponca/src/SpatialPartitioning/KdTree/kdTree.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
#include "Query/kdTreeRangeQueries.h"
2626

2727
namespace Ponca {
28-
template <typename Traits> class KdTreeImplBase;
28+
template <typename Traits> class KdTreeBase;
2929
template <typename Traits> class KdTreeDenseBase;
3030
template <typename Traits> class KdTreeSparseBase;
3131

3232
/*!
3333
* \brief Base type for default KdTree implementations
3434
*
3535
* \see KdTreeDefaultTraits for the default trait interface documentation.
36-
* \see KdTreeImplBase for complete API
36+
* \see KdTreeBase for complete API
3737
*/
3838
template <typename DataPoint>
39-
using KdTreeImpl = KdTreeImplBase<KdTreeDefaultTraits<DataPoint>>;
39+
using KdTree = KdTreeBase<KdTreeDefaultTraits<DataPoint>>;
4040

4141
/*!
4242
* \brief Public interface for dense KdTree datastructure.
@@ -74,7 +74,7 @@ using KdTreeSparse = KdTreeSparseBase<KdTreeDefaultTraits<DataPoint>>;
7474
* \todo Better handle sampling: do not store non-selected points (requires to store original indices)
7575
*/
7676
template <typename Traits>
77-
class KdTreeImplBase
77+
class KdTreeBase
7878
{
7979
public:
8080
using DataPoint = typename Traits::DataPoint; ///< DataPoint given by user via Traits
@@ -277,7 +277,7 @@ public :
277277

278278
// Internal ----------------------------------------------------------------
279279
protected:
280-
inline KdTreeImplBase() = default;
280+
inline KdTreeBase() = default;
281281

282282
/// Generate a tree sampled from a custom contained type converted using a `Converter`
283283
/// \tparam PointUserContainer Input point, transformed to PointContainer
@@ -291,7 +291,7 @@ public :
291291
IndexUserContainer sampling,
292292
Converter c);
293293

294-
/// Generate a tree sampled from a custom contained type converted using a \ref KdTreeImplBase::DefaultConverter
294+
/// Generate a tree sampled from a custom contained type converted using a \ref KdTreeBase::DefaultConverter
295295
/// \tparam PointUserContainer Input points, transformed to PointContainer
296296
/// \tparam IndexUserContainer Input sampling, transformed to IndexContainer
297297
/// \param points Input points
@@ -323,17 +323,17 @@ public :
323323
* \see KdTreeDefaultTraits for the trait interface documentation.
324324
*/
325325
template <typename Traits>
326-
class KdTreeDenseBase : public KdTreeImplBase<Traits>
326+
class KdTreeDenseBase : public KdTreeBase<Traits>
327327
{
328328
private:
329-
using Base = KdTreeImplBase<Traits>;
329+
using Base = KdTreeBase<Traits>;
330330

331331
public:
332332
/// Default constructor creating an empty tree
333333
/// \see build
334334
KdTreeDenseBase() = default;
335335

336-
/// Constructor generating a tree from a custom contained type converted using a \ref KdTreeImplBase::DefaultConverter
336+
/// Constructor generating a tree from a custom contained type converted using a \ref KdTreeBase::DefaultConverter
337337
template<typename PointUserContainer>
338338
inline explicit KdTreeDenseBase(PointUserContainer&& points)
339339
: Base()
@@ -357,10 +357,10 @@ class KdTreeDenseBase : public KdTreeImplBase<Traits>
357357
* \see KdTreeDefaultTraits for the trait interface documentation.
358358
*/
359359
template <typename Traits>
360-
class KdTreeSparseBase : public KdTreeImplBase<Traits>
360+
class KdTreeSparseBase : public KdTreeBase<Traits>
361361
{
362362
private:
363-
using Base = KdTreeImplBase<Traits>;
363+
using Base = KdTreeBase<Traits>;
364364

365365
public:
366366
static constexpr bool SUPPORTS_SUBSAMPLING = false;
@@ -369,15 +369,15 @@ class KdTreeSparseBase : public KdTreeImplBase<Traits>
369369
/// \see build
370370
KdTreeSparseBase() = default;
371371

372-
/// Constructor generating a tree from a custom contained type converted using a \ref KdTreeImplBase::DefaultConverter
372+
/// Constructor generating a tree from a custom contained type converted using a \ref KdTreeBase::DefaultConverter
373373
template<typename PointUserContainer>
374374
inline explicit KdTreeSparseBase(PointUserContainer&& points)
375375
: Base()
376376
{
377377
this->build(std::forward<PointUserContainer>(points));
378378
}
379379

380-
/// Constructor generating a tree sampled from a custom contained type converted using a \ref KdTreeImplBase::DefaultConverter
380+
/// Constructor generating a tree sampled from a custom contained type converted using a \ref KdTreeBase::DefaultConverter
381381
/// \tparam PointUserContainer Input points, transformed to PointContainer
382382
/// \tparam IndexUserContainer Input sampling, transformed to IndexContainer
383383
/// \param point Input points
@@ -396,7 +396,7 @@ class KdTreeSparseBase : public KdTreeImplBase<Traits>
396396
} // namespace Ponca
397397

398398
template <typename Traits>
399-
std::ostream& operator<<(std::ostream& os, const Ponca::KdTreeImplBase<Traits>& kdtree)
399+
std::ostream& operator<<(std::ostream& os, const Ponca::KdTreeBase<Traits>& kdtree)
400400
{
401401
kdtree.print(os);
402402
return os;

Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
template<typename Traits>
1010
template<typename PointUserContainer, typename Converter>
11-
inline void KdTreeImplBase<Traits>::build(PointUserContainer&& points, Converter c)
11+
inline void KdTreeBase<Traits>::build(PointUserContainer&& points, Converter c)
1212
{
1313
IndexContainer ids(points.size());
1414
std::iota(ids.begin(), ids.end(), 0);
1515
this->buildWithSampling(std::forward<PointUserContainer>(points), std::move(ids), std::move(c));
1616
}
1717

1818
template<typename Traits>
19-
void KdTreeImplBase<Traits>::clear()
19+
void KdTreeBase<Traits>::clear()
2020
{
2121
m_points.clear();
2222
m_nodes.clear();
@@ -25,7 +25,7 @@ void KdTreeImplBase<Traits>::clear()
2525
}
2626

2727
template<typename Traits>
28-
bool KdTreeImplBase<Traits>::valid() const
28+
bool KdTreeBase<Traits>::valid() const
2929
{
3030
if (m_points.empty())
3131
return m_nodes.empty() && m_indices.empty();
@@ -72,7 +72,7 @@ bool KdTreeImplBase<Traits>::valid() const
7272
}
7373

7474
template<typename Traits>
75-
void KdTreeImplBase<Traits>::print(std::ostream& os, bool verbose) const
75+
void KdTreeBase<Traits>::print(std::ostream& os, bool verbose) const
7676
{
7777
os << "KdTree:";
7878
os << "\n MaxNodes: " << MAX_NODE_COUNT;
@@ -118,9 +118,9 @@ void KdTreeImplBase<Traits>::print(std::ostream& os, bool verbose) const
118118

119119
template<typename Traits>
120120
template<typename PointUserContainer, typename IndexUserContainer, typename Converter>
121-
inline void KdTreeImplBase<Traits>::buildWithSampling(PointUserContainer&& points,
122-
IndexUserContainer sampling,
123-
Converter c)
121+
inline void KdTreeBase<Traits>::buildWithSampling(PointUserContainer&& points,
122+
IndexUserContainer sampling,
123+
Converter c)
124124
{
125125
PONCA_DEBUG_ASSERT(points.size() <= MAX_POINT_COUNT);
126126
this->clear();
@@ -140,7 +140,7 @@ inline void KdTreeImplBase<Traits>::buildWithSampling(PointUserContainer&& point
140140
}
141141

142142
template<typename Traits>
143-
void KdTreeImplBase<Traits>::build_rec(NodeIndexType node_id, IndexType start, IndexType end, int level)
143+
void KdTreeBase<Traits>::build_rec(NodeIndexType node_id, IndexType start, IndexType end, int level)
144144
{
145145
NodeType& node = m_nodes[node_id];
146146
AabbType aabb;
@@ -174,7 +174,7 @@ void KdTreeImplBase<Traits>::build_rec(NodeIndexType node_id, IndexType start, I
174174
}
175175

176176
template<typename Traits>
177-
auto KdTreeImplBase<Traits>::partition(IndexType start, IndexType end, int dim, Scalar value)
177+
auto KdTreeBase<Traits>::partition(IndexType start, IndexType end, int dim, Scalar value)
178178
-> IndexType
179179
{
180180
const auto& points = m_points;

Ponca/src/SpatialPartitioning/KnnGraph/knnGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ template <typename Traits> class KnnGraphBase
6868
/// \warning Stores a const reference to kdtree.point_data()
6969
/// \warning KdTreeTraits compatibility is checked with static assertion
7070
template<typename KdTreeTraits>
71-
inline KnnGraphBase(const KdTreeImplBase<KdTreeTraits>& kdtree, int k = 6)
71+
inline KnnGraphBase(const KdTreeBase<KdTreeTraits>& kdtree, int k = 6)
7272
: m_k(std::min(k,kdtree.sample_count()-1)),
7373
m_kdTreePoints(kdtree.points())
7474
{

doc/src/ponca_module_spatialpartitioning.mdoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ fit.computeWithIds( myDataStructure.range_neighbors(fitInitPos, scale), vectorPo
9292

9393
We call indices into the underlying point storage *point indices* and indices into the sample storage *sample
9494
indices*. Note that the sample storage stores point indices: sample number 0 may, for example, refer to point number 25.
95-
The point storage can be accessed with KdTreeImplBase::points, while the array of samples can be accessed with
96-
KdTreeImplBase::samples.
95+
The point storage can be accessed with KdTreeBase::points, while the array of samples can be accessed with
96+
KdTreeBase::samples.
9797

9898
While most of the KdTree API is built on using point indices, it can still be useful to iterate over samples instead
9999
(e.g. when using a Ponca::KdTreeSparse). If you ever need to convert sample indices to point indices, see
100-
KdTreeImplBase::pointFromSample (see also KdTreeImplBase::pointDataFromSample).
100+
KdTreeBase::pointFromSample (see also KdTreeBase::pointDataFromSample).
101101

102102
\subsection spatialpartitioning_kdtree_examples Examples
103103

@@ -120,8 +120,8 @@ fit.computeWithIds( myDataStructure.range_neighbors(fitInitPos, scale), vectorPo
120120
The kd-tree is a binary search tree that
121121
- is balanced (cuts at the median at each node)
122122
- cuts along the dimension that extends the most at each node
123-
- has a maximal depth (KdTreeImplBase::MAX_DEPTH)
124-
- has a minimal number of points per leaf (KdTreeImplBase::m_min_cell_size)
123+
- has a maximal depth (KdTreeBase::MAX_DEPTH)
124+
- has a minimal number of points per leaf (KdTreeBase::m_min_cell_size)
125125
- only stores points in the leafs
126126
- uses depth-first search with a static stack for queries
127127
- keeps the initial order of points

examples/cpp/nanoflann/ponca_nanoflann.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int test_raw(FitType& f, const std::vector<MyPoint>& _vecs, VectorType _p)
9898
return f.getNumNeighbors();
9999
}
100100

101-
int test_ponca_kdtree(FitType& f, const std::vector<MyPoint>& _vecs, VectorType _p, const KdTreeImpl<MyPoint>& tree, Scalar tmax){
101+
int test_ponca_kdtree(FitType& f, const std::vector<MyPoint>& _vecs, VectorType _p, const KdTree<MyPoint>& tree, Scalar tmax){
102102
f.init(_p);
103103
if(! (
104104
//! [Use Ponca KdTree]

examples/cpp/ponca_basic_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ using Fit3 = BasketDiff< Fit1, FitSpaceDer, OrientedSphereDer, GLSDer, Curvature
7676
using Fit4 = Basket<MyPoint,WeightFunc,SphereFit, GLSParam>;
7777

7878
template<typename Fit>
79-
void test_fit(Fit& _fit, const KdTreeImpl<MyPoint>& tree, const VectorType& _p)
79+
void test_fit(Fit& _fit, const KdTree<MyPoint>& tree, const VectorType& _p)
8080
{
8181
Scalar tmax = 100.0;
8282

0 commit comments

Comments
 (0)