Fix a couple of out-of-bounds bugs.
parent
522fc86225
commit
e82a60e136
|
@ -140,7 +140,7 @@ public:
|
||||||
perm[i] = i;
|
perm[i] = i;
|
||||||
|
|
||||||
/* Build the kd-tree and compute a suitable permutation of the elements */
|
/* 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 */
|
/* Apply the permutation */
|
||||||
permute_inplace(&m_items[0], perm);
|
permute_inplace(&m_items[0], perm);
|
||||||
|
|
|
@ -218,7 +218,7 @@ void blueNoisePointSet(const Scene *scene, const std::vector<Shape *> &shapes,
|
||||||
Cell &cell = cells[cellID];
|
Cell &cell = cells[cellID];
|
||||||
int arrayIndex = cell.firstIndex + trial;
|
int arrayIndex = cell.firstIndex + trial;
|
||||||
|
|
||||||
if (arrayIndex > (int) samples.size() ||
|
if (arrayIndex >= (int) samples.size() ||
|
||||||
samples[arrayIndex].cellID != cellID ||
|
samples[arrayIndex].cellID != cellID ||
|
||||||
cell.sample != -1)
|
cell.sample != -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue