sofa
sofa copied to clipboard
[DefaultType] fix rigidcoord compilation
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).
I dont think the fix is good ; the "toMatrix()" is available for Mat3x3 but not for Mat4x4 (there was a toMatrix
for Mat4x4 but it was deleted and replace with toHomogenousMatrix()
).
This RigidCoord::toMatrix() is templated on the Mat type actually, and is really ill-formed (no assert on the size of the given matrix, etc).
I think the solution is to either:
- test if the matrix is 3x3 or 4x4 (and failed to compile with a message with a static assert) and calling the respective
toMatrix()
ortoHomogenousMatrix ()
- or remove the template, force it to Mat3x3 and create an other
toHomogenousMatrix
in RigidCoord. Consisntent with Quat but duplicating code and breaking.
I am more for the first solution.
Thanks for your contribution. I wonder how it was not detected before
I guess this was not detected before because nobody was calling RigidCoord::toMatrix with a Mat4x4 with the code compiled on the CI. Actually, nobody calls RigidCoord::toMatrix, either with mat3 or mat4 apparently.
The changes I suggested are here: https://github.com/mimesis-inria/sofa/pull/18