new walker (control+path)

added new sanity checks
fixed minor errors
added corresponding test-cases
added moving-median
This commit is contained in:
2016-02-05 20:18:48 +01:00
parent 56203e59ed
commit 382a046df1
10 changed files with 296 additions and 20 deletions

View File

@@ -78,12 +78,13 @@ public:
/** add the given (not necessarly aligned) element to the grid */
int addUnaligned(const T& elem) {
const int idx = nodes.size(); // next free index
const UID uid = getUID(elem); // get the UID for this new element
nodes.push_back(elem); // add it to the grid
nodes.back()._idx = idx;
hashes[uid] = idx; // add an UID->index lookup
return idx; // done
const UID uid = getUID(elem); // get the UID for this new element
Assert::isTrue(hashes.find(uid) == hashes.end(), "node's UID is already taken!"); // avoid potential errors
const int idx = nodes.size(); // next free index
nodes.push_back(elem); // add it to the grid
nodes.back()._idx = idx; // let the node know his own index
hashes[uid] = idx; // add an UID->index lookup
return idx; // done
}
/** connect (uni-dir) i1 -> i2 */