new walker (control+path)
added new sanity checks fixed minor errors added corresponding test-cases added moving-median
This commit is contained in:
13
grid/Grid.h
13
grid/Grid.h
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user