Matrix4x4Typed::Decompose() is not properly typed
Categories
(Core :: Graphics, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox92 | --- | fixed |
People
(Reporter: botond, Assigned: botond)
Details
Attachments
(2 files)
The signature of Matrix4x4Typed::Decompose() is as follows:
template <class SourceUnits, class TargetUnits, class T>
class Matrix4x4Typed {
...
bool Decompose(Point3DTyped<UnknownUnits, T>& translation,
BaseQuaternion<T>& rotation,
Point3DTyped<UnknownUnits, T>& scale) const {
};
Note the use of UnknownUnits in the signature.
Moreover, even if you pass in inputs of the specified (unknown) types, a call to this function does not compile if the matrix itself is not unknown-typed, because of this call:
rotation.SetFromRotationMatrix(*this);
Here, BaseQuaternion::SetFromRotationMatrix() is not templated on any unit types and expects an unknown matrix as input.
So, the only way to call this function is to convert to an unknown matrix first:
matrix.ToUnknownMatrix().Decompose(...)
which is probably not what's intended.
| Assignee | ||
Comment 1•5 years ago
|
||
It's not immediately obvious how to convert the signature into a fully typed one:
- The translation applies after the other transforms, so that could be changed to
Point3DTyped<TargetUnits> BaseQuaternionis not parameterized on types (which is fine, it can be left alone)- For the scale, it's not clear how it could be typed. We usually use
ScaleFactors2D<Source, Target>for typed scales, but we don't have a "3D" scale representation.
So, I think for now I'll just leave the signature alone, and tweak the implementation so that it compiles for non-Unknown matrix objects as well.
| Assignee | ||
Comment 2•5 years ago
|
||
Prior to this patch, ToUnknownMatrix() on a Matrix4x4Typed<A, B, double>
would return a Matrix4x4Typed<Unknown, Unknown, float>.
After this patch, it returns a Matrix4x4Typed<Unknown, Unknown, double>.
| Assignee | ||
Comment 3•5 years ago
|
||
Depends on D119696
Comment 5•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/f95bf7ce00ee
https://hg.mozilla.org/mozilla-central/rev/9079b87aeba1
Description
•