We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5938a49 commit 91d5cacCopy full SHA for 91d5cac
openvdb/openvdb/points/IndexFilter.h
@@ -240,7 +240,8 @@ class RandomLeafFilter
240
currentPoints += iter->pointCount();
241
}
242
243
- const float factor = targetPoints > currentPoints ? 1.0f : float(targetPoints) / float(currentPoints);
+ const float denom = currentPoints > 0 ? float(currentPoints) : 1.0f; // Do not divide by zero.
244
+ const float factor = targetPoints > currentPoints ? 1.0f : float(targetPoints) / denom;
245
246
std::mt19937 generator(seed);
247
std::uniform_int_distribution<unsigned int> dist(0, std::numeric_limits<unsigned int>::max() - 1);
0 commit comments