Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an error in the matrix.decompose when the determinant is negative #1822

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

cptbtptpbcptdtptp
Copy link
Collaborator

Demo:

import { Matrix, Quaternion, Vector3, WebGLEngine } from "@galacean/engine";

WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  engine.canvas.resizeByClientSize();

  const scale = new Vector3(-1, 1, 1);
  const quaternion = new Quaternion();
  const position = new Vector3();
  const matrix = new Matrix();
  Matrix.affineTransformation(scale, quaternion, position, matrix);
  console.log("matrix before", JSON.stringify(matrix.elements));
  matrix.decompose(position, quaternion, scale);
  Matrix.affineTransformation(scale, quaternion, position, matrix);
  console.log("matrix after", JSON.stringify(matrix.elements));
});

@cptbtptpbcptdtptp cptbtptpbcptdtptp self-assigned this Oct 18, 2023
@cptbtptpbcptdtptp cptbtptpbcptdtptp added the bug Something isn't working label Oct 18, 2023
@cptbtptpbcptdtptp cptbtptpbcptdtptp added this to the Backlog milestone Oct 18, 2023
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e591a10) 65.09% compared to head (f52905b) 65.04%.

❗ Current head f52905b differs from pull request most recent head 03f8bc5. Consider uploading reports for the commit 03f8bc5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1822      +/-   ##
==========================================
- Coverage   65.09%   65.04%   -0.06%     
==========================================
  Files         473      473              
  Lines       23750    23749       -1     
  Branches     3368     3366       -2     
==========================================
- Hits        15461    15448      -13     
- Misses       7094     7105      +11     
- Partials     1195     1196       +1     
Files Coverage Δ
packages/core/src/Entity.ts 84.49% <100.00%> (+0.19%) ⬆️
packages/math/src/Matrix.ts 86.87% <75.00%> (+0.18%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cptbtptpbcptdtptp cptbtptpbcptdtptp changed the title Fix get scale form matrix is wrong when determinant is negative Fix an error in the matrix.decompose when the determinant is negative Oct 18, 2023
@GuoLei1990 GuoLei1990 merged commit 25d010d into galacean:main Oct 18, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants