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

Altered matrix inversion code to behave correctly with single precision zero scaling #7037

Merged
merged 3 commits into from
Sep 17, 2018

Conversation

mksquires
Copy link

A fix for issue #6954 . Appropriate tests have been added.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@cesium-concierge
Copy link

Thanks for the pull request @mksquires!

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

Sorry, something went wrong.

@@ -2308,7 +2283,31 @@ define([
// calculate determinant
var det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;

if (Math.abs(det) < CesiumMath.EPSILON20) {
if (Math.abs(det) < 1e-21) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use CesiumMath.EPSILON20. Or if it needs to be 21 add CesiumMath.EPSILON21

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(to Math.js)

@hpinkos
Copy link
Contributor

hpinkos commented Sep 12, 2018

I'll let @bagnell review and merge, but this change looks fine to me

@bagnell
Copy link
Contributor

bagnell commented Sep 17, 2018

I made some minor tweaks in 93cb38e. Thanks @mksquires!

@bagnell bagnell merged commit 229fdf6 into CesiumGS:master Sep 17, 2018
@mksquires
Copy link
Author

Hello @GatorScot! Sorry I didn't respond earlier, I just noticed your question. Thanks @emackey for responding. I'll add a few thoughts; to really check for a singular matrix the optimal route would probably involve checking the matrix's condition number or its rank (but maybe this is too slow?). The second thing is that we should consider why we elect to stop rendering when we have an ill-conditioned matrix in the first place. There may be a way to more gracefully handle this issue without crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants