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

Fix problems with ImathInterval, and add test #52

Merged
merged 1 commit into from
Sep 5, 2020

Conversation

cary-ilm
Copy link
Member

@cary-ilm cary-ilm commented Sep 3, 2020

The test for Imath::Interval was missing and it's not included
anywhere else in the library, so builds were not compiling it and thus
not catching syntax errors. These changes also bring it more in line
with the Box class.

  • misspelling of "constexpr"
  • replace constexpr with IMATH_CONSTEXPR14
  • add makeInfinite()/isInfinite() for similarity with Box
  • add operator<<
  • add ImathTest/testInterval.cpp, based on testBox.cpp

Signed-off-by: Cary Phillips [email protected]

The test for Imath::Interval was missing and it's not included
anywhere else in the library, so builds were not compiling it and thus
not catching syntax errors. These changes also bring it more in line
with the Box<T> class.

* misspelling of "constexpr"
* replace constexpr with IMATH_CONSTEXPR14
* add makeInfinite()/isInfinite() for similarity with Box<T>
* add operator<<
* add ImathTest/testInterval.cpp, based on testBox.cpp

Signed-off-by: Cary Phillips <[email protected]>
@cary-ilm
Copy link
Member Author

cary-ilm commented Sep 3, 2020

One other change here: Imath::Interval::size() now returns 0 if the interval is empty (consistent with Box). The existing code returns max-min, which for an empty Interval (via makeEmpty()) would overflow, since max=-limits::min() and min=limits::max().

This breaks compatibility, but the existing behavior sure seems like a bug.

@lgritz
Copy link
Contributor

lgritz commented Sep 3, 2020

I agree, I think you're justified in saying that this is a bug fix, not a change in any useful or expected behavior.

@cary-ilm cary-ilm merged commit 9c864c5 into AcademySoftwareFoundation:master Sep 5, 2020
@cary-ilm cary-ilm deleted the interval-fix branch May 7, 2021 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants