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

epsilon not declared in color_space.inl #1233

Closed
chrismile opened this issue Jan 26, 2024 · 2 comments · Fixed by #1239
Closed

epsilon not declared in color_space.inl #1233

chrismile opened this issue Jan 26, 2024 · 2 comments · Fixed by #1239

Comments

@chrismile
Copy link

chrismile commented Jan 26, 2024

When including color_space.hpp, I get the following errors:

In file included from ../src/../glm/include/glm/gtx/color_space.hpp:70,
                 from ../src/Main.cpp:5:
../src/../glm/include/glm/gtx/color_space.inl: In function ‘glm::vec<3, T, Q> glm::rgbColor(const glm::vec<3, T, Q>&)’:
../src/../glm/include/glm/gtx/color_space.inl:13:52: error: ‘epsilon’ was not declared in this scope
   13 |                 if(equal(hsv.y, static_cast<T>(0), epsilon<T>()))
      |                                                    ^~~~~~~
../src/../glm/include/glm/gtx/color_space.inl:13:61: error: expected primary-expression before ‘>’ token
   13 |                 if(equal(hsv.y, static_cast<T>(0), epsilon<T>()))
      |                                                             ^
../src/../glm/include/glm/gtx/color_space.inl:13:63: error: expected primary-expression before ‘)’ token
   13 |                 if(equal(hsv.y, static_cast<T>(0), epsilon<T>()))
      |                                                               ^
../src/../glm/include/glm/gtx/color_space.inl: In function ‘glm::vec<3, T, Q> glm::hsvColor(const glm::vec<3, T, Q>&)’:
../src/../glm/include/glm/gtx/color_space.inl:74:51: error: ‘epsilon’ was not declared in this scope
   74 |                 if(!equal(Max, static_cast<T>(0), epsilon<T>()))
      |                                                   ^~~~~~~
../src/../glm/include/glm/gtx/color_space.inl:74:60: error: expected primary-expression before ‘>’ token
   74 |                 if(!equal(Max, static_cast<T>(0), epsilon<T>()))
      |                                                            ^
../src/../glm/include/glm/gtx/color_space.inl:74:62: error: expected primary-expression before ‘)’ token
   74 |                 if(!equal(Max, static_cast<T>(0), epsilon<T>()))
      |                                                              ^
../src/../glm/include/glm/gtx/color_space.inl:79:60: error: expected primary-expression before ‘>’ token
   79 |                         if(equal(rgbColor.r, Max, epsilon<T>()))
      |                                                            ^
../src/../glm/include/glm/gtx/color_space.inl:79:62: error: expected primary-expression before ‘)’ token
   79 |                         if(equal(rgbColor.r, Max, epsilon<T>()))
      |                                                              ^
../src/../glm/include/glm/gtx/color_space.inl:82:65: error: expected primary-expression before ‘>’ token
   82 |                         else if(equal(rgbColor.g, Max, epsilon<T>()))
      |                                                                 ^
../src/../glm/include/glm/gtx/color_space.inl:82:67: error: expected primary-expression before ‘)’ token
   82 |                         else if(equal(rgbColor.g, Max, epsilon<T>()))
      |                                                                   ^

There's probably an include missing to glm/gtc/epsilon.hpp.

EDIT: Even including glm/gtc/epsilon.hpp beforehand seems to be insufficient. Is epsilon in a different namespace?

@chrismile
Copy link
Author

This bug seems to have been introduced by f86092a.

@gottfriedleibniz
Copy link

gottfriedleibniz commented Jan 26, 2024

In most cases ext/scalar_constants.hpp is indirectly included. For instance, gtx/matrix_decompose.hpp -> gtc/quaternion.hpp -> gtc/constants.hpp -> ext/scalar_constants.hpp. Unfortunately that is not true with gtx/color_space.hpp's case and the closest example would be to follow gtx/matrix_interpolation.inl.

Those epsilon changes were to compensate -Weverything enabling -Wfloat-equal. In this case it may have been better to abstract this a little e.g., detail::equal or detail::approx(?). This would be inline with C++-14's introduction of std::equal_to which prevents Wfloat-equal (and the likes) from firing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants