Skip to content

Commit

Permalink
Update metric SO2 to remove code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
pranjal-rai committed Aug 20, 2017
1 parent b0e8369 commit 7306b64
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions include/nanoflann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,7 @@ namespace nanoflann
SO2_Adaptor(const DataSource &_data_source) : data_source(_data_source) { }

inline DistanceType evalMetric(const T* a, const size_t b_idx, size_t size) const {
DistanceType result = DistanceType();
result = data_source.kdtree_get_pt(b_idx, 0) - a[0];
if (result > M_PI)
result -= 2. * M_PI;
else if (result < -M_PI)
result += 2. * M_PI;
return result;
return accum_dist(a[size-1], data_source.kdtree_get_pt(b_idx, size-1) , size-1);
}

template <typename U, typename V>
Expand Down

1 comment on commit 7306b64

@jlblancoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.