Skip to content

Commit

Permalink
size() -> DIM (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
improbable-til authored Jan 30, 2022
1 parent ace232d commit d1b2d96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
Nothing yet.
### Changed
- Replaced size() in filters with DIM

## [1.1.0] - 2022-01-25
### Added
Expand Down
10 changes: 7 additions & 3 deletions phtree/common/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class FilterAABB {
ScalarInternal node_min_bits = MAX_MASK<ScalarInternal> << bits_to_ignore;
ScalarInternal node_max_bits = ~node_min_bits;

for (size_t i = 0; i < prefix.size(); ++i) {
for (dimension_t i = 0; i < DIM; ++i) {
if ((prefix[i] | node_max_bits) < min_internal_[i] ||
(prefix[i] & node_min_bits) > max_internal_[i]) {
return false;
Expand All @@ -154,13 +154,17 @@ class FilterAABB {
/*
* The sphere filter can be used to query a point tree for a sphere.
*/
template <typename CONVERTER = ConverterIEEE<3>, typename DISTANCE = DistanceEuclidean<3>>
template <
typename CONVERTER = ConverterIEEE<3>,
typename DISTANCE = DistanceEuclidean<CONVERTER::DimInternal>>
class FilterSphere {
using KeyExternal = typename CONVERTER::KeyExternal;
using KeyInternal = typename CONVERTER::KeyInternal;
using ScalarInternal = typename CONVERTER::ScalarInternal;
using ScalarExternal = typename CONVERTER::ScalarExternal;

static constexpr auto DIM = CONVERTER::DimInternal;

public:
FilterSphere(
const KeyExternal& center,
Expand Down Expand Up @@ -194,7 +198,7 @@ class FilterSphere {
ScalarInternal node_max_bits = ~node_min_bits;

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

0 comments on commit d1b2d96

Please sign in to comment.