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

Matrix4: Add note about non-uniform scale to decompose(). #20752

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Nov 24, 2020

Related issue: Fixed #20435.

Description

The PR adds a note about non-uniform scale to .decompose().

@mrdoob mrdoob added this to the r123 milestone Nov 24, 2020
@mrdoob mrdoob merged commit d9156ac into mrdoob:dev Nov 24, 2020
@mrdoob
Copy link
Owner

mrdoob commented Nov 24, 2020

Thanks!

Decomposes this matrix into it's [page:Vector3 position], [page:Quaternion quaternion] and
[page:Vector3 scale] components.
Decomposes this matrix into it's [page:Vector3 position], [page:Quaternion quaternion] and [page:Vector3 scale] components.
The method can't be used to decompose an object's world matrix if its parent has a non-uniform scale.
Copy link
Collaborator

Choose a reason for hiding this comment

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

That statement is incorrect. You can't make such general statements based on a specific example.

It is better to say nothing.

Copy link
Owner

Choose a reason for hiding this comment

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

What would be a better description? Or do you think that it's better to not say anything and let users figure it out on their own?

Copy link
Collaborator Author

@Mugen87 Mugen87 Nov 25, 2020

Choose a reason for hiding this comment

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

You can't make such general statements

TBH, I do not have the impression that it's a general statement. It's a specific note intended for Object3D.matrixWorld.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Mugen87 As I said, the statement is not true.

A simple counterexample is a non-uniformly scaled parent matrix with a child having the Identity as its matrix. The child's world matrix is decomposable in that case. There are infinitely many other examples.

@mrdoob I would say nothing. If you insist on saying something, you could say "Note: not all matrices can be decomposed in this manner."

Copy link
Owner

Choose a reason for hiding this comment

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

A bit of a delay but we finally got to discuss the statement "off-line".

@WestLangley suggested this one which I find educative:

Note: Not all matrices are decomposable in this way. For example, if an object has a non-uniformly scaled parent, then the object's world matrix may not be decomposable, and this method may not be appropriate.

I'll update the file directly.

Copy link
Owner

Choose a reason for hiding this comment

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

mrdoob added a commit that referenced this pull request Jan 22, 2021
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.

Matrix4.decompose docs and #15079
3 participants