Skip to content

Conversation

@Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 12, 2020

Fixed #17926.

This PR changes the behavior of getInverse() when a matrix is processes with a determinant of zero. Similar to Unity's Matrix4x4.inverse, the method does not log a warning anymore but just return a zero matrix.

@WestLangley
Copy link
Collaborator

/ping @bhouston Opinion requested.

  1. This PR removes the throwOnDegenerate arg.

  2. If the matrix is not invertible, the PR silently returns the zero matrix (instead of the identity matrix).

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

I think we should give this a try. #17926 (comment)
We can always revert if we need to.

@mrdoob mrdoob added this to the r115 milestone Mar 12, 2020
@mrdoob mrdoob merged commit b41e9f3 into mrdoob:dev Mar 12, 2020
@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

Thanks!

@WestLangley
Copy link
Collaborator

There is not going to be any discussion now.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

We can definitely have discussion. And we can revert if we come up with arguments to do so.

But up until now this topic has been based on theory and correctness, but I'm curious to see how/if it affects users in practice.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

The fact that we're aligning with Unity also makes me feel more comfortable about this change.

@WestLangley
Copy link
Collaborator

WestLangley commented Mar 12, 2020

The change is fine if you want. That is not the point. The API has changed -- and there is no warning to the user that the arg they pass is ignored.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

Yeah, I understand. It's just that these methods look much more clean now...

You don't think stating it in the migration page is good enough?

@WestLangley
Copy link
Collaborator

With a signature change, we add a waning inline that the arg is no longer honored. I am not aware of any exceptions to that policy.

We will get feedback if users find the change troubling.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

I don't remember exactly which change was... but I remember changing signatures and people notifying us that they would have benefited from a warning and us adding a warning in the next version.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

But I see your point.

This doesn't look too bad?

getInverse: function ( m, throwOnDegenerate ) {

	if ( throwOnDegenerate !== undefined ) {

		console.error( "THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate." );

	}

@WestLangley
Copy link
Collaborator

I think that would be fine -- and appropriate.

@mrdoob
Copy link
Owner

mrdoob commented Mar 12, 2020

Done! 6c3db4b

@makc
Copy link
Contributor

makc commented Mar 13, 2020

@WestLangley

If the matrix is not invertible, the PR silently returns the zero matrix (instead of the identity matrix).

that does make sense, if you think about it. if you pass 0 and get 1 as inverse, you can invert it again and conclude that the original was 1 (incorrectly).

...but if you get 0 for inverse, and invert it back, you get 0, see 😝

big brain time

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.

Cleaner handling of 0 scale

4 participants