Fix a couple of out-of-bounds bugs.

metadata
Edgar Velazquez-Armendariz 2013-01-22 21:50:38 -05:00
parent 522fc86225
commit e82a60e136
2 changed files with 2 additions and 2 deletions

View File

@ -140,7 +140,7 @@ public:
perm[i] = i;
/* Build the kd-tree and compute a suitable permutation of the elements */
m_root = build(m_aabb, 0, &perm[0], &temp[0], &perm[0], &perm[m_items.size()]);
m_root = build(m_aabb, 0, &perm[0], &temp[0], &perm[0], &perm[m_items.size()-1]);
/* Apply the permutation */
permute_inplace(&m_items[0], perm);

View File

@ -218,7 +218,7 @@ void blueNoisePointSet(const Scene *scene, const std::vector<Shape *> &shapes,
Cell &cell = cells[cellID];
int arrayIndex = cell.firstIndex + trial;
if (arrayIndex > (int) samples.size() ||
if (arrayIndex >= (int) samples.size() ||
samples[arrayIndex].cellID != cellID ||
cell.sample != -1)
continue;