Change the behavior or name of Matrix.getInverse() to align with the rest of the API
See original GitHub issueIs your feature request related to a problem? Please describe.
At any other place in the API I’ve seen so far, the semantics of methods are <source>.getSomething(<target>)
. Except for Matrix.getInverse
where this becomes <target>.getInverse(<source>)
. I find this extremely confusing and it can expose developers to some nasty bugs. It is true that the docs do clarify this, however it goes against some natural assumptions you make as a programmer. You assume that the API is consistent, and you assume that a getter gets a property or derived value of the this
object, and not the parameter.
Describe the solution you’d like
Either change the semantics of the getInverse
function to apply the inverse of this
to the parameter matrix, or change the name to setToInverseOf()
.
For reference, in Babylon this is much more clearly named: https://doc.babylonjs.com/api/classes/babylon.matrix#inverttoref
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top GitHub Comments
I don’t like either way to be honest.
I like this pattern better:
@RemusMar it’s this way for performance.