Skip to content

Commit de2fa40

Browse files
committed
Using equality condition when pruning float min and max value.
Signed-off-by: Andre Pradhana <[email protected]>
1 parent 15ffc61 commit de2fa40

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

openvdb/openvdb/tools/FastSweeping.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ struct FastSweeping<SdfGridT, ExtValueT>::MinMaxKernel
930930
for (auto leafIter = r.begin(); leafIter; ++leafIter) {
931931
for (auto voxelIter = leafIter->beginValueOn(); voxelIter; ++voxelIter) {
932932
const SdfValueT v = *voxelIter;
933-
const bool vEqFltMin = v == - std::numeric_limits<SdfValueT>::max();
933+
const bool vEqFltMin = v == -std::numeric_limits<SdfValueT>::max();
934934
const bool vEqFltMax = v == std::numeric_limits<SdfValueT>::max();
935935
if (v < mMin && !vEqFltMin) mMin = v;
936936
if (v > mMax && !vEqFltMax) mMax = v;
@@ -952,18 +952,18 @@ struct FastSweeping<SdfGridT, ExtValueT>::MinMaxKernel
952952
bool mFltMinExists, mFltMaxExists;
953953
};// FastSweeping::MinMaxKernel
954954

955-
/// Private class of FastSweeping to prune sdf value that is near float max or
955+
/// Private class of FastSweeping to prune sdf value that is equal to float max or
956956
/// float min.
957957
template <typename SdfGridT, typename ExtValueT>
958958
struct FastSweeping<SdfGridT, ExtValueT>::PruneMinMaxFltKernel {
959959

960960
PruneMinMaxFltKernel(SdfValueT min, SdfValueT max) : mMin(min), mMax(max) {}
961961

962962
inline void operator()(const typename SdfGridT::ValueAllIter &iter) const {
963-
if (std::abs(*iter + std::numeric_limits<SdfValueT>::max()) < 1.0e-4f) {
963+
if (*iter == -std::numeric_limits<SdfValueT>::max()) {
964964
iter.setValue(mMin);
965965
}
966-
if (std::abs(*iter - std::numeric_limits<SdfValueT>::max()) < 1.0e-4f) {
966+
if (*iter == std::numeric_limits<SdfValueT>::max()) {
967967
iter.setValue(mMax);
968968
}
969969
}

0 commit comments

Comments
 (0)