Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix: Van der Corput - consider span for resolution check #552

Merged
merged 4 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/VanDerCorput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void VanDerCorput::const_iterator::increment()
{
++mN;
mCurr = (*mSeq)[mN];
if (mCurr.second <= mSeq->mMinResolution)
if (mCurr.second*mSeq->mSpan <= mSeq->mMinResolution)
{
mFinalIter = true;
}
Expand Down
17 changes: 7 additions & 10 deletions tests/common/test_VanDerCorput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,13 @@ TEST(VanDerCorput, FirstNineIteratorValuesWithEndpoints)
EXPECT_DOUBLE_EQ(7. / 8, *itr);
}

TEST(VanDerCorput, ScaleProperlyOverSpan)
{
VanDerCorput vdc{2};
EXPECT_DOUBLE_EQ(2.0 / 2, vdc[0].first);
EXPECT_DOUBLE_EQ(2.0 / 4, vdc[1].first);
EXPECT_DOUBLE_EQ(6.0 / 4, vdc[2].first);
EXPECT_DOUBLE_EQ(2.0 / 8, vdc[3].first);
EXPECT_DOUBLE_EQ(10. / 8, vdc[4].first);
EXPECT_DOUBLE_EQ(6.0 / 8, vdc[5].first);
EXPECT_DOUBLE_EQ(14. / 8, vdc[6].first);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping this test? Isn't this still a valid test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured the replaced test would suffice for both. I brought this back and added a separate test for this bugfix.

TEST(VanDerCorput, ScaleProperlyOverSpanWithResolution)
{
VanDerCorput vdc{2, false, false, 0.5};
EXPECT_EQ(vdc.getLength(), 3);
EXPECT_DOUBLE_EQ(1.0, vdc[0].first);
EXPECT_DOUBLE_EQ(0.5, vdc[1].first);
EXPECT_DOUBLE_EQ(1.5, vdc[2].first);
}

TEST(VanDerCorput, ScaleProperlyOverSpanWithEndpoints)
Expand Down