-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1673 from Idclip/stencil_minmax
Fixed a compilation issue with min() and max() methods on the stencils
- Loading branch information
Showing
4 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright Contributors to the OpenVDB Project | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <openvdb/openvdb.h> | ||
#include <openvdb/math/Stencils.h> | ||
|
||
#include <gtest/gtest.h> | ||
|
||
|
||
class TestStencils : public ::testing::Test | ||
{ | ||
}; | ||
|
||
TEST_F(TestStencils, testMinMax) | ||
{ | ||
using namespace openvdb; | ||
|
||
Int32Grid grid; | ||
grid.tree().setValue(math::Coord(0,0,0), -3); | ||
grid.tree().setValue(math::Coord(0,0,1), -2); | ||
grid.tree().setValue(math::Coord(0,1,0), -1); | ||
grid.tree().setValue(math::Coord(1,0,0), 0); | ||
grid.tree().setValue(math::Coord(1,1,0), 1); | ||
grid.tree().setValue(math::Coord(0,1,1), 2); | ||
grid.tree().setValue(math::Coord(1,0,1), 3); | ||
grid.tree().setValue(math::Coord(1,1,1), 4); | ||
math::BoxStencil<Int32Grid> stencil(grid); | ||
|
||
stencil.moveTo(Coord(0,0,0)); | ||
EXPECT_EQ(stencil.min(), -3); | ||
EXPECT_EQ(stencil.max(), 4); | ||
|
||
stencil.moveTo(Coord(1,1,1)); | ||
EXPECT_EQ(stencil.min(), 0); | ||
EXPECT_EQ(stencil.max(), 4); | ||
|
||
stencil.moveTo(Coord(0,0,1)); | ||
EXPECT_EQ(stencil.min(), -2); | ||
EXPECT_EQ(stencil.max(), 4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
OpenVDB: | ||
- Bug Fixes: | ||
Fixed a compilation issue with the min() and max() methods on Stencils | ||
in openvdb/math/Stencils.h | ||
[Reported by Samuel Mauch] |