-
Notifications
You must be signed in to change notification settings - Fork 724
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
combined TRS decompose for mat4 #401
Comments
I think the combined getter methods were excluded, because they weren't absolutely necessary. Still, I do think that combined getter methods are quite useful and would be quite happy about a PR. Regarding the name, either |
I was concerned about the return value too. Here is the proposed signature /**
* Decomposes a transformation matrix into its rotation, translation and scale components. ...
* @param {quat} out_r Quaternion to receive the rotation component
* @param {vec3} out_t Vector to receive the translation vector
* @param {vec3} out_s Vector to receive the scaling factor
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
* @returns ??? <=
*/
export function decompose(out_r, out_t, out_s, mat) { // ... Technically I don't even need the position to be lumped together for my own use (I am referencing the underlying Alternatively, I propose adding a 3rd optional argument to /**
* Returns a quaternion representing the rotational component ...
* @param {quat} out Quaternion to receive the rotation component
* @param {ReadonlyMat4} mat Matrix to be decomposed (input)
* @param {ReadonlyVec3} scaling Scaling vector (optional)
* @return {quat} out
*/
export function getRotation(out, mat, scaling) {
if (scaling === undefined) {
scaling = new glMatrix.ARRAY_TYPE(3);
getScaling(scaling, mat);
}
// ... |
I like the first option. |
(unrelated to #305)
mat4.fromRotationTranslationScale
exists but not the other way round (i.e.Matrix4.decompose
from Three.js)The
getX
functions from #204 are excellent, but if both rotation and scale are desired there is a wasted call togetScaling
(position is independent)I can do a PR but the only thing I am unsure of is the function signature, since I can't find an example of multiple
out
s on a function (besidesquat.getAxisAngle
which sets thevec3
and returns the angle). I am also not sure if there was a concious decison to exclude it because of this.The text was updated successfully, but these errors were encountered: