Closed Bug 1589204 Opened 5 years ago Closed 5 years ago

Matrix4x4Flagged::operator* implementation is incorrect

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: botond, Assigned: botond)

Details

Attachments

(1 file)

While debugging a test failure for bug 1556556, I discovered a bug in Matrix4x4TypedFlagged::operator*(Matrix4x4Typed).

I was trying to multiply the following two matrices:

1 0 0 0
0 1 0 0
0 0 1 0
12 290 01

and

1.225 0 0 0
0 1.225 0 0
0 0 1 0
0 0 0 1

and getting this as the result:

1.225 0 0 0
0.12225 0 0
0 0 1 0 
14.7 355.25 0 0

The result is incorrect: the _44 element should be 1, not 0.

The problem is on this line:

  matrix._44 = _41 * aMatrix._14 + _42 * aMatrix._24;

The full calculation would be:

  matrix._44 = _41 * aMatrix._14 + _42 * aMatrix._24 + _43 * aMatrix._34 + _44 * aMatrix._44;

Since this is MatrixType::Simple, we know that _43=0 and _44=1, so we can simplify this to:

  matrix._44 = _41 * aMatrix._14 + _42 * aMatrix._24 + aMatrix._44;

However, the calculation as written excludes the last term, aMatrix._44.

Pushed by bballo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/41a1dfdfea9f
Fix a bug in Matrix4x4Flagged::operator*. r=mstange
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: