-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return numerically maximal index (unsigned) or -1 (signed) for no match case #79
Conversation
nabo/index_heap.h
Outdated
|
||
|
||
//! invalid index | ||
static constexpr auto InvalidIndex = std::numeric_limits<IT>::max(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you've converted this to a templated constexpr inline function, you could return as value :
std::is_unsigned<IT>::value ? std::numeric_limits<IT>::max() : IT(-1);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, except for the failing unit tests.
Did you find already how to fix those?
@@ -213,7 +213,17 @@ namespace Nabo | |||
#define NABO_VERSION "1.0.6" | |||
//! version of the Nabo library as an int | |||
#define NABO_VERSION_INT 10006 | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make another commit, could you add a comment here, like:
// TODO (c++14) Convert invalidIndex, invalidValue to constexpr templated variables
Aha, I believe you've found a bug in the unit tests: But now there should probably be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, that should do.
Thanks!
@simonlynen , @stephanemagnenat , any concerns? E.g. style-wise?
const float distDiff(fabsf((pbf-pq).squaredNorm() - (pkdtree-pq).squaredNorm())); | ||
if (distDiff > numeric_limits<float>::epsilon()) | ||
const T distDiff(fabsf((pbf-pq).squaredNorm() - (pkdtree-pq).squaredNorm())); | ||
if (distDiff > numeric_limits<T>::epsilon()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
I first have to find out why the tests do not pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was a bit optimistic here. Strange. I can also take over from here, if you've run out of time..
Would be nice if you take a quick look at the test. What i have found out so far is that indexes_kdtree is filled with -1 and dists2_kdtree is filled with 0 if |
Okay, I'll do that. Not now but later, probably weekend. Thanks! |
@HannesSommer Should be fixed now ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! (And I though, I had checked all of these - apparently not really...)
Address issue #2.