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
Matrix/Vector methods #118
Conversation
I would always prefer a method over a constructor. That allows to reuse an existing instance. On the other side, also adding a factory constructor calling that method wouldn't be a big deal and would satisfy everyone. The same applies for methods like getNormalMatrix. I would prefer a copyNormalMatrix where I can supply a destination matrix. But providing both methods would be possible if getNormalMatrix calls copyNormalMatrix without much additional code. About the apply* methods: Some of them are already available in Matrix as transform_. I'm not sure if we should have them both as apply_ and transform*. However, I also introduced perspectiveTransform some days ago and noticed later that there was already the right applyProjection method... |
I guess you're right about reusing an exisiting instance. But if I were to create a constructor calling compose, what should it be called? Also, I added copyNormalMatrix as you suggested. Regarding the apply methods, I would prefer doing |
The first moment when I saw compose and decompose I thought about fromTranslationRotationScale and copyTranslationRotationScale but these are quite long names =D |
Yeah, those are pretty lengthy indeed :) Maybe we should leave it as is for now. |
By the way, Matrix4 has a method called setFromTranslationRotation so the name is not that far off. |
Just as you know, moments after you merged I renamed the compose method to setFromTranslationRotationScale and created a Matrix4.compose constructor instead. |
Hi, Can you send me a pull request? |
It seems like the change was included. I think I may have already pushed the change before you merged, but pushed again later to change the commit messages. |
Ok, so I added some more methods from three.js. I only found tests for compose/decompose, so If you think some tests are in order, I would need some help with that. Also, I feel that maybe
Matrix4.compose
should be a constructor instead of a method. What do you think?