-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from poncateam/fix_47
Fix code duplication in queries
- Loading branch information
Showing
22 changed files
with
357 additions
and
821 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestIndexQuery.h
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestIndexQuery.hpp
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestPointQuery.h
This file was deleted.
Oops, something went wrong.
75 changes: 0 additions & 75 deletions
75
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestPointQuery.hpp
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeKNearestQueries.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "kdTreeQuery.h" | ||
#include "../../query.h" | ||
#include "../Iterator/kdTreeKNearestIterator.h" | ||
|
||
namespace Ponca { | ||
|
||
template <typename Traits, | ||
template <typename, typename> typename IteratorType, | ||
typename QueryType> | ||
class KdTreeKNearestQueryBase : public KdTreeQuery<Traits>, public QueryType | ||
{ | ||
public: | ||
using DataPoint = typename Traits::DataPoint; | ||
using IndexType = typename Traits::IndexType; | ||
using Scalar = typename DataPoint::Scalar; | ||
using VectorType = typename DataPoint::VectorType; | ||
using QueryAccelType = KdTreeQuery<Traits>; | ||
using Iterator = IteratorType<typename Traits::IndexType, typename Traits::DataPoint>; | ||
|
||
inline KdTreeKNearestQueryBase(const KdTreeBase<Traits>* kdtree, IndexType k, typename QueryType::InputType input) : | ||
KdTreeQuery<Traits>(kdtree), QueryType(k, input) { } | ||
|
||
public: | ||
inline Iterator begin(){ | ||
QueryAccelType::reset(); | ||
QueryType::reset(); | ||
this->search(); | ||
return Iterator(QueryType::m_queue.begin()); | ||
} | ||
inline Iterator end(){ | ||
return Iterator(QueryType::m_queue.end()); | ||
} | ||
|
||
protected: | ||
inline void search(){ | ||
KdTreeQuery<Traits>::search_internal(QueryType::getInputPosition(QueryAccelType::m_kdtree->point_data()), | ||
[](IndexType, IndexType){}, | ||
[this](){return QueryType::descentDistanceThreshold();}, | ||
[this](IndexType idx){return QueryType::skipIndexFunctor(idx);}, | ||
[this](IndexType idx, IndexType, Scalar d){QueryType::m_queue.push({idx, d}); return false;} | ||
); | ||
} | ||
}; | ||
|
||
template <typename Traits> | ||
using KdTreeKNearestIndexQuery = KdTreeKNearestQueryBase< Traits, KdTreeKNearestIterator, | ||
KNearestIndexQuery<typename Traits::IndexType, typename Traits::DataPoint::Scalar>>; | ||
template <typename Traits> | ||
using KdTreeKNearestPointQuery = KdTreeKNearestQueryBase< Traits, KdTreeKNearestIterator, | ||
KNearestPointQuery<typename Traits::IndexType, typename Traits::DataPoint>>; | ||
} // namespace ponca |
41 changes: 0 additions & 41 deletions
41
Ponca/src/SpatialPartitioning/KdTree/Query/kdTreeNearestIndexQuery.h
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.