Decomposes this
into translation
, rotation
and scale
components.
Source
void decompose(Vector3 translation, Quaternion rotation, Vector3 scale) { final v = new Vector3.zero(); var sx = (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length; var sy = (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length; var sz = (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length; if (determinant() < 0) sx = -sx; translation._v3storage[0] = _m4storage[12]; translation._v3storage[1] = _m4storage[13]; translation._v3storage[2] = _m4storage[14]; final invSX = 1.0 / sx; final invSY = 1.0 / sy; final invSZ = 1.0 / sz; final m = new Matrix4.copy(this); m._m4storage[0] *= invSX; m._m4storage[1] *= invSX; m._m4storage[2] *= invSX; m._m4storage[4] *= invSY; m._m4storage[5] *= invSY; m._m4storage[6] *= invSY; m._m4storage[8] *= invSZ; m._m4storage[9] *= invSZ; m._m4storage[10] *= invSZ; rotation.setFromRotation(m.getRotation()); scale._v3storage[0] = sx; scale._v3storage[1] = sy; scale._v3storage[2] = sz; }