sofa
sofa copied to clipboard
[Sofa.Type] Constexpr Quaternion
Because... https://www.youtube.com/watch?v=PJwd4JLYJJY (a little bad side-effect is that it is mandatory to inline those if we want to access it from an other TU [dcl.constexpr] §7.1.5/2 and [basic.def.odr] §3.2/4 )
+ cleanups:
- factorize toOpenGlMatrix
- remove hard-coded usage of double/float instead of Real
- surely other things
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if
- it builds with SUCCESS for all platforms on the CI.
- it does not generate new warnings.
- it does not generate new unit test failures.
- it does not generate new scene test failures.
- it does not break API compatibility.
- it is more than 1 week old (or has fast-merge label).
[ci-build][with-all-tests]
I removed the ready flag because I not more time and explanation to estimate if having constexpr everywhere is worth the "little bad side-effect is that it is mandatory to inline those".
Compilation might be a bit longer @damienmarchal what else would you like to know?
up @damienmarchal
NB : move Quat::writeOpenGlMatrix
in another PR
Let's test to define it constexpr
while defining it in the inl file (including it in the header) and see if it works as constexpr
Due to the fact that math functions are generally not constexpr (abs, sin, tan, cos, sqrt) a lot of fonctions in Quat cannot be used at compile time actually :/ So those have been reverted to "non constexpr"
[ci-build][with-all-tests]
Agreement on merge with strong recommendation to add constexpr specific unittest.
[ci-build]
[ci-build][with-all-tests]
[ci-build][with-all-tests]
[ci-build]
[ci-build]
[ci-build][with-all-tests]