Skip to content

Commit d1b2d96

Browse files
size() -> DIM (#26)
1 parent ace232d commit d1b2d96

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8-
Nothing yet.
8+
### Changed
9+
- Replaced size() in filters with DIM
910

1011
## [1.1.0] - 2022-01-25
1112
### Added

phtree/common/filter.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class FilterAABB {
134134
ScalarInternal node_min_bits = MAX_MASK<ScalarInternal> << bits_to_ignore;
135135
ScalarInternal node_max_bits = ~node_min_bits;
136136

137-
for (size_t i = 0; i < prefix.size(); ++i) {
137+
for (dimension_t i = 0; i < DIM; ++i) {
138138
if ((prefix[i] | node_max_bits) < min_internal_[i] ||
139139
(prefix[i] & node_min_bits) > max_internal_[i]) {
140140
return false;
@@ -154,13 +154,17 @@ class FilterAABB {
154154
/*
155155
* The sphere filter can be used to query a point tree for a sphere.
156156
*/
157-
template <typename CONVERTER = ConverterIEEE<3>, typename DISTANCE = DistanceEuclidean<3>>
157+
template <
158+
typename CONVERTER = ConverterIEEE<3>,
159+
typename DISTANCE = DistanceEuclidean<CONVERTER::DimInternal>>
158160
class FilterSphere {
159161
using KeyExternal = typename CONVERTER::KeyExternal;
160162
using KeyInternal = typename CONVERTER::KeyInternal;
161163
using ScalarInternal = typename CONVERTER::ScalarInternal;
162164
using ScalarExternal = typename CONVERTER::ScalarExternal;
163165

166+
static constexpr auto DIM = CONVERTER::DimInternal;
167+
164168
public:
165169
FilterSphere(
166170
const KeyExternal& center,
@@ -194,7 +198,7 @@ class FilterSphere {
194198
ScalarInternal node_max_bits = ~node_min_bits;
195199

196200
KeyInternal closest_in_bounds;
197-
for (size_t i = 0; i < prefix.size(); ++i) {
201+
for (dimension_t i = 0; i < DIM; ++i) {
198202
// calculate lower and upper bound for dimension for given node
199203
ScalarInternal lo = prefix[i] & node_min_bits;
200204
ScalarInternal hi = prefix[i] | node_max_bits;

0 commit comments

Comments
 (0)