o[ 9] = n[ 2];
o[10] = n[ 0];
o[11] = n[ 3];
return o;
}
function nNewExchangeZXY (n) {
return [n[ 5], n[ 6], n[ 4], n[ 7],
n[ 9], n[10], n[ 8], n[11],
n[ 1], n[ 2], n[ 0], n[ 3]];
}
function nLetIdentity (o) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewIdentity () {
return [1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0];
}
function nInverse (n) {
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];
let d = n11 * (n22 * n33 - n23 * n32) + n12 * (n23 * n31 - n21 * n33) + n13 * (n21 * n32 - n22 * n31);
n[ 0] = (n22 * n33 - n23 * n32) / d;
n[ 1] = (n13 * n32 - n12 * n33) / d;
n[ 2] = (n12 * n23 - n13 * n22) / d;
n[ 3] = (n14 * (n23 * n32 - n22 * n33) + n24 * (n12 * n33 - n13 * n32) + n34 * (n13 * n22 - n12 * n23)) / d;
n[ 4] = (n23 * n31 - n21 * n33) / d;
n[ 5] = (n11 * n33 - n13 * n31) / d;
n[ 6] = (n13 * n21 - n11 * n23) / d;
n[ 7] = (n14 * (n21 * n33 - n23 * n31) + n24 * (n13 * n31 - n11 * n33) + n34 * (n11 * n23 - n13 * n21)) / d;
n[ 8] = (n21 * n32 - n22 * n31) / d;
n[ 9] = (n12 * n31 - n11 * n32) / d;
n[10] = (n11 * n22 - n12 * n21) / d;
n[11] = (n14 * (n22 * n31 - n21 * n32) + n24 * (n11 * n32 - n12 * n31) + n34 * (n12 * n21 - n11 * n22)) / d;
return n;
}
function nLetInverse (o, n) {
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];
let d = n11 * (n22 * n33 - n23 * n32) + n12 * (n23 * n31 - n21 * n33) + n13 * (n21 * n32 - n22 * n31);
o[ 0] = (n22 * n33 - n23 * n32) / d;
o[ 1] = (n13 * n32 - n12 * n33) / d;
o[ 2] = (n12 * n23 - n13 * n22) / d;
o[ 3] = (n14 * (n23 * n32 - n22 * n33) + n24 * (n12 * n33 - n13 * n32) + n34 * (n13 * n22 - n12 * n23)) / d;
o[ 4] = (n23 * n31 - n21 * n33) / d;
o[ 5] = (n11 * n33 - n13 * n31) / d;
o[ 6] = (n13 * n21 - n11 * n23) / d;
o[ 7] = (n14 * (n21 * n33 - n23 * n31) + n24 * (n13 * n31 - n11 * n33) + n34 * (n11 * n23 - n13 * n21)) / d;
o[ 8] = (n21 * n32 - n22 * n31) / d;
o[ 9] = (n12 * n31 - n11 * n32) / d;
o[10] = (n11 * n22 - n12 * n21) / d;
o[11] = (n14 * (n22 * n31 - n21 * n32) + n24 * (n11 * n32 - n12 * n31) + n34 * (n12 * n21 - n11 * n22)) / d;
return o;
}
function nNewInverse (n) {
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];
let d = n11 * (n22 * n33 - n23 * n32) + n12 * (n23 * n31 - n21 * n33) + n13 * (n21 * n32 - n22 * n31);
return [(n22 * n33 - n23 * n32) / d,
(n13 * n32 - n12 * n33) / d,
(n12 * n23 - n13 * n22) / d,
(n14 * (n23 * n32 - n22 * n33) + n24 * (n12 * n33 - n13 * n32) + n34 * (n13 * n22 - n12 * n23)) / d,
(n23 * n31 - n21 * n33) / d,
(n11 * n33 - n13 * n31) / d,
(n13 * n21 - n11 * n23) / d,
(n14 * (n21 * n33 - n23 * n31) + n24 * (n13 * n31 - n11 * n33) + n34 * (n11 * n23 - n13 * n21)) / d,
(n21 * n32 - n22 * n31) / d,
(n12 * n31 - n11 * n32) / d,
(n11 * n22 - n12 * n21) / d,
(n14 * (n22 * n31 - n21 * n32) + n24 * (n11 * n32 - n12 * n31) + n34 * (n12 * n21 - n11 * n22)) / d];
}
function nLetIRotateXY (o, t) {
let c = cos (t), s = sin (t);
o[ 0] = c;
o[ 1] = -s;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = s;
o[ 5] = c;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewIRotateXY (t) {
let c = cos (t), s = sin (t);
return [c, -s, 0, 0,
s, c, 0, 0,
0, 0, 1, 0];
}
function nRotateXY (n, t) {
let c = cos (t), s = sin (t);
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];
n[ 0] = c * n11 - s * n21;
n[ 1] = c * n12 - s * n22;
n[ 2] = c * n13 - s * n23;
n[ 3] = c * n14 - s * n24;
n[ 4] = s * n11 + c * n21;
n[ 5] = s * n12 + c * n22;
n[ 6] = s * n13 + c * n23;
n[ 7] = s * n14 + c * n24;
return n;
}
function nLetRotateXY (o, n, t) {
let c = cos (t), s = sin (t);
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];
o[ 0] = c * n11 - s * n21;
o[ 1] = c * n12 - s * n22;
o[ 2] = c * n13 - s * n23;
o[ 3] = c * n14 - s * n24;
o[ 4] = s * n11 + c * n21;
o[ 5] = s * n12 + c * n22;
o[ 6] = s * n13 + c * n23;
o[ 7] = s * n14 + c * n24;
o[ 8] = n[ 8];
o[ 9] = n[ 9];
o[10] = n[10];
o[11] = n[11];
return o;
}
function nNewRotateXY (n, t) {
let c = cos (t), s = sin (t);
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];
return [c * n11 - s * n21, c * n12 - s * n22, c * n13 - s * n23, c * n14 - s * n24,
s * n11 + c * n21, s * n12 + c * n22, s * n13 + c * n23, s * n14 + c * n24,
n[ 8], n[ 9], n[10], n[11]];
}
function nLetIRotateYZ (o, t) {
let c = cos (t), s = sin (t);
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = c;
o[ 6] = -s;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = s;
o[10] = c;
o[11] = 0;
return o;
}
function nNewIRotateYZ (t) {
let c = cos (t), s = sin (t);
return [1, 0, 0, 0,
0, c, -s, 0,
0, s, c, 0];
}
function nRotateYZ (n, t) {
let c = cos (t), s = sin (t);
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[ 4] = c * n21 - s * n31;
n[ 5] = c * n22 - s * n32;
n[ 6] = c * n23 - s * n33;
n[ 7] = c * n24 - s * n34;
n[ 8] = s * n21 + c * n31;
n[ 9] = s * n22 + c * n32;
n[10] = s * n23 + c * n33;
n[11] = s * n24 + c * n34;
return n;
}
function nLetRotateYZ (o, n, t) {
let c = cos (t), s = sin (t);
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] = n[ 0];
o[ 1] = n[ 1];
o[ 2] = n[ 2];
o[ 3] = n[ 3];
o[ 4] = c * n21 - s * n31;
o[ 5] = c * n22 - s * n32;
o[ 6] = c * n23 - s * n33;
o[ 7] = c * n24 - s * n34;
o[ 8] = s * n21 + c * n31;
o[ 9] = s * n22 + c * n32;
o[10] = s * n23 + c * n33;
o[11] = s * n24 + c * n34;
return o;
}
function nNewRotateYZ (n, t) {
let c = cos (t), s = sin (t);
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 [n[ 0], n[ 1], n[ 2], n[ 3],
c * n21 - s * n31, c * n22 - s * n32, c * n23 - s * n33, c * n24 - s * n34,
s * n21 + c * n31, s * n22 + c * n32, s * n23 + c * n33, s * n24 + c * n34];
}
function nLetIRotateZX (o, t) {
let c = cos (t), s = sin (t);
o[ 0] = c;
o[ 1] = 0;
o[ 2] = s;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = -s;
o[ 9] = 0;
o[10] = c;
o[11] = 0;
return o;
}
function nNewIRotateZX (t) {
let c = cos (t), s = sin (t);
return [c, 0, s, 0,
0, 1, 0, 0,
-s, 0, c, 0];
}
function nRotateZX (n, t) {
let c = cos (t), s = sin (t);
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
n[ 0] = s * n31 + c * n11;
n[ 1] = s * n32 + c * n12;
n[ 2] = s * n33 + c * n13;
n[ 3] = s * n34 + c * n14;
n[ 8] = c * n31 - s * n11;
n[ 9] = c * n32 - s * n12;
n[10] = c * n33 - s * n13;
n[11] = c * n34 - s * n14;
return n;
}
function nLetRotateZX (o, n, t) {
let c = cos (t), s = sin (t);
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
o[ 0] = s * n31 + c * n11;
o[ 1] = s * n32 + c * n12;
o[ 2] = s * n33 + c * n13;
o[ 3] = s * n34 + c * n14;
o[ 4] = n[ 4];
o[ 5] = n[ 5];
o[ 6] = n[ 6];
o[ 7] = n[ 7];
o[ 8] = c * n31 - s * n11;
o[ 9] = c * n32 - s * n12;
o[10] = c * n33 - s * n13;
o[11] = c * n34 - s * n14;
return o;
}
function nNewRotateZX (n, t) {
let c = cos (t), s = sin (t);
let n31 = n[8], n32 = n[9], n33 = n[10], n34 = n[11];
let n11 = n[0], n12 = n[1], n13 = n[ 2], n14 = n[ 3];
return [s * n31 + c * n11, s * n32 + c * n12, s * n33 + c * n13, s * n34 + c * n14,
n[ 4], n[ 5], n[ 6], n[ 7],
c * n31 - s * n11, c * n32 - s * n12, c * n33 - s * n13, c * n34 - s * n14];
}
function nRotationComponent (o) {
o[ 3] = 0;
o[ 7] = 0;
o[11] = 0;
return o;
}
function nLetRotationComponent (o, n) {
o[ 0] = n[ 0];
o[ 1] = n[ 1];
o[ 2] = n[ 2];
o[ 3] = 0;
o[ 4] = n[ 4];
o[ 5] = n[ 5];
o[ 6] = n[ 6];
o[ 7] = 0;
o[ 8] = n[ 8];
o[ 9] = n[ 9];
o[10] = n[10];
o[11] = 0;
return o;
}
function nNewRotationComponent (n) {
return [n[ 0], n[ 1], n[ 2], 0,
n[ 4], n[ 5], n[ 6], 0,
n[ 8], n[ 9], n[10], 0];
}
function nLetIScaleS (o, s) {
o[ 0] = s;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = s;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = s;
o[11] = 0;
return o;
}
function nNewIScaleS (s) {
return [s, 0, 0, 0,
0, s, 0, 0,
0, 0, s, 0];
}
function nLetIScaleX (o, p) {
o[ 0] = p;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewIScaleX (p) {
return [p, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0];
}
function nLetIScaleY (o, q) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = q;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewIScaleY (q) {
return [1, 0, 0, 0,
0, q, 0, 0,
0, 0, 1, 0];
}
function nLetIScaleZ (o, r) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = r;
o[11] = 0;
return o;
}
function nNewIScaleZ (r) {
return [1, 0, 0, 0,
0, 1, 0, 0,
0, 0, r, 0];
}
function nLetIScaleXYZ (o, p, q, r) {
o[ 0] = p;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = q;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = r;
o[11] = 0;
return o;
}
function nNewIScaleXYZ (p, q, r) {
return [p, 0, 0, 0,
0, q, 0, 0,
0, 0, r, 0];
}
function nScaleS (n, s) {
n[ 0] *= s;
n[ 1] *= s;
n[ 2] *= s;
n[ 3] *= s;
n[ 4] *= s;
n[ 5] *= s;
n[ 6] *= s;
n[ 7] *= s;
n[ 8] *= s;
n[ 9] *= s;
n[10] *= s;
n[11] *= s;
return n;
}
function nLetScaleS (o, n, s) {
o[ 0] = n[ 0] * s;
o[ 1] = n[ 1] * s;
o[ 2] = n[ 2] * s;
o[ 3] = n[ 3] * s;
o[ 4] = n[ 4] * s;
o[ 5] = n[ 5] * s;
o[ 6] = n[ 6] * s;
o[ 7] = n[ 7] * s;
o[ 8] = n[ 8] * s;
o[ 9] = n[ 9] * s;
o[10] = n[10] * s;
o[11] = n[11] * s;
return o;
}
function nNewScaleS (n, s) {
return [n[ 0] * s, n[ 1] * s, n[ 2] * s, n[ 3] * s,
n[ 4] * s, n[ 5] * s, n[ 6] * s, n[ 7] * s,
n[ 8] * s, n[ 9] * s, n[10] * s, n[11] * s];
}
function nScaleW (n, w) {
n[ 0] *= w[0];
n[ 1] *= w[0];
n[ 2] *= w[0];
n[ 3] *= w[0];
n[ 4] *= w[1];
n[ 5] *= w[1];
n[ 6] *= w[1];
n[ 7] *= w[1];
n[ 8] *= w[2];
n[ 9] *= w[2];
n[10] *= w[2];
n[11] *= w[2];
return n;
}
function nLetScaleW (o, n, w) {
o[ 0] = n[ 0] * w[0];
o[ 1] = n[ 1] * w[0];
o[ 2] = n[ 2] * w[0];
o[ 3] = n[ 3] * w[0];
o[ 4] = n[ 4] * w[1];
o[ 5] = n[ 5] * w[1];
o[ 6] = n[ 6] * w[1];
o[ 7] = n[ 7] * w[1];
o[ 8] = n[ 8] * w[2];
o[ 9] = n[ 9] * w[2];
o[10] = n[10] * w[2];
o[11] = n[11] * w[2];
return o;
}
function nNewScaleW (n, w) {
return [n[ 0] * w[0], n[ 1] * w[0], n[ 2] * w[0], n[ 3] * w[0],
n[ 4] * w[1], n[ 5] * w[1], n[ 6] * w[1], n[ 7] * w[1],
n[ 8] * w[2], n[ 9] * w[2], n[10] * w[2], n[11] * w[2]];
}
function nScaleX (n, p) {
n[ 0] *= p;
n[ 1] *= p;
n[ 2] *= p;
n[ 3] *= p;
return n;
}
function nLetScaleX (o, n, p) {
o[ 0] = n[ 0] * p;
o[ 1] = n[ 1] * p;
o[ 2] = n[ 2] * p;
o[ 3] = n[ 3] * p;
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 nNewScaleX (n, p) {
return [n[ 0] * p, n[ 1] * p, n[ 2] * p, n[ 3] * p,
n[ 4], n[ 5], n[ 6], n[ 7],
n[ 8], n[ 9], n[10], n[11]];
}
function nScaleY (n, q) {
n[ 4] *= q;
n[ 5] *= q;
n[ 6] *= q;
n[ 7] *= q;
return n;
}
function nLetScaleY (o, n, q) {
o[ 0] = n[ 0];
o[ 1] = n[ 1];
o[ 2] = n[ 2];
o[ 3] = n[ 3];
o[ 4] = n[ 4] * q;
o[ 5] = n[ 5] * q;
o[ 6] = n[ 6] * q;
o[ 7] = n[ 7] * q;
o[ 8] = n[ 8];
o[ 9] = n[ 9];
o[10] = n[10];
o[11] = n[11];
return o;
}
function nNewScaleY (n, q) {
return [n[ 0], n[ 1], n[ 2], n[ 3],
n[ 4] * q, n[ 5] * q, n[ 6] * q, n[ 7] * q,
n[ 8], n[ 9], n[10], n[11]];
}
function nScaleZ (n, r) {
n[ 8] *= r;
n[ 9] *= r;
n[10] *= r;
n[11] *= r;
return n;
}
function nLetScaleZ (o, n, r) {
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] * r;
o[ 9] = n[ 9] * r;
o[10] = n[10] * r;
o[11] = n[11] * r;
return o;
}
function nNewScaleZ (n, r) {
return [n[ 0], n[ 1], n[ 2], n[ 3],
n[ 4], n[ 5], n[ 6], n[ 7],
n[ 8] * r, n[ 9] * r, n[10] * r, n[11] * r];
}
function nScaleXYZ (n, p, q, r) {
n[ 0] *= p;
n[ 1] *= p;
n[ 2] *= p;
n[ 3] *= p;
n[ 4] *= q;
n[ 5] *= q;
n[ 6] *= q;
n[ 7] *= q;
n[ 8] *= r;
n[ 9] *= r;
n[10] *= r;
n[11] *= r;
return n;
}
function nLetScaleXYZ (o, n, p, q, r) {
o[ 0] = n[ 0] * p;
o[ 1] = n[ 1] * p;
o[ 2] = n[ 2] * p;
o[ 3] = n[ 3] * p;
o[ 4] = n[ 4] * q;
o[ 5] = n[ 5] * q;
o[ 6] = n[ 6] * q;
o[ 7] = n[ 7] * q;
o[ 8] = n[ 8] * r;
o[ 9] = n[ 9] * r;
o[10] = n[10] * r;
o[11] = n[11] * r;
return o;
}
function nNewScaleXYZ (n, p, q, r) {
return [n[ 0] * p, n[ 1] * p, n[ 2] * p, n[ 3] * p,
n[ 4] * q, n[ 5] * q, n[ 6] * q, n[ 7] * q,
n[ 8] * r, n[ 9] * r, n[10] * r, n[11] * r];
}
function nLetITranslateW (o, w) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = w[0];
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = w[1];
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = w[2];
return o;
}
function nNewITranslateW (w) {
return [1, 0, 0, w[0],
0, 1, 0, w[1],
0, 0, 1, w[2]];
}
function nLetITranslateX (o, d) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = d;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = 0;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewITranslateX (d) {
return [1, 0, 0, d,
0, 1, 0, 0,
0, 0, 1, 0];
}
function nLetITranslateY (o, e) {
o[ 0] = 1;
o[ 1] = 0;
o[ 2] = 0;
o[ 3] = 0;
o[ 4] = 0;
o[ 5] = 1;
o[ 6] = 0;
o[ 7] = e;
o[ 8] = 0;
o[ 9] = 0;
o[10] = 1;
o[11] = 0;
return o;
}
function nNewITranslateY (e) {
return [1, 0, 0, 0,
0, 1, 0, e,