g-truc / glm

OpenGL Mathematics (GLM)
https://glm.g-truc.net
Other
9.1k stars 2.12k forks source link

epsilonEqual and epsilonNotEqual #1220

Closed gottfriedleibniz closed 7 months ago

gottfriedleibniz commented 7 months ago

The implementations to epsilonEqual and epsilonNotEqual are fully specialized and no generic implementation exists. Can this be simplified or made more generic (e.g., supporting long double and other types)?

Secondly, should the definition to epsilonEqual be: |x - y| <= epsilon, not ... < epsilon (and opposite for epsilonNotEqual)? Otherwise glm::epsilonEqual(1.f, 1.f, 0.f) returns false even though the values are identical.

christophe-lunarg commented 7 months ago

Correct me if I am missing something but the vector and scalar relational extension implements that in the generic approach you are requesting : https://github.com/g-truc/glm/blob/master/glm/ext/scalar_relational.inl https://github.com/g-truc/glm/blob/master/glm/ext/vector_relational.inl

So really the implementation called "epsilonEqual" and "epsilonNotEqual" are kind of deprecated and I'll rather not change these.

Reopen if I missed something!

gottfriedleibniz commented 7 months ago

are kind of deprecated and I'll rather not change these.

Is this documented anywhere?