getScaling function

List<double> getScaling(
  1. List<double> out,
  2. List<double> mat
)

Returns the scaling factor component of a transformation matrix. If a matrix is built with fromRotationTranslationScale with a normalized Quaternion paramter, the returned vector will be the same as the scaling vector originally supplied. @param {vec3} out Vector to receive scaling factor component @param {ReadonlyMat4} mat Matrix to be decomposed (input) @return {vec3} out

Implementation

List<double> getScaling(List<double> out, List<double> mat) {
  final m11 = mat[0];
  final m12 = mat[1];
  final m13 = mat[2];
  final m21 = mat[4];
  final m22 = mat[5];
  final m23 = mat[6];
  final m31 = mat[8];
  final m32 = mat[9];
  final m33 = mat[10];

  out[0] = hypot([m11, m12, m13]);
  out[1] = hypot([m21, m22, m23]);
  out[2] = hypot([m31, m32, m33]);

  return out;
}