function mExchange (m) {
let m11 = m[0];
let m12 = m[1];
let m13 = m[2];
let m21 = m[3];
let m22 = m[4];
let m23 = m[5];
m[0] = m22;
m[1] = m21;
m[2] = m23;
m[3] = m12;
m[4] = m11;
m[5] = m13;
return m;
}
function mLetExchange (o, m) {
o[ 0] = m[4];
o[ 1] = m[3];
o[ 2] = m[5];
o[ 3] = m[1];
o[ 4] = m[0];
o[ 5] = m[2];
return o;
}
function mNewExchange (m) {
return [m[4], m[3], m[5],
m[1], m[0], m[2]];
}
function mLetIdentity (o) {
o[0] = 1;
o[1] = 0;
o[2] = 0;
o[3] = 0;
o[4] = 1;
o[5] = 0;
return o;
}
function mNewIdentity () {
return [1, 0, 0,
0, 1, 0];
}
function mInverse (m) {
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
let d = m11 * m22 - m12 * m21;
m[0] = m22 / d;
m[1] = -m12 / d;
m[2] = (m12 * m23 - m13 * m22) / d;
m[3] = -m21 / d;
m[4] = m11 / d;
m[5] = (m13 * m21 - m11 * m23) / d;
return m;
}
function mLetInverse (o, m) {
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
let d = m11 * m22 - m12 * m21;
o[0] = m22 / d;
o[1] = -m12 / d;
o[2] = (m12 * m23 - m13 * m22) / d;
o[3] = -m21 / d;
o[4] = m11 / d;
o[5] = (m13 * m21 - m11 * m23) / d;
return o;
}
function mNewInverse (m) {
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
let d = m11 * m22 - m12 * m21;
return [m22 / d, -m12 / d, (m12 * m23 - m13 * m22) / d,
-m21 / d, m11 / d, (m13 * m21 - m11 * m23) / d];
}
function mLetIRotate (o, t) {
let c = cos (t), s = sin (t);
o[0] = c;
o[1] = -s;
o[2] = 0;
o[3] = s;
o[4] = c;
o[5] = 0;
return o;
}
function mNewIRotate (t) {
let c = cos (t), s = sin (t);
return [c, -s, 0,
s, c, 0];
}
function mRotate (m, t) {
let c = cos (t), s = sin (t);
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
m[0] = c * m11 - s * m21;
m[1] = c * m12 - s * m22;
m[2] = c * m13 - s * m23;
m[3] = s * m11 + c * m21;
m[4] = s * m12 + c * m22;
m[5] = s * m13 + c * m23;
return m;
}
function mLetRotate (o, m, t) {
let c = cos (t), s = sin (t);
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
o[0] = c * m11 - s * m21;
o[1] = c * m12 - s * m22;
o[2] = c * m13 - s * m23;
o[3] = s * m11 + c * m21;
o[4] = s * m12 + c * m22;
o[5] = s * m13 + c * m23;
return o;
}
function mNewRotate (m, t) {
let c = cos (t), s = sin (t);
let m11 = m[0], m12 = m[1], m13 = m[2];
let m21 = m[3], m22 = m[4], m23 = m[5];
return [c * m11 - s * m21, c * m12 - s * m22, c * m13 - s * m23,
s * m11 + c * m21, s * m12 + c * m22, s * m13 + c * m23];
}
function mRotationComponent (o) {
o[ 2] = 0;
o[ 5] = 0;
return o;
}
function mLetRotationComponent (o, m) {
o[ 0] = m[ 0];
o[ 1] = m[ 1];
o[ 2] = 0;
o[ 3] = m[ 3];
o[ 4] = m[ 4];
o[ 5] = 0;
return o;
}
function mNewRotationComponent (m) {
return [m[ 0], m[ 1], 0,
m[ 3], m[ 4], 0];
}
function mLetIScaleS (o, s) {
o[0] = s;
o[1] = 0;
o[2] = 0;
o[3] = 0;
o[4] = s;
o[5] = 0;
return o;
}
function mNewIScaleS (s) {
return [s, 0, 0,
0, s, 0];
}
function mLetIScaleX (o, p) {
o[0] = p;
o[1] = 0;
o[2] = 0;
o[3] = 0;
o[4] = 1;
o[5] = 0;
return o;
}
function mNewIScaleX (p) {
return [p, 0, 0,
0, 1, 0];
}
function mLetIScaleY (o, q) {
o[0] = 1;
o[1] = 0;
o[2] = 0;
o[3] = 0;
o[4] = q;
o[5] = 0;
return o;
}
function mNewIScaleY (q) {
return [1, 0, 0,
0, q, 0];
}
function mScaleS (m, s) {
m[0] *= s;
m[1] *= s;
m[2] *= s;
m[3] *= s;
m[4] *= s;
m[5] *= s;
return m;
}
function mLetScaleS (o, m, s) {
o[0] = m[0] * s;
o[1] = m[1] * s;
o[2] = m[2] * s;
o[3] = m[3] * s;
o[4] = m[4] * s;
o[5] = m[5] * s;
return o;
}
function mNewScaleS (m, s) {
return [m[0] * s, m[1] * s, m[2] * s,
m[3] * s, m[4] * s, m[5] * s];
}
function mScaleV (m, v) {
let p = v[0];
let q = v[1];
m[0] *= p;
m[1] *= p;
m[2] *= p;
m[3] *= q;
m[4] *= q;
m[5] *= q;
return m;
}
function mLetScaleV (o, m, v) {
let p = v[0];
let q = v[1];
o[0] = m[0] * p;
o[1] = m[1] * p;
o[2] = m[2] * p;
o[3] = m[3] * q;
o[4] = m[4] * q;
o[5] = m[5] * q;
return o;
}
function mNewScaleV (m, v) {
let p = v[0];
let q = v[1];
return [m[0] * p, m[1] * p, m[2] * p,
m[3] * q, m[4] * q, m[5] * q];
}
function mScaleX (m, p) {
m[0] *= p;
m[1] *= p;
m[2] *= p;
return m;
}
function mLetScaleX (o, m, p) {
o[0] = m[0] * p;
o[1] = m[1] * p;
o[2] = m[2] * p;
o[3] = m[3];
o[4] = m[4];
o[5] = m[5];
return o;
}
function mNewScaleX (m, p) {
return [m[0] * p, m[1] * p, m[2] * p,
m[3], m[4], m[5]];
}
function mScaleY (m, q) {
m[3] *= q;
m[4] *= q;
m[5] *= q;
return m;
}
function mLetScaleY (o, m, q) {
o[0] = m[0];
o[1] = m[1];
o[2] = m[2];
o[3] = m[3] * q;
o[4] = m[4] * q;
o[5] = m[5] * q;
return o;
}
function mNewScaleY (m, q) {
return [m[0], m[1], m[2],
m[3] * q, m[4] * q, m[5] * q];
}
function mScaleXY (m, p, q) {
m[0] *= p;
m[1] *= p;
m[2] *= p;
m[3] *= q;
m[4] *= q;
m[5] *= q;
return m;
}
function mLetScaleXY (o, m, p, q) {
o[0] = m[0] * p;
o[1] = m[1] * p;
o[2] = m[2] * p;
o[3] = m[3] * q;
o[4] = m[4] * q;
o[5] = m[5] * q;
return o;
}
function mNewScaleXY (m, p, q) {
return [m[0] * p, m[1] * p, m[2] * p,
m[3] * q, m[4] * q, m[5] * q];
}
function mLetITranslateV (o, v) {
o[0] = 1;
o[1] = 0;
o[2] = v[0];
o[3] = 0;
o[4] = 1;
o[5] = v[1];
return o;
}
function mNewITranslateV (v) {
return [1, 0, v[0],
0, 1, v[1]];
}
function mLetITranslateX (o, d) {
o[0] = 1;
o[1] = 0;
o[2] = d;
o[3] = 0;
o[4] = 1;
o[5] = 0;
return o;
}
function mNewITranslateX (d) {
return [1, 0, d,
0, 1, 0];
}
function mLetITranslateY (o, e) {
o[0] = 1;
o[1] = 0;
o[2] = 0;
o[3] = 0;
o[4] = 1;
o[5] = e;
return o;
}
function mNewITranslateY (e) {
return [1, 0, 0,
0, 1, e];
}
function mLetITranslateXY (o, d, e) {
o[0] = 1;
o[1] = 0;
o[2] = d;
o[3] = 0;
o[4] = 1;
o[5] = e;
return o;
}
function mNewITranslateXY (d, e) {
return [1, 0, d,
0, 1, e];
}
function mTranslateV (m, v) {
m[2] += v[0];
m[5] += v[1];
return m;
}
function mLetTranslateV (o, m, v) {
o[0] = m[0];
o[1] = m[1];
o[2] = m[2] + v[0];
o[3] = m[3];
o[4] = m[4];
o[5] = m[5] + v[1];
return o;
}
function mNewTranslateV (m, v) {
return [m[0], m[1], m[2] + v[0],
m[3], m[4], m[5] + v[1]];
}
function mTranslateX (m, d) {
m[2] += d;
return m;
}
function mLetTranslateX (o, m, d) {
o[0] = m[0];
o[1] = m[1];
o[2] = m[2] + d;
o[3] = m[3];
o[4] = m[4];
o[5] = m[5];
return o;
}
function mNewTranslateX (m, d) {
return [m[0], m[1], m[2] + d,
m[3], m[4], m[5]];
}
function mTranslateY (m, e) {
m[5] += e;
return m;
}
function mLetTranslateY (o, m, e) {
o[0] = m[0];
o[1] = m[1];
o[2] = m[2];
o[3] = m[3];
o[4] = m[4];
o[5] = m[5] + e;
return o;
}
function mNewTranslateY (m, e) {
return [m[0], m[1], m[2],
m[3], m[4], m[5] + e];
}
function mTranslateXY (m, d, e) {
m[2] += d;
m[5] += e;
return m;
}
function mLetTranslateXY (o, m, d, e) {
o[0] = m[0];
o[1] = m[1];
o[2] = m[2] + d;
o[3] = m[3];
o[4] = m[4];
o[5] = m[5] + e;
return o;
}
function mNewTranslateXY (m, d, e) {
return [m[0], m[1], m[2] + d,
m[3], m[4], m[5] + e];
}
function mTranslationComponent (o) {
o[ 0] = 1;
o[ 1] = 0;
o[ 3] = 0;
o[ 4] = 1;
return o;
}
function mLetTranslationComponent (o, m) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = m[ 2];
o[ 3] = 0;
o[ 4] = 1;
o[ 5] = m[ 5];
return o;
}
function mNewTranslationComponent (m) {
return [1, 0, m[ 2],
0, 1, m[ 5]];
}
function nConcatenate (n, a) {
let a11 = a[0], a12 = a[1], a13 = a[ 2], a14 = a[ 3];
let a21 = a[4], a22 = a[5], a23 = a[ 6], a24 = a[ 7];
let a31 = a[8], a32 = a[9], a33 = a[10], a34 = a[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
let n21 = n[4], n22 = n[5], n23 = n[ 6], n24 = n[ 7];
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
n[ 0] = a11 * n11 + a12 * n21 + a13 * n31;
n[ 1] = a11 * n12 + a12 * n22 + a13 * n32;
n[ 2] = a11 * n13 + a12 * n23 + a13 * n33;
n[ 3] = a11 * n14 + a12 * n24 + a13 * n34 + a14;
n[ 4] = a21 * n11 + a22 * n21 + a23 * n31;
n[ 5] = a21 * n12 + a22 * n22 + a23 * n32;
n[ 6] = a21 * n13 + a22 * n23 + a23 * n33;
n[ 7] = a21 * n14 + a22 * n24 + a23 * n34 + a24;
n[ 8] = a31 * n11 + a32 * n21 + a33 * n31;
n[ 9] = a31 * n12 + a32 * n22 + a33 * n32;
n[10] = a31 * n13 + a32 * n23 + a33 * n33;
n[11] = a31 * n14 + a32 * n24 + a33 * n34 + a34;
return n;
}
function nLetConcatenate (o, n, a) {
let a11 = a[0], a12 = a[1], a13 = a[ 2], a14 = a[ 3];
let a21 = a[4], a22 = a[5], a23 = a[ 6], a24 = a[ 7];
let a31 = a[8], a32 = a[9], a33 = a[10], a34 = a[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
let n21 = n[4], n22 = n[5], n23 = n[ 6], n24 = n[ 7];
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
o[ 0] = a11 * n11 + a12 * n21 + a13 * n31;
o[ 1] = a11 * n12 + a12 * n22 + a13 * n32;
o[ 2] = a11 * n13 + a12 * n23 + a13 * n33;
o[ 3] = a11 * n14 + a12 * n24 + a13 * n34 + a14;
o[ 4] = a21 * n11 + a22 * n21 + a23 * n31;
o[ 5] = a21 * n12 + a22 * n22 + a23 * n32;
o[ 6] = a21 * n13 + a22 * n23 + a23 * n33;
o[ 7] = a21 * n14 + a22 * n24 + a23 * n34 + a24;
o[ 8] = a31 * n11 + a32 * n21 + a33 * n31;
o[ 9] = a31 * n12 + a32 * n22 + a33 * n32;
o[10] = a31 * n13 + a32 * n23 + a33 * n33;
o[11] = a31 * n14 + a32 * n24 + a33 * n34 + a34;
return o;
}
function nNewConcatenate (n, a) {
let a11 = a[0], a12 = a[1], a13 = a[ 2], a14 = a[ 3];
let a21 = a[4], a22 = a[5], a23 = a[ 6], a24 = a[ 7];
let a31 = a[8], a32 = a[9], a33 = a[10], a34 = a[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
let n21 = n[4], n22 = n[5], n23 = n[ 6], n24 = n[ 7];
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
return [a11 * n11 + a12 * n21 + a13 * n31,
a11 * n12 + a12 * n22 + a13 * n32,
a11 * n13 + a12 * n23 + a13 * n33,
a11 * n14 + a12 * n24 + a13 * n34 + a14,
a21 * n11 + a22 * n21 + a23 * n31,
a21 * n12 + a22 * n22 + a23 * n32,
a21 * n13 + a22 * n23 + a23 * n33,
a21 * n14 + a22 * n24 + a23 * n34 + a24,
a31 * n11 + a32 * n21 + a33 * n31,
a31 * n12 + a32 * n22 + a33 * n32,
a31 * n13 + a32 * n23 + a33 * n33,
a31 * n14 + a32 * n24 + a33 * n34 + a34];
}
function nLetCopy (o, n) {
o[ 0] = n[ 0];
o[ 1] = n[ 1];
o[ 2] = n[ 2];
o[ 3] = n[ 3];
o[ 4] = n[ 4];
o[ 5] = n[ 5];
o[ 6] = n[ 6];
o[ 7] = n[ 7];
o[ 8] = n[ 8];
o[ 9] = n[ 9];
o[10] = n[10];
o[11] = n[11];
return o;
}
function nNewCopy (n) {
return n.concat ();
}
function nExchangeYZX (n) {
let n11 = n[ 0];
let n12 = n[ 1];
let n13 = n[ 2];
let n14 = n[ 3];
let n21 = n[ 4];
let n22 = n[ 5];
let n23 = n[ 6];
let n24 = n[ 7];
let n31 = n[ 8];
let n32 = n[ 9];
let n33 = n[10];
let n34 = n[11];
n[ 0] = n33;
n[ 1] = n31;
n[ 2] = n32;
n[ 3] = n34;
n[ 4] = n13;
n[ 5] = n11;
n[ 6] = n12;
n[ 7] = n14;
n[ 8] = n23;
n[ 9] = n21;
n[10] = n22;
n[11] = n24;
return n;
}
function nLetExchangeYZX (o, n) {
o[ 0] = n[10];
o[ 1] = n[ 8];
o[ 2] = n[ 9];
o[ 3] = n[11];
o[ 4] = n[ 2];
o[ 5] = n[ 0];
o[ 6] = n[ 1];
o[ 7] = n[ 3];
o[ 8] = n[ 6];
o[ 9] = n[ 4];
o[10] = n[ 5];
o[11] = n[ 7];
return o;
}
function nNewExchangeYZX (n) {
return [n[10], n[ 8], n[ 9], n[11],
n[ 2], n[ 0], n[ 1], n[ 3],
n[ 6], n[ 4], n[ 5], n[ 7]];
}
function nExchangeZXY (n) {
let n11 = n[ 0];
let n12 = n[ 1];
let n13 = n[ 2];
let n14 = n[ 3];
let n21 = n[ 4];
let n22 = n[ 5];
let n23 = n[ 6];
let n24 = n[ 7];
let n31 = n[ 8];
let n32 = n[ 9];
let n33 = n[10];
let n34 = n[11];
n[ 0] = n22;
n[ 1] = n23;
n[ 2] = n21;
n[ 3] = n24;
n[ 4] = n32;
n[ 5] = n33;
n[ 6] = n31;
n[ 7] = n34;
n[ 8] = n12;
n[ 9] = n13;
n[10] = n11;
n[11] = n14;
return n;
}
function nLetExchangeZXY (o, n) {
o[ 0] = n[ 5];
o[ 1] = n[ 6];
o[ 2] = n[ 4];
o[ 3] = n[ 7];
o[ 4] = n[ 9];
o[ 5] = n[10];
o[ 6] = n[ 8];
o[ 7] = n[11];
o[ 8] = n[ 1];