in reply to Re^2: Efficient selection mechanism? (Thank you all)
in thread Efficient selection mechanism?
Sometimes, you just need to see your problem through someone else's eyes.
I'd been faffing around with multi-level hashes so that given the first quad's numbers I could use them to index down four levels to just that subset that didn't contain those four numbers. Which ought to work, but proved to be clumsy and produced a huge, unwieldy data structure.
But the real problem is that once I've found the second non-overlapping quad I then want to find a third that doesn't overlap either of the first two; then a fourth that doesn't overlap any of the first three. And that requires two more, deeper, multi-level data structures be built.
With the vec solution I just OR the masks and grep the previous subset again to produce the next.
Simple once you've seen it, but I was so locked in on my multi-level hash approach that using bitmasks didn't cross my mind.
|
|---|