Warning fixes for quaternion headers#21319
Merged
alalek merged 2 commits intoopencv:4.xfrom Dec 24, 2021
Merged
Conversation
alalek
reviewed
Dec 22, 2021
| Quat<T> r = Quat<T>::createFromAngleAxis(angle, axis); | ||
| Quat<T> t{0, trans[0], trans[1], trans[2]}; | ||
| return createFromQuat(r, t * r / 2); | ||
| return createFromQuat(r, t * r / T(2.0)); |
Contributor
Author
There was a problem hiding this comment.
Makes sense, fixed to * 0.5
| inline Vec<T, 3> DualQuat<T>::getTranslation(QuatAssumeType assumeUnit) const | ||
| { | ||
| Quat<T> trans = 2.0 * (getDualPart() * getRealPart().inv(assumeUnit)); | ||
| Quat<T> trans = T(2.0) * (getDualPart() * getRealPart().inv(assumeUnit)); |
Contributor
Author
There was a problem hiding this comment.
T type can be float or double, so what's the point of using f postfix?
Member
There was a problem hiding this comment.
f suffix makes number of float type.
AFAIK, there is no issues with both operations float*float or float*double (the second result is double).
Contributor
Author
There was a problem hiding this comment.
It's understood; the problem is that this is not float*float or float*double, this is float*Quat<T> where T can be both.
No wonder using 2.0f breaks compilation on my machine (fails to find corresponding operator).
I propose to leave this code as it is now.
alalek
approved these changes
Dec 24, 2021
Merged
Merged
a-sajjad72
pushed a commit
to a-sajjad72/opencv
that referenced
this pull request
Mar 30, 2023
Warning fixes for quaternion headers * warning fixes for quaternion headers * a/T(x) => a * T(1/x)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport to 4.x from #21018
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.